From 6578dfa37866ad90dcc988da932911dc4b0b616b Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Mon, 5 Dec 2016 16:26:59 -0500 Subject: [PATCH] pimd: Fix where we handle the inherited_olist for ifchannel When we receive a new *,G ifchannel, handle the inherited_olist for S,G mroutes in a place where it is more appropriate. Ticket: CM-13892 Signed-off-by: Donald Sharp Reviewed-by: Anuradha Karuppiah --- pimd/pim_ifchannel.c | 52 ++++++++++++++++++++++++++++++++++ pimd/pim_join.c | 67 -------------------------------------------- 2 files changed, 52 insertions(+), 67 deletions(-) diff --git a/pimd/pim_ifchannel.c b/pimd/pim_ifchannel.c index 175385265..efb1e3c65 100644 --- a/pimd/pim_ifchannel.c +++ b/pimd/pim_ifchannel.c @@ -229,6 +229,58 @@ void pim_ifchannel_ifjoin_switch(const char *caller, ch->ifjoin_state = new_state; + if (ch->sg.src.s_addr == INADDR_ANY) + { + struct pim_upstream *up = ch->upstream; + struct pim_upstream *child; + struct listnode *up_node; + + if (up) + { + if (ch->ifjoin_state == PIM_IFJOIN_NOINFO) + { + for (ALL_LIST_ELEMENTS_RO (up->sources, up_node, child)) + { + struct channel_oil *c_oil = child->channel_oil; + struct pim_interface *pim_ifp = ch->interface->info; + + if (PIM_DEBUG_PIM_TRACE) + zlog_debug("%s %s: Prune(S,G)=%s from %s", + __FILE__, __PRETTY_FUNCTION__, + child->sg_str, up->sg_str); + if (!c_oil) + continue; + + if (!pim_upstream_evaluate_join_desired (child)) + pim_channel_del_oif (c_oil, ch->interface, PIM_OIF_FLAG_PROTO_PIM); + + /* + * If the S,G has no if channel and the c_oil still + * has output here then the *,G was supplying the implied + * if channel. So remove it. + */ + if (!ch && c_oil->oil.mfcc_ttls[pim_ifp->mroute_vif_index]) + pim_channel_del_oif (c_oil, ch->interface, PIM_OIF_FLAG_PROTO_PIM); + } + } + if (ch->ifjoin_state == PIM_IFJOIN_JOIN) + { + for (ALL_LIST_ELEMENTS_RO (up->sources, up_node, child)) + { + if (PIM_DEBUG_PIM_TRACE) + zlog_debug("%s %s: Join(S,G)=%s from %s", + __FILE__, __PRETTY_FUNCTION__, + child->sg_str, up->sg_str); + + if (pim_upstream_evaluate_join_desired (child)) + { + pim_channel_add_oif (child->channel_oil, ch->interface, PIM_OIF_FLAG_PROTO_PIM); + pim_upstream_switch (child, PIM_UPSTREAM_JOINED); + } + } + } + } + } /* Transition to/from NOINFO ? */ if ((old_state == PIM_IFJOIN_NOINFO) || (new_state == PIM_IFJOIN_NOINFO)) { diff --git a/pimd/pim_join.c b/pimd/pim_join.c index c12fc588f..c0535c484 100644 --- a/pimd/pim_join.c +++ b/pimd/pim_join.c @@ -95,35 +95,6 @@ static void recv_join(struct interface *ifp, pim_ifchannel_join_add(ifp, neigh->source_addr, upstream, sg, source_flags, holdtime); - if (sg->src.s_addr == INADDR_ANY) - { - struct pim_upstream *up = pim_upstream_find (sg); - struct pim_upstream *child; - struct listnode *up_node; - - /* - * If we are unable to create upstream information - * Due to any number of reasons it is possible - * That we might have not created the ifchannel - * and upstream above. So just fall out gracefully - */ - if (!up) - return; - - for (ALL_LIST_ELEMENTS_RO (up->sources, up_node, child)) - { - if (PIM_DEBUG_PIM_TRACE) - zlog_debug("%s %s: Join(S,G)=%s from %s", - __FILE__, __PRETTY_FUNCTION__, - child->sg_str, up->sg_str); - - if (pim_upstream_evaluate_join_desired (child)) - { - pim_channel_add_oif (child->channel_oil, ifp, PIM_OIF_FLAG_PROTO_PIM); - pim_upstream_switch (child, PIM_UPSTREAM_JOINED); - } - } - } } static void recv_prune(struct interface *ifp, @@ -160,44 +131,6 @@ static void recv_prune(struct interface *ifp, pim_ifchannel_prune(ifp, upstream, sg, source_flags, holdtime); - if (sg->src.s_addr == INADDR_ANY) - { - struct pim_upstream *up = pim_upstream_find (sg); - struct pim_upstream *child; - struct listnode *up_node; - - /* - * If up is not found then there is nothing - * to do here (see recv_join above) - */ - if (!up) - return; - - for (ALL_LIST_ELEMENTS_RO (up->sources, up_node, child)) - { - struct channel_oil *c_oil = child->channel_oil; - struct pim_ifchannel *ch = pim_ifchannel_find (ifp, &child->sg); - struct pim_interface *pim_ifp = ifp->info; - - if (PIM_DEBUG_PIM_TRACE) - zlog_debug("%s %s: Prune(S,G)=%s from %s", - __FILE__, __PRETTY_FUNCTION__, - child->sg_str, up->sg_str); - if (!c_oil) - continue; - - if (!pim_upstream_evaluate_join_desired (child)) - pim_channel_del_oif (c_oil, ifp, PIM_OIF_FLAG_PROTO_PIM); - - /* - * If the S,G has no if channel and the c_oil still - * has output here then the *,G was supplying the implied - * if channel. So remove it. - */ - if (!ch && c_oil->oil.mfcc_ttls[pim_ifp->mroute_vif_index]) - pim_channel_del_oif (c_oil, ifp, PIM_OIF_FLAG_PROTO_PIM); - } - } } int pim_joinprune_recv(struct interface *ifp, -- 2.39.5