git: a0627bc6923c - main - netstat: improve output for tcp stats

From: Michael Tuexen <tuexen_at_FreeBSD.org>
Date: Mon, 01 Sep 2025 22:29:07 UTC
The branch main has been updated by tuexen:

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

commit a0627bc6923c4f27bad3dd83af3d3441dc0526aa
Author:     Michael Tuexen <tuexen@FreeBSD.org>
AuthorDate: 2025-09-01 22:23:26 +0000
Commit:     Michael Tuexen <tuexen@FreeBSD.org>
CommitDate: 2025-09-01 22:23:26 +0000

    netstat: improve output for tcp stats
    
    Put SYN-cookie related counters in its own container and use consistent
    indentation for them.
    
    Reviewed by:            glebius
    MFC after:              1 week
    Sponsored by:           Netflix, Inc.
    Differential Revision:  https://reviews.freebsd.org/D52227
---
 usr.bin/netstat/inet.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/usr.bin/netstat/inet.c b/usr.bin/netstat/inet.c
index 7014f02032c2..5f36b1599cad 100644
--- a/usr.bin/netstat/inet.c
+++ b/usr.bin/netstat/inet.c
@@ -767,15 +767,20 @@ tcp_stats(u_long off, const char *name, int af1 __unused, int proto __unused)
 	p1a(tcps_sc_badack, "\t\t{:bad-ack/%ju} {N:/badack}\n");
 	p1a(tcps_sc_unreach, "\t\t{:unreachable/%ju} {N:/unreach}\n");
 	p(tcps_sc_zonefail, "\t\t{:zone-failures/%ju} {N:/zone failure%s}\n");
+
+	xo_close_container("syncache");
+
+	xo_open_container("syncookies");
+
 	p(tcps_sc_sendcookie, "\t{:sent-cookies/%ju} {N:/cookie%s sent}\n");
-	p(tcps_sc_recvcookie, "\t{:received-cookies/%ju} "
+	p(tcps_sc_recvcookie, "\t\t{:received-cookies/%ju} "
 	    "{N:/cookie%s received}\n");
-	p(tcps_sc_spurcookie, "\t{:spurious-cookies/%ju} "
+	p(tcps_sc_spurcookie, "\t\t{:spurious-cookies/%ju} "
 	    "{N:/spurious cookie%s rejected}\n");
-	p(tcps_sc_failcookie, "\t{:failed-cookies/%ju} "
+	p(tcps_sc_failcookie, "\t\t{:failed-cookies/%ju} "
 	    "{N:/failed cookie%s rejected}\n");
 
-	xo_close_container("syncache");
+	xo_close_container("syncookies");
 
 	xo_open_container("hostcache");