]> git.puffer.fish Git - matthieu/frr.git/commitdiff
bgpd: Do not try to uninstall BFD session if the peer is not established
authorDonatas Abraitis <donatas@opensourcerouting.org>
Mon, 11 Nov 2024 14:49:22 +0000 (16:49 +0200)
committerDonatas Abraitis <donatas@opensourcerouting.org>
Mon, 11 Nov 2024 14:49:22 +0000 (16:49 +0200)
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>
bgpd/bgp_fsm.c

index 58e1ffa500c32271901a925d139c125d3af4e5aa..8c9050185b32c89fb3451ec5cc425d0728895b0a 100644 (file)
@@ -1344,11 +1344,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))
@@ -1368,6 +1363,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;