summaryrefslogtreecommitdiff
path: root/ospfd/ospf_nsm.c
diff options
context:
space:
mode:
authorPaul Jakma <paul.jakma@sun.com>2006-07-04 13:44:19 +0000
committerPaul Jakma <paul.jakma@sun.com>2006-07-04 13:44:19 +0000
commitba0beb4a846056301d6baa7f67002c6705084b40 (patch)
tree4a481f49e3993b61039f157be879173bc2b98e08 /ospfd/ospf_nsm.c
parentd7b0fb62ec78cfd31ff8d905490a5c929c44e971 (diff)
[ospfd] Ensure NSM state functions can redirect next_state accidently
2006-07-02 Paul Jakma <paul.jakma@sun.com> * ospf_nsm.c: (ospf_nsm_event) Don't allow action functions to change next_state if the NSM tables do not indicate next_state is conditional, log warning if one tries - existing code appears fine though.
Diffstat (limited to 'ospfd/ospf_nsm.c')
-rw-r--r--ospfd/ospf_nsm.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/ospfd/ospf_nsm.c b/ospfd/ospf_nsm.c
index c5a55367..73ed088f 100644
--- a/ospfd/ospf_nsm.c
+++ b/ospfd/ospf_nsm.c
@@ -878,6 +878,22 @@ ospf_nsm_event (struct thread *thread)
if (! next_state)
next_state = NSM [nbr->state][event].next_state;
+ else if (NSM [nbr->state][event].next_state != NSM_DependUpon)
+ {
+ /* There's a mismatch between the FSM tables and what an FSM
+ * action/state-change function returned. State changes which
+ * do not have conditional/DependUpon next-states should not
+ * try set next_state.
+ */
+ zlog_warn ("NSM[%s:%s]: %s (%s): "
+ "Warning: action tried to change next_state to %s",
+ IF_NAME (oi), inet_ntoa (nbr->router_id),
+ LOOKUP (ospf_nsm_state_msg, nbr->state),
+ ospf_nsm_event_str [event],
+ LOOKUP (ospf_nsm_state_msg, next_state));
+
+ next_state = NSM [nbr->state][event].next_state;
+ }
if (IS_DEBUG_OSPF (nsm, NSM_EVENTS))
zlog_debug ("NSM[%s:%s]: %s (%s)", IF_NAME (oi),