EngineTime max value handling when sending a trap

Hi,

I’m using SNMP4J 2.8.0. I have a SNMP session which I use to send traps to extenal systems (only sending traps in this session, no other operations).
I use snmpv3 (AuthPriv) and USM model.
I would like to test a case when engineTime exceeds its maximum. I checked code and noticed that following methods are used to set engineTime in outgoing message:
org.snmp4j.security.UsmTimeTable#getLocalTime
org.snmp4j.security.UsmTimeTable#getEngineTime

According to RFC 2574 (&2.2.2) and comment in your method (org.snmp4j.security.UsmTimeTable#getEngineTime):
“If snmpEngineTime ever reaches its maximum value (2147483647), then snmpEngineBoots is incremented as if the SNMP engine has re-booted and snmpEngineTime is reset to zero and starts incrementing again.”

What I noticed during this test - engineTime was reset to zero but engineBoots was not incremented.
My question is: do you have handling of this case in SNMP4J or I need to implement it by myself i.e. by overriding USM class? Maybe you have some hints for me. Thanks

Hi Tomek,

Currently there is not any automatic engineBoots increment. It could be easily added to the UsmTimeTable class, but that is not sufficient, because the engine boots counter need to be save persistently on disk which is done by the API itself.
I will think about an API interface that facilitates this procedure by using an event that can be listened to.

Best regards
Frank

Thank you for fast response.