summaryrefslogtreecommitdiffstats
path: root/usr.bin/netstat/mroute.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr.bin/netstat/mroute.c')
-rw-r--r--usr.bin/netstat/mroute.c43
1 files changed, 16 insertions, 27 deletions
diff --git a/usr.bin/netstat/mroute.c b/usr.bin/netstat/mroute.c
index acf6ddc..d3cf740 100644
--- a/usr.bin/netstat/mroute.c
+++ b/usr.bin/netstat/mroute.c
@@ -84,32 +84,24 @@ mroutepr(u_long mfcaddr, u_long vifaddr)
size_t len;
len = sizeof(mfctable);
- if (sysctlbyname("net.inet.ip.mfctable", mfctable, &len, NULL, 0) < 0) {
- warn("sysctl: net.inet.ip.mfctable");
- if (mfcaddr == 0) {
- printf("No IPv4 multicast forwarding configured in "
- "the running system.\n");
+ if (live) {
+ if (sysctlbyname("net.inet.ip.mfctable", mfctable, &len, NULL,
+ 0) < 0) {
+ warn("sysctl: net.inet.ip.mfctable");
return;
}
- /*
- * XXX: Try KVM if the module is neither compiled nor loaded.
- * The correct behaviour would be to always use KVM if
- * the -M option is specified to netstat(1).
- */
+ } else
kread(mfcaddr, (char *)mfctable, sizeof(mfctable));
- }
len = sizeof(viftable);
- if (sysctlbyname("net.inet.ip.viftable", viftable, &len, NULL, 0) < 0) {
- warn("sysctl: net.inet.ip.viftable");
- if (vifaddr == 0) {
- printf("No IPv4 multicast forwarding configured in "
- "the running system.\n");
+ if (live) {
+ if (sysctlbyname("net.inet.ip.viftable", viftable, &len, NULL,
+ 0) < 0) {
+ warn("sysctl: net.inet.ip.viftable");
return;
}
- /* XXX KVM */
+ } else
kread(vifaddr, (char *)viftable, sizeof(viftable));
- }
saved_numeric_addr = numeric_addr;
numeric_addr = 1;
@@ -276,18 +268,15 @@ mrt_stats(u_long mstaddr)
struct mrtstat mrtstat;
size_t len = sizeof mrtstat;
- 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 forwarding configured in "
- "the running system.\n");
+ if (live) {
+ if (sysctlbyname("net.inet.ip.mrtstat", &mrtstat, &len, NULL,
+ 0) < 0) {
+ warn("sysctl: net.inet.ip.mrtstat");
return;
}
- /* XXX KVM */
+ } else
kread(mstaddr, (char *)&mrtstat, sizeof(mrtstat));
- }
+
printf("IPv4 multicast forwarding:\n");
#define p(f, m) if (mrtstat.f || sflag <= 1) \
OpenPOWER on IntegriCloud