Bug 12852 - ifconfig reports wrong packet statistics when they're greater than LONG_MAX
Summary: ifconfig reports wrong packet statistics when they're greater than LONG_MAX
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: net-tools
Version: 6.1
Hardware: i386
OS: Linux
Target Milestone: ---
Assignee: Crutcher Dunnavant
QA Contact:
Depends On:
TreeView+ depends on / blocked
Reported: 2000-06-23 12:38 UTC by Tomasz Beger
Modified: 2008-05-01 15:37 UTC (History)
1 user (show)

Clone Of:
Last Closed: 2001-02-15 20:24:45 UTC

Attachments (Terms of Use)

Description Tomasz Beger 2000-06-23 12:38:22 UTC
When an interface statistic counter is greater than 2147483647 ifconfig 
always reports the value of 2147483647 (LONG_MAX on i386). The reason of 
this behavior is that the internal representation device statistic counter 
in Linux device structure is an unsigned long and the ifconfig utility 
reads the interface statistic counters from /proc/net/dev file system as a 
string and then converts the textual representation into a long. The 
conversion is done in function if_getstats()(ifconfig.c) by a call to 
sscanf() function but with wrong conversion specification. The sscanf() 
function is told to treat the string as a signed long (%ld) and it returns 
the 2147483647 value for all strings that represent numbers exceeding the 
range of long.

Comment 1 Pekka Savola 2001-02-15 20:24:40 UTC
This has been fixed in upstream net-tools-1.58.

Comment 2 Crutcher Dunnavant 2001-04-19 18:39:01 UTC

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