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

Why is the OID required to start with .1.3? #4

Closed
Subito opened this issue Jan 29, 2014 · 9 comments
Closed

Why is the OID required to start with .1.3? #4

Subito opened this issue Jan 29, 2014 · 9 comments

Comments

@Subito
Copy link
Contributor

Subito commented Jan 29, 2014

.I have a use-case where I need to lookup .1.0.8802 OIDs - they are perfectly fine and work, but I can't use them with your library.

If I remove the check, the requests seem to work, but all I get for a response is a "did not understand type 128" which looks like "No Instance found" - but there is an instance for sure, because if I look it up using snmpget it returns a STRING.

@cdevr
Copy link
Owner

cdevr commented Jan 29, 2014

This error is generated when WapSNMP does not understand the data type of the object returned by the SNMP Agent (the switch/router/... you're monitoring). This is not the result of the OID starting with .1.3.

The reason almost every OID starts with 1.3 is that this is the space allocated to public, shared OIDs. Everything outside of it is vendor-specific. This usually means that these numbers are temporary, in the sense that after a software upgrade of the router or switch they may not be available anymore. Of course it also means it's where the more interesting stuff is.

@cdevr
Copy link
Owner

cdevr commented Jan 29, 2014

I am unsure what to do with this exactly since the OID you provided .1.0.8802 is a table identifier. Tables themselves do not have an object returned, the first instance should be 1.0.8802.1.1.1.1.1.1.0 .

May I ask where you're seeing this, what device/version ? Ideally I'd love a tcpdump of the data that
WapSNMP fails to parse. Alternatively I could probe the device you're having trouble with.

@Subito
Copy link
Contributor Author

Subito commented Jan 29, 2014

OID would be .1.0.8802.1.1.2.1.5.32962.1.2.3.1.2.2.1 its from a DLINK DGS-1500.
It seems that the OID I "hacked" into MustParseOid gets automatically rewritten to something which starts with 1.3. tcpdump here: http://pastebin.com/LD3VSyXd

Of course the rewritten OID can't be found... Its invalid indeed.

@Subito
Copy link
Contributor Author

Subito commented Jan 29, 2014

The request which produces this dump:

    oid := wapsnmp.MustParseOid(".1.0.8802.1.1.2.1.5.32962.1.2.3.1.2.45.2")
    snmp, err := wapsnmp.NewWapSNMP(d.Address, d.Community, d.Version, 2*time.Second, 5)

@cdevr
Copy link
Owner

cdevr commented Jan 29, 2014

Any chance you can send me the data dump (the file) that produces the error ? I can't seem to find the oid you mentioned here in the data you pasted.

Just tcpdump -w log.pcap, start the program to generate the error, and get log.pcap to me. ( chr -no spaces- istop -nothing here- hedevriese -at goes here- gmail.com).

@Subito
Copy link
Contributor Author

Subito commented Jan 29, 2014

Dump should arrive shortly. I can't find the OID either - and I think this is the problem ;). The 1.0.8802 get send as 1.3.8802.

@Subito
Copy link
Contributor Author

Subito commented Jan 29, 2014

The code which does the "rewrite" of the OID is in oid.go in DecodeOID() lines 70-72:

result := make([]int, 2)
result[0] = 1
result[1] = 3

why is this necessary?

@Subito
Copy link
Contributor Author

Subito commented Jan 29, 2014

and again on line 99-102:

    /* Every o is supposed to start with .1.3, which is encoded as
       40 * first_byte + second byte. First_byte is ALWAYS 1, second
       byte is always 3, so it's 43, or hex 0x2b */
       result = append(result, 0x2b)

@Subito
Copy link
Contributor Author

Subito commented Jan 29, 2014

If I change

result = append(result, 0x2b)

to

result = append(result, 0x28)

it works as expected. But it breaks all OIDs starting with 1.3 of course. I could write some edge-case patch, but that does not feel like a proper solution...

@Subito Subito mentioned this issue Jan 29, 2014
@cdevr cdevr closed this as completed in 3dc0c74 Jan 30, 2014
cdevr added a commit that referenced this issue Jan 30, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants