git: 34c3e1d718a8 - main - netstat: Fix whitespace in libxo output for multicast routes
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 30 Jan 2026 20:38:05 UTC
The branch main has been updated by markj:
URL: https://cgit.FreeBSD.org/src/commit/?id=34c3e1d718a86436f863b2ae8b91bcf406b37f0e
commit 34c3e1d718a86436f863b2ae8b91bcf406b37f0e
Author: Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2026-01-30 20:30:58 +0000
Commit: Mark Johnston <markj@FreeBSD.org>
CommitDate: 2026-01-30 20:30:58 +0000
netstat: Fix whitespace in libxo output for multicast routes
Also fix some bogus libxo format strings in mroute6.c, and close a
couple of lists instead of opening them twice.
Fixes: ade9ccfe211a ("Convert netstat to use libxo.")
MFC after: 2 weeks
Sponsored by: Stormshield
Sponsored by: Klara, Inc.
---
usr.bin/netstat/mroute.c | 11 +++++------
usr.bin/netstat/mroute6.c | 13 ++++++-------
2 files changed, 11 insertions(+), 13 deletions(-)
diff --git a/usr.bin/netstat/mroute.c b/usr.bin/netstat/mroute.c
index 1577a6ae73ac..75c3c8477ea4 100644
--- a/usr.bin/netstat/mroute.c
+++ b/usr.bin/netstat/mroute.c
@@ -37,7 +37,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
/*
* Print multicast routing structures and statistics.
*
@@ -157,7 +156,7 @@ print_bw_meter(struct bw_meter *bw_meter, int *banner_printed)
}
xo_emit(" {:remaining-time/%s}", s3);
- xo_open_instance("bandwidth-meter");
+ xo_close_instance("bandwidth-meter");
xo_emit("\n");
}
@@ -186,9 +185,9 @@ print_mfc(struct mfc *m, int maxvif, int *banner_printed)
}
memcpy(&sin.sin_addr, &m->mfc_origin, sizeof(sin.sin_addr));
- xo_emit(" {:origin-address/%-15.15s}", routename(sa, numeric_addr));
+ xo_emit(" {t:origin-address/%-*.15s}", 15, routename(sa, numeric_addr));
memcpy(&sin.sin_addr, &m->mfc_mcastgrp, sizeof(sin.sin_addr));
- xo_emit(" {:group-address/%-15.15s}",
+ xo_emit(" {t:group-address/%-15.15s}",
routename(sa, numeric_addr));
xo_emit(" {:sent-packets/%9lu}", m->mfc_pkt_cnt);
xo_emit(" {:parent/%3d} ", m->mfc_parent);
@@ -303,12 +302,12 @@ mroutepr(void)
xo_open_instance("vif");
memcpy(&sin.sin_addr, &v->v_lcl_addr, sizeof(sin.sin_addr));
- xo_emit(" {:vif/%2u} {:threshold/%6u} {:route/%-15.15s}",
+ xo_emit(" {:vif/%2u} {:threshold/%6u} {t:route/%-15.15s}",
/* opposite math of add_vif() */
vifi, v->v_threshold,
routename(sa, numeric_addr));
memcpy(&sin.sin_addr, &v->v_rmt_addr, sizeof(sin.sin_addr));
- xo_emit(" {:source/%-15.15s}", (v->v_flags & VIFF_TUNNEL) ?
+ xo_emit(" {t:source/%-15.15s}", (v->v_flags & VIFF_TUNNEL) ?
routename(sa, numeric_addr) : "");
xo_emit(" {:received-packets/%9lu} {:sent-packets/%9lu}\n",
diff --git a/usr.bin/netstat/mroute6.c b/usr.bin/netstat/mroute6.c
index 0bb44b8292e7..5898791dcbe6 100644
--- a/usr.bin/netstat/mroute6.c
+++ b/usr.bin/netstat/mroute6.c
@@ -65,7 +65,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
#ifdef INET6
#include <sys/param.h>
#include <sys/queue.h>
@@ -151,7 +150,7 @@ mroute6pr(void)
xo_close_instance("multicast-interface");
}
if (banner_printed)
- xo_open_list("multicast-interface");
+ xo_close_list("multicast-interface");
else
xo_emit("\n{T:IPv6 Multicast Interface Table is empty}\n");
@@ -172,19 +171,19 @@ mroute6pr(void)
xo_open_list("multicast-forwarding-cache");
xo_emit("\n"
"{T:IPv6 Multicast Forwarding Cache}\n");
- xo_emit(" {T:%-*.*s} {T:%-*.*s} {T:%s}",
+ xo_emit(" {T:/%-*.*s} {T:/%-*.*s} {T:/%s}\n",
WID_ORG, WID_ORG, "Origin",
WID_GRP, WID_GRP, "Group",
- " Packets Waits In-Mif Out-Mifs\n");
+ " Packets Waits In-Mif Out-Mifs");
banner_printed = 1;
}
xo_open_instance("multicast-forwarding-cache");
- xo_emit(" {:origin/%-*.*s}", WID_ORG, WID_ORG,
+ xo_emit(" {t:origin/%-*.*s}", WID_ORG, WID_ORG,
routename(sin6tosa(&mfc.mf6c_origin),
numeric_addr));
- xo_emit(" {:group/%-*.*s}", WID_GRP, WID_GRP,
+ xo_emit(" {t:group/%-*.*s}", WID_GRP, WID_GRP,
routename(sin6tosa(&mfc.mf6c_mcastgrp),
numeric_addr));
xo_emit(" {:total-packets/%9ju}",
@@ -205,7 +204,7 @@ mroute6pr(void)
xo_open_list("mif");
for (mifi = 0; mifi <= maxmif; mifi++) {
if (IF_ISSET(mifi, &mfc.mf6c_ifset))
- xo_emit(" {l:%u}", mifi);
+ xo_emit(" {l:/%u}", mifi);
}
xo_close_list("mif");
xo_emit("\n");