On Thu, Oct 28, 2021 at 6:01 PM Fulko Hew <fulko....@gmail.com> wrote:
> > > On Thu, Oct 28, 2021 at 5:23 PM Craig Small <csm...@dropbear.xyz> wrote: > >> 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. >> > > I always followed the principles of: > 1/ least surprise > 2/ Be precise in what you send, and forgiving in what you receive. > > Having said that, reading that the first 'two varbinds are the uptime and > trapOID respectively' > and that a MIB source file lists the varbind in some order... Why not send > them in the order shown? > Why randomize? (ie. the principle of least surprise) > https://datatracker.ietf.org/doc/html/rfc3416#section-4.2.6 may not use MUST but does use some pretty specific words with easily understood meanings: If the OBJECTS clause is present in the invocation of the corresponding NOTIFICATION-TYPE macro, then each corresponding variable, as instantiated by this notification, is copied, in order, to the variable-bindings field. To me it is pretty clear that the explicit inclusion of "in order" in this sentence means that the ordering in the NOTIFICATION-TYPE macro in the MIB module is the ordering that should be used in the Trap-PDU. Section 4.2.6 continues: If any additional variables are being included (at the option of the generating SNMP entity), then each is copied to the variable-bindings field. This addresses one of the points that Fulko mentioned - that an intermediate proxy might add varbinds - BUT it also covers the case where the originating agent is supplying additional varbinds beyond those mentioned in the MIB. One of our customers reported that their NMS stopped displaying all of the trap variables when it loaded the MIB module - i.e., it only displayed the varbinds defined in the NOTIFICATION-TYPE macro. But the spec is clear that an agent has the option of adding additional varbinds, and it's worth remembering this. Bill
_______________________________________________ Net-snmp-coders mailing list Net-snmp-coders@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/net-snmp-coders