diff options
| author | Anuradha Karuppiah <anuradhak@cumulusnetworks.com> | 2019-11-15 11:32:10 -0800 | 
|---|---|---|
| committer | Anuradha Karuppiah <anuradhak@cumulusnetworks.com> | 2019-11-15 14:16:02 -0800 | 
| commit | 0688d6033a29060f4537bc0592d0790eb2467b4b (patch) | |
| tree | 0500949af0b5c393aca089e3fade4f5f0bcf2145 /pimd/pim_msg.c | |
| parent | cfa8f7eb057b2314bfca96f9e358935dff27915b (diff) | |
pimd: fixup (S,G,rpt) prune to conform to the RFC
Deviations -
1. Avoid using SPTbit setting. Replace that with Use_Spt macro.
2. If S is supposed to be forwarded along the RPT but has an empty OIL
prune it.
Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
Diffstat (limited to 'pimd/pim_msg.c')
| -rw-r--r-- | pimd/pim_msg.c | 51 | 
1 files changed, 24 insertions, 27 deletions
diff --git a/pimd/pim_msg.c b/pimd/pim_msg.c index 2e467502b1..fba76d84dd 100644 --- a/pimd/pim_msg.c +++ b/pimd/pim_msg.c @@ -126,8 +126,17 @@ size_t pim_msg_get_jp_group_size(struct list *sources)  				__PRETTY_FUNCTION__, up->sg_str);  		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)) { +			if (!PIM_UPSTREAM_FLAG_TEST_USE_RPT(child->flags)) { +				/* If we are using SPT and the SPT and RPT IIFs +				 * are different we can prune the source off +				 * of the RPT. +				 * If RPF_interface(S) is not resolved hold +				 * decision to prune as SPT may end up on the +				 * same IIF as RPF_interface(RP). +				 */ +				if (child->rpf.source_nexthop.interface && +					!pim_rpf_is_same(&up->rpf, +						&child->rpf)) {  					size += sizeof(  						struct pim_encoded_source_ipv4);  					PIM_UPSTREAM_FLAG_SET_SEND_SG_RPT_PRUNE( @@ -143,37 +152,25 @@ size_t pim_msg_get_jp_group_size(struct list *sources)  						"%s: SPT Bit and RPF'(%s) == RPF'(S,G): Not adding Prune for (%s,rpt)",  						__PRETTY_FUNCTION__, up->sg_str,  						child->sg_str); -			} else if (pim_upstream_is_sg_rpt(child)) { -				if (pim_upstream_empty_inherited_olist(child)) { -					size += sizeof( +			} 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(  						struct pim_encoded_source_ipv4); -					PIM_UPSTREAM_FLAG_SET_SEND_SG_RPT_PRUNE( +				PIM_UPSTREAM_FLAG_SET_SEND_SG_RPT_PRUNE(  						child->flags); -					if (PIM_DEBUG_PIM_PACKETS) -						zlog_debug( +				if (PIM_DEBUG_PIM_PACKETS) +					zlog_debug(  							"%s: inherited_olist(%s,rpt) is NULL, Add Prune to compound message",  							__PRETTY_FUNCTION__,  							child->sg_str); -				} else if (!pim_rpf_is_same(&up->rpf, -							    &child->rpf)) { -					size += sizeof( -						struct pim_encoded_source_ipv4); -					PIM_UPSTREAM_FLAG_SET_SEND_SG_RPT_PRUNE( -						child->flags); -					if (PIM_DEBUG_PIM_PACKETS) -						zlog_debug( -							"%s: RPF'(%s) != RPF'(%s,rpt), Add Prune to compound message", -							__PRETTY_FUNCTION__, -							up->sg_str, -							child->sg_str); -				} else if (PIM_DEBUG_PIM_PACKETS) -					zlog_debug( -						"%s: RPF'(%s) == RPF'(%s,rpt), Do not add Prune to compound message", -						__PRETTY_FUNCTION__, up->sg_str, -						child->sg_str);  			} else if (PIM_DEBUG_PIM_PACKETS) -				zlog_debug("%s: SPT bit is not set for (%s)", -					   __PRETTY_FUNCTION__, child->sg_str); +				zlog_debug( +						"%s: Do not add Prune %s to compound message %s", +						__PRETTY_FUNCTION__, child->sg_str, +						up->sg_str);  		}  	}  	return size;  | 
