netstat counts input traffic twice

Ben RUBSON ben.rubson at gmail.com
Fri Sep 23 17:59:14 UTC 2016


Hello,

I found a strange issue where input traffic is counted twice,
sometimes more.



How to reproduce :

dst# netstat -b -I mlxen1
Name    Mtu Network           Ipkts        Ibytes     Opkts        Obytes
mlxen  9000 <Link#3>      223135371 2297323715986 242534891 1594979072449
mlxen     - 192.168.0.0/1 140330886 1143518393245 239792545 1583789250111

dst# sysctl hw.mlxen1.stat.rx_bytes
hw.mlxen1.stat.rx_bytes: 1151840666259

dst# iperf -s

src# iperf -c dst -i 1 -t 10 -n 1G
[ ID] Interval       Transfer     Bandwidth
[  3]  0.0- 0.3 sec  1.00 GBytes  33.0 Gbits/sec

dst# netstat -b -I mlxen1
Name    Mtu Network           Ipkts        Ibytes     Opkts        Obytes
mlxen  9000 <Link#3>      223257341 2299482904332 242578378 1594982116541
mlxen     - 192.168.0.0/1 140378866 1144594630061 239836031 1583791511391

dst# sysctl hw.mlxen1.stat.rx_bytes
hw.mlxen1.stat.rx_bytes: 1152922946009



Results :

iperf on dst gives good results :
dst# iperf -s
[ ID] Interval       Transfer     Bandwidth
[  3]  0.0- 0.3 sec  1.00 GBytes  33.0 Gbits/sec

hw.mlxen1.stat.rx_bytes also gives good results :
1152922946009 - 1151840666259 = 1GG

However, netstat :
2299482904332 - 2297323715986 = 2GB (!)
1144594630061 - 1143518393245 = 1GB

Strangely enough input packets are counted twice for the "link" interface.
Why ?
Is there a bug somewhere ?
Of course looking at the real time results with netstat -w 1
gives the same uncorrect results. As well as with systat -ifstat.
iftop (which I do not like so much because it sometimes hangs the traffic)
seems to give good results however.

I tested this on 3 similar servers, in all possible ways.
Every time I get these strange results.

This behaviour of course totally brakes reporting tools based on netstat.



My 2 systems :

# uname -r
11.0-RC3

# uptime
 7:40p.m.  up 47 mins, 1 users, load averages: 0.00, 0.00, 0.00

# mst status
MST devices:
------------
  pci0:133:0:0 - MT27500 Family [ConnectX-3]

# flint -d pci0:133:0:0 q
Image type:          FS2
FW Version:          2.36.5000
FW Release Date:     26.1.2016
Product Version:     02.36.50.00
Rom Info:            type=PXE version=3.4.718 devid=4099
Device ID:           4099
PSID:                MT_1090110023



Thank you very much !

Ben



More information about the freebsd-net mailing list