diff --git a/pimd/pim_ifchannel.c b/pimd/pim_ifchannel.c index d091505837..ca8f061681 100644 --- a/pimd/pim_ifchannel.c +++ b/pimd/pim_ifchannel.c @@ -781,6 +781,28 @@ static int nonlocal_upstream(int is_join, struct interface *recv_ifp, return 1; /* non-local */ } +static void pim_ifchannel_ifjoin_handler(struct pim_ifchannel *ch, + struct pim_interface *pim_ifp) +{ + pim_ifchannel_ifjoin_switch(__PRETTY_FUNCTION__, ch, + PIM_IFJOIN_JOIN); + PIM_IF_FLAG_UNSET_S_G_RPT(ch->flags); + /* check if the interface qualifies as an immediate + * OIF + */ + if (pim_upstream_evaluate_join_desired_interface( + ch->upstream, ch, + NULL /*starch*/)) { + pim_channel_add_oif(ch->upstream->channel_oil, + ch->interface, + PIM_OIF_FLAG_PROTO_PIM, + __func__); + pim_upstream_update_join_desired(pim_ifp->pim, + ch->upstream); + } +} + + void pim_ifchannel_join_add(struct interface *ifp, struct in_addr neigh_addr, struct in_addr upstream, struct prefix_sg *sg, uint8_t source_flags, uint16_t holdtime) @@ -888,30 +910,8 @@ void pim_ifchannel_join_add(struct interface *ifp, struct in_addr neigh_addr, if (source_flags & PIM_ENCODE_RPT_BIT) pim_ifchannel_ifjoin_switch(__PRETTY_FUNCTION__, ch, PIM_IFJOIN_NOINFO); - else { - /* - * We have received a S,G join and we are in - * S,G RPT Prune state. Which means we need - * to transition to Join state and setup - * state as appropriate. - */ - pim_ifchannel_ifjoin_switch(__PRETTY_FUNCTION__, ch, - PIM_IFJOIN_JOIN); - PIM_IF_FLAG_UNSET_S_G_RPT(ch->flags); - /* check if the interface qualifies as an immediate - * OIF - */ - if (pim_upstream_evaluate_join_desired_interface( - ch->upstream, ch, - NULL /*starch*/)) { - pim_channel_add_oif(ch->upstream->channel_oil, - ch->interface, - PIM_OIF_FLAG_PROTO_PIM, - __func__); - pim_upstream_update_join_desired(pim_ifp->pim, - ch->upstream); - } - } + else + pim_ifchannel_ifjoin_handler(ch, pim_ifp); break; case PIM_IFJOIN_PRUNE_PENDING: THREAD_OFF(ch->t_ifjoin_prune_pending_timer); @@ -919,9 +919,9 @@ void pim_ifchannel_join_add(struct interface *ifp, struct in_addr neigh_addr, 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); + } else { + pim_ifchannel_ifjoin_handler(ch, pim_ifp); + } break; case PIM_IFJOIN_PRUNE_TMP: break; diff --git a/pimd/pim_join.c b/pimd/pim_join.c index 53bfb28228..d63bc83862 100644 --- a/pimd/pim_join.c +++ b/pimd/pim_join.c @@ -316,7 +316,6 @@ int pim_joinprune_recv(struct interface *ifp, struct pim_neighbor *neigh, recv_prune(ifp, neigh, msg_holdtime, msg_upstream_addr.u.prefix4, &sg, msg_source_flags); - /* * So if we are receiving a S,G,RPT prune * before we have any data for that S,G