diff options
author | 2007-12-14 18:33:37 +0000 | |
---|---|---|
committer | 2007-12-14 18:33:37 +0000 | |
commit | ab46c28df9dade40ac2a7e07eff58829ad435982 (patch) | |
tree | a00a64a333d8efced177951cd0e350ca85389a07 /sys/netinet/ipsec_input.c | |
parent | Remove a lot of symbols from the namespace, otherwise sys/sysctl.h and (diff) | |
download | wireguard-openbsd-ab46c28df9dade40ac2a7e07eff58829ad435982.tar.xz wireguard-openbsd-ab46c28df9dade40ac2a7e07eff58829ad435982.zip |
add sysctl entry points into various network layers, in particular to
provide netstat(1) with data it needs; ok claudio reyk
Diffstat (limited to 'sys/netinet/ipsec_input.c')
-rw-r--r-- | sys/netinet/ipsec_input.c | 62 |
1 files changed, 49 insertions, 13 deletions
diff --git a/sys/netinet/ipsec_input.c b/sys/netinet/ipsec_input.c index 16ea0a2cdb7..13370a297be 100644 --- a/sys/netinet/ipsec_input.c +++ b/sys/netinet/ipsec_input.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ipsec_input.c,v 1.84 2007/05/28 17:16:39 henning Exp $ */ +/* $OpenBSD: ipsec_input.c,v 1.85 2007/12/14 18:33:41 deraadt Exp $ */ /* * The authors of this code are John Ioannidis (ji@tla.org), * Angelos D. Keromytis (kermit@csd.uch.gr) and @@ -644,30 +644,66 @@ int esp_sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp, void *newp, size_t newlen) { - if (name[0] < ESPCTL_MAXID) - return (sysctl_int_arr(espctl_vars, name, namelen, - oldp, oldlenp, newp, newlen)); - return (ENOPROTOOPT); + /* All sysctl names at this level are terminal. */ + if (namelen != 1) + return (ENOTDIR); + + switch (name[0]) { + case ESPCTL_STATS: + if (newp != NULL) + return (EPERM); + return (sysctl_struct(oldp, oldlenp, newp, newlen, + &espstat, sizeof(espstat))); + default: + if (name[0] < ESPCTL_MAXID) + return (sysctl_int_arr(espctl_vars, name, namelen, + oldp, oldlenp, newp, newlen)); + return (ENOPROTOOPT); + } } int ah_sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp, void *newp, size_t newlen) { - if (name[0] < AHCTL_MAXID) - return (sysctl_int_arr(ahctl_vars, name, namelen, - oldp, oldlenp, newp, newlen)); - return (ENOPROTOOPT); + /* All sysctl names at this level are terminal. */ + if (namelen != 1) + return (ENOTDIR); + + switch (name[0]) { + case AHCTL_STATS: + if (newp != NULL) + return (EPERM); + return (sysctl_struct(oldp, oldlenp, newp, newlen, + &ahstat, sizeof(ahstat))); + default: + if (name[0] < AHCTL_MAXID) + return (sysctl_int_arr(ahctl_vars, name, namelen, + oldp, oldlenp, newp, newlen)); + return (ENOPROTOOPT); + } } int ipcomp_sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp, void *newp, size_t newlen) { - if (name[0] < IPCOMPCTL_MAXID) - return (sysctl_int_arr(ipcompctl_vars, name, namelen, - oldp, oldlenp, newp, newlen)); - return (ENOPROTOOPT); + /* All sysctl names at this level are terminal. */ + if (namelen != 1) + return (ENOTDIR); + + switch (name[0]) { + case IPCOMPCTL_STATS: + if (newp != NULL) + return (EPERM); + return (sysctl_struct(oldp, oldlenp, newp, newlen, + &ipcompstat, sizeof(ipcompstat))); + default: + if (name[0] < IPCOMPCTL_MAXID) + return (sysctl_int_arr(ipcompctl_vars, name, namelen, + oldp, oldlenp, newp, newlen)); + return (ENOPROTOOPT); + } } #ifdef INET |