pimd: pim_upstream *always* creates a channel_oil

Modify code base so that pim_upstream *always* creates a channel_oil
and as such we do not need to create it later or play other games.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
This commit is contained in:
Donald Sharp 2019-07-08 19:57:01 -04:00
parent afb2f47031
commit 46dd6edb06
3 changed files with 17 additions and 54 deletions

View File

@ -518,11 +518,7 @@ static int pim_mroute_msg_wrvifwhole(int fd, struct interface *ifp,
up->upstream_register);
up->sptbit = PIM_UPSTREAM_SPTBIT_TRUE;
}
if (!up->channel_oil)
up->channel_oil = pim_channel_oil_add(
pim_ifp->pim, &sg,
pim_ifp->mroute_vif_index,
__PRETTY_FUNCTION__);
pim_upstream_inherited_olist(pim_ifp->pim, up);
if (!up->channel_oil->installed)
pim_mroute_add(up->channel_oil,

View File

@ -716,7 +716,8 @@ static struct pim_upstream *pim_upstream_new(struct pim_instance *pim,
up->join_state = PIM_UPSTREAM_NOTJOINED;
up->reg_state = PIM_REG_NOINFO;
up->state_transition = pim_time_monotonic_sec();
up->channel_oil = NULL;
up->channel_oil =
pim_channel_oil_add(pim, &up->sg, MAXVIFS, __PRETTY_FUNCTION__);
up->sptbit = PIM_UPSTREAM_SPTBIT_FALSE;
up->rpf.source_nexthop.interface = NULL;
@ -740,48 +741,25 @@ static struct pim_upstream *pim_upstream_new(struct pim_instance *pim,
pim_upstream_fill_static_iif(up, incoming);
pim_ifp = up->rpf.source_nexthop.interface->info;
assert(pim_ifp);
up->channel_oil = pim_channel_oil_add(pim, &up->sg,
pim_ifp->mroute_vif_index,
__PRETTY_FUNCTION__);
} else if (up->upstream_addr.s_addr == INADDR_ANY) {
/* Create a dummmy channel oil with incoming ineterface MAXVIFS,
* since RP is not configured
*/
up->channel_oil = pim_channel_oil_add(pim, &up->sg, MAXVIFS,
__PRETTY_FUNCTION__);
} else {
pim_channel_oil_change_iif(pim, up->channel_oil,
pim_ifp->mroute_vif_index,
__PRETTY_FUNCTION__);
} else if (up->upstream_addr.s_addr != INADDR_ANY) {
rpf_result = pim_rpf_update(pim, up, NULL);
if (rpf_result == PIM_RPF_FAILURE) {
if (PIM_DEBUG_TRACE)
zlog_debug(
"%s: Attempting to create upstream(%s), Unable to RPF for source",
__PRETTY_FUNCTION__, up->sg_str);
/* Create a dummmy channel oil with incoming ineterface
* MAXVIFS, since RP is not reachable
*/
up->channel_oil = pim_channel_oil_add(
pim, &up->sg, MAXVIFS, __PRETTY_FUNCTION__);
}
if (up->rpf.source_nexthop.interface) {
pim_ifp = up->rpf.source_nexthop.interface->info;
if (pim_ifp)
up->channel_oil = pim_channel_oil_add(
pim, &up->sg, pim_ifp->mroute_vif_index,
pim_channel_oil_change_iif(
pim, up->channel_oil,
pim_ifp->mroute_vif_index,
__PRETTY_FUNCTION__);
else {
/*
* Yeah this should not happen
* but let's be sure that we are not
* doing something stupid, all paths
* through upstream creation will
* create a channel oil
*/
up->channel_oil = pim_channel_oil_add(
pim, &up->sg, MAXVIFS,
__PRETTY_FUNCTION__);
}
}
}
@ -1526,22 +1504,14 @@ int pim_upstream_inherited_olist_decide(struct pim_instance *pim,
struct pim_upstream *up)
{
struct interface *ifp;
struct pim_interface *pim_ifp = NULL;
struct pim_ifchannel *ch, *starch;
struct pim_upstream *starup = up->parent;
int output_intf = 0;
if (up->rpf.source_nexthop.interface)
pim_ifp = up->rpf.source_nexthop.interface->info;
else {
if (!up->rpf.source_nexthop.interface)
if (PIM_DEBUG_TRACE)
zlog_debug("%s: up %s RPF is not present",
__PRETTY_FUNCTION__, up->sg_str);
}
if (pim_ifp && !up->channel_oil)
up->channel_oil = pim_channel_oil_add(pim, &up->sg,
pim_ifp->mroute_vif_index,
__PRETTY_FUNCTION__);
FOR_ALL_INTERFACES (pim->vrf, ifp) {
if (!ifp->info)

View File

@ -1231,14 +1231,15 @@ void pim_forward_start(struct pim_ifchannel *ch)
__FILE__, __PRETTY_FUNCTION__,
source_str);
}
up->channel_oil = pim_channel_oil_add(
pim, &up->sg, MAXVIFS, __PRETTY_FUNCTION__);
pim_channel_oil_change_iif(pim, up->channel_oil,
MAXVIFS,
__PRETTY_FUNCTION__);
}
else
up->channel_oil = pim_channel_oil_add(
pim, &up->sg, input_iface_vif_index,
__PRETTY_FUNCTION__);
pim_channel_oil_change_iif(pim, up->channel_oil,
input_iface_vif_index,
__PRETTY_FUNCTION__);
if (PIM_DEBUG_TRACE) {
struct interface *in_intf = pim_if_find_by_vif_index(
@ -1249,10 +1250,6 @@ void pim_forward_start(struct pim_ifchannel *ch)
in_intf ? in_intf->name : "Unknown",
input_iface_vif_index, up->sg_str);
}
up->channel_oil =
pim_channel_oil_add(pim, &up->sg, input_iface_vif_index,
__PRETTY_FUNCTION__);
}
if (up->flags & PIM_UPSTREAM_FLAG_MASK_SRC_IGMP)