Merge pull request #10088 from opensourcerouting/pim-forward-stop

pimd: fix stale forwarding entries left around after join goes away
This commit is contained in:
Donald Sharp 2021-11-22 08:30:18 -05:00 committed by GitHub
commit cfbf74a9a1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 10 additions and 14 deletions

View File

@ -651,17 +651,16 @@ struct pim_ifchannel *pim_ifchannel_add(struct interface *ifp,
return ch; return ch;
} }
static void ifjoin_to_noinfo(struct pim_ifchannel *ch, bool ch_del) static void ifjoin_to_noinfo(struct pim_ifchannel *ch)
{ {
pim_forward_stop(ch, !ch_del);
pim_ifchannel_ifjoin_switch(__func__, ch, PIM_IFJOIN_NOINFO); pim_ifchannel_ifjoin_switch(__func__, ch, PIM_IFJOIN_NOINFO);
pim_forward_stop(ch);
if (ch->upstream) if (ch->upstream)
PIM_UPSTREAM_FLAG_UNSET_SRC_PIM(ch->upstream->flags); PIM_UPSTREAM_FLAG_UNSET_SRC_PIM(ch->upstream->flags);
PIM_IF_FLAG_UNSET_PROTO_PIM(ch->flags); PIM_IF_FLAG_UNSET_PROTO_PIM(ch->flags);
if (ch_del)
delete_on_noinfo(ch); delete_on_noinfo(ch);
} }
@ -675,7 +674,7 @@ static int on_ifjoin_expiry_timer(struct thread *t)
zlog_debug("%s: ifchannel %s expiry timer", __func__, zlog_debug("%s: ifchannel %s expiry timer", __func__,
ch->sg_str); ch->sg_str);
ifjoin_to_noinfo(ch, true); ifjoin_to_noinfo(ch);
/* ch may have been deleted */ /* ch may have been deleted */
return 0; return 0;
@ -714,7 +713,7 @@ static int on_ifjoin_prune_pending_timer(struct thread *t)
&rpf, ch->upstream, 0); &rpf, ch->upstream, 0);
} }
ifjoin_to_noinfo(ch, true); ifjoin_to_noinfo(ch);
} else { } else {
/* If SGRpt flag is set on ifchannel, Trigger SGRpt /* If SGRpt flag is set on ifchannel, Trigger SGRpt
* message on RP path upon prune timer expiry. * message on RP path upon prune timer expiry.

View File

@ -561,7 +561,7 @@ static void forward_off(struct pim_upstream *up)
/* scan per-interface (S,G) state */ /* scan per-interface (S,G) state */
for (ALL_LIST_ELEMENTS(up->ifchannels, chnode, chnextnode, ch)) { for (ALL_LIST_ELEMENTS(up->ifchannels, chnode, chnextnode, ch)) {
pim_forward_stop(ch, false); pim_forward_stop(ch);
} /* scan iface channel list */ } /* scan iface channel list */
} }

View File

@ -845,14 +845,14 @@ void pim_forward_start(struct pim_ifchannel *ch)
mask, __func__); mask, __func__);
} }
void pim_forward_stop(struct pim_ifchannel *ch, bool install_it) void pim_forward_stop(struct pim_ifchannel *ch)
{ {
struct pim_upstream *up = ch->upstream; struct pim_upstream *up = ch->upstream;
if (PIM_DEBUG_PIM_TRACE) { if (PIM_DEBUG_PIM_TRACE) {
zlog_debug("%s: (S,G)=%s oif=%s install_it: %d installed: %d", zlog_debug("%s: (S,G)=%s oif=%s installed: %d",
__func__, ch->sg_str, ch->interface->name, __func__, ch->sg_str, ch->interface->name,
install_it, up->channel_oil->installed); up->channel_oil->installed);
} }
/* /*
@ -865,9 +865,6 @@ void pim_forward_stop(struct pim_ifchannel *ch, bool install_it)
else else
pim_channel_del_oif(up->channel_oil, ch->interface, pim_channel_del_oif(up->channel_oil, ch->interface,
PIM_OIF_FLAG_PROTO_PIM, __func__); PIM_OIF_FLAG_PROTO_PIM, __func__);
if (install_it && !up->channel_oil->installed)
pim_upstream_mroute_add(up->channel_oil, __func__);
} }
void pim_zebra_zclient_update(struct vty *vty) void pim_zebra_zclient_update(struct vty *vty)

View File

@ -42,7 +42,7 @@ void igmp_source_forward_stop(struct igmp_source *source);
void igmp_source_forward_reevaluate_all(struct pim_instance *pim); void igmp_source_forward_reevaluate_all(struct pim_instance *pim);
void pim_forward_start(struct pim_ifchannel *ch); void pim_forward_start(struct pim_ifchannel *ch);
void pim_forward_stop(struct pim_ifchannel *ch, bool install_it); void pim_forward_stop(struct pim_ifchannel *ch);
void sched_rpf_cache_refresh(struct pim_instance *pim); void sched_rpf_cache_refresh(struct pim_instance *pim);
struct zclient *pim_zebra_zclient_get(void); struct zclient *pim_zebra_zclient_get(void);