What is the correct encoding for type SNMP Unsigned32?

I am writing an SNMP agent, and the MIB definition includes an OID of type Unsigned32.

The Unix agent implementation uses Net-SNMP and sets the OID as type ASN_UNSIGNED, since it does not have ASN_UNSIGNED32. When I look at the GET response from Wireshark, it decodes it as the value "Gauge32". This makes sense at a glance, because according to RFC 1902, Unsigned32 and Gauge32 are the same.

The Windows implementation is based on Windows SnmpAPI.lib and sets the OID as ASN_UNSIGNED32, and when I look at the GET response from Wireshark, it decodes it as "Unsigned32". It looks even better for me.

Why do 2 implementations give different results on the wire?

What is the correct version and how can I get the same from both implementations?

+5
source share
2 answers

It turns out that Net-SNMP uses the current RFC 1902 encoding, where Unsigned32 and Gauge32 are identical, while Windows uses the legacy RFC 1442 encoding, where Unsigned32 and Gauge32 have different encodings.

+5
source

If you save Wireshark capture on Windows and then open it on Wireshark on Unix. Then you can see that it is the type that it shows. Unsigned32 and Gauge32 are interchangeable as defined by the standard, so there should be no difference in the entire SNMP implementation. On the wire, it must transmit the same bytes.

+1
source

All Articles