Date: Mon, 16 Feb 2026 19:47:28 +0000 From: Mark Johnston <markj@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Subject: git: 49dbd7670300 - stable/14 - netstat: Fix whitespace in libxo output for multicast routes Message-ID: <69937450.40d78.37ad6354@gitrepo.freebsd.org>
index | next in thread | raw e-mail
The branch stable/14 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=49dbd7670300e015a217ffb00a3110db5ef28c7d commit 49dbd7670300e015a217ffb00a3110db5ef28c7d Author: Mark Johnston <markj@FreeBSD.org> AuthorDate: 2026-01-30 20:30:58 +0000 Commit: Mark Johnston <markj@FreeBSD.org> CommitDate: 2026-02-16 16:09:28 +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. (cherry picked from commit 34c3e1d718a86436f863b2ae8b91bcf406b37f0e) (cherry picked from commit d2b595debaf2ff82a402c9226a77cd43cc97bb50) --- 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 a5da29e89009..84db9022e43b 100644 --- a/usr.bin/netstat/mroute.c +++ b/usr.bin/netstat/mroute.c @@ -39,7 +39,6 @@ * @(#)mroute.c 8.2 (Berkeley) 4/28/95 */ -#include <sys/cdefs.h> /* * Print multicast routing structures and statistics. * @@ -160,7 +159,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"); } @@ -189,9 +188,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); @@ -306,12 +305,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 5873c1ee85c6..0b9438dee2a3 100644 --- a/usr.bin/netstat/mroute6.c +++ b/usr.bin/netstat/mroute6.c @@ -67,7 +67,6 @@ * @(#)mroute.c 8.2 (Berkeley) 4/28/95 */ -#include <sys/cdefs.h> #ifdef INET6 #include <sys/param.h> #include <sys/queue.h> @@ -155,7 +154,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"); @@ -176,19 +175,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}", @@ -209,7 +208,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");home | help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?69937450.40d78.37ad6354>
