From 9ab028b26daeeb180e2d38489c118ea119ec643d Mon Sep 17 00:00:00 2001 From: Chirag Shah Date: Wed, 3 May 2017 18:56:44 -0700 Subject: [PATCH] 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 --- pimd/pim_jp_agg.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pimd/pim_jp_agg.c b/pimd/pim_jp_agg.c index ce4ddfd4a4..bbc51bd91c 100644 --- a/pimd/pim_jp_agg.c +++ b/pimd/pim_jp_agg.c @@ -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); -- 2.39.5