]> git.puffer.fish Git - mirror/frr.git/commitdiff
pimd: Use correct flag to add an oif
authorDonald Sharp <sharpd@cumulusnetworks.com>
Wed, 25 Jan 2017 19:47:04 +0000 (14:47 -0500)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Mon, 30 Jan 2017 17:51:45 +0000 (12:51 -0500)
When we are creating the igmp ifchannel we were creating
it with both a P and a I flag.  This was causing
it to not be cleaned up properly when the interface
was shut down.  Subsuquently when the interface
came back up we would attempt to add it back in
but it would fail.

Ticket: CM-14586
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
pimd/pim_ifchannel.c
pimd/pim_ifchannel.h
pimd/pim_zebra.c

index 8d2de3c8785893babbb62e6212c8131a9e6e3180..7056ade501460f15fdf02b8f7da50d5d97c46b79 100644 (file)
@@ -142,7 +142,11 @@ void pim_ifchannel_delete(struct pim_ifchannel *ch)
 
   if (ch->upstream->channel_oil)
     {
-      pim_channel_del_oif (ch->upstream->channel_oil, ch->interface, PIM_OIF_FLAG_PROTO_PIM);
+      uint32_t mask = PIM_OIF_FLAG_PROTO_PIM;
+      if (ch->upstream->flags & PIM_UPSTREAM_FLAG_MASK_SRC_IGMP)
+        mask = PIM_OIF_FLAG_PROTO_IGMP;
+
+      pim_channel_del_oif (ch->upstream->channel_oil, ch->interface, mask);
       /*
        * Do we have any S,G's that are inheriting?
        * Nuke from on high too.
@@ -929,8 +933,9 @@ void pim_ifchannel_prune(struct interface *ifp,
   }
 }
 
-void pim_ifchannel_local_membership_add(struct interface *ifp,
-                                       struct prefix_sg *sg)
+int
+pim_ifchannel_local_membership_add(struct interface *ifp,
+                                  struct prefix_sg *sg)
 {
   struct pim_ifchannel *ch;
   struct pim_interface *pim_ifp;
@@ -938,13 +943,13 @@ void pim_ifchannel_local_membership_add(struct interface *ifp,
   /* PIM enabled on interface? */
   pim_ifp = ifp->info;
   if (!pim_ifp)
-    return;
+    return 0;
   if (!PIM_IF_TEST_PIM(pim_ifp->options))
-    return;
+    return 0;
 
   ch = pim_ifchannel_add(ifp, sg, PIM_UPSTREAM_FLAG_MASK_SRC_IGMP);
   if (!ch) {
-    return;
+    return 0;
   }
 
   ifmembership_set(ch, PIM_IFMEMBERSHIP_INCLUDE);
@@ -969,6 +974,8 @@ void pim_ifchannel_local_membership_add(struct interface *ifp,
            }
         }
     }
+
+  return 1;
 }
 
 void pim_ifchannel_local_membership_del(struct interface *ifp,
index bfe632135cfba29e5cb071c6b6e75698c7f2c697..a3dc0e9d83fc8d5da402eefefafffe55d843d92f 100644 (file)
@@ -130,8 +130,8 @@ void pim_ifchannel_prune(struct interface *ifp,
                         struct prefix_sg *sg,
                         uint8_t source_flags,
                         uint16_t holdtime);
-void pim_ifchannel_local_membership_add(struct interface *ifp,
-                                       struct prefix_sg *sg);
+int pim_ifchannel_local_membership_add(struct interface *ifp,
+                                      struct prefix_sg *sg);
 void pim_ifchannel_local_membership_del(struct interface *ifp,
                                        struct prefix_sg *sg);
 
index aa09819fbe95fd71afcf59bca62b5c049f3821ff..1bb4852c6b0dfdea11365e113e9cd72654f06346 100644 (file)
@@ -1097,7 +1097,13 @@ void igmp_source_forward_start(struct igmp_source *source)
     Feed IGMPv3-gathered local membership information into PIM
     per-interface (S,G) state.
    */
-  pim_ifchannel_local_membership_add(group->group_igmp_sock->interface, &sg);
+  if (!pim_ifchannel_local_membership_add(group->group_igmp_sock->interface, &sg))
+    {
+      if (PIM_DEBUG_MROUTE)
+       zlog_warn ("%s: Failure to add local membership for %s",
+                  __PRETTY_FUNCTION__, pim_str_sg_dump (&sg));
+      return;
+    }
 
   IGMP_SOURCE_DO_FORWARDING(source->source_flags);
 }
@@ -1167,6 +1173,7 @@ void igmp_source_forward_stop(struct igmp_source *source)
 void pim_forward_start(struct pim_ifchannel *ch)
 {
   struct pim_upstream *up = ch->upstream;
+  uint32_t mask = PIM_OIF_FLAG_PROTO_PIM;
 
   if (PIM_DEBUG_PIM_TRACE) {
     char source_str[INET_ADDRSTRLEN];
@@ -1206,9 +1213,10 @@ void pim_forward_start(struct pim_ifchannel *ch)
     }
   }
 
-  pim_channel_add_oif(up->channel_oil,
-                     ch->interface,
-                     PIM_OIF_FLAG_PROTO_PIM);
+  if (up->flags & PIM_UPSTREAM_FLAG_MASK_SRC_IGMP)
+    mask = PIM_OIF_FLAG_PROTO_IGMP;
+
+  pim_channel_add_oif(up->channel_oil, ch->interface, mask);
 }
 
 void pim_forward_stop(struct pim_ifchannel *ch)