]> git.puffer.fish Git - matthieu/frr.git/commitdiff
zebra: Fix for mcast-group update and delete per vni for svd
authorsharathr <sharathr@cumulusnetworks.com>
Tue, 19 Oct 2021 11:01:50 +0000 (04:01 -0700)
committerStephen Worley <sworley@nvidia.com>
Mon, 13 Feb 2023 23:12:05 +0000 (18:12 -0500)
Ticket: 2698649
Testing Done: precommit and evpn-min

Problem:
When the mcast-group is updated, the changes were being read from the netlink
and populated by zebra, but when kernel sends the delete of fdb delete for the
group, we are deleting the mcast-group that we newly updated. This is because,
currently we blindly reset the mcast-group during fdb delete without checking
for mcast-group associated to the vni.

Fix is to separate add/update and delete mcast-group functions and to check
for mcast-group before resetting during delete.

Signed-off-by: sramamurthy <sramamurthy@nvidia.com>
zebra/rt_netlink.c
zebra/zebra_vxlan_if.c
zebra/zebra_vxlan_if.h

index 7895c3226e49f20dc62f89fcbbcc2be506e6810e..8bf59e02c783d5aed0bf87f17c7ad1408a318d46 100644 (file)
@@ -3715,7 +3715,7 @@ static int netlink_macfdb_change(struct nlmsghdr *h, int len, ns_id_t ns_id)
                                return 0;
 
                        if (vni_mcast_grp)
-                               return zebra_vxlan_if_vni_mcast_group_update(
+                               return zebra_vxlan_if_vni_mcast_group_add_update(
                                        ifp, vni, &vtep_ip);
 
                        return zebra_vxlan_dp_network_mac_add(
@@ -3742,8 +3742,8 @@ static int netlink_macfdb_change(struct nlmsghdr *h, int len, ns_id_t ns_id)
 
        if (dst_present) {
                if (vni_mcast_grp)
-                       return zebra_vxlan_if_vni_mcast_group_update(ifp, vni,
-                                                                    NULL);
+                       return zebra_vxlan_if_vni_mcast_group_del(ifp, vni,
+                                                                 &vtep_ip);
 
                if (is_zero_mac(&mac) && vni)
                        return zebra_vxlan_check_readd_vtep(ifp, vni, vtep_ip);
index 31cef767dec48c39f9ccf801b25cd62b1b5d8270..08e07b60a2990fcb02560b4a10bbb4ca6ba7051c 100644 (file)
@@ -806,8 +806,9 @@ int zebra_vxlan_if_vni_table_add_update(struct interface *ifp,
        return 0;
 }
 
-int zebra_vxlan_if_vni_mcast_group_update(struct interface *ifp, vni_t vni_id,
-                                         struct in_addr *mcast_group)
+int zebra_vxlan_if_vni_mcast_group_add_update(struct interface *ifp,
+                                             vni_t vni_id,
+                                             struct in_addr *mcast_group)
 {
        struct zebra_if *zif;
        struct zebra_vxlan_vni *vni;
@@ -826,10 +827,35 @@ int zebra_vxlan_if_vni_mcast_group_update(struct interface *ifp, vni_t vni_id,
        ctx.old_vni.mcast_grp = vni->mcast_grp;
        ctx.chgflags = ZEBRA_VXLIF_MCAST_GRP_CHANGE;
 
-       if (mcast_group)
-               vni->mcast_grp = *mcast_group;
-       else
-               memset(&vni->mcast_grp, 0, sizeof(vni->mcast_grp));
+       vni->mcast_grp = *mcast_group;
+
+       return zebra_vxlan_if_update_vni(ifp, vni, &ctx);
+}
+
+int zebra_vxlan_if_vni_mcast_group_del(struct interface *ifp, vni_t vni_id,
+                                      struct in_addr *mcast_group)
+{
+       struct zebra_if *zif = NULL;
+       struct zebra_vxlan_vni *vni;
+       struct zebra_vxlan_if_update_ctx ctx;
+
+       zif = (struct zebra_if *)ifp->info;
+
+       if (!IS_ZEBRA_VXLAN_IF_SVD(zif))
+               return 0;
+
+       vni = zebra_vxlan_if_vni_find(zif, vni_id);
+       if (!vni)
+               return 0;
+
+       if (memcmp(mcast_group, &vni->mcast_grp, sizeof(*mcast_group)))
+               return 0;
+
+       memset(&ctx, 0, sizeof(ctx));
+       ctx.old_vni.mcast_grp = vni->mcast_grp;
+       ctx.chgflags = ZEBRA_VXLIF_MCAST_GRP_CHANGE;
+
+       memset(&vni->mcast_grp, 0, sizeof(vni->mcast_grp));
 
        return zebra_vxlan_if_update_vni(ifp, vni, &ctx);
 }
index 7d2ddb2d8d237323780445d263d69e0132083161..8a03acbf1ea0df28090f05431a2332db64d91df2 100644 (file)
@@ -64,9 +64,12 @@ extern void zebra_vxlan_if_vni_walk(struct zebra_if *zif,
                                    void *arg);
 extern vni_t zebra_vxlan_if_access_vlan_vni_find(struct zebra_if *zif,
                                                 struct interface *br_if);
-extern int zebra_vxlan_if_vni_mcast_group_update(struct interface *ifp,
-                                                vni_t vni_id,
-                                                struct in_addr *mcast_group);
+extern int
+zebra_vxlan_if_vni_mcast_group_add_update(struct interface *ifp, vni_t vni_id,
+                                         struct in_addr *mcast_group);
+extern int zebra_vxlan_if_vni_mcast_group_del(struct interface *ifp,
+                                             vni_t vni_id,
+                                             struct in_addr *mcast_group);
 extern int zebra_vxlan_if_vni_down(struct interface *ifp,
                                   struct zebra_vxlan_vni *vni);
 extern int zebra_vxlan_if_down(struct interface *ifp);