On a SIGHUP, clear_mteTTable() clears trigger_table_data but the
mteTrigger entries remain registered in the POST_READ_CONFIG callbacks
table. This causes multiple trap notifications for the same event when
a SIGHUP is issued to snmpd.
The patch below makes sure that the callbacks for the mteTrigger entries
being deleted get unregistered and the corresponding alarms are disabled.
Comments welcome.
Index: agent/mibgroup/disman/event/mteTriggerConf.c
===================================================================
--- agent/mibgroup/disman/event/mteTriggerConf.c (revision 17505)
+++ agent/mibgroup/disman/event/mteTriggerConf.c (working copy)
@@ -1472,9 +1472,18 @@
clear_mteTTable(int majorID, int minorID, void *serverarg, void *clientarg)
{
netsnmp_tdata_row *row;
-
+
while (( row = netsnmp_tdata_row_first( trigger_table_data ))) {
- netsnmp_tdata_remove_and_delete_row( trigger_table_data, row );
+ struct mteTrigger *entry = (struct mteTrigger *)
+ netsnmp_tdata_remove_and_delete_row(trigger_table_data, row);
+ if (entry) {
+ /* Remove from the callbacks list and disable triggers */
+ snmp_unregister_callback( SNMP_CALLBACK_LIBRARY,
+ SNMP_CALLBACK_POST_READ_CONFIG,
+ _mteTrigger_callback_enable,
entry, 0 );
+ mteTrigger_disable( entry );
+ SNMP_FREE(entry);
+ }
}
return SNMPERR_SUCCESS;
}
------------------------------------------------------------------------------
Stay on top of everything new and different, both inside and
around Java (TM) technology - register by April 22, and save
$200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco.
300 plus technical and hands-on sessions. Register today.
Use priority code J9JMT32. http://p.sf.net/sfu/p
_______________________________________________
Net-snmp-coders mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders