diff options
| author | Jafar Al-Gharaibeh <jafar@atcorp.com> | 2024-12-18 16:26:37 -0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-12-18 16:26:37 -0600 |
| commit | f78b1786a65e237325161e667201e617d57118d9 (patch) | |
| tree | b87d2bee575a60e886e9ac127cc3326b01f8e815 /bgpd/bgp_fsm.c | |
| parent | 6c3e1e4fd636e6cdc9a14c4d19de26784a6b890e (diff) | |
| parent | 4ac77b199e0547c8457dbf7e94f159c1fbe57d06 (diff) | |
Merge pull request #17599 from opensourcerouting/fix/reduce_default_connect_timer
bgpd: Connect retry timer backoff
Diffstat (limited to 'bgpd/bgp_fsm.c')
| -rw-r--r-- | bgpd/bgp_fsm.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/bgpd/bgp_fsm.c b/bgpd/bgp_fsm.c index 6ad8a2e8de..3d02214ca9 100644 --- a/bgpd/bgp_fsm.c +++ b/bgpd/bgp_fsm.c @@ -491,11 +491,14 @@ static void bgp_connect_timer(struct event *thread) assert(!connection->t_read); if (bgp_debug_neighbor_events(peer)) - zlog_debug("%s [FSM] Timer (connect timer expire)", peer->host); + zlog_debug("%s [FSM] Timer (connect timer (%us) expire)", peer->host, + peer->v_connect); if (CHECK_FLAG(peer->sflags, PEER_STATUS_ACCEPT_PEER)) bgp_stop(connection); else { + if (!peer->connect) + peer->v_connect = MIN(BGP_MAX_CONNECT_RETRY, peer->v_connect * 2); EVENT_VAL(thread) = ConnectRetry_timer_expired; bgp_event(thread); /* bgp_event unlocks peer */ } @@ -1224,9 +1227,14 @@ void bgp_fsm_change_status(struct peer_connection *connection, peer_count = bgp->established_peers; - if (status == Established) + if (status == Established) { bgp->established_peers++; - else if ((peer_established(connection)) && (status != Established)) + /* Reset the retry timer if we already established */ + if (peer->connect) + peer->v_connect = peer->connect; + else + peer->v_connect = peer->bgp->default_connect_retry; + } else if ((peer_established(connection)) && (status != Established)) bgp->established_peers--; if (bgp_debug_neighbor_events(peer)) { |
