#2394 Incorrect engineBoots value in snmpd.conf on SIGHUP

linux
open
nobody
agent (1103)
5
2014-08-25
2012-08-21
K Bhaskar
No

I've observed a minor issue in the handling of engineBoots when the agent is reconfigured( on SIGHUP).
The issue is identified in 5.7.1 version.

This issue is on receiving SIGHUP snmpd is incrementing the enginBoots by 1 locally but in the configuration file in persistent folder is not updated immediately with the incremented value. Only when snmpd receives SIGTERM it is updating with the new value in to file . But in some expectionaly cases where snmpd could not handle/receive SIGTERM , update of engineBoots will be missed in to teh configuration file in the persistent folder.

I have below pacth for this issue. Call " snmp_store(app_name);" after update_config() function call which will store the new engineBoots value in to configuration file immediately.

   if \(reconfig\) \{

#if HAVE_SIGHOLD
sighold(SIGHUP);
#endif
reconfig = 0;
snmp_log(LOG_INFO, "Reconfiguring daemon\n");
/* Stop and restart logging. This allows logfiles to be
rotated etc. */
netsnmp_logging_restart();
snmp_log(LOG_INFO, "NET-SNMP version %s restarted\n",
netsnmp_get_version());
update_config();
snmp_store(app_name);
send_easy_trap(SNMP_TRAP_ENTERPRISESPECIFIC, 3);
#if HAVE_SIGHOLD
sigrelse(SIGHUP);
#endif
}

Discussion