void pim_register_join(struct pim_upstream *up)
{
- if (pim_is_grp_ssm(up->sg.grp)) {
+ struct pim_instance *pim = up->channel_oil->pim;
+
+ if (pim_is_grp_ssm(pim, up->sg.grp)) {
if (PIM_DEBUG_PIM_EVENTS)
zlog_debug("%s register setup skipped as group is SSM",
up->sg_str);
return;
}
- pim_channel_add_oif(up->channel_oil, pimg->regiface,
+ pim_channel_add_oif(up->channel_oil, pim->regiface,
PIM_OIF_FLAG_PROTO_PIM);
up->reg_state = PIM_REG_JOIN;
}
++pinfo->pim_ifstat_reg_stop_send;
}
-int pim_register_stop_recv(uint8_t *buf, int buf_size)
+int pim_register_stop_recv(struct interface *ifp, uint8_t *buf, int buf_size)
{
+ struct pim_interface *pim_ifp = ifp->info;
+ struct pim_instance *pim = pim_ifp->pim;
struct pim_upstream *upstream = NULL;
struct prefix source;
struct prefix_sg sg;
pim_parse_addr_ucast(&source, buf, buf_size);
sg.src = source.u.prefix4;
- upstream = pim_upstream_find(pimg, &sg);
+ upstream = pim_upstream_find(pim, &sg);
if (!upstream) {
return 0;
}
break;
case PIM_REG_JOIN:
upstream->reg_state = PIM_REG_PRUNE;
- pim_channel_del_oif(upstream->channel_oil, pimg->regiface,
+ pim_channel_del_oif(upstream->channel_oil, pim->regiface,
PIM_OIF_FLAG_PROTO_PIM);
pim_upstream_start_register_stop_timer(upstream, 0);
break;
*/
if (!upstream) {
upstream = pim_upstream_add(
- &sg, ifp, PIM_UPSTREAM_FLAG_MASK_SRC_STREAM,
- __PRETTY_FUNCTION__);
+ pim_ifp->pim, &sg, ifp,
+ PIM_UPSTREAM_FLAG_MASK_SRC_STREAM,
+ __PRETTY_FUNCTION__, NULL);
if (!upstream) {
zlog_warn("Failure to create upstream state");
return 1;
}
upstream->upstream_register = src_addr;
+ } else {
+ /*
+ * If the FHR has set a very very fast register timer
+ * there exists a possibility that the incoming NULL
+ * register
+ * is happening before we set the spt bit. If so
+ * Do a quick check to update the counters and
+ * then set the spt bit as appropriate
+ */
+ if (upstream->sptbit != PIM_UPSTREAM_SPTBIT_TRUE) {
+ pim_mroute_update_counters(
+ upstream->channel_oil);
+ /*
+ * Have we seen packets?
+ */
+ if (upstream->channel_oil->cc.oldpktcnt
+ < upstream->channel_oil->cc.pktcnt)
+ pim_upstream_set_sptbit(
+ upstream,
+ upstream->rpf.source_nexthop
+ .interface);
+ }
}
if ((upstream->sptbit == PIM_UPSTREAM_SPTBIT_TRUE)
- || ((SwitchToSptDesired(&sg))
+ || ((SwitchToSptDesired(pim_ifp->pim, &sg))
&& pim_upstream_inherited_olist(pim_ifp->pim, upstream)
== 0)) {
// pim_scan_individual_oil (upstream->channel_oil);
upstream->sptbit);
}
if ((upstream->sptbit == PIM_UPSTREAM_SPTBIT_TRUE)
- || (SwitchToSptDesired(&sg))) {
+ || (SwitchToSptDesired(pim_ifp->pim, &sg))) {
if (sentRegisterStop) {
pim_upstream_keep_alive_timer_start(
- upstream, qpim_rp_keep_alive_time);
+ upstream,
+ pim_ifp->pim->rp_keep_alive_time);
} else {
pim_upstream_keep_alive_timer_start(
- upstream, qpim_keep_alive_time);
+ upstream,
+ pim_ifp->pim->keep_alive_time);
}
}