diff options
| author | Donald Sharp <sharpd@cumulusnetworks.com> | 2016-08-31 10:50:20 -0400 |
|---|---|---|
| committer | Donald Sharp <sharpd@cumulusnetworks.com> | 2016-12-21 20:26:08 -0500 |
| commit | 5f6f65b14c79cc7ab3d80cd48a03910001e0f90f (patch) | |
| tree | a7db4a14e558fc1f8281b6de4974cb132e1e1c49 | |
| parent | e8e277d564f26b230e1cd8b2619eab149ecd433f (diff) | |
pimd: Fix creation of channel oil to happen 1st.
This has 2 fixes:
On nocache event, crate the channel oil first in
case we don't need to actually create the upstream
information
on wrvifwhole, create the channel oil and install
it, then only create the upstream information
if we are connected to the source.
Ticket: CM-12593
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
| -rw-r--r-- | pimd/pim_mroute.c | 63 |
1 files changed, 35 insertions, 28 deletions
diff --git a/pimd/pim_mroute.c b/pimd/pim_mroute.c index 3fb69bc86a..14221d3303 100644 --- a/pimd/pim_mroute.c +++ b/pimd/pim_mroute.c @@ -89,6 +89,7 @@ pim_mroute_msg_nocache (int fd, struct interface *ifp, const struct igmpmsg *msg struct pim_upstream *up; struct pim_rpf *rpg; struct prefix_sg sg; + struct channel_oil *oil; rpg = RP(msg->im_dst); /* @@ -123,28 +124,29 @@ pim_mroute_msg_nocache (int fd, struct interface *ifp, const struct igmpmsg *msg __PRETTY_FUNCTION__, pim_str_sg_dump (&sg)); } - up = pim_upstream_add (&sg, ifp); - if (!up) { + oil = pim_channel_oil_add (&sg, pim_ifp->mroute_vif_index); + if (!oil) { if (PIM_DEBUG_MROUTE) { - zlog_debug("%s: Failure to add upstream information for %s", + zlog_debug("%s: Failure to add channel oil for %s", __PRETTY_FUNCTION__, pim_str_sg_dump (&sg)); } return 0; } - pim_upstream_keep_alive_timer_start (up, qpim_keep_alive_time); - - up->channel_oil = pim_channel_oil_add(&sg, - pim_ifp->mroute_vif_index); - if (!up->channel_oil) { + up = pim_upstream_add (&sg, ifp); + if (!up) { if (PIM_DEBUG_MROUTE) { - zlog_debug("%s: Failure to add channel oil for %s", + zlog_debug("%s: Failure to add upstream information for %s", __PRETTY_FUNCTION__, pim_str_sg_dump (&sg)); } return 0; } + + pim_upstream_keep_alive_timer_start (up, qpim_keep_alive_time); + + up->channel_oil = oil; up->channel_oil->cc.pktcnt++; up->fhr = 1; pim_channel_add_oif (up->channel_oil, pim_regiface, PIM_OIF_FLAG_PROTO_PIM); @@ -304,6 +306,7 @@ pim_mroute_msg_wrvifwhole (int fd, struct interface *ifp, const char *buf) struct pim_ifchannel *ch; struct pim_upstream *up; struct prefix_sg sg; + struct channel_oil *oil; memset (&sg, 0, sizeof (struct prefix_sg)); sg.src = ip_hdr->ip_src; @@ -351,29 +354,33 @@ pim_mroute_msg_wrvifwhole (int fd, struct interface *ifp, const char *buf) return 0; } - up = pim_upstream_add (&sg, ifp); - - if (!up) + pim_ifp = ifp->info; + oil = pim_channel_oil_add (&sg, pim_ifp->mroute_vif_index); + if (!oil->installed) + pim_mroute_add (oil); + if (pim_if_connected_to_source (ifp, sg.src)) { - if (PIM_DEBUG_MROUTE) - zlog_debug ("%s: WRONGVIF%s unable to create upstream on interface", - pim_str_sg_dump (&sg), ifp->name); - return -2; - } + up = pim_upstream_add (&sg, ifp); - if (pim_if_connected_to_source (ifp, sg.src)) - up->fhr = 1; + if (!up) + { + if (PIM_DEBUG_MROUTE) + zlog_debug ("%s: WRONGVIF%s unable to create upstream on interface", + pim_str_sg_dump (&sg), ifp->name); + return -2; + } + up->fhr = 1; - pim_ifp = ifp->info; - pim_upstream_keep_alive_timer_start (up, qpim_keep_alive_time); - up->channel_oil = pim_channel_oil_add (&sg, pim_ifp->mroute_vif_index); - up->channel_oil->cc.pktcnt++; - pim_channel_add_oif (up->channel_oil, pim_regiface, PIM_OIF_FLAG_PROTO_PIM); - up->join_state = PIM_UPSTREAM_JOINED; - pim_upstream_inherited_olist (up); + pim_upstream_keep_alive_timer_start (up, qpim_keep_alive_time); + up->channel_oil = oil; + up->channel_oil->cc.pktcnt++; + pim_channel_add_oif (up->channel_oil, pim_regiface, PIM_OIF_FLAG_PROTO_PIM); + up->join_state = PIM_UPSTREAM_JOINED; + pim_upstream_inherited_olist (up); - // Send the packet to the RP - pim_mroute_msg_wholepkt (fd, ifp, buf); + // Send the packet to the RP + pim_mroute_msg_wholepkt (fd, ifp, buf); + } return 0; } |
