]> git.puffer.fish Git - matthieu/frr.git/commitdiff
pimd: stop overloading SRC_IGMP upstream for vxlan local membership
authorAnuradha Karuppiah <anuradhak@cumulusnetworks.com>
Thu, 6 Feb 2020 17:30:51 +0000 (09:30 -0800)
committerAnuradha Karuppiah <anuradhak@cumulusnetworks.com>
Fri, 14 Feb 2020 17:18:30 +0000 (09:18 -0800)
A local membership is created on the vxlan termination device ipmr-lo. This
is done to -
1. Pull multicast vxlan tunnel traffic to the VTEP for termination by
triggering JoinDesired on the BUM multicast group.
2. Include the OIF in the mroute to signal to the dataplane component
that flow needs to be vxlan terminated.

Earlier we were overloading the PIM_UPSTREAM_FLAG_MASK_SRC_IGMP for
this local membership creation but that is creating confusion both in
the state machine and in the show outputs. To avoid that we use the
more apparent PIM_UPSTREAM_FLAG_MASK_SRC_VXLAN_TERM. With this change -
1. We get LHR functionality for VXLAN_TERM mroutes
2. OIF is populated with PIM_OIF_FLAG_PROTO_PIM only

Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
pimd/pim_cmd.c
pimd/pim_ifchannel.c
pimd/pim_ifchannel.h
pimd/pim_mroute.c
pimd/pim_upstream.c
pimd/pim_upstream.h
pimd/pim_vxlan.c
pimd/pim_zebra.c

index 1fa674a6f78dbf428efdb14baadd879ba0f69f69..295b5e379d78b49b859e6249e537f3887a8209cf 100644 (file)
@@ -166,7 +166,7 @@ static void pim_if_membership_refresh(struct interface *ifp)
                                        sg.src = src->source_addr;
                                        sg.grp = grp->group_addr;
                                        pim_ifchannel_local_membership_add(ifp,
-                                                                          &sg);
+                                               &sg, false /*is_vxlan*/);
                                }
 
                        } /* scan group sources */
index 22d6e6298e3426f9b1e29ba69ad0e0cd9e28ad6a..2ea1f4e9a4e25cf8424cb65ec2a4b523092f2db2 100644 (file)
@@ -854,8 +854,9 @@ void pim_ifchannel_join_add(struct interface *ifp, struct in_addr neigh_addr,
                /*
                 * If we are going to be a LHR, we need to note it
                 */
-               if (ch->upstream->parent && (ch->upstream->parent->flags
-                                            & PIM_UPSTREAM_FLAG_MASK_SRC_IGMP)
+               if (ch->upstream->parent &&
+                       (PIM_UPSTREAM_FLAG_TEST_CAN_BE_LHR(
+                                                  ch->upstream->parent->flags))
                    && !(ch->upstream->flags
                         & PIM_UPSTREAM_FLAG_MASK_SRC_LHR)) {
                        pim_upstream_ref(ch->upstream,
@@ -1042,11 +1043,12 @@ void pim_ifchannel_prune(struct interface *ifp, struct in_addr upstream,
 }
 
 int pim_ifchannel_local_membership_add(struct interface *ifp,
-                                      struct prefix_sg *sg)
+                                      struct prefix_sg *sg, bool is_vxlan)
 {
        struct pim_ifchannel *ch, *starch;
        struct pim_interface *pim_ifp;
        struct pim_instance *pim;
+       int up_flags;
 
        /* PIM enabled on interface? */
        pim_ifp = ifp->info;
@@ -1080,7 +1082,9 @@ int pim_ifchannel_local_membership_add(struct interface *ifp,
                }
        }
 
-       ch = pim_ifchannel_add(ifp, sg, 0, PIM_UPSTREAM_FLAG_MASK_SRC_IGMP);
+       up_flags = is_vxlan ? PIM_UPSTREAM_FLAG_MASK_SRC_VXLAN_TERM :
+               PIM_UPSTREAM_FLAG_MASK_SRC_IGMP;
+       ch = pim_ifchannel_add(ifp, sg, 0, up_flags);
 
        ifmembership_set(ch, PIM_IFMEMBERSHIP_INCLUDE);
 
index b36c3236b0bd2f649d24c45a6ce010cf8ee764ea..3d5cbd8ecf8d91784af611443962434a5004042b 100644 (file)
@@ -130,7 +130,7 @@ void pim_ifchannel_prune(struct interface *ifp, struct in_addr upstream,
                         struct prefix_sg *sg, uint8_t source_flags,
                         uint16_t holdtime);
 int pim_ifchannel_local_membership_add(struct interface *ifp,
-                                      struct prefix_sg *sg);
+               struct prefix_sg *sg, bool is_vxlan);
 void pim_ifchannel_local_membership_del(struct interface *ifp,
                                        struct prefix_sg *sg);
 
index 3459abbc191c3626c227bed4155d8d631eb9d985..4afd05ab7619fe2d8247581f4078fbfd6ec4afcb 100644 (file)
@@ -262,7 +262,7 @@ static int pim_mroute_msg_wholepkt(int fd, struct interface *ifp,
 
                up = pim_upstream_find(pim_ifp->pim, &star);
 
-               if (up && PIM_UPSTREAM_FLAG_TEST_SRC_IGMP(up->flags)) {
+               if (up && PIM_UPSTREAM_FLAG_TEST_CAN_BE_LHR(up->flags)) {
                        up = pim_upstream_add(pim_ifp->pim, &sg, ifp,
                                              PIM_UPSTREAM_FLAG_MASK_SRC_LHR,
                                              __PRETTY_FUNCTION__, NULL);
index ec1888f1f7f64b4544b7424360978a41e25d18b6..444ab938f295bc055a0a09d796ec848e36c34c1e 100644 (file)
@@ -2032,7 +2032,7 @@ void pim_upstream_add_lhr_star_pimreg(struct pim_instance *pim)
                if (up->sg.src.s_addr != INADDR_ANY)
                        continue;
 
-               if (!PIM_UPSTREAM_FLAG_TEST_SRC_IGMP(up->flags))
+               if (!PIM_UPSTREAM_FLAG_TEST_CAN_BE_LHR(up->flags))
                        continue;
 
                pim_channel_add_oif(up->channel_oil, pim->regiface,
@@ -2079,7 +2079,7 @@ void pim_upstream_remove_lhr_star_pimreg(struct pim_instance *pim,
                if (up->sg.src.s_addr != INADDR_ANY)
                        continue;
 
-               if (!PIM_UPSTREAM_FLAG_TEST_SRC_IGMP(up->flags))
+               if (!PIM_UPSTREAM_FLAG_TEST_CAN_BE_LHR(up->flags))
                        continue;
 
                if (!nlist) {
index 0e718a3c31d49b8b94f0446706bc856dd4e39662..8d7508287d1ff73910a2a2467a49a8c693022a5c 100644 (file)
 #define PIM_UPSTREAM_FLAG_TEST_MLAG_PEER(flags) ((flags) & PIM_UPSTREAM_FLAG_MASK_MLAG_PEER)
 #define PIM_UPSTREAM_FLAG_TEST_SRC_NOCACHE(flags) ((flags) &PIM_UPSTREAM_FLAG_MASK_SRC_NOCACHE)
 #define PIM_UPSTREAM_FLAG_TEST_USE_RPT(flags) ((flags) & PIM_UPSTREAM_FLAG_MASK_USE_RPT)
+#define PIM_UPSTREAM_FLAG_TEST_CAN_BE_LHR(flags) ((flags) & (PIM_UPSTREAM_FLAG_MASK_SRC_IGMP | PIM_UPSTREAM_FLAG_MASK_SRC_VXLAN_TERM))
 
 #define PIM_UPSTREAM_FLAG_SET_DR_JOIN_DESIRED(flags) ((flags) |= PIM_UPSTREAM_FLAG_MASK_DR_JOIN_DESIRED)
 #define PIM_UPSTREAM_FLAG_SET_DR_JOIN_DESIRED_UPDATED(flags) ((flags) |= PIM_UPSTREAM_FLAG_MASK_DR_JOIN_DESIRED_UPDATED)
index 5c085cc4160eae3ea956f31896cb46a49d4f6f8e..41a57c267c8f2228c36be425b4453176560f7d5e 100644 (file)
@@ -531,7 +531,7 @@ static void pim_vxlan_term_mr_oif_add(struct pim_vxlan_sg *vxlan_sg)
                        vxlan_sg->sg_str, vxlan_sg->term_oif->name);
 
        if (pim_ifchannel_local_membership_add(vxlan_sg->term_oif,
-                               &vxlan_sg->sg)) {
+                               &vxlan_sg->sg, true /*is_vxlan */)) {
                vxlan_sg->flags |= PIM_VXLAN_SGF_OIF_INSTALLED;
                /* update the inherited OIL */
                /* XXX - I don't see the inherited OIL updated when a local
index 7eb648ab865a8a8e44e8d1d50ee14bec6ad795b2..baa6216df20547e9466c7050324d53d524079640 100644 (file)
@@ -547,7 +547,8 @@ static void igmp_source_forward_reevaluate_one(struct pim_instance *pim,
                                        "local membership add for %s as G is now ASM",
                                        pim_str_sg_dump(&sg));
                        pim_ifchannel_local_membership_add(
-                               group->group_igmp_sock->interface, &sg);
+                               group->group_igmp_sock->interface, &sg,
+                               false /*is_vxlan*/);
                }
        }
 }
@@ -765,7 +766,8 @@ void igmp_source_forward_start(struct pim_instance *pim,
          per-interface (S,G) state.
         */
        if (!pim_ifchannel_local_membership_add(
-                                               group->group_igmp_sock->interface, &sg)) {
+                                               group->group_igmp_sock->interface, &sg,
+                                               false /*is_vxlan*/)) {
                if (PIM_DEBUG_MROUTE)
                        zlog_warn("%s: Failure to add local membership for %s",
                                  __PRETTY_FUNCTION__, pim_str_sg_dump(&sg));