summaryrefslogtreecommitdiffstats
path: root/bgpd/bgp_evpn.c
diff options
context:
space:
mode:
authorPhilippe Guibert <philippe.guibert@6wind.com>2021-08-17 14:42:30 +0200
committermergify-bot <noreply@mergify.io>2021-09-02 21:34:56 +0200
commit4204021e46dec75b09cbbcdcdfa2fe163fa00f34 (patch)
treea3ff196abdf8bb97ccadc8850d41b3c0f6938347 /bgpd/bgp_evpn.c
parentMerge pull request #9538 from donaldsharp/bgp_view_not_working (diff)
downloadfrr-4204021e46dec75b09cbbcdcdfa2fe163fa00f34.tar.xz
frr-4204021e46dec75b09cbbcdcdfa2fe163fa00f34.zip
bgpd: update auto route target for l3vni appropriately
The BGP configuration for BGP EVPN RT5 setup consists in mainly 2 bgp instances (eventually one is enough) and L3VNI config. When L3VNI is configured before BGP instances, and BGP route targets are auto derived as per rfc8365, then, the obtained route targets are wrong. For instance, the following can be obtained: => show bgp vrf cust1 vni BGP VRF: cust1 Local-Ip: 10.209.36.1 L3-VNI: 1000 Rmac: da:85:42:ba:2a:e9 VNI Filter: none L2-VNI List: Export-RTs: RT:12757:1000 Import-RTs: RT:12757:1000 RD: 65000:1000 whereas the derived route targets should be the below ones: => show bgp vrf cust1 vni BGP VRF: cust1 Local-Ip: 10.209.36.1 L3-VNI: 1000 Rmac: 72:f3:af:a0:98:80 VNI Filter: none L2-VNI List: Export-RTs: RT:12757:268436456 Import-RTs: RT:12757:268436456 RD: 65000:1000 There is an update handler that updates appropriately L2VNIs. But this is not the case for L3VNIs. Add the missing code. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
Diffstat (limited to 'bgpd/bgp_evpn.c')
-rw-r--r--bgpd/bgp_evpn.c50
1 files changed, 50 insertions, 0 deletions
diff --git a/bgpd/bgp_evpn.c b/bgpd/bgp_evpn.c
index cbd29c146..5a4b46f37 100644
--- a/bgpd/bgp_evpn.c
+++ b/bgpd/bgp_evpn.c
@@ -4335,6 +4335,54 @@ static void update_autort_vni(struct hash_bucket *bucket, struct bgp *bgp)
}
/*
+ * Handle autort change for L3VNI.
+ */
+static void update_autort_l3vni(struct bgp *bgp)
+{
+ if ((CHECK_FLAG(bgp->vrf_flags, BGP_VRF_IMPORT_RT_CFGD))
+ && (CHECK_FLAG(bgp->vrf_flags, BGP_VRF_EXPORT_RT_CFGD)))
+ return;
+
+ if (!CHECK_FLAG(bgp->vrf_flags, BGP_VRF_IMPORT_RT_CFGD)) {
+ if (is_l3vni_live(bgp))
+ uninstall_routes_for_vrf(bgp);
+
+ /* Cleanup the RT to VRF mapping */
+ bgp_evpn_unmap_vrf_from_its_rts(bgp);
+
+ /* Remove auto generated RT */
+ evpn_auto_rt_import_delete_for_vrf(bgp);
+
+ list_delete_all_node(bgp->vrf_import_rtl);
+
+ /* Map auto derive or configured RTs */
+ evpn_auto_rt_import_add_for_vrf(bgp);
+ }
+
+ if (!CHECK_FLAG(bgp->vrf_flags, BGP_VRF_EXPORT_RT_CFGD)) {
+ list_delete_all_node(bgp->vrf_export_rtl);
+
+ evpn_auto_rt_export_delete_for_vrf(bgp);
+
+ evpn_auto_rt_export_add_for_vrf(bgp);
+
+ if (is_l3vni_live(bgp))
+ bgp_evpn_map_vrf_to_its_rts(bgp);
+ }
+
+ if (!is_l3vni_live(bgp))
+ return;
+
+ /* advertise type-5 routes if needed */
+ update_advertise_vrf_routes(bgp);
+
+ /* install all remote routes belonging to this l3vni
+ * into corresponding vrf
+ */
+ install_routes_for_vrf(bgp);
+}
+
+/*
* Public functions.
*/
@@ -4706,6 +4754,8 @@ void bgp_evpn_handle_autort_change(struct bgp *bgp)
(void (*)(struct hash_bucket *,
void*))update_autort_vni,
bgp);
+ if (bgp->l3vni)
+ update_autort_l3vni(bgp);
}
/*