]> git.proxmox.com Git - mirror_frr.git/commitdiff
pimd: Cleanup pimg from pim_upstream.c
authorDonald Sharp <sharpd@cumulusnetworks.com>
Sun, 21 May 2017 13:10:17 +0000 (09:10 -0400)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Mon, 24 Jul 2017 17:51:36 +0000 (13:51 -0400)
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
pimd/pim_register.c
pimd/pim_upstream.c
pimd/pim_upstream.h

index 8ba030d2dcca715ff171cc9701a798764d93e405..c753358ec0b1443e6572310049cef221a3e6dacf 100644 (file)
@@ -377,7 +377,7 @@ int pim_register_recv(struct interface *ifp, struct in_addr dest_addr,
                }
 
                if ((upstream->sptbit == PIM_UPSTREAM_SPTBIT_TRUE)
-                   || ((SwitchToSptDesired(&sg))
+                   || ((SwitchToSptDesired(pim_ifp->pim, &sg))
                        && pim_upstream_inherited_olist(pim_ifp->pim, upstream)
                                   == 0)) {
                        // pim_scan_individual_oil (upstream->channel_oil);
@@ -389,7 +389,7 @@ int pim_register_recv(struct interface *ifp, struct in_addr dest_addr,
                                           upstream->sptbit);
                }
                if ((upstream->sptbit == PIM_UPSTREAM_SPTBIT_TRUE)
-                   || (SwitchToSptDesired(&sg))) {
+                   || (SwitchToSptDesired(pim_ifp->pim, &sg))) {
                        if (sentRegisterStop) {
                                pim_upstream_keep_alive_timer_start(
                                        upstream, qpim_rp_keep_alive_time);
index 9d462067581a20f91e6c7b50fee716737c57ecb9..cb0170767ad43ee10022948244aa09d09f788438 100644 (file)
@@ -1081,10 +1081,12 @@ static void pim_upstream_fhr_kat_start(struct pim_upstream *up)
 static int pim_upstream_keep_alive_timer(struct thread *t)
 {
        struct pim_upstream *up;
+       struct pim_instance *pim;
 
        up = THREAD_ARG(t);
+       pim = up->channel_oil->pim;
 
-       if (I_am_RP(pimg, up->sg.grp)) {
+       if (I_am_RP(pim, up->sg.grp)) {
                pim_br_clear_pmbr(&up->sg);
                /*
                 * We need to do more here :)
@@ -1097,15 +1099,15 @@ static int pim_upstream_keep_alive_timer(struct thread *t)
 
        /* if entry was created because of activity we need to deref it */
        if (PIM_UPSTREAM_FLAG_TEST_SRC_STREAM(up->flags)) {
-               pim_upstream_fhr_kat_expiry(pimg, up);
+               pim_upstream_fhr_kat_expiry(pim, up);
                if (PIM_DEBUG_TRACE)
                        zlog_debug("kat expired on %s; remove stream reference",
                                   up->sg_str);
                PIM_UPSTREAM_FLAG_UNSET_SRC_STREAM(up->flags);
-               pim_upstream_del(pimg, up, __PRETTY_FUNCTION__);
+               pim_upstream_del(pim, up, __PRETTY_FUNCTION__);
        } else if (PIM_UPSTREAM_FLAG_TEST_SRC_LHR(up->flags)) {
                PIM_UPSTREAM_FLAG_UNSET_SRC_LHR(up->flags);
-               pim_upstream_del(pimg, up, __PRETTY_FUNCTION__);
+               pim_upstream_del(pim, up, __PRETTY_FUNCTION__);
        }
 
        return 0;
@@ -1175,9 +1177,10 @@ void pim_upstream_msdp_reg_timer_start(struct pim_upstream *up)
  *  SwitchToSptDesired(S,G) return true once a single packet has been
  *  received for the source and group.
  */
-int pim_upstream_switch_to_spt_desired(struct prefix_sg *sg)
+int pim_upstream_switch_to_spt_desired(struct pim_instance *pim,
+                                      struct prefix_sg *sg)
 {
-       if (I_am_RP(pimg, sg->grp))
+       if (I_am_RP(pim, sg->grp))
                return 1;
 
        return 0;
@@ -1311,10 +1314,12 @@ const char *pim_reg_state2str(enum pim_reg_state reg_state, char *state_str)
 static int pim_upstream_register_stop_timer(struct thread *t)
 {
        struct pim_interface *pim_ifp;
+       struct pim_instance *pim;
        struct pim_upstream *up;
        struct pim_rpf *rpg;
        struct ip ip_hdr;
        up = THREAD_ARG(t);
+       pim = up->channel_oil->pim;
 
        if (PIM_DEBUG_TRACE) {
                char state_str[PIM_REG_STATE_STR_LEN];
@@ -1326,7 +1331,7 @@ static int pim_upstream_register_stop_timer(struct thread *t)
        switch (up->reg_state) {
        case PIM_REG_JOIN_PENDING:
                up->reg_state = PIM_REG_JOIN;
-               pim_channel_add_oif(up->channel_oil, pimg->regiface,
+               pim_channel_add_oif(up->channel_oil, pim->regiface,
                                    PIM_OIF_FLAG_PROTO_PIM);
                break;
        case PIM_REG_JOIN:
@@ -1558,6 +1563,8 @@ static int pim_upstream_equal(const void *arg1, const void *arg2)
  */
 static bool pim_upstream_kat_start_ok(struct pim_upstream *up)
 {
+       struct pim_instance *pim = up->channel_oil->pim;
+
        /* "iif == RPF_interface(S)" check has to be done by the kernel or hw
         * so we will skip that here */
        if (pim_if_connected_to_source(up->rpf.source_nexthop.interface,
@@ -1577,7 +1584,7 @@ static bool pim_upstream_kat_start_ok(struct pim_upstream *up)
                 * MUST be
                 * removed to handle spt turn-arounds correctly in a 3-tier clos
                 */
-               if (I_am_RP(pimg, up->sg.grp))
+               if (I_am_RP(pim, up->sg.grp))
                        return true;
        }
 
@@ -1591,9 +1598,10 @@ static bool pim_upstream_kat_start_ok(struct pim_upstream *up)
 static void pim_upstream_sg_running(void *arg)
 {
        struct pim_upstream *up = (struct pim_upstream *)arg;
+       struct pim_instance *pim = up->channel_oil->pim;
 
        // No packet can have arrived here if this is the case
-       if (!up->channel_oil || !up->channel_oil->installed) {
+       if (!up->channel_oil->installed) {
                if (PIM_DEBUG_TRACE)
                        zlog_debug("%s: %s is not installed in mroute",
                                   __PRETTY_FUNCTION__, up->sg_str);
@@ -1613,7 +1621,7 @@ static void pim_upstream_sg_running(void *arg)
                        zlog_debug(
                                "%s: Handling unscanned inherited_olist for %s",
                                __PRETTY_FUNCTION__, up->sg_str);
-               pim_upstream_inherited_olist_decide(pimg, up);
+               pim_upstream_inherited_olist_decide(pim, up);
                up->channel_oil->oil_inherited_rescan = 0;
        }
        pim_mroute_update_counters(up->channel_oil);
index 62bd212e995dc3e9ed768cda12386356dc41611b..a9d84bb9b42e3b83497de260c477db1dfb40f6b7 100644 (file)
@@ -178,8 +178,9 @@ void pim_upstream_update_my_assert_metric(struct pim_upstream *up);
 void pim_upstream_keep_alive_timer_start(struct pim_upstream *up,
                                         uint32_t time);
 
-int pim_upstream_switch_to_spt_desired(struct prefix_sg *sg);
-#define SwitchToSptDesired(sg) pim_upstream_switch_to_spt_desired (sg)
+int pim_upstream_switch_to_spt_desired(struct pim_instance *pim,
+                                      struct prefix_sg *sg);
+#define SwitchToSptDesired(pim, sg) pim_upstream_switch_to_spt_desired (pim, sg)
 int pim_upstream_is_sg_rpt(struct pim_upstream *up);
 
 void pim_upstream_set_sptbit(struct pim_upstream *up,