Hi,

I've observed a bug in the handling of engineBoots/engineTime when the agent 
being reconfigured.  The bug was identified in 5.4.1.2, but I believe 5.5 is 
also affected.

At startup, the agent sets engineTime to zero, reads engineBoots from the 
persistent conf file and increments it as expected.

When a reconfig occurs (ie kill -HUP), the engineBoots value used by the agent 
is incremented internally but the new value is not written back to the 
persistent conf.  engineTime is not reset to zero.  If the agent is then killed 
and restarted, the previous engineBoots is read from the conf file and 
incremented, resulting in the reuse of the last engineBoots value.  To clients 
unaware of the agent restart, this looks like engineTime is being reset.

Eg:
snmpd(pid=657): engineTime=397, engineBoots=182 (in snmpd.conf=182)
> kill -HUP 657
snmpd(pid=657): engineTime=417, engineBoots=183 (in snmpd.conf=182)
> kill -9 657
snmpd(pid=685): engineTime=18,  engineBoots=183 (in snmpd.conf=183)


I've looked at the relevant source code and the attached patch (on 5.4.1.2) 
seems to fix the problem.  Are there any negative side-effects of changing the 
handler in this way that need to be considered?

Regards,
Mark Ware


--- ../orig/snmplib/snmpv3.c      2008-08-08 11:39:15.000000000 +1000
+++ snmplib/snmpv3.c    2009-10-02 13:30:05.000000000 +1000
@@ -1294,8 +1294,8 @@ init_snmpv3(const char *type)
                                     engineIDType_conf, NULL, "num");
     register_prenetsnmp_mib_handler(type, "engineIDNic", engineIDNic_conf,
                                     NULL, "string");
-    register_config_handler(type, "engineBoots", engineBoots_conf, NULL,
-                            NULL);
+    register_prenetsnmp_mib_handler(type, "engineBoots", engineBoots_conf, 
NULL,
+                                    NULL);

     /*
      * default store config entries

------------------------------------------------------------------------------
Come build with us! The BlackBerry® Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9-12, 2009. Register now!
http://p.sf.net/sfu/devconf
_______________________________________________
Net-snmp-coders mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

Reply via email to