Bug#561161: netstat -s -t reports negative octet counts

Rick Jones rick.jones2 at hp.com
Mon Dec 14 22:01:23 UTC 2009

Package: net-tools
Version: 1.60-23

If one sends a large quantity of data through the system and looks at the output 
of netstat -s -t, the counts for InOctets and OutOctets of the IpExt: section 
can appear as negative values:

     InBcastPkts: 8790
     InOctets: -1200421535
     OutOctets: -1971599035

However, the output of /proc/net/netstat looks sane:

IpExt: InNoRoutes InTruncatedPkts InMcastPkts OutMcastPkts InBcastPkts 
OutBcastPkts InOctets OutOctets InMcastOctets OutMcastOctets InBcastOctets 
IpExt: 0 0 0 0 8816 0 270760005735 218449208561 0 0 2813870 0

It would seem that /bin/netstat is incorrectly interpreting at least some octet 
counters as signed quantities - and perhaps 32 bit signed quantities at that, 
rather than unsigned 64-bit quantities.

This was seen on a 5.03 (5.0.3?) system with a 2.6.32 kernel from "upstream" and 
was also seen with the net-tools from squeeze.  The HW in this case was a 
dual-processor Intel E5520 system, but it is unlikely the system type matters 
except in how quickly it can wrap counters.

This can be reproduced by looking at netstat -s -t output while
either netperf TCP_STREAM or "burst" TCP_RR tests run over loopback:

./configure --enable-burst
netperf -t TCP_RR -l 120 -- -r 64K -b 12

or I suspect anything that will send large quantities of data. There is no need 
to send data through an actual network interface - loopback will suffice.  As 
you look at netstat -s -t output you will see if flipping back and forth between 
positive and negative values.

More information about the Pkg-net-tools-maintainers mailing list