From 1be8f9d323c53c98205bf3800edb81a399f3ec37 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Fri, 14 Oct 2016 11:22:12 -0400 Subject: [PATCH] pimd: Fix ifchannel being left around In some situations, the deletion of the ifchannel would not ocurr if the last flag cleared was the assert flag. Signed-off-by: Donald Sharp --- pimd/pim_ifchannel.c | 33 +++++---------------------------- 1 file changed, 5 insertions(+), 28 deletions(-) diff --git a/pimd/pim_ifchannel.c b/pimd/pim_ifchannel.c index 93a6cad649..1be7ebb4a9 100644 --- a/pimd/pim_ifchannel.c +++ b/pimd/pim_ifchannel.c @@ -143,27 +143,13 @@ void pim_ifchannel_delete(struct pim_ifchannel *ch) pim_ifchannel_free(ch); } - -#define IFCHANNEL_NOINFO(ch) \ - ( \ - ((ch)->local_ifmembership == PIM_IFMEMBERSHIP_NOINFO) \ - && \ - ((ch)->ifjoin_state == PIM_IFJOIN_NOINFO) \ - && \ - ((ch)->ifassert_state == PIM_IFASSERT_NOINFO) \ - ) static void delete_on_noinfo(struct pim_ifchannel *ch) { - if (IFCHANNEL_NOINFO(ch)) { - - /* In NOINFO state, timers should have been cleared */ - zassert(!ch->t_ifjoin_expiry_timer); - zassert(!ch->t_ifjoin_prune_pending_timer); - zassert(!ch->t_ifassert_timer); - + if (ch->local_ifmembership == PIM_IFMEMBERSHIP_NOINFO && + ch->ifjoin_state == PIM_IFJOIN_NOINFO) pim_ifchannel_delete(ch); - } + } void pim_ifchannel_ifjoin_switch(const char *caller, @@ -191,11 +177,8 @@ void pim_ifchannel_ifjoin_switch(const char *caller, ch->ifjoin_state = new_state; /* Transition to/from NOINFO ? */ - if ( - (old_state == PIM_IFJOIN_NOINFO) - || - (new_state == PIM_IFJOIN_NOINFO) - ) { + if ((old_state == PIM_IFJOIN_NOINFO) || + (new_state == PIM_IFJOIN_NOINFO)) { if (PIM_DEBUG_PIM_EVENTS) { zlog_debug("PIM_IFCHANNEL_%s: (S,G)=%s on interface %s", @@ -432,8 +415,6 @@ pim_ifchannel_add(struct interface *ifp, /* Attach to list */ listnode_add_sort(pim_ifp->pim_ifchannel_list, ch); - zassert(IFCHANNEL_NOINFO(ch)); - return ch; } @@ -695,8 +676,6 @@ void pim_ifchannel_join_add(struct interface *ifp, break; } - zassert(!IFCHANNEL_NOINFO(ch)); - if (holdtime != 0xFFFF) { THREAD_TIMER_ON(master, ch->t_ifjoin_expiry_timer, on_ifjoin_expiry_timer, @@ -782,8 +761,6 @@ void pim_ifchannel_local_membership_add(struct interface *ifp, ifmembership_set(ch, PIM_IFMEMBERSHIP_INCLUDE); - zassert(!IFCHANNEL_NOINFO(ch)); - if (sg->src.s_addr == INADDR_ANY) { struct pim_upstream *up = pim_upstream_find (sg); -- 2.39.5