diff --git a/sys/net/route.c b/sys/net/route.c --- a/sys/net/route.c +++ b/sys/net/route.c @@ -75,6 +75,10 @@ VNET_PCPUSTAT_SYSUNINIT(rtstat); #endif +SYSCTL_DECL(_net_route); +SYSCTL_VNET_PCPUSTAT(_net_route, OID_AUTO, stats, struct rtstat, + rtstat, "route statistics."); + EVENTHANDLER_LIST_DEFINE(rt_addrmsg); static int rt_ifdelroute(const struct rtentry *rt, const struct nhop_object *, diff --git a/usr.bin/netstat/main.c b/usr.bin/netstat/main.c --- a/usr.bin/netstat/main.c +++ b/usr.bin/netstat/main.c @@ -523,12 +523,9 @@ if (rflag) { xo_open_container("statistics"); xo_set_version(NETSTAT_XO_VERSION); - if (sflag) { - if (live) { - kresolve_list(nl); - } + if (sflag) rt_stats(); - } else + else routepr(fib, af); xo_close_container("statistics"); if (xo_finish() < 0) diff --git a/usr.bin/netstat/route.c b/usr.bin/netstat/route.c --- a/usr.bin/netstat/route.c +++ b/usr.bin/netstat/route.c @@ -699,13 +699,11 @@ rt_stats(void) { struct rtstat rtstat; - u_long rtsaddr; - if ((rtsaddr = nl[N_RTSTAT].n_value) == 0) { - xo_emit("{W:rtstat: symbol not in namelist}\n"); + if (fetch_stats("net.route.stats", nl[N_RTSTAT].n_value, &rtstat, + sizeof(rtstat), kread_counters) != 0) return; - } - kread_counters(rtsaddr, (char *)&rtstat, sizeof (rtstat)); + xo_emit("{T:routing}:\n"); #define p(f, m) if (rtstat.f || sflag <= 1) \