Bug 1060195 - Lack of 64-Bit Counters in /sbin/ip -s link show
Summary: Lack of 64-Bit Counters in /sbin/ip -s link show
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: iproute
Version: 6.5
Hardware: x86_64
OS: Linux
Target Milestone: rc
: ---
Assignee: Pavel Šimerda (pavlix)
QA Contact: Jaroslav Aster
Depends On:
TreeView+ depends on / blocked
Reported: 2014-01-31 12:37 UTC by Ted Rule
Modified: 2019-07-11 07:51 UTC (History)
5 users (show)

Fixed In Version: iproute-2.6.32-38.el6
Doc Type: Bug Fix
Doc Text:
The /sbin/ip file displayed statistics for 32-bit system even on 64-bit kernel. To fix this bug, a patch has been applied, and the statistics are now presented correctly.
Clone Of:
Last Closed: 2015-07-22 06:40:53 UTC
Target Upstream Version:

Attachments (Terms of Use)
patch (12.92 KB, patch)
2014-12-11 20:35 UTC, Pavel Šimerda (pavlix)
no flags Details | Diff
patch (13.13 KB, patch)
2015-02-20 12:39 UTC, Pavel Šimerda (pavlix)
no flags Details | Diff

System ID Private Priority Status Summary Last Updated
Red Hat Knowledge Base (Solution) 1159143 0 None None None Never
Red Hat Product Errata RHBA-2015:1331 0 normal SHIPPED_LIVE iproute bug fix and enhancement update 2015-07-20 17:53:02 UTC

Description Ted Rule 2014-01-31 12:37:40 UTC
Description of problem:

/sbin/ip shows 32-bit statistics, even on 64-bit kernel.

Version-Release number of selected component (if applicable):

For this kernel/iproute/net-tools combination on my test rig:

[root@trafalgar-centos65-x86-64 ~]# uname -a 
Linux trafalgar-centos65-x86-64.bugfinder.co.uk 2.6.32-431.el6.x86_64 #1 SMP Fri Nov 22 03:15:09 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux
[root@trafalgar-centos65-x86-64 ~]# 



How reproducible:

Having pumped about 5GB of data in to a test CentOS6.5 x86_64 instance, I could see that /sbin/ifconfig reported >4GB of Rx Bytes, whilst "/sbin/ip -s link show" reported 600MB, indicating that ifconfig is using a 64-bit counter whilst /sbin/ip is using a 32-bit counter.

FWIW, SNMP interfaces MIB still reports a 32-bit Counter, but that's to be expected as it's defined as 32-bit in the MIB, but the HC-MIB does report 64-bit Counters on x86_64 as shown by the tests below.

[root@trafalgar-centos65-x86-64 ~]# ifconfig eth0
eth0      Link encap:Ethernet  HWaddr 00:1C:42:91:BE:74 
          inet addr:  Bcast:  Mask:
          inet6 addr: fe80::21c:42ff:fe91:be74/64 Scope:Link
          RX packets:3455650 errors:0 dropped:0 overruns:0 frame:0
          TX packets:463111 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:4931589231 (4.5 GiB)  TX bytes:33046767 (31.5 MiB)

[root@trafalgar-centos65-x86-64 ~]#

[root@trafalgar-centos65-x86-64 ~]# ip -s link show eth0
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 00:1c:42:91:be:74 brd ff:ff:ff:ff:ff:ff
    RX: bytes  packets  errors  dropped overrun mcast  
    636623473  3455667  0       0       0       1     
    TX: bytes  packets  errors  dropped carrier collsns
    33048677   463120   0       0       0       0     
[root@trafalgar-centos65-x86-64 ~]#

FWIW, neither ifconfig nor /sbin/ip nor SNMP HC-MIB report 64-bit Counters on 32-bit Kernels, but I understand that part of the reason for that may be difficulties in updating a 64-bit kernel variable atomically on a 32-bit ARCH.

It would be good, in my view, to not support HC-MIB on 32-bit ARCH unless it can report a true 64-bit Counter, but that may be something of a religious argument :)

[root@trafalgar-centos65-x86-64 ~]# snmpwalk -c public -v 2c localhost interfaces | grep Octets
IF-MIB::ifInOctets.1 = Counter32: 0
IF-MIB::ifInOctets.2 = Counter32: 636619429
IF-MIB::ifOutOctets.1 = Counter32: 0
IF-MIB::ifOutOctets.2 = Counter32: 33042059
[root@trafalgar-centos65-x86-64 ~]#

[root@trafalgar-centos65-x86-64 ~]# snmpwalk -c public -v 2c localhost .  | grep Octets
IF-MIB::ifHCInOctets.1 = Counter64: 13572
IF-MIB::ifHCInOctets.2 = Counter64: 4931600285
IF-MIB::ifHCOutOctets.1 = Counter64: 13572
IF-MIB::ifHCOutOctets.2 = Counter64: 33058003
[root@trafalgar-centos65-x86-64 ~]#

Comment 6 Pavel Šimerda (pavlix) 2014-12-11 20:35:53 UTC
Created attachment 967374 [details]

Comment 9 Jaroslav Aster 2015-02-18 16:42:29 UTC

there is a mistake in printing rx/tx stats, the number is correct.

# # rpm -q iproute

# ip -s l show dev lo
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN 
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    RX: bytes  packets  errors  dropped overrun mcast   
    412714401141825064980      0      0      0      
    TX: bytes  packets  errors  dropped carrier collsns 
    412714401141825064980      0      0      0      

# ifconfig lo
lo        Link encap:Local Loopback  
          inet addr:  Mask:
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:182506498 errors:0 dropped:0 overruns:0 frame:0
          TX packets:182506498 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:41271440114 (38.4 GiB)  TX bytes:41271440114 (38.4 GiB)

You can see that there are no spaces between rx/tx bytes, packages and errors, so there is one number instead of three numbers.

Comment 11 Pavel Šimerda (pavlix) 2015-02-20 12:39:51 UTC
Created attachment 993889 [details]

Also backported the print_num() function that is used in the code.

Comment 16 errata-xmlrpc 2015-07-22 06:40:53 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.


Note You need to log in before you can comment on or make changes to this bug.