From 1e3a51321345bbec450cec0ef3f6a7e23e1afdbd Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Thu, 1 Dec 2016 20:32:03 -0500 Subject: [PATCH] pimd: Modify the Prune Pending Timer Pop to not assert So there exist conditions where we can start the Prune Pending Timer and receive other packets that cause us to not stop the pending timer. This was due to a missread of the state machine. Additionally when the prune pending timer pops and we are not in prune pending state, note the fact and move on with our life instead of crashing and burning Ticket: CM-13851 Signed-off-by: Donald Sharp Reviewed-by: --- pimd/pim_ifchannel.c | 38 +++++++++++++++++++++++--------------- 1 file changed, 23 insertions(+), 15 deletions(-) diff --git a/pimd/pim_ifchannel.c b/pimd/pim_ifchannel.c index 1222ac29c9..1753852654 100644 --- a/pimd/pim_ifchannel.c +++ b/pimd/pim_ifchannel.c @@ -511,19 +511,26 @@ static int on_ifjoin_prune_pending_timer(struct thread *t) ch->t_ifjoin_prune_pending_timer = NULL; - zassert(ch->ifjoin_state == PIM_IFJOIN_PRUNE_PENDING); - - /* Send PruneEcho(S,G) ? */ - ifp = ch->interface; - pim_ifp = ifp->info; - send_prune_echo = (listcount(pim_ifp->pim_neighbor_list) > 1); + if (ch->ifjoin_state == PIM_IFJOIN_PRUNE_PENDING) + { + /* Send PruneEcho(S,G) ? */ + ifp = ch->interface; + pim_ifp = ifp->info; + send_prune_echo = (listcount(pim_ifp->pim_neighbor_list) > 1); - ifjoin_to_noinfo(ch); - /* from here ch may have been deleted */ + ifjoin_to_noinfo(ch); + /* from here ch may have been deleted */ - if (send_prune_echo) - pim_joinprune_send (ifp, pim_ifp->primary_address, - ch->upstream, 0); + if (send_prune_echo) + pim_joinprune_send (ifp, pim_ifp->primary_address, + ch->upstream, 0); + } + else + { + zlog_warn("%s: IFCHANNEL%s Prune Pending Timer Popped while in %s state", + __PRETTY_FUNCTION__, pim_str_sg_dump (&ch->sg), + pim_ifchannel_ifjoin_name (ch->ifjoin_state)); + } return 0; } @@ -724,13 +731,14 @@ void pim_ifchannel_join_add(struct interface *ifp, pim_ifchannel_ifjoin_switch(__PRETTY_FUNCTION__, ch, PIM_IFJOIN_NOINFO); break; case PIM_IFJOIN_PRUNE_PENDING: + THREAD_OFF(ch->t_ifjoin_prune_pending_timer); if (source_flags & PIM_ENCODE_RPT_BIT) - pim_ifchannel_ifjoin_switch(__PRETTY_FUNCTION__, ch, PIM_IFJOIN_NOINFO); - else { - THREAD_OFF(ch->t_ifjoin_prune_pending_timer); - pim_ifchannel_ifjoin_switch(__PRETTY_FUNCTION__, ch, PIM_IFJOIN_JOIN); + THREAD_OFF(ch->t_ifjoin_expiry_timer); + pim_ifchannel_ifjoin_switch(__PRETTY_FUNCTION__, ch, PIM_IFJOIN_NOINFO); } + else + pim_ifchannel_ifjoin_switch(__PRETTY_FUNCTION__, ch, PIM_IFJOIN_JOIN); break; case PIM_IFJOIN_PRUNE_TMP: break; -- 2.39.5