summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJafar Al-Gharaibeh <jafar@atcorp.com>2023-08-31 00:22:24 -0500
committerGitHub <noreply@github.com>2023-08-31 00:22:24 -0500
commit286fc3edd603eb5b6818349b22eb217b1e72d0c0 (patch)
tree3f831525a9039f0fd4008f9f51bfa12845a8f10b
parentd28c904206c0c1587caa215c903613755c3764e9 (diff)
parent523e6c923dc68b777a9b83eec65d951f02371733 (diff)
Merge pull request #14309 from FRRouting/mergify/bp/stable/9.0/pr-14301
bgpd: Add peers back to peer hash when peer_xfer_conn fails (backport #14301)
-rw-r--r--bgpd/bgp_fsm.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/bgpd/bgp_fsm.c b/bgpd/bgp_fsm.c
index 09b35bc7e7..00aefafb3d 100644
--- a/bgpd/bgp_fsm.c
+++ b/bgpd/bgp_fsm.c
@@ -2116,6 +2116,17 @@ static enum bgp_fsm_state_progress bgp_establish(struct peer *peer)
peer = peer_xfer_conn(peer);
if (!peer) {
flog_err(EC_BGP_CONNECT, "%%Neighbor failed in xfer_conn");
+
+ /*
+ * A failure of peer_xfer_conn but not putting the peers
+ * back in the hash ends up with a situation where incoming
+ * connections are rejected, as that the peer is not found
+ * when a lookup is done
+ */
+ (void)hash_get(peer->bgp->peerhash, peer, hash_alloc_intern);
+ if (other)
+ (void)hash_get(other->bgp->peerhash, other,
+ hash_alloc_intern);
return BGP_FSM_FAILURE;
}