From b6587fc2af3a83550586cd5fbe83f4643dcc6655 Mon Sep 17 00:00:00 2001 From: Chirag Shah Date: Fri, 28 Jun 2019 10:42:08 -0700 Subject: [PATCH] zebra: evpn entries are not cleaned upon frr stop As part of PR 4458, when a client (bgpd) goes down, zebra cleans up any evpn state including remotely learned neighs, macs and vteps are suppose to be cleaned up, uninstall from kernel tables. Neighs (arps), macs and vteps (HREP entries) were not removed from kernel tables as the uninstall flag as not set. Clean up l3vni associated remote neighs, macs and vteps. Ticket:CM-25468 Reviewed By:CCR-8889 Testing Done: Validated in evpn symmetric routing topology where remotely learned l2/l3 vnis neigh, macs and remote vtep (hrep) entries are installed in kernel table, perform systemctl stop frr.service and validated all remotely learned entries cleaned up from kernel tables. Signed-off-by: Chirag Shah --- zebra/zebra_vxlan.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/zebra/zebra_vxlan.c b/zebra/zebra_vxlan.c index a3a630d53..222d91105 100644 --- a/zebra/zebra_vxlan.c +++ b/zebra/zebra_vxlan.c @@ -9774,22 +9774,35 @@ static void zvni_evpn_cfg_cleanup(struct hash_bucket *bucket, void *ctxt) zvni->advertise_svi_macip = 0; zvni->advertise_subnet = 0; - zvni_neigh_del_all(zvni, 0, 0, + zvni_neigh_del_all(zvni, 1, 0, DEL_REMOTE_NEIGH | DEL_REMOTE_NEIGH_FROM_VTEP); - zvni_mac_del_all(zvni, 0, 0, + zvni_mac_del_all(zvni, 1, 0, DEL_REMOTE_MAC | DEL_REMOTE_MAC_FROM_VTEP); - zvni_vtep_del_all(zvni, 0); + zvni_vtep_del_all(zvni, 1); } /* Cleanup EVPN configuration of a specific VRF */ static void zebra_evpn_vrf_cfg_cleanup(struct zebra_vrf *zvrf) { + zebra_l3vni_t *zl3vni = NULL; + zvrf->advertise_all_vni = 0; zvrf->advertise_gw_macip = 0; zvrf->advertise_svi_macip = 0; zvrf->vxlan_flood_ctrl = VXLAN_FLOOD_HEAD_END_REPL; hash_iterate(zvrf->vni_table, zvni_evpn_cfg_cleanup, NULL); + + if (zvrf->l3vni) + zl3vni = zl3vni_lookup(zvrf->l3vni); + if (zl3vni) { + /* delete and uninstall all rmacs */ + hash_iterate(zl3vni->rmac_table, zl3vni_del_rmac_hash_entry, + zl3vni); + /* delete and uninstall all next-hops */ + hash_iterate(zl3vni->nh_table, zl3vni_del_nh_hash_entry, + zl3vni); + } } /* Cleanup BGP EVPN configuration upon client disconnect */ -- 2.39.5