From: Donald Sharp Date: Wed, 2 Nov 2016 15:21:49 +0000 (-0400) Subject: pimd: Start coding of sending Prune (s,g,rpt) with *,g prune. X-Git-Tag: frr-3.0-branchpoint~64^2~10^2~138 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=d67f268e94707d4e3e9d130a8fb90ae571dc2ea0;p=mirror%2Ffrr.git pimd: Start coding of sending Prune (s,g,rpt) with *,g prune. 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 --- diff --git a/pimd/pim_msg.c b/pimd/pim_msg.c index 749cee96e9..12a043b650 100644 --- a/pimd/pim_msg.c +++ b/pimd/pim_msg.c @@ -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);