From 92475ca4873fd6ccf1f804e675c912c698c486ce Mon Sep 17 00:00:00 2001 From: Chirag Shah Date: Mon, 6 Jul 2020 11:13:54 -0700 Subject: [PATCH] zebra: vrf disable clean up evpn rmac nxthp cache In networking restart event, l3vni (vxlan) interface followed by associated vrf interfaces go down/deleted. L3vni (oper) down event (from zebra to bgp) triggers to clean up/un-import evpn routes (one-by-one) from the vrf table, zebra internally removes the route entry from nexthop and RMAC hash. When all the routes references in nexthop and RMAC db removed, both (nexthop/rmac) are suppose to be uninstalled from the bridge fdb and neigh table. While evpn routes removal in progress, a vrf disable event removes l3vni to its vrf association. Subsequent bgp to evpn routes removal does not clean up thus evpn routes reference to nexthop and RMAC remains in zebra hash. bridge fdb and neigh tables are flushed out since networking restart brings down all interfaces which results in flush of fdb and neigh tables. By product is the zebra does not install nexthop and rmac when routes are re-imported into vrf in VNI/VRF up event. The fix is in vrf disable event to flush all l3vni's nexthop and rmac db. Ticket:CM-30338 Reviewed By:CCR-10489 Testing Done: Performed multiple networking restart and checked neigh and bridge fdb tables for respective nexthop and router mac entry programmed. Signed-off-by: Chirag Shah --- zebra/zebra_vxlan.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/zebra/zebra_vxlan.c b/zebra/zebra_vxlan.c index 66441e1756..9a1cde3bc3 100644 --- a/zebra/zebra_vxlan.c +++ b/zebra/zebra_vxlan.c @@ -9475,8 +9475,15 @@ int zebra_vxlan_vrf_disable(struct zebra_vrf *zvrf) if (!zl3vni) return 0; - zl3vni->vrf_id = VRF_UNKNOWN; zebra_vxlan_process_l3vni_oper_down(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); + + zl3vni->vrf_id = VRF_UNKNOWN; + return 0; } -- 2.39.5