]> git.puffer.fish Git - matthieu/frr.git/commitdiff
bgpd: fix evpn mh esi flap remove local routes
authorChirag Shah <chirag@nvidia.com>
Tue, 8 Oct 2024 02:04:43 +0000 (19:04 -0700)
committerMergify <37929162+mergify[bot]@users.noreply.github.com>
Tue, 15 Oct 2024 05:21:53 +0000 (05:21 +0000)
In symmetric routing, when local ESI is down,
the MH peer learnt local mac-ip
prefix is installed into teannt vrf (given l3vni).

When ESI is back up and associated to evi/vni then
remove the local synced mac-ip imported routes from the
tenant vrf as local neigh/arp is present.

Ticket: #3878699
Testing:

peer advertised mac-ip route:
*> [2]:[0]:[48]:[aa:aa:aa:00:00:01]:[32]:[45.0.0.51] RD 27.0.0.4:9
                    27.0.0.4 (spine-1)
                                                           0 64435 65016 i
                    ESI:03:44:38:39:ff:ff:01:00:00:01
                    RT:65016:1000 RT:65016:4000 ET:8 Rmac:44:38:39:ff:ff:16

When local ESI is flapped
torm-11:# ip neigh show 45.0.0.51
45.0.0.51 dev vlan1000 lladdr aa:aa:aa:00:00:01 REACHABLE proto zebra

Before fix:
(The imported route remained in tenant-vrf)
torm-11:# ip route show vrf vrf1 45.0.0.51
45.0.0.51 nhid 257 proto bgp metric 20

After fix:

torm-11# ip route show vrf vrf1 45.0.0.51
torm-11#

trace:
2024/10/11 18:19:29 BGP: [JMP3T-178G8] route [2]:[0]:[48]:[00:02:00:00:00:08]:[32]:[21.1.0.5]
is matched on local esi 03:00:00:00:77:01:04:00:00:0e, uninstall from VRF tenant1 route table

Signed-off-by: Chirag Shah <chirag@nvidia.com>
(cherry picked from commit 3f00709a39ab2fe6f4bbae3d8f4b17baaab2e3dd)

bgpd/bgp_evpn.c
bgpd/bgp_evpn.h
bgpd/bgp_evpn_mh.c
bgpd/bgp_evpn_mh.h

index 7af6ff7ce34f3d8a19b30d36f72d6ebd9cba30c4..39cc320b300a59e8f8bac5be143160c45cd140f7 100644 (file)
@@ -3451,9 +3451,8 @@ uninstall_evpn_route_entry_in_vni_mac(struct bgp *bgp, struct bgpevpn *vpn,
  * Uninstall route entry from the VRF routing table and send message
  * to zebra, if appropriate.
  */
-static int uninstall_evpn_route_entry_in_vrf(struct bgp *bgp_vrf,
-                                            const struct prefix_evpn *evp,
-                                            struct bgp_path_info *parent_pi)
+int uninstall_evpn_route_entry_in_vrf(struct bgp *bgp_vrf, const struct prefix_evpn *evp,
+                                     struct bgp_path_info *parent_pi)
 {
        struct bgp_dest *dest;
        struct bgp_path_info *pi;
@@ -3820,10 +3819,8 @@ static int bgp_evpn_route_rmac_self_check(struct bgp *bgp_vrf,
 }
 
 /* don't import hosts that are locally attached */
-static inline bool
-bgp_evpn_skip_vrf_import_of_local_es(struct bgp *bgp_vrf,
-                                    const struct prefix_evpn *evp,
-                                    struct bgp_path_info *pi, int install)
+bool bgp_evpn_skip_vrf_import_of_local_es(struct bgp *bgp_vrf, const struct prefix_evpn *evp,
+                                         struct bgp_path_info *pi, int install)
 {
        esi_t *esi;
 
index dc82bcfba9e9cc9afba583518b1668a6a650f45d..10eff1dcfb2fa64ae5f330c089b2c779b006c793 100644 (file)
@@ -195,4 +195,8 @@ extern enum zclient_send_status
 evpn_zebra_uninstall(struct bgp *bgp, struct bgpevpn *vpn,
                     const struct prefix_evpn *p, struct bgp_path_info *pi,
                     bool is_sync);
+bool bgp_evpn_skip_vrf_import_of_local_es(struct bgp *bgp_vrf, const struct prefix_evpn *evp,
+                                         struct bgp_path_info *pi, int install);
+int uninstall_evpn_route_entry_in_vrf(struct bgp *bgp_vrf, const struct prefix_evpn *evp,
+                                     struct bgp_path_info *parent_pi);
 #endif /* _QUAGGA_BGP_EVPN_H */
index d723a2b1be6f2e7e3fa5ce933783f8ae80b182e1..aa28b6f3d8400997f3fe1bb9f7cb87a7941170ea 100644 (file)
@@ -3804,6 +3804,7 @@ int bgp_evpn_local_es_evi_add(struct bgp *bgp, esi_t *esi, vni_t vni)
                bgp_evpn_ead_evi_route_update(bgp, es, vpn, &p);
        }
 
+       bgp_evpn_local_es_evi_unistall_local_routes_in_vrfs(es, es_evi);
        /* update EAD-ES */
        if (bgp_evpn_local_es_is_active(es))
                bgp_evpn_ead_es_route_update(bgp, es);
@@ -5053,3 +5054,38 @@ void bgp_evpn_switch_ead_evi_rx(void)
                }
        }
 }
+
+void bgp_evpn_local_es_evi_unistall_local_routes_in_vrfs(struct bgp_evpn_es *es,
+                                                        struct bgp_evpn_es_evi *es_evi)
+{
+       struct listnode *node;
+       struct bgp_path_es_info *es_info;
+       struct bgp_path_info *pi;
+       const struct prefix_evpn *evp;
+       struct bgp_evpn_es_vrf *es_vrf = es_evi->es_vrf;
+
+       if (!es_vrf)
+               return;
+
+       for (ALL_LIST_ELEMENTS_RO(es->macip_global_path_list, node, es_info)) {
+               pi = es_info->pi;
+
+               if (!bgp_evpn_is_macip_path(pi))
+                       continue;
+
+               evp = (const struct prefix_evpn *)bgp_dest_get_prefix(pi->net);
+
+               if (!(CHECK_FLAG(pi->flags, BGP_PATH_VALID) && pi->type == ZEBRA_ROUTE_BGP &&
+                     pi->sub_type == BGP_ROUTE_NORMAL))
+                       continue;
+
+               if (BGP_DEBUG(evpn_mh, EVPN_MH_RT))
+                       zlog_debug("route %pFX is matched on local esi %s, uninstall from %s route table",
+                                  evp, es->esi_str, es_vrf->bgp_vrf->name_pretty);
+
+               if (!bgp_evpn_skip_vrf_import_of_local_es(es_vrf->bgp_vrf, evp, pi, 0))
+                       continue;
+
+               uninstall_evpn_route_entry_in_vrf(es_vrf->bgp_vrf, evp, pi);
+       }
+}
index 5d393c37a20df72899cbe1dd7c7dadb53cece7e0..149bf384b1d87bca734874263346e8fbf2f125b3 100644 (file)
@@ -459,5 +459,7 @@ extern void bgp_evpn_path_nh_add(struct bgp *bgp_vrf, struct bgp_path_info *pi);
 extern void bgp_evpn_path_nh_del(struct bgp *bgp_vrf, struct bgp_path_info *pi);
 extern void bgp_evpn_mh_config_ead_export_rt(struct bgp *bgp,
                                             struct ecommunity *ecom, bool del);
+extern void bgp_evpn_local_es_evi_unistall_local_routes_in_vrfs(struct bgp_evpn_es *es,
+                                                               struct bgp_evpn_es_evi *es_evi);
 
 #endif /* _FRR_BGP_EVPN_MH_H */