]> git.puffer.fish Git - mirror/frr.git/commitdiff
bgpd: some safi's do not mix with bgp suppress-fib 13798/head
authorDonald Sharp <sharpd@nvidia.com>
Wed, 14 Jun 2023 16:25:18 +0000 (12:25 -0400)
committerDonald Sharp <sharpd@nvidia.com>
Wed, 14 Jun 2023 19:15:13 +0000 (15:15 -0400)
BGP cannot decide to disseminate the safi based upon the
bgp suppress-fib command.  Modify the code to look at
the safi for the decision to communicate to a peer the
particular node.

Ticket: #3402926
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
bgpd/bgp_route.c
bgpd/bgp_route.h
bgpd/bgp_updgrp_adv.c

index 7737738d28215e00f8ab286ae4fb8db19bcb2864..bea31042e874c177b303f8008fd1710ddab8afd9 100644 (file)
@@ -2924,7 +2924,7 @@ void subgroup_process_announce_selected(struct update_subgroup *subgrp,
         * is pending (BGP_NODE_FIB_INSTALL_PENDING), do not advertise the
         * route
         */
-       advertise = bgp_check_advertise(bgp, dest);
+       advertise = bgp_check_advertise(bgp, dest, safi);
 
        if (selected) {
                if (subgroup_announce_check(dest, selected, subgrp, p, &attr,
@@ -2933,7 +2933,7 @@ void subgroup_process_announce_selected(struct update_subgroup *subgrp,
                         * in FIB, then it is advertised
                         */
                        if (advertise) {
-                               if (!bgp_check_withdrawal(bgp, dest)) {
+                               if (!bgp_check_withdrawal(bgp, dest, safi)) {
                                        struct attr *adv_attr =
                                                bgp_attr_intern(&attr);
 
@@ -7752,7 +7752,7 @@ bool bgp_aggregate_route(struct bgp *bgp, const struct prefix *p, afi_t afi,
                /* If suppress fib is enabled and route not installed
                 * in FIB, skip the route
                 */
-               if (!bgp_check_advertise(bgp, dest))
+               if (!bgp_check_advertise(bgp, dest, safi))
                        continue;
 
                match = 0;
@@ -8266,7 +8266,7 @@ void bgp_aggregate_increment(struct bgp *bgp, const struct prefix *p,
        /* If suppress fib is enabled and route not installed
         * in FIB, do not update the aggregate route
         */
-       if (!bgp_check_advertise(bgp, pi->net))
+       if (!bgp_check_advertise(bgp, pi->net, safi))
                return;
 
        child = bgp_node_get(table, p);
index 9bd9e48e22775da60de921ede5bfbba3d60c72e0..3068902022463eeb97ff51c78c803d601c1e9709 100644 (file)
@@ -592,8 +592,12 @@ static inline void prep_for_rmap_apply(struct bgp_path_info *dst_pi,
        }
 }
 
-static inline bool bgp_check_advertise(struct bgp *bgp, struct bgp_dest *dest)
+static inline bool bgp_check_advertise(struct bgp *bgp, struct bgp_dest *dest,
+                                      safi_t safi)
 {
+       if (!bgp_fibupd_safi(safi))
+               return true;
+
        return (!(BGP_SUPPRESS_FIB_ENABLED(bgp) &&
                  CHECK_FLAG(dest->flags, BGP_NODE_FIB_INSTALL_PENDING) &&
                 (!bgp_option_check(BGP_OPT_NO_FIB))));
@@ -605,11 +609,12 @@ static inline bool bgp_check_advertise(struct bgp *bgp, struct bgp_dest *dest)
  * This function assumes that bgp_check_advertise was already returned
  * as good to go.
  */
-static inline bool bgp_check_withdrawal(struct bgp *bgp, struct bgp_dest *dest)
+static inline bool bgp_check_withdrawal(struct bgp *bgp, struct bgp_dest *dest,
+                                       safi_t safi)
 {
        struct bgp_path_info *pi, *selected = NULL;
 
-       if (!BGP_SUPPRESS_FIB_ENABLED(bgp))
+       if (!bgp_fibupd_safi(safi) || !BGP_SUPPRESS_FIB_ENABLED(bgp))
                return false;
 
        for (pi = bgp_dest_get_bgp_path_info(dest); pi; pi = pi->next) {
index 33617811cfe8108453fa33dcffecc8a85c5320e1..b412fa6b2071ea307064ea3577925aed9805e187 100644 (file)
@@ -307,6 +307,7 @@ static void subgroup_coalesce_timer(struct event *thread)
 {
        struct update_subgroup *subgrp;
        struct bgp *bgp;
+       safi_t safi;
 
        subgrp = EVENT_ARG(thread);
        if (bgp_debug_update(NULL, NULL, subgrp->update_group, 0))
@@ -317,7 +318,7 @@ static void subgroup_coalesce_timer(struct event *thread)
        subgrp->v_coalesce = 0;
        bgp = SUBGRP_INST(subgrp);
        subgroup_announce_route(subgrp);
-
+       safi = SUBGRP_SAFI(subgrp);
 
        /* While the announce_route() may kick off the route advertisement timer
         * for
@@ -328,7 +329,8 @@ static void subgroup_coalesce_timer(struct event *thread)
         * announce, this is the method currently employed to trigger the EOR.
         */
        if (!bgp_update_delay_active(SUBGRP_INST(subgrp)) &&
-           !(BGP_SUPPRESS_FIB_ENABLED(bgp))) {
+           !(bgp_fibupd_safi(safi) && BGP_SUPPRESS_FIB_ENABLED(bgp))) {
+
                struct peer_af *paf;
                struct peer *peer;
 
@@ -549,7 +551,8 @@ void bgp_adj_out_set_subgroup(struct bgp_dest *dest,
                         * the flag PEER_STATUS_ADV_DELAY which will allow
                         * more routes to be sent in the update message
                         */
-                       if (BGP_SUPPRESS_FIB_ENABLED(bgp)) {
+                       if (bgp_fibupd_safi(safi) &&
+                           BGP_SUPPRESS_FIB_ENABLED(bgp)) {
                                adv_peer = PAF_PEER(paf);
                                if (!bgp_adv_fifo_count(
                                                &subgrp->sync->withdraw))
@@ -1014,7 +1017,7 @@ void group_announce_route(struct bgp *bgp, afi_t afi, safi_t safi,
        /* If suppress fib is enabled, the route will be advertised when
         * FIB status is received
         */
-       if (!bgp_check_advertise(bgp, dest))
+       if (!bgp_check_advertise(bgp, dest, safi))
                return;
 
        update_group_af_walk(bgp, afi, safi, group_announce_route_walkcb, &ctx);