diff options
author | gnezdo <gnezdo@cvs.openbsd.org> | 2020-08-01 23:41:57 +0000 |
---|---|---|
committer | gnezdo <gnezdo@cvs.openbsd.org> | 2020-08-01 23:41:57 +0000 |
commit | 50617ee1a6ab1d941555113e61b76cd700a18426 (patch) | |
tree | 5b0fded7d52f900963e34415ff7a1bf66aefe3ea /sys/netinet6/icmp6.c | |
parent | f4356c8d157b8d980cd0e10760a6edd3e67ab30e (diff) |
Move range check inside sysctl_int_arr
Range violations are now consistently reported as EOPNOTSUPP.
Previously they were mixed with ENOPROTOOPT.
OK kn@
Diffstat (limited to 'sys/netinet6/icmp6.c')
-rw-r--r-- | sys/netinet6/icmp6.c | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/sys/netinet6/icmp6.c b/sys/netinet6/icmp6.c index 9f609ccff0b..2db284a1bea 100644 --- a/sys/netinet6/icmp6.c +++ b/sys/netinet6/icmp6.c @@ -1,4 +1,4 @@ -/* $OpenBSD: icmp6.c,v 1.230 2019/11/29 16:41:01 nayden Exp $ */ +/* $OpenBSD: icmp6.c,v 1.231 2020/08/01 23:41:56 gnezdo Exp $ */ /* $KAME: icmp6.c,v 1.217 2001/06/20 15:03:29 jinmei Exp $ */ /* @@ -1908,14 +1908,11 @@ icmp6_sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp, case ICMPV6CTL_STATS: return icmp6_sysctl_icmp6stat(oldp, oldlenp, newp); default: - if (name[0] < ICMPV6CTL_MAXID) { - NET_LOCK(); - error = sysctl_int_arr(icmpv6ctl_vars, name, namelen, - oldp, oldlenp, newp, newlen); - NET_UNLOCK(); - return (error); - } - return ENOPROTOOPT; + NET_LOCK(); + error = sysctl_int_arr(icmpv6ctl_vars, nitems(icmpv6ctl_vars), + name, namelen, oldp, oldlenp, newp, newlen); + NET_UNLOCK(); + return (error); } /* NOTREACHED */ } |