summaryrefslogtreecommitdiffstats
path: root/usr.bin/netstat
diff options
context:
space:
mode:
authorru <ru@FreeBSD.org>2001-06-23 09:18:57 +0000
committerru <ru@FreeBSD.org>2001-06-23 09:18:57 +0000
commitb3aa602e23ece34e47cebfa021714069fe78231a (patch)
tree7101e8b9ecb7c61e4233e0d0ec0c907df6194b1c /usr.bin/netstat
parent601886f70a47483a72cf8355d4f5b5cadea3cf33 (diff)
downloadFreeBSD-src-b3aa602e23ece34e47cebfa021714069fe78231a.zip
FreeBSD-src-b3aa602e23ece34e47cebfa021714069fe78231a.tar.gz
Honor -s -s (don't show zero stats) with -r, untangle SYNOPSIS further.
(usage() still is not synchronized with SYNOPSIS, intentionally.)
Diffstat (limited to 'usr.bin/netstat')
-rw-r--r--usr.bin/netstat/netstat.117
-rw-r--r--usr.bin/netstat/route.c20
2 files changed, 25 insertions, 12 deletions
diff --git a/usr.bin/netstat/netstat.1 b/usr.bin/netstat/netstat.1
index 594e277..667c29f 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 83c4c49..c5956d8 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 *
OpenPOWER on IntegriCloud