diff options
author | 2020-08-22 17:54:57 +0000 | |
---|---|---|
committer | 2020-08-22 17:54:57 +0000 | |
commit | e8cfbd4635f1471f9b30406a784c79a395ad3ecb (patch) | |
tree | 40e5d26cd2ab1a2fe6d8224a6932f90a164136bd | |
parent | Add sizes to free() calls (diff) | |
download | wireguard-openbsd-e8cfbd4635f1471f9b30406a784c79a395ad3ecb.tar.xz wireguard-openbsd-e8cfbd4635f1471f9b30406a784c79a395ad3ecb.zip |
Convert udp_sysctl to sysctl_bounded_args
-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> |