]> git.proxmox.com Git - mirror_frr.git/commitdiff
zebra: remove host prefix mapping in rmac
authorChirag Shah <chirag@nvidia.com>
Fri, 15 Oct 2021 18:47:25 +0000 (11:47 -0700)
committerChirag Shah <chirag@nvidia.com>
Fri, 11 Mar 2022 01:27:15 +0000 (17:27 -0800)
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 <chirag@nvidia.com>
zebra/zebra_vxlan.c

index 6a2bac522c93d85617c5845fdcee91f1cf5969ae..43045bd7ca43203661e51a5b3ab047363b09fe35 100644 (file)
@@ -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);
+               }
        }
 }