Skip to content

Commit d69b32e

Browse files
authored
Merge pull request #14339 from opensourcerouting/fix/backport_ce1f5d3774935e1694fd140858f3c3cdecf64ba4_9.0
bgpd: Add peers back to peer hash when peer_xfer_conn fails
2 parents 77b16f5 + 46fb4cc commit d69b32e

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

bgpd/bgp_fsm.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2107,6 +2107,7 @@ static enum bgp_fsm_state_progress bgp_establish(struct peer *peer)
21072107
enum bgp_fsm_state_progress ret = BGP_FSM_SUCCESS;
21082108
struct peer *other;
21092109
int status;
2110+
struct peer *orig = peer;
21102111

21112112
other = peer->doppelganger;
21122113
hash_release(peer->bgp->peerhash, peer);
@@ -2116,6 +2117,17 @@ static enum bgp_fsm_state_progress bgp_establish(struct peer *peer)
21162117
peer = peer_xfer_conn(peer);
21172118
if (!peer) {
21182119
flog_err(EC_BGP_CONNECT, "%%Neighbor failed in xfer_conn");
2120+
2121+
/*
2122+
* A failure of peer_xfer_conn but not putting the peers
2123+
* back in the hash ends up with a situation where incoming
2124+
* connections are rejected, as that the peer is not found
2125+
* when a lookup is done
2126+
*/
2127+
(void)hash_get(orig->bgp->peerhash, orig, hash_alloc_intern);
2128+
if (other)
2129+
(void)hash_get(other->bgp->peerhash, other,
2130+
hash_alloc_intern);
21192131
return BGP_FSM_FAILURE;
21202132
}
21212133

0 commit comments

Comments
 (0)