diff options
author | gnezdo <gnezdo@cvs.openbsd.org> | 2020-08-22 17:54:58 +0000 |
---|---|---|
committer | gnezdo <gnezdo@cvs.openbsd.org> | 2020-08-22 17:54:58 +0000 |
commit | b2ad2f95ae915340a39492a98f007a6f98b9a119 (patch) | |
tree | 25a4aa88c3cb13e14d31e8d1a19e1d8f2cf79c69 /sys/netinet | |
parent | e847f31ff224dcdd1ba250b4a759e9fd720903e8 (diff) |
Convert udp_sysctl to sysctl_bounded_args
Diffstat (limited to 'sys/netinet')
-rw-r--r-- | sys/netinet/udp_usrreq.c | 12 | ||||
-rw-r--r-- | sys/netinet/udp_var.h | 12 |
2 files changed, 9 insertions, 15 deletions
diff --git a/sys/netinet/udp_usrreq.c b/sys/netinet/udp_usrreq.c index 0aced03307f..19752d29fd8 100644 --- a/sys/netinet/udp_usrreq.c +++ b/sys/netinet/udp_usrreq.c @@ -1,4 +1,4 @@ -/* $OpenBSD: udp_usrreq.c,v 1.261 2020/08/05 21:15:38 mglocker Exp $ */ +/* $OpenBSD: udp_usrreq.c,v 1.262 2020/08/22 17:54:57 gnezdo Exp $ */ /* $NetBSD: udp_usrreq.c,v 1.28 1996/03/16 23:54:03 christos Exp $ */ /* @@ -127,7 +127,11 @@ u_int udp_sendspace = 9216; /* really max datagram size */ u_int udp_recvspace = 40 * (1024 + sizeof(struct sockaddr_in)); /* 40 1K datagrams */ -int *udpctl_vars[UDPCTL_MAXID] = UDPCTL_VARS; +const struct sysctl_bounded_args udpctl_vars[] = { + { UDPCTL_CHECKSUM, &udpcksum, 0, 1 }, + { UDPCTL_RECVSPACE, &udp_recvspace, 0, INT_MAX }, + { UDPCTL_SENDSPACE, &udp_sendspace, 0, INT_MAX }, +}; struct inpcbtable udbtable; struct cpumem *udpcounters; @@ -1296,8 +1300,8 @@ udp_sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp, void *newp, default: NET_LOCK(); - error = sysctl_int_arr(udpctl_vars, nitems(udpctl_vars), name, - namelen, oldp, oldlenp, newp, newlen); + error = sysctl_bounded_arr(udpctl_vars, nitems(udpctl_vars), + name, namelen, oldp, oldlenp, newp, newlen); NET_UNLOCK(); return (error); } diff --git a/sys/netinet/udp_var.h b/sys/netinet/udp_var.h index 8026f935a6c..337542a3f10 100644 --- a/sys/netinet/udp_var.h +++ b/sys/netinet/udp_var.h @@ -1,4 +1,4 @@ -/* $OpenBSD: udp_var.h,v 1.34 2017/11/02 14:01:18 florian Exp $ */ +/* $OpenBSD: udp_var.h,v 1.35 2020/08/22 17:54:57 gnezdo Exp $ */ /* $NetBSD: udp_var.h,v 1.12 1996/02/13 23:44:41 christos Exp $ */ /* @@ -91,16 +91,6 @@ struct udpstat { { "rootonly", CTLTYPE_STRUCT }, \ } -#define UDPCTL_VARS { \ - NULL, \ - &udpcksum, \ - NULL, \ - &udp_recvspace, \ - &udp_sendspace, \ - NULL, \ - NULL \ -} - #ifdef _KERNEL #include <sys/percpu.h> |