]> git.puffer.fish Git - mirror/frr.git/commitdiff
ospf_nsm.c: Convert warn->err and use error-code
authorDonald Sharp <sharpd@cumulusnetworks.com>
Tue, 21 Aug 2018 13:29:30 +0000 (09:29 -0400)
committerQuentin Young <qlyoung@cumulusnetworks.com>
Thu, 6 Sep 2018 20:50:58 +0000 (20:50 +0000)
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
ospfd/ospf_errors.c
ospfd/ospf_errors.h
ospfd/ospf_nsm.c

index b3673a7f76a410501f66e2b34b8195863243797b..4646ed33b9a6c3d75bccd07ab09f6f07803a83ec 100644 (file)
@@ -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,
        }
index f0e9e3da93acc426cc4bddc35aab1f4d0b78c3b5..664f6f1bd41796481b0084bb96c79ae5bbbcb029 100644 (file)
@@ -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,
index 1e72e3db6308f93ba136cf3e18222942a05f08bf..83183071c7cecc1e9e80593a7ded8bd7c16f9d73 100644 (file)
@@ -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));
                }
        }