netstat(1) -s -f is broken
Dieter BSD
dieterbsd at gmail.com
Thu May 3 21:32:46 UTC 2018
FreeBSD 10.3-RELEASE
The fine man page promises:
netstat -i | -I interface -s [-46] [-f protocol_family | -p protocol]
[-M core] [-N system]
Display per-interface statistics for each network protocol, for a
particular protocol_family, or for a single protocol.
But in reality,
netstat -I interface -s -f family
only works if family is inet6.
interface=lo0
for fam in inet inet6 pfkey atalk netgraph ipx unix link
do
echo -n interface = $interface fam = $fam
netstat -I $interface -s -f $fam | wc
done
interface = lo0 fam = inet 0 0 0
interface = lo0 fam = inet6 56 258 1728
interface = lo0 fam = pfkey 0 0 0
interface = lo0 fam = atalk 0 0 0
interface = lo0 fam = netgraph 0 0 0
interface = lo0 fam = ipx 0 0 0
interface = lo0 fam = unix 0 0 0
interface = lo0 fam = link 0 0 0
I had this in a loop with all the interfaces, the results are
the same for all interfaces.
Doesn't work with -p either.
netstat -I lo0 -s -p udp
:udp: no per-interface stats routine
It would be very useful if this actually worked.
More information about the freebsd-hackers
mailing list