summaryrefslogtreecommitdiff
path: root/pimd/pim_mroute.c
diff options
context:
space:
mode:
Diffstat (limited to 'pimd/pim_mroute.c')
-rw-r--r--pimd/pim_mroute.c63
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;
}