]> git.puffer.fish Git - matthieu/frr.git/commitdiff
bgpd: skip VRF import of MAC-IP routes that belong to locally attached hosts
authorAnuradha Karuppiah <anuradhak@cumulusnetworks.com>
Sat, 9 May 2020 02:19:57 +0000 (19:19 -0700)
committerAnuradha Karuppiah <anuradhak@nvidia.com>
Tue, 24 Nov 2020 18:22:48 +0000 (10:22 -0800)
Local attached hosts are routed via the access ports using the neigh and
fdb/MAC dplane entries.

Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
bgpd/bgp_evpn.c

index 890f7963e685a265265e1d0655c93a616283ca28..83c5dc534e958b92f6ea8af069834c00e5346c3e 100644 (file)
@@ -2852,6 +2852,29 @@ static int bgp_evpn_route_rmac_self_check(struct bgp *bgp_vrf,
        return 0;
 }
 
+/* don't import hosts that are locally attached */
+static inline bool
+bgp_evpn_skip_vrf_import_of_local_es(const struct prefix_evpn *evp,
+                                    struct bgp_path_info *pi, int install)
+{
+       if ((evp->prefix.route_type == BGP_EVPN_MAC_IP_ROUTE)
+           && bgp_evpn_attr_is_local_es(pi->attr)) {
+               if (BGP_DEBUG(evpn_mh, EVPN_MH_RT)) {
+                       char esi_buf[ESI_STR_LEN];
+                       char prefix_buf[PREFIX_STRLEN];
+
+                       zlog_debug(
+                               "vrf %s of evpn prefix %s skipped, local es %s",
+                               install ? "import" : "unimport",
+                               prefix2str(evp, prefix_buf, sizeof(prefix_buf)),
+                               esi_to_str(bgp_evpn_attr_get_esi(pi->attr),
+                                          esi_buf, sizeof(esi_buf)));
+               }
+               return true;
+       }
+       return false;
+}
+
 /*
  * Install or uninstall mac-ip routes are appropriate for this
  * particular VRF.
@@ -2909,6 +2932,12 @@ static int install_uninstall_routes_for_vrf(struct bgp *bgp_vrf, int install)
                                      && pi->sub_type == BGP_ROUTE_NORMAL))
                                        continue;
 
+                               /* don't import hosts that are locally attached
+                                */
+                               if (bgp_evpn_skip_vrf_import_of_local_es(
+                                           evp, pi, install))
+                                       continue;
+
                                if (is_route_matching_for_vrf(bgp_vrf, pi)) {
                                        if (bgp_evpn_route_rmac_self_check(
                                                                bgp_vrf, evp, pi))
@@ -3115,6 +3144,10 @@ static int install_uninstall_route_in_vrfs(struct bgp *bgp_def, afi_t afi,
                 || is_evpn_prefix_ipaddr_v6(evp)))
                return 0;
 
+       /* don't import hosts that are locally attached */
+       if (bgp_evpn_skip_vrf_import_of_local_es(evp, pi, install))
+               return 0;
+
        for (ALL_LIST_ELEMENTS(vrfs, node, nnode, bgp_vrf)) {
                int ret;