diff options
-rw-r--r-- | usr.bin/netstat/main.c | 4 | ||||
-rw-r--r-- | usr.bin/netstat/netstat.h | 2 | ||||
-rw-r--r-- | usr.bin/netstat/route.c | 16 |
3 files changed, 17 insertions, 5 deletions
diff --git a/usr.bin/netstat/main.c b/usr.bin/netstat/main.c index a6e9966..4f373d1 100644 --- a/usr.bin/netstat/main.c +++ b/usr.bin/netstat/main.c @@ -163,6 +163,8 @@ static struct nlist nl[] = { { "_pagesize" }, #define N_MBPSTAT 46 { "_mb_statpcpu" }, +#define N_RTTRASH 47 + { "_rttrash" }, { "" }, }; @@ -532,7 +534,7 @@ main(argc, argv) if (rflag) { kread(0, 0, 0); if (sflag) - rt_stats(nl[N_RTSTAT].n_value); + rt_stats(nl[N_RTSTAT].n_value, nl[N_RTTRASH].n_value); else routepr(nl[N_RTREE].n_value); exit(0); diff --git a/usr.bin/netstat/netstat.h b/usr.bin/netstat/netstat.h index f4411e6..3efa21e 100644 --- a/usr.bin/netstat/netstat.h +++ b/usr.bin/netstat/netstat.h @@ -106,7 +106,7 @@ void intpr (int, u_long, void (*)(char *)); void pr_rthdr (int); void pr_family (int); -void rt_stats (u_long); +void rt_stats (u_long, u_long); char *ipx_pnet (struct sockaddr *); char *ipx_phost (struct sockaddr *); char *ns_phost (struct sockaddr *); diff --git a/usr.bin/netstat/route.c b/usr.bin/netstat/route.c index 2831539..4390a2e 100644 --- a/usr.bin/netstat/route.c +++ b/usr.bin/netstat/route.c @@ -851,15 +851,21 @@ routename6(struct sockaddr_in6 *sa6) * Print routing statistics */ void -rt_stats(u_long off) +rt_stats(u_long rtsaddr, u_long rttaddr) { struct rtstat rtstat; + int rttrash; - if (off == 0) { + if (rtsaddr == 0) { printf("rtstat: symbol not in namelist\n"); return; } - kread(off, (char *)&rtstat, sizeof (rtstat)); + if (rttaddr == 0) { + printf("rttrash: symbol not in namelist\n"); + return; + } + kread(rtsaddr, (char *)&rtstat, sizeof (rtstat)); + kread(rttaddr, (char *)&rttrash, sizeof (rttrash)); printf("routing:\n"); #define p(f, m) if (rtstat.f || sflag <= 1) \ @@ -871,6 +877,10 @@ rt_stats(u_long off) p(rts_unreach, "\t%u destination%s found unreachable\n"); p(rts_wildcard, "\t%u use%s of a wildcard route\n"); #undef p + + if (rttrash || sflag <= 1) + printf("\t%u route%s not in table but not freed\n", + rttrash, plural(rttrash)); } char * |