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.
Created attachment 98840 [details] patch fixing ifIndex lookup problems for ipAdEntIfIndex
It would be good if this made FC2, too. :)
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