]> git.puffer.fish Git - mirror/frr.git/commitdiff
bgpd: Make `suppress-fib-pending` clear peering 15005/head
authorDonald Sharp <sharpd@nvidia.com>
Mon, 11 Dec 2023 15:46:53 +0000 (10:46 -0500)
committerDonatas Abraitis <donatas@opensourcerouting.org>
Wed, 13 Dec 2023 07:51:38 +0000 (09:51 +0200)
When a peer has come up and already started installing
routes into the rib and `suppress-fib-pending` is either
turned on or off.  BGP is left with some routes that
may need to be withdrawn from peers and routes that
it does not know the status of.  Clear the BGP peers
for the interesting parties and let's let us come
up to speed as needed.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
bgpd/bgp_fsm.c
bgpd/bgpd.c
bgpd/bgpd.h

index 8f1fdea85669a23002066a814abd5cfb16f30cb2..78c649ea6791d6f4b667201b521f515dcf8afa30 100644 (file)
@@ -605,42 +605,45 @@ void bgp_delayopen_timer(struct thread *thread)
 }
 
 /* BGP Peer Down Cause */
-const char *const peer_down_str[] = {"",
-                                    "Router ID changed",
-                                    "Remote AS changed",
-                                    "Local AS change",
-                                    "Cluster ID changed",
-                                    "Confederation identifier changed",
-                                    "Confederation peer changed",
-                                    "RR client config change",
-                                    "RS client config change",
-                                    "Update source change",
-                                    "Address family activated",
-                                    "Admin. shutdown",
-                                    "User reset",
-                                    "BGP Notification received",
-                                    "BGP Notification send",
-                                    "Peer closed the session",
-                                    "Neighbor deleted",
-                                    "Peer-group add member",
-                                    "Peer-group delete member",
-                                    "Capability changed",
-                                    "Passive config change",
-                                    "Multihop config change",
-                                    "NSF peer closed the session",
-                                    "Intf peering v6only config change",
-                                    "BFD down received",
-                                    "Interface down",
-                                    "Neighbor address lost",
-                                    "No path to specified Neighbor",
-                                    "Waiting for Peer IPv6 LLA",
-                                    "Waiting for VRF to be initialized",
-                                    "No AFI/SAFI activated for peer",
-                                    "AS Set config change",
-                                    "Waiting for peer OPEN",
-                                    "Reached received prefix count",
-                                    "Socket Error",
-                                    "Admin. shutdown (RTT)"};
+const char *const peer_down_str[] = {
+       "",
+       "Router ID changed",
+       "Remote AS changed",
+       "Local AS change",
+       "Cluster ID changed",
+       "Confederation identifier changed",
+       "Confederation peer changed",
+       "RR client config change",
+       "RS client config change",
+       "Update source change",
+       "Address family activated",
+       "Admin. shutdown",
+       "User reset",
+       "BGP Notification received",
+       "BGP Notification send",
+       "Peer closed the session",
+       "Neighbor deleted",
+       "Peer-group add member",
+       "Peer-group delete member",
+       "Capability changed",
+       "Passive config change",
+       "Multihop config change",
+       "NSF peer closed the session",
+       "Intf peering v6only config change",
+       "BFD down received",
+       "Interface down",
+       "Neighbor address lost",
+       "No path to specified Neighbor",
+       "Waiting for Peer IPv6 LLA",
+       "Waiting for VRF to be initialized",
+       "No AFI/SAFI activated for peer",
+       "AS Set config change",
+       "Waiting for peer OPEN",
+       "Reached received prefix count",
+       "Socket Error",
+       "Admin. shutdown (RTT)",
+       "Suppress Fib Turned On or Off",
+};
 
 static void bgp_graceful_restart_timer_off(struct peer *peer)
 {
index 964349bba0c8f30b2bbbd98f0f099ea0c605c6a7..1423529af886f88f9a5c9f329798a56c3272c7f0 100644 (file)
@@ -425,6 +425,9 @@ void bgp_router_id_static_set(struct bgp *bgp, struct in_addr id)
 void bm_wait_for_fib_set(bool set)
 {
        bool send_msg = false;
+       struct bgp *bgp;
+       struct peer *peer;
+       struct listnode *next, *node;
 
        if (bm->wait_for_fib == set)
                return;
@@ -443,12 +446,31 @@ void bm_wait_for_fib_set(bool set)
        if (send_msg && zclient)
                zebra_route_notify_send(ZEBRA_ROUTE_NOTIFY_REQUEST,
                                        zclient, set);
+
+       /*
+        * If this is configed at a time when peers are already set
+        * FRR needs to reset the connection(s) as that some installs
+        * may have already happened in some shape fashion or form
+        * let's just start over
+        */
+       for (ALL_LIST_ELEMENTS_RO(bm->bgp, next, bgp)) {
+               for (ALL_LIST_ELEMENTS_RO(bgp->peer, node, peer)) {
+                       if (!BGP_IS_VALID_STATE_FOR_NOTIF(peer->status))
+                               continue;
+
+                       peer->last_reset = PEER_DOWN_SUPPRESS_FIB_PENDING;
+                       bgp_notify_send(peer, BGP_NOTIFY_CEASE,
+                                       BGP_NOTIFY_CEASE_CONFIG_CHANGE);
+               }
+       }
 }
 
 /* Set the suppress fib pending for the bgp configuration */
 void bgp_suppress_fib_pending_set(struct bgp *bgp, bool set)
 {
        bool send_msg = false;
+       struct peer *peer;
+       struct listnode *node;
 
        if (bgp->inst_type == BGP_INSTANCE_TYPE_VIEW)
                return;
@@ -480,6 +502,21 @@ void bgp_suppress_fib_pending_set(struct bgp *bgp, bool set)
                        zebra_route_notify_send(ZEBRA_ROUTE_NOTIFY_REQUEST,
                                        zclient, set);
        }
+
+       /*
+        * If this is configed at a time when peers are already set
+        * FRR needs to reset the connection as that some installs
+        * may have already happened in some shape fashion or form
+        * let's just start over
+        */
+       for (ALL_LIST_ELEMENTS_RO(bgp->peer, node, peer)) {
+               if (!BGP_IS_VALID_STATE_FOR_NOTIF(peer->status))
+                       continue;
+
+               peer->last_reset = PEER_DOWN_SUPPRESS_FIB_PENDING;
+               bgp_notify_send(peer, BGP_NOTIFY_CEASE,
+                               BGP_NOTIFY_CEASE_CONFIG_CHANGE);
+       }
 }
 
 /* BGP's cluster-id control. */
index 72b5b50fb4f5c38eba9335cd6934f75d5d2d123a..51bb718a78f609c15b9ea5cd82976e3bea5b8499 100644 (file)
@@ -1698,6 +1698,7 @@ struct peer {
 #define PEER_DOWN_PFX_COUNT             33U /* Reached received prefix count */
 #define PEER_DOWN_SOCKET_ERROR          34U /* Some socket error happened */
 #define PEER_DOWN_RTT_SHUTDOWN          35U /* Automatically shutdown due to RTT */
+#define PEER_DOWN_SUPPRESS_FIB_PENDING  36U /* Suppress fib pending changed */
        /*
         * Remember to update peer_down_str in bgp_fsm.c when you add
         * a new value to the last_reset reason