summaryrefslogtreecommitdiff
path: root/bgpd
diff options
context:
space:
mode:
authorDonatas Abraitis <donatas@opensourcerouting.org>2024-11-11 16:49:22 +0200
committerDonatas Abraitis <donatas@opensourcerouting.org>2025-01-03 12:45:38 +0200
commitb150170d88a31cd742ae00bfd8b6101d26041c94 (patch)
tree4ba2550f02b762c1173c88e498298a0a444ced8a /bgpd
parentff82618d89802e502685c00d028a8c32213a3c56 (diff)
bgpd: Do not try to uninstall BFD session if the peer is not established
Having something like: ``` neighbor 192.168.1.222 ebgp-multihop 32 neighbor 192.168.1.222 update-source 192.168.1.5 neighbor 192.168.1.222 bfd ``` Won't work and the result is (empty): ``` $ show bfd peers BFD Peers: ``` bgp_stop() is called in BGP FSM multiple times (even at startup) that causes intermediate session interruption when update-source/ebgp-multihop is triggered. With this fix, the ordering does not matter and the BFD session's parameters are updated correctly. Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
Diffstat (limited to 'bgpd')
-rw-r--r--bgpd/bgp_fsm.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/bgpd/bgp_fsm.c b/bgpd/bgp_fsm.c
index ac33e8a62c..de1959d762 100644
--- a/bgpd/bgp_fsm.c
+++ b/bgpd/bgp_fsm.c
@@ -1343,11 +1343,6 @@ enum bgp_fsm_state_progress bgp_stop(struct peer_connection *connection)
peer->nsf_af_count = 0;
- /* deregister peer */
- if (peer->bfd_config
- && peer->last_reset == PEER_DOWN_UPDATE_SOURCE_CHANGE)
- bfd_sess_uninstall(peer->bfd_config->session);
-
if (peer_dynamic_neighbor_no_nsf(peer) &&
!(CHECK_FLAG(peer->flags, PEER_FLAG_DELETE))) {
if (bgp_debug_neighbor_events(peer))
@@ -1367,6 +1362,10 @@ enum bgp_fsm_state_progress bgp_stop(struct peer_connection *connection)
if (peer_established(connection)) {
peer->dropped++;
+ if (peer->bfd_config && (peer->last_reset == PEER_DOWN_UPDATE_SOURCE_CHANGE ||
+ peer->last_reset == PEER_DOWN_MULTIHOP_CHANGE))
+ bfd_sess_uninstall(peer->bfd_config->session);
+
/* Notify BGP conditional advertisement process */
peer->advmap_table_change = true;