diff --git a/usr.bin/netstat/netstat.1 b/usr.bin/netstat/netstat.1 index 594e277d9bc7..667c29f211ad 100644 --- a/usr.bin/netstat/netstat.1 +++ b/usr.bin/netstat/netstat.1 @@ -45,7 +45,7 @@ .Op Fl M Ar core .Op Fl N Ar system .Nm -.Op Fl gilnrsS +.Op Fl gilnsS .Op Fl f Ar address_family .Op Fl M Ar core .Op Fl N Ar system @@ -69,6 +69,17 @@ .Fl m .Op Fl M Ar core .Op Fl N Ar system +.Nm +.Fl r +.Op Fl Aaln +.Op Fl f Ar address_family +.Op Fl M Ar core +.Op Fl N Ar system +.Nm +.Fl rs +.Op Fl s +.Op Fl M Ar core +.Op Fl N Ar system .Sh DESCRIPTION The .Nm @@ -87,12 +98,14 @@ interval specified, will continuously display the information regarding packet traffic on the configured network interfaces. The fourth form displays statistics for -the specified protocol or address familily. +the specified protocol or address family. The fifth form displays per-interface statistics for the specified protocol or address family. The sixth form displays .Xr mbuf 9 statistics. +The seventh form displays routing table for the specified address family. +The eighth form displays routing statistics. .Pp The options have the following meaning: .Bl -tag -width flag diff --git a/usr.bin/netstat/route.c b/usr.bin/netstat/route.c index 83c4c497df3d..c5956d8778e5 100644 --- a/usr.bin/netstat/route.c +++ b/usr.bin/netstat/route.c @@ -866,16 +866,16 @@ rt_stats(u_long off) } kread(off, (char *)&rtstat, sizeof (rtstat)); printf("routing:\n"); - printf("\t%u bad routing redirect%s\n", - rtstat.rts_badredirect, plural(rtstat.rts_badredirect)); - printf("\t%u dynamically created route%s\n", - rtstat.rts_dynamic, plural(rtstat.rts_dynamic)); - printf("\t%u new gateway%s due to redirects\n", - rtstat.rts_newgateway, plural(rtstat.rts_newgateway)); - printf("\t%u destination%s found unreachable\n", - rtstat.rts_unreach, plural(rtstat.rts_unreach)); - printf("\t%u use%s of a wildcard route\n", - rtstat.rts_wildcard, plural(rtstat.rts_wildcard)); + +#define p(f, m) if (rtstat.f || sflag <= 1) \ + printf(m, rtstat.f, plural(rtstat.f)) + + p(rts_badredirect, "\t%u bad routing redirect%s\n"); + p(rts_dynamic, "\t%u dynamically created route%s\n"); + p(rts_newgateway, "\t%u new gateway%s due to redirects\n"); + p(rts_unreach, "\t%u destination%s found unreachable\n"); + p(rts_wildcard, "\t%u use%s of a wildcard route\n"); +#undef p } char *