-
Notifications
You must be signed in to change notification settings - Fork 637
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
gosnmp sets SnmpPDU.Value to nil when type is Bitstring #1216
Comments
Yes, I think this may need to be fixed upstream first. |
I've done some more learning and think this may be more of a bug with Switch B. |
I'm not great with C, but it looks like this is where ASN Bitstring is parsed: https://github.com/net-snmp/net-snmp/blob/90a70ebd82ae1b545e7a58c1b3eb10981cb85adc/snmplib/asn1.c#L1824 . Doing some tracing on Switch B's output through this makes it seem like that Bitstring parsing code isn't that careful and essentially treats Bitstrings as Octet Strings. Tracing that function also explains why Switch B reports |
It seems the ASN.1 Bitstring type has no place, officially, in SNMP. Encoding a BITS construct as anything other than an Octet String is incorrect. It just happens to be that netsnmp (kind of) handles it. I'll close this and the other issue as I'm reasonably confident this is simply incorrect behavior from the switch. |
Host operating system: output of
uname -a
Docker on Mac
Linux cc14ccb5bd57 6.6.31-linuxkit #1 SMP PREEMPT_DYNAMIC Wed Jun 5 07:37:32 UTC 2024 x86_64 GNU/Linux
snmp_exporter version: output of
snmp_exporter -version
snmp_exporter, version 0.24.0 (branch: HEAD, revision: c9fd025)
build user: root@fb4e1a1f31ed
build date: 20230829-12:20:02
go version: go1.21.0
platform: linux/amd64
tags: netgo
What device/snmpwalk OID are you using?
Two switches, "Switch A" and "Switch B" that are from separate manufacturers with separate OS's.
dot3adAggPortActorAdminState
dot3adAggPortActorOperState
1.2.840.10006.300.43.1.2.1.1.21 and 1.2.840.10006.300.43.1.2.1.1.23
If this is a new device, please link to the MIB(s).
https://github.com/librenms/librenms/blob/04101c2c6f7411b2f882b5ea05c6a5c1ef77cff5/mibs/IEEE8023-LAG-MIB
What did you do that produced an error?
What did you expect to see?
This worked as expected on Switch A, following the Bits support code in this exporter. It created a StateSet.
What did you see instead?
Switch B fails, reporting the following:
More investigation found that the switches report this OID as different types.
Switch A, that succeeds, reports a
String
:Switch B, that fails, reports a
Bitstring
:I created this issue gosnmp/gosnmp#472 as I'm not sure where this should be addressed.
The text was updated successfully, but these errors were encountered: