summaryrefslogtreecommitdiff
path: root/sys/netinet/ip_icmp.c
diff options
context:
space:
mode:
authorgnezdo <gnezdo@cvs.openbsd.org>2020-08-22 17:55:55 +0000
committergnezdo <gnezdo@cvs.openbsd.org>2020-08-22 17:55:55 +0000
commit65d712de9de9f91d6b1abab57f19683a2fbbb1e1 (patch)
treec6a16094d35454c2bbe559d861e1ff4a7af8ddd0 /sys/netinet/ip_icmp.c
parent5e23bff6d4e55004ac86ddc64b6dd229ef970cd9 (diff)
Convert icmp_sysctl to sysctl_bounded_args
... these all look fine, derradt@
Diffstat (limited to 'sys/netinet/ip_icmp.c')
-rw-r--r--sys/netinet/ip_icmp.c15
1 files changed, 11 insertions, 4 deletions
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;
}