diff options
| author | Donatas Abraitis <donatas@opensourcerouting.org> | 2023-09-01 08:28:13 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-09-01 08:28:13 +0300 |
| commit | 2ed81c8ef8b2ab30e3533ce6a3aef82b388e4ae7 (patch) | |
| tree | 0300190e0ff6885a595a977e1372a0bd2e7170ff | |
| parent | e903db3ab358eb194d7900d522dc4980149a6f76 (diff) | |
| parent | ce1f5d3774935e1694fd140858f3c3cdecf64ba4 (diff) | |
Merge pull request #14325 from donaldsharp/peerhash_take_two
bgpd: Add peers back to peer hash when peer_xfer_conn fails
| -rw-r--r-- | bgpd/bgp_fsm.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/bgpd/bgp_fsm.c b/bgpd/bgp_fsm.c index b0d2a8fe0e..786e953843 100644 --- a/bgpd/bgp_fsm.c +++ b/bgpd/bgp_fsm.c @@ -2137,6 +2137,7 @@ bgp_establish(struct peer_connection *connection) struct peer *other; int status; struct peer *peer = connection->peer; + struct peer *orig = peer; other = peer->doppelganger; hash_release(peer->bgp->peerhash, peer); @@ -2146,6 +2147,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(orig->bgp->peerhash, orig, hash_alloc_intern); + if (other) + (void)hash_get(other->bgp->peerhash, other, + hash_alloc_intern); return BGP_FSM_FAILURE; } |
