diff --git a/usr.bin/netstat/mroute.c b/usr.bin/netstat/mroute.c index afc5458e5e11..04b7ead03b7b 100644 --- a/usr.bin/netstat/mroute.c +++ b/usr.bin/netstat/mroute.c @@ -409,15 +409,13 @@ mrt_stats() mstaddr = nl[N_MRTSTAT].n_value; - if (mstaddr == 0) { - fprintf(stderr, "No IPv4 MROUTING kernel support.\n"); + if (fetch_stats("net.inet.ip.mrtstat", mstaddr, &mrtstat, + sizeof(mrtstat), kread_counters) != 0) { + if ((live && errno == ENOENT) || (!live && mstaddr == 0)) + fprintf(stderr, "No IPv4 MROUTING kernel support.\n"); return; } - if (fetch_stats("net.inet.ip.mrtstat", mstaddr, &mrtstat, - sizeof(mrtstat), kread_counters) != 0) - return; - xo_emit("{T:IPv4 multicast forwarding}:\n"); #define p(f, m) if (mrtstat.f || sflag <= 1) \