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/netmpls/mpls_raw.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/netmpls/mpls_raw.c')
-rw-r--r-- | sys/netmpls/mpls_raw.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/sys/netmpls/mpls_raw.c b/sys/netmpls/mpls_raw.c index c87158a91cb..dd6c0f62e41 100644 --- a/sys/netmpls/mpls_raw.c +++ b/sys/netmpls/mpls_raw.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mpls_raw.c,v 1.16 2019/11/05 08:26:38 claudio Exp $ */ +/* $OpenBSD: mpls_raw.c,v 1.17 2020/08/01 23:41:56 gnezdo Exp $ */ /* * Copyright (C) 1999, 2000 and 2001 AYAME Project, WIDE Project. @@ -57,16 +57,13 @@ int mpls_sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp, void *newp, size_t newlen) { - if (name[0] >= MPLSCTL_MAXID) - return (EOPNOTSUPP); - /* Almost all sysctl names at this level are terminal. */ if (namelen != 1) return (ENOTDIR); switch (name[0]) { default: - return sysctl_int_arr(mplsctl_vars, name, namelen, - oldp, oldlenp, newp, newlen); + return sysctl_int_arr(mplsctl_vars, nitems(mplsctl_vars), name, + namelen, oldp, oldlenp, newp, newlen); } } |