git: cff675e83cdb - main - netstat: Add -F support for -g
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 07 Apr 2026 14:41:36 UTC
The branch main has been updated by bnovkov:
URL: https://cgit.FreeBSD.org/src/commit/?id=cff675e83cdb6c9027e94df9d010439e42e27dee
commit cff675e83cdb6c9027e94df9d010439e42e27dee
Author: Bojan Novković <bnovkov@FreeBSD.org>
AuthorDate: 2026-03-26 09:39:10 +0000
Commit: Bojan Novković <bnovkov@FreeBSD.org>
CommitDate: 2026-04-07 14:39:51 +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
---
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 d81e7c5e8307..0084426540f6 100644
--- a/usr.bin/netstat/main.c
+++ b/usr.bin/netstat/main.c
@@ -550,6 +550,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 a726c703752f..5c7f2336c06b 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 April 3, 2026
+.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
@@ -738,6 +739,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
@@ -764,6 +766,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 .