2005-09-29 Alain Ritoux <alain.ritoux@6wind.com>
* lib/smux.[ch]: allow to retreive global OID (identified by <0
namelen).
* ospf_ism.c: generate SNMP traps on Interface state change
* ospf_nsm.c: generate SNMP traps on Neighbour state change
* ospf_snmp.[ch]: support for SNMP traps for interface and neighbours.
diff --git a/ospfd/ospf_ism.c b/ospfd/ospf_ism.c
index b251e59..ab91e8d 100644
--- a/ospfd/ospf_ism.c
+++ b/ospfd/ospf_ism.c
@@ -43,6 +43,7 @@
#include "ospfd/ospf_packet.h"
#include "ospfd/ospf_flood.h"
#include "ospfd/ospf_abr.h"
+#include "ospfd/ospf_snmp.h"
/* elect DR and BDR. Refer to RFC2319 section 9.4 */
static struct ospf_neighbor *
@@ -552,6 +553,20 @@
oi->state = state;
oi->state_change++;
+#ifdef HAVE_SNMP
+ /* Terminal state or regression */
+ if ((state == ISM_DR) || (state == ISM_Backup) || (state == ISM_DROther) ||
+ (state == ISM_PointToPoint) || (state < old_state))
+ {
+ /* ospfVirtIfStateChange */
+ if (oi->type == OSPF_IFTYPE_VIRTUALLINK)
+ ospfTrapVirtIfStateChange (oi);
+ /* ospfIfStateChange */
+ else
+ ospfTrapIfStateChange (oi);
+ }
+#endif
+
/* Set multicast memberships appropriately for new state. */
ospf_if_set_multicast(oi);