mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-06 00:41:20 +00:00
bgpd: Ensure correct checks for EVPN route import
In a situation where a VRF has configured route targets for importing EVPN routes, this configuration may exist prior to the VRF being ready to have EVPN routes installed into it - e.g., still missing the L3VNI configuration or associated interface information. Ensure that this is taken into account during EVPN route import and unimport. Without this fix, EVPN routes would end up being prematurely imported into the VRF routing table and consequently installed as inactive (because the nexthop information would be incorrect when BGP informs zebra). Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
This commit is contained in:
parent
f067bdf8e2
commit
3d0b43d7c5
@ -4459,7 +4459,8 @@ void bgp_evpn_configure_import_rt_for_vrf(struct bgp *bgp_vrf,
|
||||
struct ecommunity *ecomadd)
|
||||
{
|
||||
/* uninstall routes from vrf */
|
||||
uninstall_routes_for_vrf(bgp_vrf);
|
||||
if (is_l3vni_live(bgp_vrf))
|
||||
uninstall_routes_for_vrf(bgp_vrf);
|
||||
|
||||
/* Cleanup the RT to VRF mapping */
|
||||
bgp_evpn_unmap_vrf_from_its_rts(bgp_vrf);
|
||||
@ -4471,11 +4472,11 @@ void bgp_evpn_configure_import_rt_for_vrf(struct bgp *bgp_vrf,
|
||||
listnode_add_sort(bgp_vrf->vrf_import_rtl, ecomadd);
|
||||
SET_FLAG(bgp_vrf->vrf_flags, BGP_VRF_IMPORT_RT_CFGD);
|
||||
|
||||
/* map VRF to its RTs */
|
||||
bgp_evpn_map_vrf_to_its_rts(bgp_vrf);
|
||||
|
||||
/* install routes matching the new VRF */
|
||||
install_routes_for_vrf(bgp_vrf);
|
||||
/* 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);
|
||||
install_routes_for_vrf(bgp_vrf);
|
||||
}
|
||||
}
|
||||
|
||||
void bgp_evpn_unconfigure_import_rt_for_vrf(struct bgp *bgp_vrf,
|
||||
@ -4485,7 +4486,8 @@ void bgp_evpn_unconfigure_import_rt_for_vrf(struct bgp *bgp_vrf,
|
||||
struct ecommunity *ecom = NULL;
|
||||
|
||||
/* uninstall routes from vrf */
|
||||
uninstall_routes_for_vrf(bgp_vrf);
|
||||
if (is_l3vni_live(bgp_vrf))
|
||||
uninstall_routes_for_vrf(bgp_vrf);
|
||||
|
||||
/* Cleanup the RT to VRF mapping */
|
||||
bgp_evpn_unmap_vrf_from_its_rts(bgp_vrf);
|
||||
@ -4509,11 +4511,11 @@ void bgp_evpn_unconfigure_import_rt_for_vrf(struct bgp *bgp_vrf,
|
||||
evpn_auto_rt_import_add_for_vrf(bgp_vrf);
|
||||
}
|
||||
|
||||
/* map VRFs to its RTs */
|
||||
bgp_evpn_map_vrf_to_its_rts(bgp_vrf);
|
||||
|
||||
/* install routes matching this new RT */
|
||||
install_routes_for_vrf(bgp_vrf);
|
||||
/* 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);
|
||||
install_routes_for_vrf(bgp_vrf);
|
||||
}
|
||||
}
|
||||
|
||||
void bgp_evpn_configure_export_rt_for_vrf(struct bgp *bgp_vrf,
|
||||
|
@ -275,6 +275,11 @@ static inline int is_vni_live(struct bgpevpn *vpn)
|
||||
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)
|
||||
{
|
||||
return (CHECK_FLAG(vpn->flags, VNI_FLAG_RD_CFGD));
|
||||
|
Loading…
Reference in New Issue
Block a user