Skip to content

Commit

Permalink
bgpd: Incorrect auto-RT formed when L3VNI is not configured
Browse files Browse the repository at this point in the history
We use ASN:VNI format to calculate auto RT for L3VNI.
When L3VNI is not configured, if we delete the configured RT, incorrect auto-RT
value is generated as VRF VNI is 0.

Fix:
Do not configure auto-RT if L3VNI is not configured.

Trigger:
1. Delete L3VNI
2. Delete configured RT.

Before fix:

dev# sh bgp vrf vrf-blue vni
BGP VRF: vrf-blue
  Local-Ip: 10.100.0.1
  L3-VNI: 0
  Rmac: 00:00:00:00:00:00
  VNI Filter: none
  L2-VNI List:

  Export-RTs:
  RT:101:0
  Import-RTs:
  RT:101:0
  RD: 10.100.0.1:2

After fix:

dev# sh bgp vrf vrf-blue vni
BGP VRF: vrf-blue
  Local-Ip: 10.100.0.1
  L3-VNI: 0
  Rmac: 00:00:00:00:00:00
  VNI Filter: none
  L2-VNI List:

  Export-RTs:

  Import-RTs:

  RD: 10.100.0.1:2

Signed-off-by: Ameya Dharkar <adharkar@vmware.com>
  • Loading branch information
Ameya Dharkar committed Jun 22, 2020
1 parent 8803809 commit ebdc9e6
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions bgpd/bgp_evpn.c
Original file line number Diff line number Diff line change
Expand Up @@ -4715,7 +4715,8 @@ void bgp_evpn_unconfigure_import_rt_for_vrf(struct bgp *bgp_vrf,
/* fallback to auto import rt, if this was the last RT */
if (bgp_vrf->vrf_import_rtl && list_isempty(bgp_vrf->vrf_import_rtl)) {
UNSET_FLAG(bgp_vrf->vrf_flags, BGP_VRF_IMPORT_RT_CFGD);
evpn_auto_rt_import_add_for_vrf(bgp_vrf);
if (is_l3vni_live(bgp_vrf))
evpn_auto_rt_import_add_for_vrf(bgp_vrf);
}

/* map VRFs to its RTs and install routes matching this new RT */
Expand All @@ -4735,7 +4736,8 @@ void bgp_evpn_configure_export_rt_for_vrf(struct bgp *bgp_vrf,
listnode_add_sort(bgp_vrf->vrf_export_rtl, ecomadd);
SET_FLAG(bgp_vrf->vrf_flags, BGP_VRF_EXPORT_RT_CFGD);

bgp_evpn_handle_export_rt_change_for_vrf(bgp_vrf);
if (is_l3vni_live(bgp_vrf))
bgp_evpn_handle_export_rt_change_for_vrf(bgp_vrf);
}

void bgp_evpn_unconfigure_export_rt_for_vrf(struct bgp *bgp_vrf,
Expand Down Expand Up @@ -4769,10 +4771,12 @@ void bgp_evpn_unconfigure_export_rt_for_vrf(struct bgp *bgp_vrf,
/* fall back to auto-generated RT if this was the last RT */
if (list_isempty(bgp_vrf->vrf_export_rtl)) {
UNSET_FLAG(bgp_vrf->vrf_flags, BGP_VRF_EXPORT_RT_CFGD);
evpn_auto_rt_export_add_for_vrf(bgp_vrf);
if (is_l3vni_live(bgp_vrf))
evpn_auto_rt_export_add_for_vrf(bgp_vrf);
}

bgp_evpn_handle_export_rt_change_for_vrf(bgp_vrf);
if (is_l3vni_live(bgp_vrf))
bgp_evpn_handle_export_rt_change_for_vrf(bgp_vrf);
}

/*
Expand Down

0 comments on commit ebdc9e6

Please sign in to comment.