Bug 119106

Summary: patch: ipAdEntIfIndex is wrong
Product: [Fedora] Fedora Reporter: Kaj J. Niemi <kajtzu>
Component: net-snmpAssignee: Phil Knirsch <pknirsch>
Status: CLOSED RAWHIDE QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: rawhideCC: rvokal
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: 2004-04-08 15:00:36 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 fixing ifIndex lookup problems for ipAdEntIfIndex none

Description Kaj J. Niemi 2004-03-25 03:31:00 UTC
Description of problem:
On Linux values ipAdEntIfIndex values for other than 127.0.0.1 point
to the wrong IfIndex. 

The Attached patch fixes the problem mentioned above. It works okay on
both 2.4 and 2.6 kernels along with 1-4 physical interfaces besides lo0.

Since ipAddr.c pretty much blindly takes the ifreq->ifr_index value
coming filled by the kernel I guess the real problem might not be with
net-snmp. Once upon the someone had to write their own interface index
lookup routines in net-snmp for linux. My patch ignores both of these
(Address_Scan_Init() and Address_Scan_next()) and instead uses the
functions available for other operating systems, mostly *BSD I guess.
There is also a check to ignore addresses from 0/8 as interfaces
without an address get assigned 0.0.0.0.

It took a while to reduce it to only a few lines of changes ;-)

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

How reproducible:
Always

Steps to Reproduce:
1. snmpwalk -v 2c -c community host ifdescr
2. snmpwalk -v 2c -c community host ipadentifindex
3. 
  
Actual results:
ifDescr.1 = STRING: "lo"
ifDescr.2 = STRING: "eth0"
ifDescr.3 = STRING: "eth1"
ifDescr.4 = STRING: "sit0"
ipAdEntIfIndex.127.0.0.1 = INTEGER: 1
ipAdEntIfIndex.193.65.56.49 = INTEGER: 4
ipAdEntIfIndex.193.94.142.90 = INTEGER: 5

Expected results:
ifDescr.1 = STRING: "lo"
ifDescr.2 = STRING: "eth0"
ifDescr.3 = STRING: "eth1"
ifDescr.4 = STRING: "sit0"
ipAdEntIfIndex.127.0.0.1 = INTEGER: 1
ipAdEntIfIndex.193.65.56.49 = INTEGER: 2
ipAdEntIfIndex.193.94.142.90 = INTEGER: 3


Additional info:
RFC1213 states: "The index value which uniquely identifies the
interface to which this entry is applicable.  The interface identified
by a particular value of this index is the same interface as
identified by the same value of ifIndex."

Thanks.

Comment 1 Kaj J. Niemi 2004-03-25 03:32:10 UTC
Created attachment 98840 [details]
patch fixing ifIndex lookup problems for ipAdEntIfIndex

Comment 2 Kaj J. Niemi 2004-04-06 17:06:10 UTC
It would be good if this made FC2, too. :)

Comment 3 Phil Knirsch 2004-04-08 15:00:36 UTC
As always, good catch & thanks, Kaj!

There is another bug report open with the exact same problem, but i
hadn't had time to look at it closer yet, so i'm more than happy that
you found the problem.

Will include the patch in next net-snmp build.

Read ya, Phil