From: Donald Sharp Date: Wed, 25 Jan 2017 19:47:04 +0000 (-0500) Subject: pimd: Use correct flag to add an oif X-Git-Tag: frr-3.0-branchpoint~60^2~5 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=f663aa7ad4028905632fdc4d6801522b8a17f731;p=mirror%2Ffrr.git pimd: Use correct flag to add an oif When we are creating the igmp ifchannel we were creating it with both a P and a I flag. This was causing it to not be cleaned up properly when the interface was shut down. Subsuquently when the interface came back up we would attempt to add it back in but it would fail. Ticket: CM-14586 Signed-off-by: Donald Sharp --- diff --git a/pimd/pim_ifchannel.c b/pimd/pim_ifchannel.c index 8d2de3c878..7056ade501 100644 --- a/pimd/pim_ifchannel.c +++ b/pimd/pim_ifchannel.c @@ -142,7 +142,11 @@ void pim_ifchannel_delete(struct pim_ifchannel *ch) if (ch->upstream->channel_oil) { - pim_channel_del_oif (ch->upstream->channel_oil, ch->interface, PIM_OIF_FLAG_PROTO_PIM); + uint32_t mask = PIM_OIF_FLAG_PROTO_PIM; + if (ch->upstream->flags & PIM_UPSTREAM_FLAG_MASK_SRC_IGMP) + mask = PIM_OIF_FLAG_PROTO_IGMP; + + pim_channel_del_oif (ch->upstream->channel_oil, ch->interface, mask); /* * Do we have any S,G's that are inheriting? * Nuke from on high too. @@ -929,8 +933,9 @@ void pim_ifchannel_prune(struct interface *ifp, } } -void pim_ifchannel_local_membership_add(struct interface *ifp, - struct prefix_sg *sg) +int +pim_ifchannel_local_membership_add(struct interface *ifp, + struct prefix_sg *sg) { struct pim_ifchannel *ch; struct pim_interface *pim_ifp; @@ -938,13 +943,13 @@ void pim_ifchannel_local_membership_add(struct interface *ifp, /* PIM enabled on interface? */ pim_ifp = ifp->info; if (!pim_ifp) - return; + return 0; if (!PIM_IF_TEST_PIM(pim_ifp->options)) - return; + return 0; ch = pim_ifchannel_add(ifp, sg, PIM_UPSTREAM_FLAG_MASK_SRC_IGMP); if (!ch) { - return; + return 0; } ifmembership_set(ch, PIM_IFMEMBERSHIP_INCLUDE); @@ -969,6 +974,8 @@ void pim_ifchannel_local_membership_add(struct interface *ifp, } } } + + return 1; } void pim_ifchannel_local_membership_del(struct interface *ifp, diff --git a/pimd/pim_ifchannel.h b/pimd/pim_ifchannel.h index bfe632135c..a3dc0e9d83 100644 --- a/pimd/pim_ifchannel.h +++ b/pimd/pim_ifchannel.h @@ -130,8 +130,8 @@ void pim_ifchannel_prune(struct interface *ifp, struct prefix_sg *sg, uint8_t source_flags, uint16_t holdtime); -void pim_ifchannel_local_membership_add(struct interface *ifp, - struct prefix_sg *sg); +int pim_ifchannel_local_membership_add(struct interface *ifp, + struct prefix_sg *sg); void pim_ifchannel_local_membership_del(struct interface *ifp, struct prefix_sg *sg); diff --git a/pimd/pim_zebra.c b/pimd/pim_zebra.c index aa09819fbe..1bb4852c6b 100644 --- a/pimd/pim_zebra.c +++ b/pimd/pim_zebra.c @@ -1097,7 +1097,13 @@ void igmp_source_forward_start(struct igmp_source *source) Feed IGMPv3-gathered local membership information into PIM per-interface (S,G) state. */ - pim_ifchannel_local_membership_add(group->group_igmp_sock->interface, &sg); + if (!pim_ifchannel_local_membership_add(group->group_igmp_sock->interface, &sg)) + { + if (PIM_DEBUG_MROUTE) + zlog_warn ("%s: Failure to add local membership for %s", + __PRETTY_FUNCTION__, pim_str_sg_dump (&sg)); + return; + } IGMP_SOURCE_DO_FORWARDING(source->source_flags); } @@ -1167,6 +1173,7 @@ void igmp_source_forward_stop(struct igmp_source *source) void pim_forward_start(struct pim_ifchannel *ch) { struct pim_upstream *up = ch->upstream; + uint32_t mask = PIM_OIF_FLAG_PROTO_PIM; if (PIM_DEBUG_PIM_TRACE) { char source_str[INET_ADDRSTRLEN]; @@ -1206,9 +1213,10 @@ void pim_forward_start(struct pim_ifchannel *ch) } } - pim_channel_add_oif(up->channel_oil, - ch->interface, - PIM_OIF_FLAG_PROTO_PIM); + if (up->flags & PIM_UPSTREAM_FLAG_MASK_SRC_IGMP) + mask = PIM_OIF_FLAG_PROTO_IGMP; + + pim_channel_add_oif(up->channel_oil, ch->interface, mask); } void pim_forward_stop(struct pim_ifchannel *ch)