summaryrefslogtreecommitdiffstats
path: root/sys/netinet
diff options
context:
space:
mode:
authorgnezdo <gnezdo@openbsd.org>2020-08-22 17:55:54 +0000
committergnezdo <gnezdo@openbsd.org>2020-08-22 17:55:54 +0000
commit3bb7c9e932aecaff16f131d624ccfe641eb349b5 (patch)
tree8a95f98ebbd8c34e0f8725b4eef18b84bad392cb /sys/netinet
parentConvert ip_sysctl to sysctl_bounded_args (diff)
downloadwireguard-openbsd-3bb7c9e932aecaff16f131d624ccfe641eb349b5.tar.xz
wireguard-openbsd-3bb7c9e932aecaff16f131d624ccfe641eb349b5.zip
Convert icmp_sysctl to sysctl_bounded_args
... these all look fine, derradt@
Diffstat (limited to 'sys/netinet')
-rw-r--r--sys/netinet/icmp_var.h13
-rw-r--r--sys/netinet/ip_icmp.c15
2 files changed, 12 insertions, 16 deletions
diff --git a/sys/netinet/icmp_var.h b/sys/netinet/icmp_var.h
index a8ad4bdb1fc..76cf4de4ada 100644
--- a/sys/netinet/icmp_var.h
+++ b/sys/netinet/icmp_var.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: icmp_var.h,v 1.15 2017/02/07 22:30:16 jmatthew Exp $ */
+/* $OpenBSD: icmp_var.h,v 1.16 2020/08/22 17:55:54 gnezdo Exp $ */
/* $NetBSD: icmp_var.h,v 1.8 1995/03/26 20:32:19 jtc Exp $ */
/*
@@ -79,17 +79,6 @@ struct icmpstat {
{ "stats", CTLTYPE_STRUCT } \
}
-#define ICMPCTL_VARS { \
- NULL, \
- &icmpmaskrepl, \
- &icmpbmcastecho, \
- &icmperrppslim, \
- &icmp_rediraccept, \
- NULL, \
- &icmptstamprepl, \
- NULL \
-}
-
#ifdef _KERNEL
#include <sys/percpu.h>
diff --git a/sys/netinet/ip_icmp.c b/sys/netinet/ip_icmp.c
index 60f10adc65d..8a162c0ecde 100644
--- a/sys/netinet/ip_icmp.c
+++ b/sys/netinet/ip_icmp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip_icmp.c,v 1.182 2020/08/01 23:41:55 gnezdo Exp $ */
+/* $OpenBSD: ip_icmp.c,v 1.183 2020/08/22 17:55:54 gnezdo Exp $ */
/* $NetBSD: ip_icmp.c,v 1.19 1996/02/13 23:42:22 christos Exp $ */
/*
@@ -123,7 +123,14 @@ static struct timeval icmperrppslim_last;
static struct rttimer_queue *icmp_redirect_timeout_q = NULL;
struct cpumem *icmpcounters;
-int *icmpctl_vars[ICMPCTL_MAXID] = ICMPCTL_VARS;
+const struct sysctl_bounded_args icmpctl_vars[] = {
+ { ICMPCTL_MASKREPL, &icmpmaskrepl, 0, 1 },
+ { ICMPCTL_BMCASTECHO, &icmpbmcastecho, 0, 1 },
+ { ICMPCTL_ERRPPSLIMIT, &icmperrppslim, -1, INT_MAX },
+ { ICMPCTL_REDIRACCEPT, &icmp_rediraccept, 0, 1 },
+ { ICMPCTL_TSTAMPREPL, &icmptstamprepl, 0, 1 },
+};
+
void icmp_mtudisc_timeout(struct rtentry *, struct rttimer *);
int icmp_ratelimit(const struct in_addr *, const int, const int);
@@ -892,8 +899,8 @@ icmp_sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp, void *newp,
default:
NET_LOCK();
- error = sysctl_int_arr(icmpctl_vars, nitems(icmpctl_vars), name,
- namelen, oldp, oldlenp, newp, newlen);
+ error = sysctl_bounded_arr(icmpctl_vars, nitems(icmpctl_vars),
+ name, namelen, oldp, oldlenp, newp, newlen);
NET_UNLOCK();
break;
}