]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
MFC r354633:
authorMike Karels <karels@FreeBSD.org>
Sat, 23 Nov 2019 13:20:24 +0000 (13:20 +0000)
committerMike Karels <karels@FreeBSD.org>
Sat, 23 Nov 2019 13:20:24 +0000 (13:20 +0000)
commitc2d32e6c2302f9c217bc5f138338092fe4ab448d
tree560bdc846779a4e8b6dbbb972da8763bd151bf5d
parent913c944a5d066a67cbdbba50888bf54cd6067963
MFC r354633:

Fix netstat -gs with ip_mroute module and/or vnet

The code for "netstat -gs -f inet" failed if the kernel namelist did not
include the _mrtstat symbol. However, that symbol is not in a standard
kernel even with the ip_mroute module loaded, where the functionality is
available. It is also not in a kernel with MROUTING but also VIMAGE, as
there can be multiple sets of stats. However, when running the command
on a live system, the symbol is not used; a sysctl is used. Go ahead
and try the sysctl in any case, and complain that IPv4 MROUTING is not
present only if the sysctl fails with ENOENT. Also fail if _mrtstat is
not defined when running on a core file; netstat doesn't know about vnets,
so can only work if MROUTING was included, and VIMAGE was not.

Reviewed by:    bz
usr.bin/netstat/mroute.c