git: 4084b1ab0413 - main - Fix `netstat -rs` reporting.

Alexander V. Chernikov melifaro at FreeBSD.org
Wed Mar 31 20:59:18 UTC 2021


The branch main has been updated by melifaro:

URL: https://cgit.FreeBSD.org/src/commit/?id=4084b1ab0413d15dab496b1c24c3875601c71438

commit 4084b1ab0413d15dab496b1c24c3875601c71438
Author:     Alexander V. Chernikov <melifaro at FreeBSD.org>
AuthorDate: 2021-03-31 20:56:26 +0000
Commit:     Alexander V. Chernikov <melifaro at FreeBSD.org>
CommitDate: 2021-03-31 20:59:10 +0000

    Fix `netstat -rs` reporting.
    
    rttrash (unused but not yet delete entries) were eliminated
     during routing rework. Remove reading these symbols from the kernel.
    
    PR:             254681
    Reported by:    rashey at superbox.pl
    MFC after:      immediately
---
 usr.bin/netstat/nlist_symbols |  1 -
 usr.bin/netstat/route.c       | 13 +------------
 2 files changed, 1 insertion(+), 13 deletions(-)

diff --git a/usr.bin/netstat/nlist_symbols b/usr.bin/netstat/nlist_symbols
index afad45d353bd..1c09d81c0b98 100644
--- a/usr.bin/netstat/nlist_symbols
+++ b/usr.bin/netstat/nlist_symbols
@@ -39,7 +39,6 @@ all	_rip6stat
 all	_ripcbinfo
 all	_rtree
 all	_rtstat
-all	_rttrash
 all	_sctpstat
 all	_sfstat
 all	_tcbinfo
diff --git a/usr.bin/netstat/route.c b/usr.bin/netstat/route.c
index ba47a4b56ac5..317e3ffb9607 100644
--- a/usr.bin/netstat/route.c
+++ b/usr.bin/netstat/route.c
@@ -699,19 +699,13 @@ void
 rt_stats(void)
 {
 	struct rtstat rtstat;
-	u_long rtsaddr, rttaddr;
-	int rttrash;
+	u_long rtsaddr;
 
 	if ((rtsaddr = nl[N_RTSTAT].n_value) == 0) {
 		xo_emit("{W:rtstat: symbol not in namelist}\n");
 		return;
 	}
-	if ((rttaddr = nl[N_RTTRASH].n_value) == 0) {
-		xo_emit("{W:rttrash: symbol not in namelist}\n");
-		return;
-	}
 	kread_counters(rtsaddr, (char *)&rtstat, sizeof (rtstat));
-	kread(rttaddr, (char *)&rttrash, sizeof (rttrash));
 	xo_emit("{T:routing}:\n");
 
 #define	p(f, m) if (rtstat.f || sflag <= 1) \
@@ -728,9 +722,4 @@ rt_stats(void)
 	p(rts_wildcard, "\t{:wildcard-uses/%ju} "
 	    "{N:/use%s of a wildcard route}\n");
 #undef p
-
-	if (rttrash || sflag <= 1)
-		xo_emit("\t{:unused-but-not-freed/%u} "
-		    "{N:/route%s not in table but not freed}\n",
-		    rttrash, plural(rttrash));
 }


More information about the dev-commits-src-main mailing list