]> git.puffer.fish Git - matthieu/frr.git/commitdiff
bgpd: Print old/new states of graceful restart FSM
authorDonatas Abraitis <donatas@opensourcerouting.org>
Tue, 30 Apr 2024 10:38:54 +0000 (13:38 +0300)
committerMergify <37929162+mergify[bot]@users.noreply.github.com>
Tue, 7 May 2024 13:58:03 +0000 (13:58 +0000)
To better debug what's going on before/after.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
(cherry picked from commit 7b5595b61dfbd27ba05b8f5416882514a1e2f94f)

bgpd/bgp_fsm.c

index 234dbb0715a5a1f4a40e1ba07afd0cc29c8922bf..502648697cab9f84665dc9fe82054cd2fd2aed40 100644 (file)
@@ -2895,19 +2895,22 @@ int bgp_neighbor_graceful_restart(struct peer *peer,
 
        peer_old_state = bgp_peer_gr_mode_get(peer);
 
-       if (peer_old_state == PEER_INVALID) {
-               zlog_debug("[BGP_GR] peer_old_state == Invalid state !");
+       if (BGP_DEBUG(graceful_restart, GRACEFUL_RESTART))
+               zlog_debug("%s [BGP_GR] peer_old_state: %d", __func__,
+                          peer_old_state);
+
+       if (peer_old_state == PEER_INVALID)
                return BGP_ERR_GR_OPERATION_FAILED;
-       }
 
        peer_state = peer->PEER_GR_FSM[peer_old_state][peer_gr_cmd];
        peer_new_state = peer_state.next_state;
 
-       if (peer_new_state == PEER_INVALID) {
-               zlog_debug(
-                       "[BGP_GR] Invalid bgp graceful restart command used !");
+       if (BGP_DEBUG(graceful_restart, GRACEFUL_RESTART))
+               zlog_debug("%s [BGP_GR] peer_new_state: %d", __func__,
+                          peer_new_state);
+
+       if (peer_new_state == PEER_INVALID)
                return BGP_ERR_GR_INVALID_CMD;
-       }
 
        if (peer_new_state != peer_old_state) {
                result = peer_state.action_fun(peer, peer_old_state,