]> git.proxmox.com Git - mirror_frr.git/commitdiff
pimd: Fix where we handle the inherited_olist for ifchannel
authorDonald Sharp <sharpd@cumulusnetworks.com>
Mon, 5 Dec 2016 21:26:59 +0000 (16:26 -0500)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Thu, 22 Dec 2016 01:26:18 +0000 (20:26 -0500)
When we receive a new *,G ifchannel, handle the inherited_olist
for S,G mroutes in a place where it is more appropriate.

Ticket: CM-13892
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Reviewed-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
pimd/pim_ifchannel.c
pimd/pim_join.c

index 17538526540c7fbc06ed9e212451ce3a5f0dadbb..efb1e3c65e28c30f011fef9c0862342d5a2bfe1c 100644 (file)
@@ -229,6 +229,58 @@ void pim_ifchannel_ifjoin_switch(const char *caller,
 
   ch->ifjoin_state = new_state;
 
+  if (ch->sg.src.s_addr == INADDR_ANY)
+    {
+      struct pim_upstream *up = ch->upstream;
+      struct pim_upstream *child;
+      struct listnode *up_node;
+
+      if (up)
+       {
+         if (ch->ifjoin_state == PIM_IFJOIN_NOINFO)
+           {
+             for (ALL_LIST_ELEMENTS_RO (up->sources, up_node, child))
+               {
+                 struct channel_oil *c_oil = child->channel_oil;
+                 struct pim_interface *pim_ifp = ch->interface->info;
+
+                 if (PIM_DEBUG_PIM_TRACE)
+                   zlog_debug("%s %s: Prune(S,G)=%s from %s",
+                              __FILE__, __PRETTY_FUNCTION__,
+                              child->sg_str, up->sg_str);
+                 if (!c_oil)
+                   continue;
+
+                 if (!pim_upstream_evaluate_join_desired (child))
+                   pim_channel_del_oif (c_oil, ch->interface, PIM_OIF_FLAG_PROTO_PIM);
+
+                 /*
+                  * If the S,G has no if channel and the c_oil still
+                  * has output here then the *,G was supplying the implied
+                  * if channel.  So remove it.
+                  */
+                 if (!ch && c_oil->oil.mfcc_ttls[pim_ifp->mroute_vif_index])
+                   pim_channel_del_oif (c_oil, ch->interface, PIM_OIF_FLAG_PROTO_PIM);
+               }
+           }
+         if (ch->ifjoin_state == PIM_IFJOIN_JOIN)
+           {
+             for (ALL_LIST_ELEMENTS_RO (up->sources, up_node, child))
+               {
+                 if (PIM_DEBUG_PIM_TRACE)
+                   zlog_debug("%s %s: Join(S,G)=%s from %s",
+                              __FILE__, __PRETTY_FUNCTION__,
+                              child->sg_str, up->sg_str);
+
+                 if (pim_upstream_evaluate_join_desired (child))
+                   {
+                     pim_channel_add_oif (child->channel_oil, ch->interface, PIM_OIF_FLAG_PROTO_PIM);
+                     pim_upstream_switch (child, PIM_UPSTREAM_JOINED);
+                   }
+               }
+           }
+       }
+    }
   /* Transition to/from NOINFO ? */
   if ((old_state == PIM_IFJOIN_NOINFO) ||
       (new_state == PIM_IFJOIN_NOINFO)) {
index c12fc588ffe84654a7ce0dd0a2ae2cd39681fba9..c0535c4844ce43eeccf9d36d1ddd56bdd0a05d49 100644 (file)
@@ -95,35 +95,6 @@ static void recv_join(struct interface *ifp,
   pim_ifchannel_join_add(ifp, neigh->source_addr, upstream,
                         sg, source_flags, holdtime);
 
-  if (sg->src.s_addr == INADDR_ANY)
-    {
-      struct pim_upstream *up = pim_upstream_find (sg);
-      struct pim_upstream *child;
-      struct listnode *up_node;
-
-      /*
-       * If we are unable to create upstream information
-       * Due to any number of reasons it is possible
-       * That we might have not created the ifchannel
-       * and upstream above.  So just fall out gracefully
-       */
-      if (!up)
-       return;
-
-      for (ALL_LIST_ELEMENTS_RO (up->sources, up_node, child))
-        {
-         if (PIM_DEBUG_PIM_TRACE)
-           zlog_debug("%s %s: Join(S,G)=%s from %s",
-                      __FILE__, __PRETTY_FUNCTION__,
-                      child->sg_str, up->sg_str);
-
-         if (pim_upstream_evaluate_join_desired (child))
-           {
-             pim_channel_add_oif (child->channel_oil, ifp, PIM_OIF_FLAG_PROTO_PIM);
-             pim_upstream_switch (child, PIM_UPSTREAM_JOINED);
-           }
-        }
-    }
 }
 
 static void recv_prune(struct interface *ifp,
@@ -160,44 +131,6 @@ static void recv_prune(struct interface *ifp,
 
   pim_ifchannel_prune(ifp, upstream, sg, source_flags, holdtime);
 
-  if (sg->src.s_addr == INADDR_ANY)
-    {
-      struct pim_upstream *up = pim_upstream_find (sg);
-      struct pim_upstream *child;
-      struct listnode *up_node;
-
-      /*
-       * If up is not found then there is nothing
-       * to do here (see recv_join above)
-       */
-      if (!up)
-       return;
-
-      for (ALL_LIST_ELEMENTS_RO (up->sources, up_node, child))
-        {
-         struct channel_oil *c_oil = child->channel_oil;
-         struct pim_ifchannel *ch = pim_ifchannel_find (ifp, &child->sg);
-         struct pim_interface *pim_ifp = ifp->info;
-
-         if (PIM_DEBUG_PIM_TRACE)
-           zlog_debug("%s %s: Prune(S,G)=%s from %s",
-                      __FILE__, __PRETTY_FUNCTION__,
-                      child->sg_str, up->sg_str);
-         if (!c_oil)
-           continue;
-
-         if (!pim_upstream_evaluate_join_desired (child))
-           pim_channel_del_oif (c_oil, ifp, PIM_OIF_FLAG_PROTO_PIM);
-
-         /*
-          * If the S,G has no if channel and the c_oil still
-          * has output here then the *,G was supplying the implied
-          * if channel.  So remove it.
-          */
-         if (!ch && c_oil->oil.mfcc_ttls[pim_ifp->mroute_vif_index])
-           pim_channel_del_oif (c_oil, ifp, PIM_OIF_FLAG_PROTO_PIM);
-        }
-    }
 }
 
 int pim_joinprune_recv(struct interface *ifp,