diff options
author | gnezdo <gnezdo@cvs.openbsd.org> | 2020-08-24 16:00:32 +0000 |
---|---|---|
committer | gnezdo <gnezdo@cvs.openbsd.org> | 2020-08-24 16:00:32 +0000 |
commit | cd1847b2a394d525e11a94f340512464d068ae00 (patch) | |
tree | d7c4a77d8c2927da9ae2e2fa3b099bfae1218662 /sys/netinet | |
parent | d68f77245aa086dc69d907edfb3ce3461b309f0f (diff) |
Convert divert*_sysctl to sysctl_bounded_args
OK sashan
Diffstat (limited to 'sys/netinet')
-rw-r--r-- | sys/netinet/ip_divert.c | 12 | ||||
-rw-r--r-- | sys/netinet/ip_divert.h | 9 |
2 files changed, 9 insertions, 12 deletions
diff --git a/sys/netinet/ip_divert.c b/sys/netinet/ip_divert.c index 76c7ff0768a..47716da5887 100644 --- a/sys/netinet/ip_divert.c +++ b/sys/netinet/ip_divert.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_divert.c,v 1.62 2020/08/01 23:41:55 gnezdo Exp $ */ +/* $OpenBSD: ip_divert.c,v 1.63 2020/08/24 16:00:31 gnezdo Exp $ */ /* * Copyright (c) 2009 Michele Marchetto <michele@openbsd.org> @@ -57,7 +57,10 @@ u_int divert_recvspace = DIVERT_RECVSPACE; #define DIVERTHASHSIZE 128 #endif -int *divertctl_vars[DIVERTCTL_MAXID] = DIVERTCTL_VARS; +const struct sysctl_bounded_args divertctl_vars[] = { + { DIVERTCTL_RECVSPACE, &divert_recvspace, 0, INT_MAX }, + { DIVERTCTL_SENDSPACE, &divert_sendspace, 0, INT_MAX }, +}; int divbhashsize = DIVERTHASHSIZE; @@ -392,8 +395,9 @@ divert_sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp, void *newp, return (divert_sysctl_divstat(oldp, oldlenp, newp)); default: NET_LOCK(); - error = sysctl_int_arr(divertctl_vars, nitems(divertctl_vars), - name, namelen, oldp, oldlenp, newp, newlen); + error = sysctl_bounded_arr(divertctl_vars, + nitems(divertctl_vars), name, namelen, oldp, oldlenp, newp, + newlen); NET_UNLOCK(); return (error); } diff --git a/sys/netinet/ip_divert.h b/sys/netinet/ip_divert.h index 1b47de3d258..8a6924e7147 100644 --- a/sys/netinet/ip_divert.h +++ b/sys/netinet/ip_divert.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_divert.h,v 1.11 2017/11/02 14:01:18 florian Exp $ */ +/* $OpenBSD: ip_divert.h,v 1.12 2020/08/24 16:00:31 gnezdo Exp $ */ /* * Copyright (c) 2009 Michele Marchetto <michele@openbsd.org> @@ -42,13 +42,6 @@ struct divstat { { "stats", CTLTYPE_STRUCT } \ } -#define DIVERTCTL_VARS { \ - NULL, \ - &divert_recvspace, \ - &divert_sendspace, \ - NULL \ -} - #ifdef _KERNEL #include <sys/percpu.h> |