Merge pull request #4847 from vivek-cumulus/evpn-route-import-fix

bgpd: Ensure correct checks for EVPN route import
This commit is contained in:
Sri Mohana Singamsetty 2019-08-29 05:50:23 -07:00 committed by GitHub
commit 614338c6ac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 12 deletions

View File

@ -4459,6 +4459,7 @@ void bgp_evpn_configure_import_rt_for_vrf(struct bgp *bgp_vrf,
struct ecommunity *ecomadd) struct ecommunity *ecomadd)
{ {
/* uninstall routes from vrf */ /* uninstall routes from vrf */
if (is_l3vni_live(bgp_vrf))
uninstall_routes_for_vrf(bgp_vrf); uninstall_routes_for_vrf(bgp_vrf);
/* Cleanup the RT to VRF mapping */ /* Cleanup the RT to VRF mapping */
@ -4471,12 +4472,12 @@ void bgp_evpn_configure_import_rt_for_vrf(struct bgp *bgp_vrf,
listnode_add_sort(bgp_vrf->vrf_import_rtl, ecomadd); listnode_add_sort(bgp_vrf->vrf_import_rtl, ecomadd);
SET_FLAG(bgp_vrf->vrf_flags, BGP_VRF_IMPORT_RT_CFGD); SET_FLAG(bgp_vrf->vrf_flags, BGP_VRF_IMPORT_RT_CFGD);
/* map VRF to its RTs */ /* map VRF to its RTs and install routes matching the new RTs */
if (is_l3vni_live(bgp_vrf)) {
bgp_evpn_map_vrf_to_its_rts(bgp_vrf); bgp_evpn_map_vrf_to_its_rts(bgp_vrf);
/* install routes matching the new VRF */
install_routes_for_vrf(bgp_vrf); install_routes_for_vrf(bgp_vrf);
} }
}
void bgp_evpn_unconfigure_import_rt_for_vrf(struct bgp *bgp_vrf, void bgp_evpn_unconfigure_import_rt_for_vrf(struct bgp *bgp_vrf,
struct ecommunity *ecomdel) struct ecommunity *ecomdel)
@ -4485,6 +4486,7 @@ void bgp_evpn_unconfigure_import_rt_for_vrf(struct bgp *bgp_vrf,
struct ecommunity *ecom = NULL; struct ecommunity *ecom = NULL;
/* uninstall routes from vrf */ /* uninstall routes from vrf */
if (is_l3vni_live(bgp_vrf))
uninstall_routes_for_vrf(bgp_vrf); uninstall_routes_for_vrf(bgp_vrf);
/* Cleanup the RT to VRF mapping */ /* Cleanup the RT to VRF mapping */
@ -4509,12 +4511,12 @@ void bgp_evpn_unconfigure_import_rt_for_vrf(struct bgp *bgp_vrf,
evpn_auto_rt_import_add_for_vrf(bgp_vrf); evpn_auto_rt_import_add_for_vrf(bgp_vrf);
} }
/* map VRFs to its RTs */ /* map VRFs to its RTs and install routes matching this new RT */
if (is_l3vni_live(bgp_vrf)) {
bgp_evpn_map_vrf_to_its_rts(bgp_vrf); bgp_evpn_map_vrf_to_its_rts(bgp_vrf);
/* install routes matching this new RT */
install_routes_for_vrf(bgp_vrf); install_routes_for_vrf(bgp_vrf);
} }
}
void bgp_evpn_configure_export_rt_for_vrf(struct bgp *bgp_vrf, void bgp_evpn_configure_export_rt_for_vrf(struct bgp *bgp_vrf,
struct ecommunity *ecomadd) struct ecommunity *ecomadd)

View File

@ -275,6 +275,11 @@ static inline int is_vni_live(struct bgpevpn *vpn)
return (CHECK_FLAG(vpn->flags, VNI_FLAG_LIVE)); return (CHECK_FLAG(vpn->flags, VNI_FLAG_LIVE));
} }
static inline int is_l3vni_live(struct bgp *bgp_vrf)
{
return (bgp_vrf->l3vni && bgp_vrf->l3vni_svi_ifindex);
}
static inline int is_rd_configured(struct bgpevpn *vpn) static inline int is_rd_configured(struct bgpevpn *vpn)
{ {
return (CHECK_FLAG(vpn->flags, VNI_FLAG_RD_CFGD)); return (CHECK_FLAG(vpn->flags, VNI_FLAG_RD_CFGD));