Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

easysnmp does not translate the index part of the OID in textual form to numeric form #123

Open
tonusoo opened this issue Jan 28, 2021 · 2 comments
Labels
Milestone

Comments

@tonusoo
Copy link

tonusoo commented Jan 28, 2021

For example, an OID in textual form of ipAddressIfIndex.ipv6 has to translate to .1.3.6.1.2.1.4.34.1.3.2 in numerical form:

$ snmptranslate -m IP-MIB -IR -On ipAddressIfIndex.ipv6
.1.3.6.1.2.1.4.34.1.3.2
$ 

However, the easysnmp seems to ignore the index part altogether and replaces it with 0. For example, both session.walk("ipAddressIfIndex.ipv6") and session.walk(("ipAddressIfIndex", "ipv6")) or even an arbitrary session.walk(("ipAddressIfIndex", "abcde")) supply the OID of .1.3.6.1.2.1.4.34.1.3.0 with the GetNextRequest query. When I run my Python script using strace utility and look for open, openat and read system calls, then the InetAddressType definition in INET-ADDRESS-MIB is read. InetAddressType definition determines the numerical value of ipv6 .

Currently I set the index part numerically(for example, session.walk(("ipAddressIfIndex", 2))), but is there a reason why easysnmp does not translate the index part of the OID in textual form to numeric form?

I'm running easysnmp version 0.2.5 under Python 3.7.3. NET-SNMP version is 5.7.3.

@kamakazikamikaze
Copy link
Collaborator

Odd. I ran your queries and easysnmp returned an empty list, however a tcpdump capture shows a noError response with 10 variable bindings. I am very much rusty on my SNMP knowledge but I don't think those results should just be "discarded". Will definitely need to investigate further.

@kamakazikamikaze kamakazikamikaze added this to the 0.2.6 milestone Mar 27, 2022
@kamakazikamikaze
Copy link
Collaborator

Looking at this today, it does indeed appear that we're requesting .1.3.6.1.2.1.4.34.1.3.0 instead of .1.3.6.1.2.1.4.34.1.3.2. Using GDB to print the members of pdu->variables on line 2954 of interface.c shows that we have a 0 instead of a 2.

Breaking on line 2854 shows that both tag and iid are parsed properly. However on lines 2861 and 2871, printing pdu->variables and oid_arr[varlist_ind] shows that we don't have children properly identified. So my current suspicion is that __tag2oid is not properly fetching child OID(s)

@kamakazikamikaze kamakazikamikaze modified the milestones: 0.2.6, 0.2.7 Jul 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants