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
This commit is contained in:
Bojan Novković
2026-03-26 10:39:10 +01:00
parent 8244dd3262
commit cff675e83c
2 changed files with 14 additions and 1 deletions
+2
View File
@@ -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) {
+12 -1
View File
@@ -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 .