Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

netstat(1) -s -f is broken

1 view
Skip to first unread message

Dieter BSD

unread,
May 3, 2018, 5:36:19 PM5/3/18
to
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.
_______________________________________________
freebsd...@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hacke...@freebsd.org"

Andrey V. Elsukov

unread,
May 4, 2018, 6:26:07 AM5/4/18
to
On 04.05.2018 00:32, Dieter BSD wrote:
> 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.

Only IPv6 and ICMPv6 have per-interface statistics counters. Other
protocols don't have such support.

--
WBR, Andrey V. Elsukov

signature.asc

神明達哉

unread,
May 5, 2018, 9:19:33 PM5/5/18
to
At Fri, 4 May 2018 13:19:57 +0300,
"Andrey V. Elsukov" <bu7...@yandex.ru> wrote:

> > 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.

> Only IPv6 and ICMPv6 have per-interface statistics counters. Other
> protocols don't have such support.

That's how I remember why per-interface statistics was originally
provided only for IPv6, but RFC4293 extended the concept to IPv4
(interestingly RFC4293 also seems to effectively deprecate
per-interface ICMPv6 statistics). So it would make sense to make
'-I <ifname> -s -f inet' now works.

The UDP case is totally different - as far as I remember there has
never been per-interface UDP statistics defined in the form of RFC
MIBs, so it's actually reasonable to emit an error against
'-I <ifname> -s -p udp'.

--
JINMEI, Tatuya
0 new messages