Bug 171996

Summary: Net-SNMP can't handle 64-bit CPU values, return values
Product: [Fedora] Fedora Reporter: Hrunting Johnson <redhat>
Component: net-snmpAssignee: Radek Vokál <rvokal>
Status: CLOSED RAWHIDE QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 4   
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2005-11-01 13:37:59 UTC Type: ---
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 to fix reading of 64-bit CPU and interrupt counters
none
64-bit return value check patch
none
64-bit return value check patch none

Description Hrunting Johnson 2005-10-28 21:00:05 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.12) Gecko/20050915 Firefox/1.0.7

Description of problem:
The way net-snmp is coded, it cannot handle the 64-bit state values from /proc/stat.  Furthermore, certain 64-bit values for things like interfaces can be returned in Counter32 fields.  When these fields are queried from 64-bit boxes, they're 64-bit values, not 32-bit values as they should be.  When these fields are queried from 32-bit boxes, they either return 0 or break the SNMP read altogether because they're the wrong size.

Version-Release number of selected component (if applicable):
net-snmp-5.2.1.2-fc4.1

How reproducible:
Always

Steps to Reproduce:
1. Start up box
2. Let it run for approximately 200 days
3. Try to query the systemStats table for raw CPU counters
  

Actual Results:  Values aren't returned.

Expected Results:  32-bit counters returned.

Additional info:

I'll attache two patches, one to fix specifically the CPU counter problem and one to fix the overall 64-bit-value-in-32-bit-fields problem.

Comment 1 Hrunting Johnson 2005-10-28 21:01:47 UTC
Created attachment 120521 [details]
Patch to fix reading of 64-bit CPU and interrupt counters

This patch is taken from net-snmp-5.2.2pre4, which is the latest release to
contain this fix.  It's relatively minor, changing the sscanf to grab
long-longs and then converting them to unsigned longs.

Comment 2 Hrunting Johnson 2005-10-28 21:04:18 UTC
Created attachment 120522 [details]
64-bit return value check patch

This patch checks the size of long on the host system and if it's longer than 4
bytes, truncates the returning value for fields that are only 32-bits wide. 
This patch was taken from net-snmp-5.2.2pre4, which is the latest version to
contain this fix.  It's a relatively clean patch.  This patch is basically the
same as that found at this URL:

http://sourceforge.net/tracker/download.php?group_id=12694&atid=456380&file_id=146117&aid=1259966

Comment 3 Hrunting Johnson 2005-10-28 21:33:22 UTC
Created attachment 120523 [details]
64-bit return value check patch

This patch checks the size of long on the host system and if it's longer than 4

bytes, truncates the returning value for fields that are only 32-bits wide. 
This patch was taken from net-snmp-5.2.2pre4, which is the latest version to
contain this fix.  It's a relatively clean patch.  This patch is basically the
same as that found at this URL:

http://sourceforge.net/tracker/download.php?group_id=12694&atid=456380&file_id=146117&aid=1259966


[Updated to be the right patch]

Comment 4 Radek Vokál 2005-11-01 13:37:59 UTC
I've updated rawhide to net-snmp-5.2.2.rc3 so this issue is fixed there.