From: Anuradha Karuppiah Date: Sat, 9 May 2020 02:19:57 +0000 (-0700) Subject: bgpd: skip VRF import of MAC-IP routes that belong to locally attached hosts X-Git-Tag: base_7.6~208^2~8 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=bbc57c6cfac1d471a8d0293cd30af59facdbd8f4;p=mirror%2Ffrr.git bgpd: skip VRF import of MAC-IP routes that belong to locally attached hosts Local attached hosts are routed via the access ports using the neigh and fdb/MAC dplane entries. Signed-off-by: Anuradha Karuppiah --- diff --git a/bgpd/bgp_evpn.c b/bgpd/bgp_evpn.c index 890f7963e6..83c5dc534e 100644 --- a/bgpd/bgp_evpn.c +++ b/bgpd/bgp_evpn.c @@ -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;