From ae9e6beaeae78bc7fe119b7bb772c7e2278e5514 Mon Sep 17 00:00:00 2001 From: Chirag Shah Date: Fri, 15 Oct 2021 11:47:25 -0700 Subject: [PATCH] zebra: remove host prefix mapping in rmac RMAC keeping list of nexthops to keep track of its existiance, remove the (old way) host prefix mapping. Ticket: #2798406 Reviewed By: Testing Done: TORS1# show evpn rmac vni 4001 mac 44:38:39:ff:ff:01 MAC: 44:38:39:ff:ff:01 Remote VTEP: 36.0.0.11 Refcount: 0 Prefixes: Signed-off-by: Chirag Shah --- zebra/zebra_vxlan.c | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/zebra/zebra_vxlan.c b/zebra/zebra_vxlan.c index 6a2bac522c..43045bd7ca 100644 --- a/zebra/zebra_vxlan.c +++ b/zebra/zebra_vxlan.c @@ -1382,8 +1382,6 @@ static int zl3vni_remote_rmac_add(struct zebra_l3vni *zl3vni, zl3vni_rmac_install(zl3vni, zrmac); } - rb_find_or_add_host(&zrmac->host_rb, host_prefix); - return 0; } @@ -1396,20 +1394,7 @@ static void zl3vni_remote_rmac_del(struct zebra_l3vni *zl3vni, { struct ipaddr ipv4_vtep; - rb_delete_host(&zrmac->host_rb, host_prefix); - - if (RB_EMPTY(host_rb_tree_entry, &zrmac->host_rb)) { - /* uninstall from kernel */ - zl3vni_rmac_uninstall(zl3vni, zrmac); - - /* Send RMAC for FPM processing */ - hook_call(zebra_rmac_update, zrmac, zl3vni, true, - "RMAC deleted"); - - /* del the rmac entry */ - zl3vni_rmac_del(zl3vni, zrmac); - /* if nh is already deleted fall back to one in the list */ - } else if (!zl3vni_nh_lookup(zl3vni, vtep_ip)) { + if (!zl3vni_nh_lookup(zl3vni, vtep_ip)) { memset(&ipv4_vtep, 0, sizeof(struct ipaddr)); ipv4_vtep.ipa_type = IPADDR_V4; if (vtep_ip->ipa_type == IPADDR_V6) @@ -1441,6 +1426,23 @@ static void zl3vni_remote_rmac_del(struct zebra_l3vni *zl3vni, /* install rmac in kernel */ zl3vni_rmac_install(zl3vni, zrmac); } + + if (!listcount(zrmac->nh_list)) { + /* uninstall from kernel */ + zl3vni_rmac_uninstall(zl3vni, zrmac); + + /* Send RMAC for FPM processing */ + hook_call(zebra_rmac_update, zrmac, zl3vni, true, + "RMAC deleted"); + + if (IS_ZEBRA_DEBUG_VXLAN) + zlog_debug( + "L3VNI %u RMAC %pEA vtep_ip %pIA delete", + zl3vni->vni, &zrmac->macaddr, vtep_ip); + + /* del the rmac entry */ + zl3vni_rmac_del(zl3vni, zrmac); + } } } -- 2.39.5