summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDonatas Abraitis <donatas@opensourcerouting.org>2025-03-25 17:20:56 +0200
committerDonatas Abraitis <donatas@opensourcerouting.org>2025-03-26 22:25:44 +0200
commit0b19d6451e56f0e5cce7717d8bdb69c156ad0906 (patch)
tree726b79a7cce2153950c6cb9b0a16801e84ef766c
parent2f6fb565fc84b98ce1cd88c3b366f0ae18ac423b (diff)
bgpd: Retain the routes if we do a clear with N-bit set for Graceful-Restart
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>
-rw-r--r--bgpd/bgp_packet.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/bgpd/bgp_packet.c b/bgpd/bgp_packet.c
index 2dbeb3cbde..1669a5c106 100644
--- a/bgpd/bgp_packet.c
+++ b/bgpd/bgp_packet.c
@@ -1035,6 +1035,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);