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)) {
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,
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,