]> git.puffer.fish Git - mirror/frr.git/commitdiff
pimd: Fix creation of channel oil to happen 1st.
authorDonald Sharp <sharpd@cumulusnetworks.com>
Wed, 31 Aug 2016 14:50:20 +0000 (10:50 -0400)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Thu, 22 Dec 2016 01:26:08 +0000 (20:26 -0500)
This has 2 fixes:

On nocache event, crate the channel oil first in
case we don't need to actually create the upstream
information

on wrvifwhole, create the channel oil and install
it, then only create the upstream information
if we are connected to the source.

Ticket: CM-12593
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
pimd/pim_mroute.c

index 3fb69bc86a2f75bb6cf061d6e6429c58337673b1..14221d33030033a58cf233b008a64131f7b24177 100644 (file)
@@ -89,6 +89,7 @@ pim_mroute_msg_nocache (int fd, struct interface *ifp, const struct igmpmsg *msg
   struct pim_upstream *up;
   struct pim_rpf *rpg;
   struct prefix_sg sg;
+  struct channel_oil *oil;
 
   rpg = RP(msg->im_dst);
   /*
@@ -123,28 +124,29 @@ pim_mroute_msg_nocache (int fd, struct interface *ifp, const struct igmpmsg *msg
               __PRETTY_FUNCTION__, pim_str_sg_dump (&sg));
   }
 
-  up = pim_upstream_add (&sg, ifp);
-  if (!up) {
+  oil = pim_channel_oil_add (&sg, pim_ifp->mroute_vif_index);
+  if (!oil) {
     if (PIM_DEBUG_MROUTE) {
-      zlog_debug("%s: Failure to add upstream information for %s",
+      zlog_debug("%s: Failure to add channel oil for %s",
                 __PRETTY_FUNCTION__,
                 pim_str_sg_dump (&sg));
     }
     return 0;
   }
 
-  pim_upstream_keep_alive_timer_start (up, qpim_keep_alive_time);
-
-  up->channel_oil = pim_channel_oil_add(&sg,
-                                       pim_ifp->mroute_vif_index);
-  if (!up->channel_oil) {
+  up = pim_upstream_add (&sg, ifp);
+  if (!up) {
     if (PIM_DEBUG_MROUTE) {
-      zlog_debug("%s: Failure to add channel oil for %s",
+      zlog_debug("%s: Failure to add upstream information for %s",
                 __PRETTY_FUNCTION__,
                 pim_str_sg_dump (&sg));
     }
     return 0;
   }
+
+  pim_upstream_keep_alive_timer_start (up, qpim_keep_alive_time);
+
+  up->channel_oil = oil;
   up->channel_oil->cc.pktcnt++;
   up->fhr = 1;
   pim_channel_add_oif (up->channel_oil, pim_regiface, PIM_OIF_FLAG_PROTO_PIM);
@@ -304,6 +306,7 @@ pim_mroute_msg_wrvifwhole (int fd, struct interface *ifp, const char *buf)
   struct pim_ifchannel *ch;
   struct pim_upstream *up;
   struct prefix_sg sg;
+  struct channel_oil *oil;
 
   memset (&sg, 0, sizeof (struct prefix_sg));
   sg.src = ip_hdr->ip_src;
@@ -351,29 +354,33 @@ pim_mroute_msg_wrvifwhole (int fd, struct interface *ifp, const char *buf)
          return 0;
     }
 
-  up = pim_upstream_add (&sg, ifp);
-
-  if (!up)
+  pim_ifp = ifp->info;
+  oil = pim_channel_oil_add (&sg, pim_ifp->mroute_vif_index);
+  if (!oil->installed)
+    pim_mroute_add (oil);
+  if (pim_if_connected_to_source (ifp, sg.src))
     {
-      if (PIM_DEBUG_MROUTE)
-       zlog_debug ("%s: WRONGVIF%s unable to create upstream on interface",
-                   pim_str_sg_dump (&sg), ifp->name);
-      return -2;
-    }
+      up = pim_upstream_add (&sg, ifp);
 
-  if (pim_if_connected_to_source (ifp, sg.src))
-    up->fhr = 1;
+      if (!up)
+       {
+         if (PIM_DEBUG_MROUTE)
+           zlog_debug ("%s: WRONGVIF%s unable to create upstream on interface",
+                       pim_str_sg_dump (&sg), ifp->name);
+         return -2;
+       }
+      up->fhr = 1;
 
-  pim_ifp = ifp->info;
-  pim_upstream_keep_alive_timer_start (up, qpim_keep_alive_time);
-  up->channel_oil = pim_channel_oil_add (&sg, pim_ifp->mroute_vif_index);
-  up->channel_oil->cc.pktcnt++;
-  pim_channel_add_oif (up->channel_oil, pim_regiface, PIM_OIF_FLAG_PROTO_PIM);
-  up->join_state = PIM_UPSTREAM_JOINED;
-  pim_upstream_inherited_olist (up);
+      pim_upstream_keep_alive_timer_start (up, qpim_keep_alive_time);
+      up->channel_oil = oil;
+      up->channel_oil->cc.pktcnt++;
+      pim_channel_add_oif (up->channel_oil, pim_regiface, PIM_OIF_FLAG_PROTO_PIM);
+      up->join_state = PIM_UPSTREAM_JOINED;
+      pim_upstream_inherited_olist (up);
 
-  // Send the packet to the RP
-  pim_mroute_msg_wholepkt (fd, ifp, buf);
+      // Send the packet to the RP
+      pim_mroute_msg_wholepkt (fd, ifp, buf);
+    }
 
   return 0;
 }