summaryrefslogtreecommitdiffstats
path: root/ospfd/ospf_snmp.c
diff options
context:
space:
mode:
authorvincent <vincent>2005-09-29 18:34:30 +0200
committervincent <vincent>2005-09-29 18:34:30 +0200
commit5e4914c31ead7b99eeed73067451367336b21422 (patch)
treef2c49d5c8182d4ee1b8ad8ca5005fe1223da18c8 /ospfd/ospf_snmp.c
parent2005-09-29 Paul Jakma <paul.jakma@sun.com> (diff)
downloadfrr-5e4914c31ead7b99eeed73067451367336b21422.tar.xz
frr-5e4914c31ead7b99eeed73067451367336b21422.zip
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.
Diffstat (limited to 'ospfd/ospf_snmp.c')
-rw-r--r--ospfd/ospf_snmp.c108
1 files changed, 108 insertions, 0 deletions
diff --git a/ospfd/ospf_snmp.c b/ospfd/ospf_snmp.c
index bceb962e1..05e4de8a4 100644
--- a/ospfd/ospf_snmp.c
+++ b/ospfd/ospf_snmp.c
@@ -2064,7 +2064,9 @@ ospf_snmp_nbr_lookup (struct ospf *ospf, struct in_addr *nbr_addr,
for (rn = route_top (oi->nbrs); rn; rn = route_next (rn))
if ((nbr = rn->info) != NULL
&& nbr != oi->nbr_self
+/* If EXACT match is needed, provide ALL entry found
&& nbr->state != NSM_Down
+ */
&& nbr->src.s_addr != 0)
{
if (IPV4_ADDR_SAME (&nbr->src, nbr_addr))
@@ -2475,6 +2477,112 @@ ospfAreaAggregateEntry (struct variable *v, oid *name, size_t *length,
return NULL;
}
+/* OSPF Traps. */
+#define IFSTATECHANGE 16
+#define VIRTIFSTATECHANGE 1
+#define NBRSTATECHANGE 2
+#define VIRTNBRSTATECHANGE 3
+
+struct trap_object ospfNbrTrapList[] =
+{
+ {ospfGeneralGroup, -2, {1, OSPFROUTERID}},
+ {ospfNbrEntry, 3, {10, 1, OSPFNBRIPADDR}},
+ {ospfNbrEntry, 3, {10, 1, OSPFNBRRTRID}},
+ {ospfNbrEntry, 3, {10, 1, OSPFNBRSTATE}}
+};
+
+
+struct trap_object ospfVirtNbrTrapList[] =
+{
+ {ospfGeneralGroup, -2, {1, 1}},
+ {ospfVirtNbrEntry, 3, {11, 1, OSPFVIRTNBRAREA}},
+ {ospfVirtNbrEntry, 3, {11, 1, OSPFVIRTNBRRTRID}},
+ {ospfVirtNbrEntry, 3, {11, 1, OSPFVIRTNBRSTATE}}
+};
+
+struct trap_object ospfIfTrapList[] =
+{
+ {ospfGeneralGroup, -2, {1, OSPFROUTERID}},
+ {ospfIfEntry, 3, {7, 1, OSPFIFIPADDRESS}},
+ {ospfIfEntry, 3, {7, 1, OSPFADDRESSLESSIF}},
+ {ospfIfEntry, 3, {7, 1, OSPFIFSTATE}}
+};
+
+struct trap_object ospfVirtIfTrapList[] =
+{
+ {ospfGeneralGroup, -2, {1, OSPFROUTERID}},
+ {ospfVirtIfEntry, 3, {9, 1, OSPFVIRTIFAREAID}},
+ {ospfVirtIfEntry, 3, {9, 1, OSPFVIRTIFNEIGHBOR}},
+ {ospfVirtIfEntry, 3, {9, 1, OSPFVIRTIFSTATE}}
+};
+
+void
+ospfTrapNbrStateChange (struct ospf_neighbor *on)
+{
+ oid index[sizeof (oid) * (IN_ADDR_SIZE + 1)];
+
+ zlog (NULL, LOG_INFO, "ospfTrapNbrStateChange trap sent");
+
+ oid_copy_addr (index, &(on->address.u.prefix4), IN_ADDR_SIZE);
+ index[IN_ADDR_SIZE] = 0;
+
+ smux_trap (ospf_oid, sizeof ospf_oid / sizeof (oid),
+ index, IN_ADDR_SIZE + 1,
+ ospfNbrTrapList,
+ sizeof ospfNbrTrapList / sizeof (struct trap_object),
+ time (NULL), NBRSTATECHANGE);
+}
+
+void
+ospfTrapVirtNbrStateChange (struct ospf_neighbor *on)
+{
+ oid index[sizeof (oid) * (IN_ADDR_SIZE + 1)];
+
+ zlog (NULL, LOG_INFO, "ospfTrapVirtNbrStateChange trap sent");
+
+ oid_copy_addr (index, &(on->address.u.prefix4), IN_ADDR_SIZE);
+ index[IN_ADDR_SIZE] = 0;
+
+ smux_trap (ospf_oid, sizeof ospf_oid / sizeof (oid),
+ index, IN_ADDR_SIZE + 1,
+ ospfVirtNbrTrapList,
+ sizeof ospfVirtNbrTrapList / sizeof (struct trap_object),
+ time (NULL), VIRTNBRSTATECHANGE);
+}
+
+void
+ospfTrapIfStateChange (struct ospf_interface *oi)
+{
+ oid index[sizeof (oid) * (IN_ADDR_SIZE + 1)];
+
+ zlog (NULL, LOG_INFO, "ospfTrapIfStateChange trap sent");
+
+ oid_copy_addr (index, &(oi->address->u.prefix4), IN_ADDR_SIZE);
+ index[IN_ADDR_SIZE] = 0;
+
+ smux_trap (ospf_oid, sizeof ospf_oid / sizeof (oid),
+ index, IN_ADDR_SIZE + 1,
+ ospfIfTrapList,
+ sizeof ospfIfTrapList / sizeof (struct trap_object),
+ time (NULL), IFSTATECHANGE);
+}
+
+void
+ospfTrapVirtIfStateChange (struct ospf_interface *oi)
+{
+ oid index[sizeof (oid) * (IN_ADDR_SIZE + 1)];
+
+ zlog (NULL, LOG_INFO, "ospfTrapVirtIfStateChange trap sent");
+
+ oid_copy_addr (index, &(oi->address->u.prefix4), IN_ADDR_SIZE);
+ index[IN_ADDR_SIZE] = 0;
+
+ smux_trap (ospf_oid, sizeof ospf_oid / sizeof (oid),
+ index, IN_ADDR_SIZE + 1,
+ ospfVirtIfTrapList,
+ sizeof ospfVirtIfTrapList / sizeof (struct trap_object),
+ time (NULL), VIRTIFSTATECHANGE);
+}
/* Register OSPF2-MIB. */
void
ospf_snmp_init ()