Just a note to anyone that might run into this. I was interested in all the evidence that snmptrap/d used to process boots/time correctly for v3 and so built 5.1.4.2 and found that snmptrap in that version does in fact correctly set boots/time based on the -Z command line argument and if -Z is not used it does use uptime as coded.
I also confirmed that snmptrapd from 5.1.4.2 actually checks those values while 5.7.3 does not which is probably why most people dont care because they are probably using both binaries so even if snmptrap isnt setting the values snmptrapd is ignoring them anyway so it just works. No clue yet when it broke or how easy it might be to fix. -denis On Sat, Oct 27, 2018 at 04:06:49PM -0400, Denis Hainsworth wrote: > so i was hoping to use snmptrap to send snmp v3 traps because it is > simple and already written. However I have some NMS systems that are > pretty stringent about checking EngineBoots and EngineTime even for > traps (I'm not using Inform). So far the nms always reports "message > received outside time window" . Checking the snmp packets with tshark I > can see that both EngineBoots and EngineTime are always zero. > > Looking at the snmptrap code it looks like by default it should be > setting Boots to 1 and Time to "uptime" IF you don't pass specific > values via -V on the command line. Throwing in some printfs I can see > that the session struct is in fact populated with these values. > > I got lost following snmp_add and snmp_pdu_create but from what I can > tell the session attributes for Boots and Time are never actually used > to set the same in the raw pdu and thus all we get are zeros. > > Was curious if someone who knew the code better could confirm this is a > bug and not some obvious miss on my part. Given how snmptrap is > written I don't think it is supposed to get any data from a running > agent (I'm trying to avoid running one) or from the persistent snmp conf > files that other methods like agentx etc would use. > > I also skimmed through the mail archives and found what looked like > similar questions in the past but without anyone addressing why setting > the Boot and Time attributes via -V for snmptrap should not work. > > -denis > -- > __________________________ > Denis Alan Hainsworth > denis.hainswo...@gmail.com -- __________________________ Denis Alan Hainsworth denis.hainswo...@gmail.com _______________________________________________ Net-snmp-coders mailing list Net-snmp-coders@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/net-snmp-coders