pimd: fix pimd crash when pim interface disabled

Upon pim enabled disabled, current upstreams entries rpf update callback,
needs to check if old rpf is still pim enabled otherwise do not trigger
prune towards old rpf.

Testing Done:
Verified by disabling pim enabled rpf interface and
 crash is not observed upon disabling pim on rpf interface.

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
This commit is contained in:
Chirag Shah 2017-05-03 18:56:44 -07:00
parent 0c62a89997
commit 9ab028b26d

View File

@ -127,6 +127,10 @@ pim_jp_agg_get_interface_upstream_switch_list (struct pim_rpf *rpf)
struct pim_iface_upstream_switch *pius;
struct listnode *node, *nnode;
/* Old interface is pim disabled */
if (!pim_ifp)
return NULL;
for (ALL_LIST_ELEMENTS(pim_ifp->upstream_switch_list, node, nnode, pius))
{
if (pius->address.s_addr == rpf->rpf_addr.u.prefix4.s_addr)
@ -323,7 +327,8 @@ pim_jp_agg_switch_interface (struct pim_rpf *orpf,
*/
/* send Prune(S,G) to the old upstream neighbor */
pim_jp_agg_add_group (opius->us, up, false);
if (opius)
pim_jp_agg_add_group (opius->us, up, false);
/* send Join(S,G) to the current upstream neighbor */
pim_jp_agg_add_group (npius->us, up, true);