]> git.puffer.fish Git - mirror/frr.git/commitdiff
bgpd: Retain the routes if we do a clear with N-bit set for Graceful-Restart
authorDonatas Abraitis <donatas@opensourcerouting.org>
Tue, 25 Mar 2025 15:20:56 +0000 (17:20 +0200)
committerDonatas Abraitis <donatas@opensourcerouting.org>
Tue, 25 Mar 2025 15:20:56 +0000 (17:20 +0200)
On receiving side we already did the job correctly, but the peer which initiates
the clear does not retain the other's routes. This commit fixes that.

Fixes: 20170775da3a3c5d41aba714d0c1d5a29b0da61c ("bgpd: Activate Graceful-Restart when receiving CEASE/HOLDTIME notifications")
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
bgpd/bgp_packet.c

index 3d33a02db08fa7b0f906acb37e74ca8fbdfc1aed..4c2eb03f3afa54eefde38815b569a3efbc937a03 100644 (file)
@@ -1038,6 +1038,13 @@ static void bgp_notify_send_internal(struct peer_connection *connection,
        /* Add packet to peer's output queue */
        stream_fifo_push(connection->obuf, s);
 
+       /* If Graceful-Restart N-bit (Notification) is exchanged,
+        * and it's not a Hard Reset, let's retain the routes.
+        */
+       if (bgp_has_graceful_restart_notification(peer) && !hard_reset &&
+           CHECK_FLAG(peer->sflags, PEER_STATUS_NSF_MODE))
+               SET_FLAG(peer->sflags, PEER_STATUS_NSF_WAIT);
+
        bgp_peer_gr_flags_update(peer);
        BGP_GR_ROUTER_DETECT_AND_SEND_CAPABILITY_TO_ZEBRA(peer->bgp,
                                                          peer->bgp->peer);