This project has moved. For the latest updates, please go here.

Walking on MIB IF-MIB interfaces

Topics: bug report (break and fix)
Nov 16, 2008 at 6:08 PM
Hi there!

I'm tring for the first time this #SNMP Suite.

To test this tool I'm using NetSNMP to compare the results. I've notice that when I try to get the Physical Interfaces (*) it always gives me an empty value, but in NetSNMP it is returning the correct values.

Using the NET-SNMP I get:

IF-MIB::ifPhysAddress.2 = STRING: 0:c:29:71:86:17
IF-MIB::ifPhysAddress.3 = STRING: 0:c:29:71:86:21
IF-MIB::ifPhysAddress.4 = STRING: 0:c:29:71:86:2b

Using #SNMP I get:

Variable: Id: .; Data:
Variable: Id: .; Data:
Variable: Id: .; Data:
Variable: Id: .; Data:

I'm using the TwinTower release on a .net 2.0 environment.

Nov 19, 2008 at 12:02 AM
No feed-backs? Only me have detected the problem? :(

Nov 19, 2008 at 4:32 PM
I actually just got done retrieving the MAC address from the MIB-II Interfaces table.

Here is the basic approach with the latest release which I don't know the name or version:

Variable variable = new Variable(new ObjectIdentifier(Common.StringToUint(".")));
Variable result = m_snmpManager.GetSingle(IPAddress.Parse(m_host), m_community, variable);

I hope that helps.
Nov 20, 2008 at 3:29 PM

I found that the problem is with the implementation of the toString() in the Variable object method that doesn't handle correctly with the PhysicalAddress type.
Nov 20, 2008 at 9:06 PM
I have noticed some issues where toString() doesn't handle the information correctly. Would you mind adding an issue to the issue tracker? It would be a great help. I will see if I can get to it this weekend! Or Bug Lex into looking at it.
Nov 20, 2008 at 9:25 PM
No prob.
I've just posted the issue.
Nov 22, 2008 at 12:24 AM
Hi, thanks for logging this issue. But I'd like to state some details here and provide you an estimate about when we can fix it.

If you notice, Net-SNMP output directly shows you the name of the objects, which means that it reads the MIB documents and finds out this is physical address. That's why it smartly interprets those raw bytes to nice looking MAC address for you.

However, at this moment, #SNMP is not able to parse MIB documents that further, so you have to use the workaround mentioned by brianb. Yes, that means you have to convert the bytes to physical address yourself.

Therefore, unless the parser is enhanced, this issue cannot be resolved easily. :)

Marked as answer by lextm on 10/6/2013 at 9:09 PM