Bug 119106 - patch: ipAdEntIfIndex is wrong
Summary: patch: ipAdEntIfIndex is wrong
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: net-snmp
Version: rawhide
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Phil Knirsch
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2004-03-25 03:31 UTC by Kaj J. Niemi
Modified: 2015-03-05 01:13 UTC (History)
1 user (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2004-04-08 15:00:36 UTC
Type: ---
Embargoed:


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

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


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