]> git.puffer.fish Git - matthieu/frr.git/commitdiff
pimd: pim_upstream *always* creates a channel_oil
authorDonald Sharp <sharpd@cumulusnetworks.com>
Mon, 8 Jul 2019 23:57:01 +0000 (19:57 -0400)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Thu, 18 Jul 2019 11:56:37 +0000 (07:56 -0400)
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>
pimd/pim_mroute.c
pimd/pim_upstream.c
pimd/pim_zebra.c

index dc2db33f653acd738f5d9a90461ef1efe193858b..417906fecf13a3bd23fa161342da32aab0161220 100644 (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,
index 50df2fdbf91707d0d2c4c2453397eee0972d6536..f89e315423f6fe0f66d975a740b8072770c03246 100644 (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)
index 3b93dd2b3cababbcc18464a79cc0fb963dbdd549..b0db23f54ac0ec3428e0c5e78eca1b84a6df6773 100644 (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)