diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2007-12-14 18:33:43 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2007-12-14 18:33:43 +0000 |
commit | 5532e64697944ad4c710705ab1b564052a8f51af (patch) | |
tree | 183870f005f01f56ae179f355463d683575b35a0 /sys/netinet/igmp.c | |
parent | 4cb17e9667a272f7541dbee84ac942404facb823 (diff) |
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/igmp.c')
-rw-r--r-- | sys/netinet/igmp.c | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/sys/netinet/igmp.c b/sys/netinet/igmp.c index b7ef843f0c2..c2ca8b0d2ab 100644 --- a/sys/netinet/igmp.c +++ b/sys/netinet/igmp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: igmp.c,v 1.25 2007/12/13 20:47:57 millert Exp $ */ +/* $OpenBSD: igmp.c,v 1.26 2007/12/14 18:33:40 deraadt Exp $ */ /* $NetBSD: igmp.c,v 1.15 1996/02/13 23:41:25 christos Exp $ */ /* @@ -79,6 +79,7 @@ #include <sys/mbuf.h> #include <sys/socket.h> #include <sys/protosw.h> +#include <sys/sysctl.h> #include <net/if.h> #include <net/route.h> @@ -96,6 +97,8 @@ #define IP_MULTICASTOPTS 0 +int *igmpctl_vars[IGMPCTL_MAXID] = IGMPCTL_VARS; + int igmp_timers_are_running; static struct router_info *rti_head; struct igmpstat igmpstat; @@ -623,3 +626,29 @@ igmp_sendpkt(inm, type, addr) ++igmpstat.igps_snd_reports; } + +/* + * Sysctl for igmp variables. + */ +int +igmp_sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp, + void *newp, size_t newlen) +{ + /* All sysctl names at this level are terminal. */ + if (namelen != 1) + return (ENOTDIR); + + switch (name[0]) { + case IGMPCTL_STATS: + if (newp != NULL) + return (EPERM); + return (sysctl_struct(oldp, oldlenp, newp, newlen, + &igmpstat, sizeof(igmpstat))); + default: + if (name[0] < IGMPCTL_MAXID) + return (sysctl_int_arr(igmpctl_vars, name, namelen, + oldp, oldlenp, newp, newlen)); + return (ENOPROTOOPT); + } + /* NOTREACHED */ +} |