]> git.proxmox.com Git - mirror_frr.git/blobdiff - ospfd/ospf_nsm.c
Merge pull request #8144 from LabNConsulting/chopps/ly2
[mirror_frr.git] / ospfd / ospf_nsm.c
index 2931831826cce836abb624082dc556e663eed101..b3b9244b22d543af76df5608cb9292991dfc5837 100644 (file)
@@ -53,7 +53,7 @@
 
 DEFINE_HOOK(ospf_nsm_change,
            (struct ospf_neighbor * on, int state, int oldstate),
-           (on, state, oldstate))
+           (on, state, oldstate));
 
 static void nsm_clear_adj(struct ospf_neighbor *);
 
@@ -66,8 +66,8 @@ static int ospf_inactivity_timer(struct thread *thread)
        nbr->t_inactivity = NULL;
 
        if (IS_DEBUG_OSPF(nsm, NSM_TIMERS))
-               zlog_debug("NSM[%s:%s:%s]: Timer (Inactivity timer expire)",
-                          IF_NAME(nbr->oi), inet_ntoa(nbr->router_id),
+               zlog_debug("NSM[%s:%pI4:%s]: Timer (Inactivity timer expire)",
+                          IF_NAME(nbr->oi), &nbr->router_id,
                           ospf_get_name(nbr->oi->ospf));
 
        /* Dont trigger NSM_InactivityTimer event , if the current
@@ -78,7 +78,7 @@ static int ospf_inactivity_timer(struct thread *thread)
        else if (IS_DEBUG_OSPF_GR_HELPER)
                zlog_debug(
                        "%s, Acting as HELPER for this neighbour, So inactivitytimer event will not be fired.",
-                       __PRETTY_FUNCTION__);
+                       __func__);
 
        return 0;
 }
@@ -91,8 +91,8 @@ static int ospf_db_desc_timer(struct thread *thread)
        nbr->t_db_desc = NULL;
 
        if (IS_DEBUG_OSPF(nsm, NSM_TIMERS))
-               zlog_debug("NSM[%s:%s:%s]: Timer (DD Retransmit timer expire)",
-                          IF_NAME(nbr->oi), inet_ntoa(nbr->src),
+               zlog_debug("NSM[%s:%pI4:%s]: Timer (DD Retransmit timer expire)",
+                          IF_NAME(nbr->oi), &nbr->src,
                           ospf_get_name(nbr->oi->ospf));
 
        /* resent last send DD packet. */
@@ -398,9 +398,9 @@ static int nsm_kill_nbr(struct ospf_neighbor *nbr)
 
                if (IS_DEBUG_OSPF(nsm, NSM_EVENTS))
                        zlog_debug(
-                               "NSM[%s:%s:%s]: Down (PollIntervalTimer scheduled)",
+                               "NSM[%s:%pI4:%s]: Down (PollIntervalTimer scheduled)",
                                IF_NAME(nbr->oi),
-                               inet_ntoa(nbr->address.u.prefix4),
+                               &nbr->address.u.prefix4,
                                ospf_get_name(nbr->oi->ospf));
        }
 
@@ -597,8 +597,8 @@ static void nsm_notice_state_change(struct ospf_neighbor *nbr, int next_state,
 {
        /* Logging change of status. */
        if (IS_DEBUG_OSPF(nsm, NSM_STATUS))
-               zlog_debug("NSM[%s:%s:%s]: State change %s -> %s (%s)",
-                          IF_NAME(nbr->oi), inet_ntoa(nbr->router_id),
+               zlog_debug("NSM[%s:%pI4:%s]: State change %s -> %s (%s)",
+                          IF_NAME(nbr->oi), &nbr->router_id,
                           ospf_get_name(nbr->oi->ospf),
                           lookup_msg(ospf_nsm_state_msg, nbr->state, NULL),
                           lookup_msg(ospf_nsm_state_msg, next_state, NULL),
@@ -608,8 +608,8 @@ static void nsm_notice_state_change(struct ospf_neighbor *nbr, int next_state,
        if (CHECK_FLAG(nbr->oi->ospf->config, OSPF_LOG_ADJACENCY_CHANGES)
            && (CHECK_FLAG(nbr->oi->ospf->config, OSPF_LOG_ADJACENCY_DETAIL)
                || (next_state == NSM_Full) || (next_state < nbr->state)))
-               zlog_notice("AdjChg: Nbr %s(%s) on %s: %s -> %s (%s)",
-                           inet_ntoa(nbr->router_id),
+               zlog_notice("AdjChg: Nbr %pI4(%s) on %s: %s -> %s (%s)",
+                           &nbr->router_id,
                            ospf_get_name(nbr->oi->ospf), IF_NAME(nbr->oi),
                            lookup_msg(ospf_nsm_state_msg, nbr->state, NULL),
                            lookup_msg(ospf_nsm_state_msg, next_state, NULL),
@@ -691,8 +691,8 @@ static void nsm_change_state(struct ospf_neighbor *nbr, int state)
 
                if (CHECK_FLAG(oi->ospf->config, OSPF_LOG_ADJACENCY_DETAIL))
                        zlog_info(
-                               "%s:[%s:%s], %s -> %s): scheduling new router-LSA origination",
-                               __func__, inet_ntoa(nbr->router_id),
+                               "%s:[%pI4:%s], %s -> %s): scheduling new router-LSA origination",
+                               __func__, &nbr->router_id,
                                ospf_get_name(oi->ospf),
                                lookup_msg(ospf_nsm_state_msg, old_state, NULL),
                                lookup_msg(ospf_nsm_state_msg, state, NULL));
@@ -749,10 +749,10 @@ static void nsm_change_state(struct ospf_neighbor *nbr, int state)
                        OSPF_DD_FLAG_I | OSPF_DD_FLAG_M | OSPF_DD_FLAG_MS;
                if (CHECK_FLAG(oi->ospf->config, OSPF_LOG_ADJACENCY_DETAIL))
                        zlog_info(
-                               "%s: Initializing [DD]: %s with seqnum:%x , flags:%x",
+                               "%s: Initializing [DD]: %pI4 with seqnum:%x , flags:%x",
                                (oi->ospf->name) ? oi->ospf->name
                                                 : VRF_DEFAULT_NAME,
-                               inet_ntoa(nbr->router_id), nbr->dd_seqnum,
+                               &nbr->router_id, nbr->dd_seqnum,
                                nbr->dd_flags);
                ospf_db_desc_send(nbr);
        }
@@ -761,7 +761,8 @@ static void nsm_change_state(struct ospf_neighbor *nbr, int state)
        if (state == NSM_Down)
                nbr->crypt_seqnum = 0;
 
-       ospf_bfd_trigger_event(nbr, old_state, state);
+       if (nbr->bfd_session)
+               ospf_bfd_trigger_event(nbr, old_state, state);
 
        /* Preserve old status? */
 }
@@ -777,8 +778,8 @@ int ospf_nsm_event(struct thread *thread)
        event = THREAD_VAL(thread);
 
        if (IS_DEBUG_OSPF(nsm, NSM_EVENTS))
-               zlog_debug("NSM[%s:%s:%s]: %s (%s)", IF_NAME(nbr->oi),
-                          inet_ntoa(nbr->router_id),
+               zlog_debug("NSM[%s:%pI4:%s]: %s (%s)", IF_NAME(nbr->oi),
+                          &nbr->router_id,
                           ospf_get_name(nbr->oi->ospf),
                           lookup_msg(ospf_nsm_state_msg, nbr->state, NULL),
                           ospf_nsm_event_str[event]);
@@ -802,8 +803,8 @@ int ospf_nsm_event(struct thread *thread)
                         */
                        flog_err(
                                EC_OSPF_FSM_INVALID_STATE,
-                               "NSM[%s:%s:%s]: %s (%s): Warning: action tried to change next_state to %s",
-                               IF_NAME(nbr->oi), inet_ntoa(nbr->router_id),
+                               "NSM[%s:%pI4:%s]: %s (%s): Warning: action tried to change next_state to %s",
+                               IF_NAME(nbr->oi), &nbr->router_id,
                                ospf_get_name(nbr->oi->ospf),
                                lookup_msg(ospf_nsm_state_msg, nbr->state,
                                           NULL),