diff options
author | David Lamparter <equinox@opensourcerouting.org> | 2016-06-12 17:32:23 +0200 |
---|---|---|
committer | David Lamparter <equinox@opensourcerouting.org> | 2017-03-25 08:52:36 +0100 |
commit | 3012671ffadbd839626b5c0b0b1fd36b3698f582 (patch) | |
tree | 847bacd0156e5e8dc2e64cbfbbf10c2f6e3ac9ac /ospfd/ospf_nsm.c | |
parent | build: split off libfrrsnmp (diff) | |
download | frr-3012671ffadbd839626b5c0b0b1fd36b3698f582.tar.xz frr-3012671ffadbd839626b5c0b0b1fd36b3698f582.zip |
*: use hooks for sending SNMP traps
This means there are no ties into the SNMP code anymore other than the
init call at startup.
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Diffstat (limited to 'ospfd/ospf_nsm.c')
-rw-r--r-- | ospfd/ospf_nsm.c | 34 |
1 files changed, 7 insertions, 27 deletions
diff --git a/ospfd/ospf_nsm.c b/ospfd/ospf_nsm.c index 01617055c..97f3f6a38 100644 --- a/ospfd/ospf_nsm.c +++ b/ospfd/ospf_nsm.c @@ -48,9 +48,12 @@ #include "ospfd/ospf_dump.h" #include "ospfd/ospf_flood.h" #include "ospfd/ospf_abr.h" -#include "ospfd/ospf_snmp.h" #include "ospfd/ospf_bfd.h" +DEFINE_HOOK(ospf_nsm_change, + (struct ospf_neighbor *on, int state, int oldstate), + (on, state, oldstate)) + static void nsm_clear_adj (struct ospf_neighbor *); /* OSPF NSM Timer functions. */ @@ -838,35 +841,12 @@ ospf_nsm_event (struct thread *thread) /* If state is changed. */ if (next_state != nbr->state) { + int old_state = nbr->state; + nsm_notice_state_change (nbr, next_state, event); -#ifdef HAVE_SNMP - int send_trap_virt = 0; - int send_trap = 0; - /* Terminal state or regression */ - if ((next_state == NSM_Full) - || (next_state == NSM_TwoWay) - || (next_state < nbr->state)) - { - /* ospfVirtNbrStateChange */ - if (nbr->oi->type == OSPF_IFTYPE_VIRTUALLINK) - send_trap_virt = 1; - /* ospfNbrStateChange trap */ - else - /* To/From FULL, only managed by DR */ - if (((next_state != NSM_Full) && (nbr->state != NSM_Full)) - || (nbr->oi->state == ISM_DR)) - send_trap = 1; - } -#endif nsm_change_state (nbr, next_state); -#ifdef HAVE_SNMP - if (send_trap_virt) { - ospfTrapVirtNbrStateChange(nbr); - } else if (send_trap) { - ospfTrapNbrStateChange(nbr); - } -#endif + hook_call(ospf_nsm_change, nbr, next_state, old_state); } /* Make sure timer is set. */ |