diff options
| author | Bill Fenner <fenner@FreeBSD.org> | 2001-07-25 20:14:09 +0000 |
|---|---|---|
| committer | Bill Fenner <fenner@FreeBSD.org> | 2001-07-25 20:14:09 +0000 |
| commit | 1a8b27c03505599546732c7ce13ff9472ae5e4e9 (patch) | |
| tree | 9e15fc0713a234a2d70e75728f3e5332b926ff5a /usr.bin/netstat | |
| parent | 9a7015165215547a26cfeaa7bccc2be672aaa659 (diff) | |
Notes
Diffstat (limited to 'usr.bin/netstat')
| -rw-r--r-- | usr.bin/netstat/mroute.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/usr.bin/netstat/mroute.c b/usr.bin/netstat/mroute.c index 22b6359ad6ba..8e0957abc79c 100644 --- a/usr.bin/netstat/mroute.c +++ b/usr.bin/netstat/mroute.c @@ -52,6 +52,7 @@ static const char rcsid[] = #include <sys/queue.h> #include <sys/socket.h> #include <sys/socketvar.h> +#include <sys/sysctl.h> #include <sys/protosw.h> #include <sys/mbuf.h> #include <sys/time.h> @@ -62,6 +63,7 @@ static const char rcsid[] = #include <net/route.h> #include <netinet/ip_mroute.h> +#include <err.h> #include <stdio.h> #include <stdlib.h> #include "netstat.h" @@ -152,13 +154,19 @@ void mrt_stats(u_long mstaddr) { struct mrtstat mrtstat; + size_t len = sizeof mrtstat; - if (mstaddr == 0) { - printf("No IPv4 multicast routing compiled into this system.\n"); - return; - } + if (sysctlbyname("net.inet.ip.mrtstat", &mrtstat, &len, + NULL, 0) < 0) { + warn("sysctl: net.inet.ip.mrtstat"); + /* Compatability with older kernels - candidate for removal */ + if (mstaddr == 0) { + printf("No IPv4 multicast routing compiled into this system.\n"); + return; + } - kread(mstaddr, (char *)&mrtstat, sizeof(mrtstat)); + kread(mstaddr, (char *)&mrtstat, sizeof(mrtstat)); + } printf("IPv4 multicast forwarding:\n"); printf(" %10lu multicast forwarding cache lookup%s\n", mrtstat.mrts_mfc_lookups, plural(mrtstat.mrts_mfc_lookups)); |
