forked from Mirror/frr
pimd: Re-align pim_msg_get_jp_group_size
This function was/is heavily indented, let's refactor this a bit. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
This commit is contained in:
parent
8006207a92
commit
413c0ebe5b
|
@ -185,14 +185,15 @@ size_t pim_msg_get_jp_group_size(struct list *sources)
|
|||
size += sizeof(pim_encoded_source) * sources->count;
|
||||
|
||||
js = listgetdata(listhead(sources));
|
||||
if (js && pim_addr_is_any(js->up->sg.src) && js->is_join) {
|
||||
if (!js || !pim_addr_is_any(js->up->sg.src) || !js->is_join)
|
||||
return size;
|
||||
|
||||
struct pim_upstream *child, *up;
|
||||
struct listnode *up_node;
|
||||
|
||||
up = js->up;
|
||||
if (PIM_DEBUG_PIM_PACKETS)
|
||||
zlog_debug(
|
||||
"%s: Considering (%s) children for (S,G,rpt) prune",
|
||||
zlog_debug("%s: Considering (%s) children for (S,G,rpt) prune",
|
||||
__func__, up->sg_str);
|
||||
|
||||
for (ALL_LIST_ELEMENTS_RO(up->sources, up_node, child)) {
|
||||
|
@ -230,39 +231,32 @@ size_t pim_msg_get_jp_group_size(struct list *sources)
|
|||
* same IIF as RPF_interface(RP).
|
||||
*/
|
||||
if (child->rpf.source_nexthop.interface &&
|
||||
!pim_rpf_is_same(&up->rpf,
|
||||
&child->rpf)) {
|
||||
!pim_rpf_is_same(&up->rpf, &child->rpf)) {
|
||||
size += sizeof(pim_encoded_source);
|
||||
PIM_UPSTREAM_FLAG_SET_SEND_SG_RPT_PRUNE(
|
||||
child->flags);
|
||||
if (PIM_DEBUG_PIM_PACKETS)
|
||||
zlog_debug(
|
||||
"%s: SPT Bit and RPF'(%s) != RPF'(S,G): Add Prune (%s,rpt) to compound message",
|
||||
zlog_debug("%s: SPT Bit and RPF'(%s) != RPF'(S,G): Add Prune (%s,rpt) to compound message",
|
||||
__func__, up->sg_str,
|
||||
child->sg_str);
|
||||
} else if (PIM_DEBUG_PIM_PACKETS)
|
||||
zlog_debug(
|
||||
"%s: SPT Bit and RPF'(%s) == RPF'(S,G): Not adding Prune for (%s,rpt)",
|
||||
__func__, up->sg_str,
|
||||
child->sg_str);
|
||||
zlog_debug("%s: SPT Bit and RPF'(%s) == RPF'(S,G): Not adding Prune for (%s,rpt)",
|
||||
__func__, up->sg_str, child->sg_str);
|
||||
} else if (pim_upstream_empty_inherited_olist(child)) {
|
||||
/* S is supposed to be forwarded along the RPT
|
||||
* but it's inherited OIL is empty. So just
|
||||
* prune it off.
|
||||
*/
|
||||
size += sizeof(pim_encoded_source);
|
||||
PIM_UPSTREAM_FLAG_SET_SEND_SG_RPT_PRUNE(
|
||||
child->flags);
|
||||
PIM_UPSTREAM_FLAG_SET_SEND_SG_RPT_PRUNE(child->flags);
|
||||
if (PIM_DEBUG_PIM_PACKETS)
|
||||
zlog_debug(
|
||||
"%s: inherited_olist(%s,rpt) is NULL, Add Prune to compound message",
|
||||
zlog_debug("%s: inherited_olist(%s,rpt) is NULL, Add Prune to compound message",
|
||||
__func__, child->sg_str);
|
||||
} else if (PIM_DEBUG_PIM_PACKETS)
|
||||
zlog_debug(
|
||||
"%s: Do not add Prune %s to compound message %s",
|
||||
zlog_debug("%s: Do not add Prune %s to compound message %s",
|
||||
__func__, child->sg_str, up->sg_str);
|
||||
}
|
||||
}
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue