From 14c5ef90b7489eba0b490f923ed9e06630f843c5 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Tue, 21 Aug 2018 09:29:30 -0400 Subject: [PATCH] ospf_nsm.c: Convert warn->err and use error-code Signed-off-by: Donald Sharp --- ospfd/ospf_errors.c | 6 ++++++ ospfd/ospf_errors.h | 1 + ospfd/ospf_nsm.c | 19 ++++++++++--------- 3 files changed, 17 insertions(+), 9 deletions(-) diff --git a/ospfd/ospf_errors.c b/ospfd/ospf_errors.c index b3673a7f76..4646ed33b9 100644 --- a/ospfd/ospf_errors.c +++ b/ospfd/ospf_errors.c @@ -163,6 +163,12 @@ static struct log_ref ferr_ospf_err[] = { .description = "OSPF Segment Routing invalid Algorithm", .suggestion = "Most likely a bug. If the problem persists, report the problem for troubleshooting" }, + { + .code = OSPF_ERR_FSM_INVALID_STATE, + .title = "OSPF FSM invalid state detected", + .description = "OSPF has attempted to change states when it should not be able to", + .suggestion = "Gather log files and open an issue", + }, { .code = END_FERR, } diff --git a/ospfd/ospf_errors.h b/ospfd/ospf_errors.h index f0e9e3da93..664f6f1bd4 100644 --- a/ospfd/ospf_errors.h +++ b/ospfd/ospf_errors.h @@ -32,6 +32,7 @@ enum ospf_log_refs { OSPF_ERR_SR_NODE_CREATE, OSPF_ERR_SR_INVALID_LSA_ID, OSPF_ERR_INVALID_ALGORITHM, + OSPF_ERR_FSM_INVALID_STATE, OSPF_WARN_SET_METRIC_PLUS, OSPF_WARN_MD5, OSPF_WARN_PACKET, diff --git a/ospfd/ospf_nsm.c b/ospfd/ospf_nsm.c index 1e72e3db63..83183071c7 100644 --- a/ospfd/ospf_nsm.c +++ b/ospfd/ospf_nsm.c @@ -48,6 +48,7 @@ #include "ospfd/ospf_flood.h" #include "ospfd/ospf_abr.h" #include "ospfd/ospf_bfd.h" +#include "ospfd/ospf_errors.h" DEFINE_HOOK(ospf_nsm_change, (struct ospf_neighbor * on, int state, int oldstate), @@ -795,15 +796,15 @@ int ospf_nsm_event(struct thread *thread) * not * try set next_state. */ - zlog_warn( - "NSM[%s:%s]: %s (%s): " - "Warning: action tried to change next_state to %s", - IF_NAME(nbr->oi), inet_ntoa(nbr->router_id), - lookup_msg(ospf_nsm_state_msg, nbr->state, - NULL), - ospf_nsm_event_str[event], - lookup_msg(ospf_nsm_state_msg, func_state, - NULL)); + flog_err(OSPF_ERR_FSM_INVALID_STATE, + "NSM[%s:%s]: %s (%s): " + "Warning: action tried to change next_state to %s", + IF_NAME(nbr->oi), inet_ntoa(nbr->router_id), + lookup_msg(ospf_nsm_state_msg, nbr->state, + NULL), + ospf_nsm_event_str[event], + lookup_msg(ospf_nsm_state_msg, func_state, + NULL)); } } -- 2.39.5