Skip to content

Commit e3a8360

Browse files
vivekrnvxincunli-sonic
authored andcommitted
[FRR] Allow proper shutdown of bgp dynamic peers (sonic-net#24961)
- Why I did it In BGP scale setup with Dynamic peering enabled, sometimes we don't see output in "show ip bgp summary" however the peers are actually learnt - How I did it Port upstream FRR commit: FRRouting/frr@aadfa2b into SONIC - How to verify it Ported this fix and verified if it solves the problem Signed-off-by: Vivek Reddy <vkarri@nvidia.com> Signed-off-by: Xincun Li <stli@microsoft.com>
1 parent f780faf commit e3a8360

File tree

2 files changed

+53
-0
lines changed

2 files changed

+53
-0
lines changed
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
From aadfa2b22ea22a07c240a16a7b883495ba37d652 Mon Sep 17 00:00:00 2001
2+
From: Donald Sharp <sharpd@nvidia.com>
3+
Date: Tue, 25 Nov 2025 13:12:07 -0500
4+
Subject: [PATCH] bgpd: Allow proper shutdown of bgp dynamic peers in rare case
5+
6+
There exists a series of events that causes dynamic peers to
7+
accept new connections on a existing connection and leaving
8+
everything in a weird state.
9+
10+
Series of events:
11+
12+
a) Interface down event
13+
b) BGP places peering on queue to be cleared in the future
14+
*note* that BGP is completely swamped and doesn't get to
15+
this in a timely manner
16+
c) Interface comes up
17+
d) Peer is not loaded and attempts to reconnect the dynamic
18+
peer.
19+
20+
At this point on the accept, BGP finds the existing dynamic
21+
peer and decides to reuse the connection, runs peer_xfer_config
22+
and messes up the CONFIG_NODE flag for the peer. This is because
23+
dynamic peers are not meant to go through that code for handling
24+
resolution of peering and it causes issues.
25+
26+
Let's just prevent dynamic peers from accepting an existing connection.
27+
This solves the issue.
28+
29+
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
30+
---
31+
bgpd/bgp_network.c | 8 ++++++++
32+
1 file changed, 8 insertions(+)
33+
34+
diff --git a/bgpd/bgp_network.c b/bgpd/bgp_network.c
35+
index a751f6b01e74..df08afb0d965 100644
36+
--- a/bgpd/bgp_network.c
37+
+++ b/bgpd/bgp_network.c
38+
@@ -546,6 +546,14 @@ static void bgp_accept(struct event *event)
39+
BGP_EVENT_ADD(incoming, TCP_connection_open);
40+
}
41+
42+
+ return;
43+
+ }
44+
+ } else {
45+
+ if (CHECK_FLAG(peer->flags, PEER_FLAG_DYNAMIC_NEIGHBOR)) {
46+
+ zlog_debug("Received an open connection for a peering %s that we have not fully closed down yet",
47+
+ peer->host);
48+
+ close(bgp_sock);
49+
+
50+
return;
51+
}
52+
}

src/sonic-frr/patch/series

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,3 +59,4 @@
5959
0097-mgmt-Note-that-a-DS-is-locked-or-not-in-output.patch
6060
0098-SRv6-Add-support-for-multiple-SRv6-locators.patch
6161
0099-zebra-Fix-SRv6-explicit-SID-allocation-to-use-the-provided-locator.patch
62+
0100-bgpd-Allow-proper-shutdown-of-bgp-dynamic-peers.patch

0 commit comments

Comments
 (0)