On Fri, 29 Oct 2021 at 05:14, Feroz <feroz.afs...@gmail.com> wrote:

> hi,
> Is it necessary to maintain any specific order in SNMP TRAP for varbinds?
>
For the first two, yes.


> e.g: "sysUpTime.0" should be the first one followed by "snmpTrapOID.0"
> then the actual data varbinds.
>
RFC 1905[1] section 4.2.6:
"The first two variable bindings in the variable binding list of an
SNMPv2-Trap-PDU are sysUpTime.0 [9] and snmpTrapOID.0 [9] respectively."

I've always assumed anything else comes at me randomly though the same
section talks about an OBJECTS clause and things being copied in order.
The other problem is neither RFC 1905 or RFC 3416 (which updates it) use
RFC 2119/8174 keywords (e.g. SHOULD MUST).
That kinda makes it hard to say if something is compliant or not, and let's
face it a lot of vendors do SNMP badly.

If I was implementing something, I would
 * for the sender: make sure my sysUpTime and snmpTrapOID were in positions
1 and 2 because I'd be trying not to be on the list of "vendors who do SNMP
badly".
 * for the receiver: not make that assumption and check the varbinds OID to
determine what it really is; possibly bin it if the trap OID is not #2
(this would probably depend on how I'm doing my parsing).

There are people here with *way* more RFC/implementation experience than me
here, but I think that is correct.

 - Craig

1: https://datatracker.ietf.org/doc/html/rfc1905
9: https://datatracker.ietf.org/doc/html/rfc1907
_______________________________________________
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

Reply via email to