]> git.puffer.fish Git - mirror/frr.git/commitdiff
bgpd: revert no retain backend
authorLouis Scalbert <louis.scalbert@6wind.com>
Tue, 6 Jun 2023 12:02:42 +0000 (14:02 +0200)
committerLouis Scalbert <louis.scalbert@6wind.com>
Fri, 16 Jun 2023 12:18:25 +0000 (14:18 +0200)
Partially revert a486300b26 ("bgpd: implement retain route-target all
behaviour") in order to fix a memory consumption issue in the next
commit.

Fixes: a486300b26 ("bgpd: implement retain route-target all behaviour")
Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
bgpd/bgp_mplsvpn.c
bgpd/bgp_mplsvpn.h
bgpd/bgp_route.c

index dc9bd3cff525ad19a8857a131e3512216cd66673..447a21b5eaf73a38c7b3270d35120e029cfe5360 100644 (file)
@@ -2116,7 +2116,7 @@ static struct bgp *bgp_lookup_by_rd(struct bgp_path_info *bpi,
        return NULL;
 }
 
-static bool vpn_leak_to_vrf_update_onevrf(struct bgp *to_bgp,   /* to */
+static void vpn_leak_to_vrf_update_onevrf(struct bgp *to_bgp,   /* to */
                                          struct bgp *from_bgp, /* from */
                                          struct bgp_path_info *path_vpn,
                                          struct prefix_rd *prd)
@@ -2146,7 +2146,7 @@ static bool vpn_leak_to_vrf_update_onevrf(struct bgp *to_bgp,   /* to */
                                "%s: from vpn (%s) to vrf (%s), skipping: %s",
                                __func__, from_bgp->name_pretty,
                                to_bgp->name_pretty, debugmsg);
-               return false;
+               return;
        }
 
        /*
@@ -2173,7 +2173,7 @@ static bool vpn_leak_to_vrf_update_onevrf(struct bgp *to_bgp,   /* to */
                        zlog_debug(
                                "from vpn (%s) to vrf (%s), skipping after no intersection of route targets",
                                from_bgp->name_pretty, to_bgp->name_pretty);
-               return false;
+               return;
        }
 
        rd_buf[0] = '\0';
@@ -2190,7 +2190,7 @@ static bool vpn_leak_to_vrf_update_onevrf(struct bgp *to_bgp,   /* to */
                        zlog_debug(
                                "%s: skipping import, match RD (%s) of src VRF (%s) and the prefix (%pFX)",
                                __func__, rd_buf, to_bgp->name_pretty, p);
-               return false;
+               return;
        }
 
        if (debug)
@@ -2301,7 +2301,7 @@ static bool vpn_leak_to_vrf_update_onevrf(struct bgp *to_bgp,   /* to */
                                        to_bgp->vpn_policy[afi]
                                                .rmap[BGP_VPN_POLICY_DIR_FROMVPN]
                                                ->name);
-                       return false;
+                       return;
                }
                /*
                 * if route-map changed nexthop, don't nexthop-self on output
@@ -2363,17 +2363,14 @@ static bool vpn_leak_to_vrf_update_onevrf(struct bgp *to_bgp,   /* to */
                         num_labels, src_vrf, &nexthop_orig, nexthop_self_flag,
                         debug))
                bgp_dest_unlock_node(bn);
-
-       return true;
 }
 
-bool vpn_leak_to_vrf_update(struct bgp *from_bgp,
+void vpn_leak_to_vrf_update(struct bgp *from_bgp,
                            struct bgp_path_info *path_vpn,
                            struct prefix_rd *prd)
 {
        struct listnode *mnode, *mnnode;
        struct bgp *bgp;
-       bool leak_success = false;
 
        int debug = BGP_DEBUG(vpn, VPN_LEAK_TO_VRF);
 
@@ -2385,11 +2382,10 @@ bool vpn_leak_to_vrf_update(struct bgp *from_bgp,
 
                if (!path_vpn->extra
                    || path_vpn->extra->bgp_orig != bgp) { /* no loop */
-                       leak_success |= vpn_leak_to_vrf_update_onevrf(
-                               bgp, from_bgp, path_vpn, prd);
+                       vpn_leak_to_vrf_update_onevrf(bgp, from_bgp, path_vpn,
+                                                     prd);
                }
        }
-       return leak_success;
 }
 
 void vpn_leak_to_vrf_withdraw(struct bgp_path_info *path_vpn)
index 75758edcc2bb4085786cd750352f58ccfcef30c5..3922fbcb116d5588149a782322d46fc05f57d51e 100644 (file)
@@ -59,7 +59,7 @@ extern void vpn_leak_to_vrf_withdraw_all(struct bgp *to_bgp, afi_t afi);
 extern void vpn_leak_to_vrf_update_all(struct bgp *to_bgp, struct bgp *from_bgp,
                                       afi_t afi);
 
-extern bool vpn_leak_to_vrf_update(struct bgp *from_bgp,
+extern void vpn_leak_to_vrf_update(struct bgp *from_bgp,
                                   struct bgp_path_info *path_vpn,
                                   struct prefix_rd *prd);
 
index 7737738d28215e00f8ab286ae4fb8db19bcb2864..155aebc5f94a1a03f93de6679c971bcd893952db 100644 (file)
@@ -4026,7 +4026,6 @@ void bgp_update(struct peer *peer, const struct prefix *p, uint32_t addpath_id,
        afi_t nh_afi;
        bool force_evpn_import = false;
        safi_t orig_safi = safi;
-       bool leak_success = true;
        int allowas_in = 0;
 
        if (frrtrace_enabled(frr_bgp, process_update)) {
@@ -4713,7 +4712,7 @@ void bgp_update(struct peer *peer, const struct prefix *p, uint32_t addpath_id,
                }
                if ((SAFI_MPLS_VPN == safi)
                    && (bgp->inst_type == BGP_INSTANCE_TYPE_DEFAULT)) {
-                       leak_success = vpn_leak_to_vrf_update(bgp, pi, prd);
+                       vpn_leak_to_vrf_update(bgp, pi, prd);
                }
 
 #ifdef ENABLE_BGP_VNC
@@ -4728,13 +4727,6 @@ void bgp_update(struct peer *peer, const struct prefix *p, uint32_t addpath_id,
                                           type, sub_type, NULL);
                }
 #endif
-               if ((safi == SAFI_MPLS_VPN) &&
-                   !CHECK_FLAG(bgp->af_flags[afi][safi],
-                               BGP_VPNVX_RETAIN_ROUTE_TARGET_ALL) &&
-                   !leak_success) {
-                       bgp_unlink_nexthop(pi);
-                       bgp_path_info_delete(dest, pi);
-               }
                return;
        } // End of implicit withdraw
 
@@ -4876,7 +4868,7 @@ void bgp_update(struct peer *peer, const struct prefix *p, uint32_t addpath_id,
        }
        if ((SAFI_MPLS_VPN == safi)
            && (bgp->inst_type == BGP_INSTANCE_TYPE_DEFAULT)) {
-               leak_success = vpn_leak_to_vrf_update(bgp, new, prd);
+               vpn_leak_to_vrf_update(bgp, new, prd);
        }
 #ifdef ENABLE_BGP_VNC
        if (SAFI_MPLS_VPN == safi) {
@@ -4890,13 +4882,6 @@ void bgp_update(struct peer *peer, const struct prefix *p, uint32_t addpath_id,
                                   sub_type, NULL);
        }
 #endif
-       if ((safi == SAFI_MPLS_VPN) &&
-           !CHECK_FLAG(bgp->af_flags[afi][safi],
-                       BGP_VPNVX_RETAIN_ROUTE_TARGET_ALL) &&
-           !leak_success) {
-               bgp_unlink_nexthop(new);
-               bgp_path_info_delete(dest, new);
-       }
 
        return;