Comments (4)
@benjamin-thomas What does a net-snmp tool such as snmpwalk or snmpget show for that OID?
from gosnmp.
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.
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.
+1 for Option 1)
from gosnmp.
Related Issues (20)
- The Get method is unable to collect data, if we provide multiple OIDs, which includes an invalid OID. HOT 1
- Query on gosnmp feature as snmp agent HOT 2
- multiple device concurrent polling fails unless you create your own snmp object HOT 2
- Question: Use on Windows HOT 1
- VULNERABILITY [CWE-347] CVE-2020-9283] golang.org/x/crypto Improper Signature Verification HOT 1
- Sometimes a previous privacy passphrase is reused instead of the specified one
- usmStatsUnknownUserNames as terminating error? HOT 3
- Chinese coding is garbled HOT 2
- How to configure read/write community? HOT 1
- marshal: marshalPDU: unable to marshal varbind list: unable to marshal OID: Value out of range HOT 2
- Should cancelling a context interrupt an ongoing operation?
- out of bounds error when parsing AuthNoPriv packet HOT 4
- msgMaxSize to be supported in SNMP v3 bulkwalk requests
- V3 feat needed: Load keys manually if the passphrases are not allowed be saved locally HOT 1
- Connect function in gosnmp always returns nil even if the credentials are not valid HOT 1
- Panic in unmarshalV3Header
- Compatibility with GoSNMPServer HOT 7
- `net-snmp` based validation testing HOT 5
- Request ID size too large
- Not handling `0` values correctly for `OpaqueDouble` or `OpaqueFloat`
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gosnmp.