Bug 119106 - patch: ipAdEntIfIndex is wrong
patch: ipAdEntIfIndex is wrong
Status: CLOSED RAWHIDE
Product: Fedora
Classification: Fedora
Component: net-snmp (Show other bugs)
rawhide
All Linux
medium Severity medium
: ---
: ---
Assigned To: Phil Knirsch
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2004-03-24 22:31 EST by Kaj J. Niemi
Modified: 2015-03-04 20:13 EST (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2004-04-08 11:00:36 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
patch fixing ifIndex lookup problems for ipAdEntIfIndex (1.46 KB, patch)
2004-03-24 22:32 EST, Kaj J. Niemi
no flags Details | Diff

  None (edit)
Description Kaj J. Niemi 2004-03-24 22:31:00 EST
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-24 22:32:10 EST
Created attachment 98840 [details]
patch fixing ifIndex lookup problems for ipAdEntIfIndex
Comment 2 Kaj J. Niemi 2004-04-06 13:06:10 EDT
It would be good if this made FC2, too. :)
Comment 3 Phil Knirsch 2004-04-08 11:00:36 EDT
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

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