git: 893b90cd9649 - stable/15 - netstat: Add -F support for -g
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 14 Apr 2026 11:10:30 UTC
The branch stable/15 has been updated by bnovkov:
URL: https://cgit.FreeBSD.org/src/commit/?id=893b90cd96495f2a9a74ece2be248f16dcdde17e
commit 893b90cd96495f2a9a74ece2be248f16dcdde17e
Author: Bojan Novković <bnovkov@FreeBSD.org>
AuthorDate: 2026-03-26 09:39:10 +0000
Commit: Bojan Novković <bnovkov@FreeBSD.org>
CommitDate: 2026-04-14 11:09:50 +0000
netstat: Add -F support for -g
This change adds the ability to examine the contents of multicast
routing tables for other FIBs without the need for executing
`netstat` with `setfib(1)`.
MFC after: 3 days
Sponsored by: Klara, Inc.
Sponsored by: Stormshield
Differential Revision: https://reviews.freebsd.org/D56205
Reviewed by: glebius, markj, zlei
(cherry picked from commit cff675e83cdb6c9027e94df9d010439e42e27dee)
---
usr.bin/netstat/main.c | 2 ++
usr.bin/netstat/netstat.1 | 13 ++++++++++++-
2 files changed, 14 insertions(+), 1 deletion(-)
diff --git a/usr.bin/netstat/main.c b/usr.bin/netstat/main.c
index 79830049948a..f901ddfb2888 100644
--- a/usr.bin/netstat/main.c
+++ b/usr.bin/netstat/main.c
@@ -552,6 +552,8 @@ main(int argc, char *argv[])
if (gflag) {
+ if (fib != -1 && setfib(fib) < 0)
+ xo_errx(EX_DATAERR, "setfib: %s", strerror(errno));
xo_open_container("statistics");
xo_set_version(NETSTAT_XO_VERSION);
if (sflag) {
diff --git a/usr.bin/netstat/netstat.1 b/usr.bin/netstat/netstat.1
index 1931c38a1fad..42604cec0b16 100644
--- a/usr.bin/netstat/netstat.1
+++ b/usr.bin/netstat/netstat.1
@@ -25,7 +25,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.Dd July 16, 2025
+.Dd April 7, 2026
.Dt NETSTAT 1
.Os
.Sh NAME
@@ -94,6 +94,7 @@
.Op Fl j Ar jail
.Op Fl -libxo
.Op Fl 46W
+.Op Fl F Ar fibnum
.Op Fl f Ar address_family
.It Nm Fl gs
.Op Fl j Ar jail
@@ -746,6 +747,7 @@ See
.Nm
.Fl g
.Op Fl 46W
+.Op Fl F Ar fibnum
.Op Fl f Ar address_family
.Op Fl M Ar core
.Op Fl N Ar system
@@ -772,6 +774,15 @@ See
.Sx GENERAL OPTIONS .
.It Fl W
Avoid truncating addresses even if this causes some fields to overflow.
+.It Fl F
+Display the routing table with the number
+.Ar fibnum .
+If the specified
+.Ar fibnum
+is -1 or
+.Fl F
+is not specified,
+the default routing table is displayed.
.It Fl f Ar protocol_family
Filter by
.Ar protocol_family .