diff options
author | Anuradha Karuppiah <anuradhak@cumulusnetworks.com> | 2020-05-09 04:19:57 +0200 |
---|---|---|
committer | Anuradha Karuppiah <anuradhak@nvidia.com> | 2020-11-24 19:22:48 +0100 |
commit | bbc57c6cfac1d471a8d0293cd30af59facdbd8f4 (patch) | |
tree | 0a9041c78a61d3e570fca650cba16eb0afa2b7dd | |
parent | Merge pull request #7475 from eololab/add-more-parameters-for-crosscompilation (diff) | |
download | frr-bbc57c6cfac1d471a8d0293cd30af59facdbd8f4.tar.xz frr-bbc57c6cfac1d471a8d0293cd30af59facdbd8f4.zip |
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 <anuradhak@cumulusnetworks.com>
-rw-r--r-- | bgpd/bgp_evpn.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/bgpd/bgp_evpn.c b/bgpd/bgp_evpn.c index 890f7963e..83c5dc534 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; |