]> git.puffer.fish Git - mirror/frr.git/commitdiff
pimd: Start coding of sending Prune (s,g,rpt) with *,g prune.
authorDonald Sharp <sharpd@cumulusnetworks.com>
Wed, 2 Nov 2016 15:21:49 +0000 (11:21 -0400)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Thu, 22 Dec 2016 01:26:13 +0000 (20:26 -0500)
Add logic to show that we are making decisions about
the s,g,rpt prune send.  We are not actually sending
anything yet.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
pimd/pim_msg.c

index 749cee96e954d5d6330360b99e730029a5d05451..12a043b650890511785e9e072279e517f6a8be88 100644 (file)
@@ -34,6 +34,7 @@
 #include "pim_util.h"
 #include "pim_str.h"
 #include "pim_rp.h"
+#include "pim_rpf.h"
 
 void pim_msg_build_header(uint8_t *pim_msg, int pim_msg_size,
                          uint8_t pim_msg_type)
@@ -121,6 +122,8 @@ pim_msg_join_prune_encode (uint8_t *buf, int buf_size, int is_join,
   uint8_t *pim_msg = buf;
   uint8_t *pim_msg_curr = buf + PIM_MSG_HEADER_LEN;
   uint8_t *end = buf + buf_size;
+  uint16_t *prunes = NULL;
+  uint16_t *joins = NULL;
   struct in_addr stosend;
   uint8_t bits;
   int remain;
@@ -170,12 +173,14 @@ pim_msg_join_prune_encode (uint8_t *buf, int buf_size, int is_join,
   }
 
   /* number of joined sources */
-  *((uint16_t *) pim_msg_curr) = htons(is_join ? 1 : 0);
+  joins = (uint16_t *)pim_msg_curr;
+  *joins = htons(is_join ? 1 : 0);
   ++pim_msg_curr;
   ++pim_msg_curr;
 
   /* number of pruned sources */
-  *((uint16_t *) pim_msg_curr) = htons(is_join ? 0 : 1);
+  prunes = (uint16_t *)pim_msg_curr;
+  *prunes = htons(is_join ? 0 : 1);
   ++pim_msg_curr;
   ++pim_msg_curr;
 
@@ -200,6 +205,50 @@ pim_msg_join_prune_encode (uint8_t *buf, int buf_size, int is_join,
     return -7;
   }
 
+  if (up->sg.src.s_addr == INADDR_ANY)
+    {
+      struct pim_upstream *child;
+      struct listnode *up_node;
+      char star_g[100];
+
+      strcpy (star_g, pim_str_sg_dump (&up->sg));
+      zlog_debug ("%s: Considering (%s) children for (S,G,rpt) prune",
+                 __PRETTY_FUNCTION__, star_g);
+      for (ALL_LIST_ELEMENTS_RO (up->sources, up_node, child))
+       {
+         if (child->sptbit == PIM_UPSTREAM_SPTBIT_TRUE)
+           {
+             if (pim_rpf_is_same(&up->rpf, &child->rpf))
+               {
+                 zlog_debug ("%s: SPT Bit and RPF'(%s) != RPF'(S,G): Add Prune (%s,rpt) to compound message",
+                             __PRETTY_FUNCTION__, star_g, pim_str_sg_dump (&child->sg));
+               }
+             else
+               zlog_debug ("%s: SPT Bit and RPF'(%s) == RPF'(S,G): Not adding Prune for (%s,rpt)",
+                           __PRETTY_FUNCTION__, star_g, pim_str_sg_dump (&child->sg));
+           }
+         else if (pim_upstream_is_sg_rpt (child))
+           {
+             if (pim_upstream_empty_inherited_olist (child))
+               {
+                 zlog_debug ("%s: inherited_olist(%s,rpt) is NULL, Add Prune to compound message",
+                             __PRETTY_FUNCTION__, pim_str_sg_dump (&child->sg));
+               }
+             else if (!pim_rpf_is_same (&up->rpf, &child->rpf))
+               {
+                 zlog_debug ("%s: RPF'(%s) != RPF'(%s,rpt), Add Prune to compound message",
+                             __PRETTY_FUNCTION__, star_g, pim_str_sg_dump (&child->sg));
+               }
+             else
+               zlog_debug ("%s: RPF'(%s) == RPF'(%s,rpt), Do not add Prune to compound message",
+                           __PRETTY_FUNCTION__, star_g, pim_str_sg_dump (&child->sg));
+           }
+         else
+           zlog_debug ("%s: SPT bit is not set for (%s)",
+                      __PRETTY_FUNCTION__, pim_str_sg_dump (&child->sg));
+       }
+    }
+
   remain = pim_msg_curr - pim_msg;
   pim_msg_build_header (pim_msg, remain, PIM_MSG_TYPE_JOIN_PRUNE);