Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 28 Jul 2026 08:18:42 +0000
From:      Pouria Mousavizadeh Tehrani <pouria@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 5286cbea9118 - main - netstat(1): Emit nhop flags for encoding styles with Wflag
Message-ID:  <6a6865e2.4346d.1d119df4@gitrepo.freebsd.org>

index | next in thread | raw e-mail

The branch main has been updated by pouria:

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

commit 5286cbea9118f79b43fb7416d9fc4f081c400949
Author:     Pouria Mousavizadeh Tehrani <pouria@FreeBSD.org>
AuthorDate: 2026-07-28 08:16:14 +0000
Commit:     Pouria Mousavizadeh Tehrani <pouria@FreeBSD.org>
CommitDate: 2026-07-28 08:17:32 +0000

    netstat(1): Emit nhop flags for encoding styles with Wflag
    
    Show nhop flags like invalid nexthop to debug cases like
    the PR below.
    
    PR:             296883
    Reviewed by:    glebius
    Differential Revision: https://reviews.freebsd.org/D58347
---
 usr.bin/netstat/nhops.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/usr.bin/netstat/nhops.c b/usr.bin/netstat/nhops.c
index 48ec2006994e..d40211e7ff77 100644
--- a/usr.bin/netstat/nhops.c
+++ b/usr.bin/netstat/nhops.c
@@ -91,6 +91,7 @@ static struct bits nh_bits[] = {
 	{ NHF_GATEWAY,	'G', "gateway" },
 	{ NHF_DEFAULT,	'd', "default" },
 	{ NHF_BROADCAST,'b', "broadcast" },
+	{ NHF_INVALID,	'I', "invalid" },
 	{ 0 , 0, NULL }
 };
 
@@ -114,7 +115,7 @@ struct nhop_map {
 static struct nhop_map global_nhop_map;
 
 static struct nhop_entry *nhop_get(struct nhop_map *map, uint32_t idx);
-
+static void p_nhflags(int f, const char *format);
 
 static struct ifmap_entry *ifmap;
 static size_t ifmap_size;
@@ -281,10 +282,10 @@ print_nhop_entry_sysctl(const char *name, struct rt_msghdr *rtm, struct nhop_ext
 	snprintf(buffer, sizeof(buffer), "{[:-%d}{:flags/%%s}{]:} ",
 	    wid_flags - protrusion);
 
-	//p_nhflags(nh->nh_flags, buffer);
 	print_flags_generic(rtm->rtm_flags, rt_bits, buffer, "rt_flags_pretty");
 
 	if (Wflag) {
+		p_nhflags(nh->nh_flags, buffer);
 		xo_emit("{t:use/%*lu} ", wid_pksent, nh->nh_pksent);
 		xo_emit("{t:mtu/%*lu} ", wid_mtu, nh->nh_mtu);
 	}
@@ -440,7 +441,7 @@ p_nhflags(int f, const char *format)
 	struct bits *p;
 	char *pretty_name = "nh_flags_pretty";
 
-	xo_emit(format, fmt_flags(nh_bits, f));
+	//xo_emit(format, fmt_flags(nh_bits, f));
 
 	xo_open_list(pretty_name);
 	for (p = nh_bits; p->b_mask; p++)


home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?6a6865e2.4346d.1d119df4>