summaryrefslogtreecommitdiff
path: root/bgpd/bgp_packet.c
diff options
context:
space:
mode:
authorJafar Al-Gharaibeh <jafar@atcorp.com>2025-03-27 10:27:11 -0500
committerGitHub <noreply@github.com>2025-03-27 10:27:11 -0500
commit2224879e54f4866334ba43be373928dab46f0012 (patch)
treeae48a33f2cbb71b3b277fb8768850cc99cd9354c /bgpd/bgp_packet.c
parent2f6fb565fc84b98ce1cd88c3b366f0ae18ac423b (diff)
parent93ba3dd5477a1e6a60b1e35c2c16bc7a1ecd6aa8 (diff)
Merge pull request #18516 from opensourcerouting/fix/backport_18498_10.2
bgpd: Retain the routes if we do a clear with N-bit set for Graceful-Restart (backport)
Diffstat (limited to 'bgpd/bgp_packet.c')
-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);