Bug 1060195

Summary: Lack of 64-Bit Counters in /sbin/ip -s link show
Product: Red Hat Enterprise Linux 6 Reporter: Ted Rule <ejtr>
Component: iprouteAssignee: Pavel Šimerda (pavlix) <psimerda>
Status: CLOSED ERRATA QA Contact: Jaroslav Aster <jaster>
Severity: low Docs Contact:
Priority: unspecified    
Version: 6.5CC: jaster, knoha, psimerda, thozza, tnagata
Target Milestone: rcKeywords: Patch
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
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.
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-07-22 06:40:53 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
patch
none
patch none

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 ~]# 

iproute-2.6.32-31.el6.x86_64

net-tools-1.60-110.el6_2.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:10.211.55.8  Bcast:10.211.55.255  Mask:255.255.255.0
          inet6 addr: fe80::21c:42ff:fe91:be74/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          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 .1.3.6.1.2.1.31  | 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]
patch

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

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

# # rpm -q iproute
iproute-2.6.32-37.el6.x86_64

# 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:127.0.0.1  Mask:255.0.0.0
          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]
patch

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.

https://rhn.redhat.com/errata/RHBA-2015-1331.html