aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPouria Mousavizadeh Tehrani <pouria@FreeBSD.org>2026-07-28 08:16:14 +0000
committerPouria Mousavizadeh Tehrani <pouria@FreeBSD.org>2026-07-28 08:17:32 +0000
commit5286cbea9118f79b43fb7416d9fc4f081c400949 (patch)
treeca4654e05d4dc5c4a3833faf52dcfcf8aca3203c
parent84f062e3364ef29bc7db5310d960963dc9df2845 (diff)
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
-rw-r--r--usr.bin/netstat/nhops.c7
1 files 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++)