diff --git a/bgpd/bgp_fsm.c b/bgpd/bgp_fsm.c index b0d2a8fe0e..df137b8d54 100644 --- a/bgpd/bgp_fsm.c +++ b/bgpd/bgp_fsm.c @@ -2146,6 +2146,17 @@ bgp_establish(struct peer_connection *connection) 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; }