Giter VIP home page Giter VIP logo

Comments (4)

ctrlrsf avatar ctrlrsf commented on May 22, 2024

@benjamin-thomas What does a net-snmp tool such as snmpwalk or snmpget show for that OID?

from gosnmp.

benjamin-thomas avatar benjamin-thomas commented on May 22, 2024

Here is the relevant snmpwalk output (the problematic OID is .1.3.6.1.4.1.641.1.9.8.0)

.1.3.6.1.4.1.641.1.9.4.0 = INTEGER: 2
.1.3.6.1.4.1.641.1.9.5.0 = STRING: "5003020000"
.1.3.6.1.4.1.641.1.9.6.0 = STRING: "5010030000"
.1.3.6.1.4.1.641.1.9.7.0 = INTEGER: 60
.1.3.6.1.4.1.641.1.9.8.0 = IpAddress: 60.0.0.0
.1.3.6.1.4.1.641.1.9.9.0 = ""
.1.3.6.1.4.1.641.2.1.1.0 = INTEGER: 1
.1.3.6.1.4.1.641.2.1.2.1.1.1 = INTEGER: 1
.1.3.6.1.4.1.641.2.1.2.1.2.1 = STRING: "Lexmark CX310dn"
.1.3.6.1.4.1.641.2.1.2.1.3.1 = STRING: "MANUFACTURER:Lexmark International;COMMAND SET:;MODEL:Lexmark CX310dn"
.1.3.6.1.4.1.641.2.1.2.1.4.1 = STRING: "LW20.GM2.P231-0"

Here is the output of my program with debug output (the retry messages are my own, the rest is the library's debug output)

OID: .1.3.6.1.4.1.641.1.9.8.0
decodeValue: value
0   40 00 
decodeValue: type is IPAddress
Retry number 1. Last error was: Unable to decode packet: Error in unmarshalResponse: Error decoding value: got ipaddress len 0, expected 4 or 16
Packet sanity verified, we got all the bytes (46)
parseRawField: version
0   02 01 00 04 06 70 75 62
8   6c 69 63 a2 1f 02 04 34
Parsed version 0
parseRawField: community
0   04 06 70 75 62 6c 69 63
8   a2 1f 02 04 34 3c 02 91
Parsed community public
SNMP Packet is GET RESPONSE
0   a2 1f 02 04 34 3c 02 91
8   02 01 00 02 01 00 30 11
getResponseLength: 33
parseRawField: request id
0   02 04 34 3c 02 91 02 01
8   00 02 01 00 30 11 30 0f
requestID: 876348049
parseRawField: error-status
0   02 01 00 02 01 00 30 11
8   30 0f 06 0b 2b 06 01 04
errorStatus: 0
parseRawField: error index
0   02 01 00 30 11 30 0f 06
8   0b 2b 06 01 04 01 85 01
error-index: 0

=== unmarshalVBL()
0   30 11 30 0f 06 0b 2b 06
8   01 04 01 85 01 01 09 08
16  30 11 30 
vblLength: 19

STARTING a varbind. Cursor 2
0   30 0f 06 0b 2b 06 01 04
8   01 85 01 01 09 08 00 40
16  30 
parseRawField: OID
0   06 0b 2b 06 01 04 01 85
8   06 0b 2b 06 01 04 01 
OID: .1.3.6.1.4.1.641.1.9.8.0
decodeValue: value
0   40 00 
decodeValue: type is IPAddress
Retry number 2. Last error was: Unable to decode packet: Error in unmarshalResponse: Error decoding value: got ipaddress len 0, expected 4 or 16

I had to scan the .1.3.6.1.4 "branch" separately with snmpwalk.

When starting to scan from .1.3.6, the last returned oid was .1.3.6.1.2.1.55.1.8.1.5.8.

My guess is snmpwalk crashed because of bad data.

I'm not sure how to interpret the raw data though.

from gosnmp.

codedance avatar codedance commented on May 22, 2024

From memory I added the IP parsing code... never expecting that an IP address could be of length zero according to ASN.1/BER. The real world always has different ideas :-) We should make our library as resilient at possible and I think we should code around this to support "the real world".

I can see two options:

Option 1)
Initialised to nil (not 0.0.0.0) I think returning 0.0.0.0 would be wrong as this as has different meaning. You can test for a nil value your up stream code.

Option 2)
Another option would be to say it's "bad data" and just remap the type as the Null type (0x05)

retVal.Type = Null
retVal.Value = nil

I'd welcome some thoughts/votes?

from gosnmp.

mgenov avatar mgenov commented on May 22, 2024

+1 for Option 1)

from gosnmp.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.