]> git.puffer.fish Git - mirror/frr.git/commitdiff
pimd: Fix crash when attempting to use channel_oil->pim before it is assigned
authorDonald Sharp <sharpd@cumulusnetworks.com>
Fri, 26 May 2017 13:07:16 +0000 (09:07 -0400)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Mon, 24 Jul 2017 17:51:38 +0000 (13:51 -0400)
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
pimd/pim_ifchannel.c
pimd/pim_mroute.c
pimd/pim_msdp.c
pimd/pim_msdp.h
pimd/pim_upstream.c
pimd/pim_upstream.h

index e3e0e9abc313bcd4215a158713601a18963b4353..5f3901e49b264e8bcb9c968385211d0d0a7f4e4c 100644 (file)
@@ -1053,7 +1053,8 @@ int pim_ifchannel_local_membership_add(struct interface *ifp,
                                    child, ch, starch)) {
                                pim_channel_add_oif(child->channel_oil, ifp,
                                                    PIM_OIF_FLAG_PROTO_STAR);
-                               pim_upstream_switch(child, PIM_UPSTREAM_JOINED);
+                               pim_upstream_switch(pim, child,
+                                                   PIM_UPSTREAM_JOINED);
                        }
                }
 
index 765c4c5e886267f476f17bf4ce7529fc49c27c93..5b826b0580fb5e17bd8b886d3eab8a59054411a0 100644 (file)
@@ -246,7 +246,8 @@ static int pim_mroute_msg_wholepkt(int fd, struct interface *ifp,
                        pim_upstream_keep_alive_timer_start(
                                up, qpim_keep_alive_time);
                        pim_upstream_inherited_olist(pim_ifp->pim, up);
-                       pim_upstream_switch(up, PIM_UPSTREAM_JOINED);
+                       pim_upstream_switch(pim_ifp->pim, up,
+                                           PIM_UPSTREAM_JOINED);
 
                        if (PIM_DEBUG_MROUTE)
                                zlog_debug("%s: Creating %s upstream on LHR",
index fa884266b395edd236868a7bc62c5c86f5e17ae6..3578f005dd0a6bd887446a6b094f5aee3332377f 100644 (file)
@@ -623,11 +623,11 @@ void pim_msdp_i_am_rp_changed(struct pim_instance *pim)
 /* We track the join state of (*, G) entries. If G has sources in the SA-cache
  * we need to setup or teardown SPT when the JoinDesired status changes for
  * (*, G) */
-void pim_msdp_up_join_state_changed(struct pim_upstream *xg_up)
+void pim_msdp_up_join_state_changed(struct pim_instance *pim,
+                                   struct pim_upstream *xg_up)
 {
        struct listnode *sanode;
        struct pim_msdp_sa *sa;
-       struct pim_instance *pim = xg_up->channel_oil->pim;
 
        if (PIM_DEBUG_MSDP_INTERNAL) {
                zlog_debug("MSDP join state changed for %s", xg_up->sg_str);
index ef2ee260f1240a9c9b7e9a0fba924032aaf059c2..a24883b5d435d7f078e62f81b7dec36e2f2445bc 100644 (file)
@@ -248,7 +248,8 @@ void pim_msdp_sa_local_update(struct pim_upstream *up);
 void pim_msdp_sa_local_del(struct pim_instance *pim, struct prefix_sg *sg);
 void pim_msdp_i_am_rp_changed(struct pim_instance *pim);
 bool pim_msdp_peer_rpf_check(struct pim_msdp_peer *mp, struct in_addr rp);
-void pim_msdp_up_join_state_changed(struct pim_upstream *xg_up);
+void pim_msdp_up_join_state_changed(struct pim_instance *pim,
+                                   struct pim_upstream *xg_up);
 void pim_msdp_up_del(struct pim_instance *pim, struct prefix_sg *sg);
 enum pim_msdp_err pim_msdp_mg_mbr_add(struct pim_instance *pim,
                                      const char *mesh_group_name,
index 31437e26f7ada2cda4937a8362d0a3ddc6d37768..7880bfd491c32599a33eaa404d26686b4f4e0d32 100644 (file)
@@ -512,7 +512,7 @@ void pim_upstream_register_reevaluate(struct pim_instance *pim)
        }
 }
 
-void pim_upstream_switch(struct pim_upstream *up,
+void pim_upstream_switch(struct pim_instance *pim, struct pim_upstream *up,
                         enum pim_upstream_state new_state)
 {
        enum pim_upstream_state old_state = up->join_state;
@@ -534,7 +534,7 @@ void pim_upstream_switch(struct pim_upstream *up,
                if (old_state != PIM_UPSTREAM_JOINED) {
                        int old_fhr = PIM_UPSTREAM_FLAG_TEST_FHR(up->flags);
                        forward_on(up);
-                       pim_msdp_up_join_state_changed(up);
+                       pim_msdp_up_join_state_changed(pim, up);
                        if (pim_upstream_could_register(up)) {
                                PIM_UPSTREAM_FLAG_SET_FHR(up->flags);
                                if (!old_fhr
@@ -555,13 +555,13 @@ void pim_upstream_switch(struct pim_upstream *up,
 
                forward_off(up);
                if (old_state == PIM_UPSTREAM_JOINED)
-                       pim_msdp_up_join_state_changed(up);
+                       pim_msdp_up_join_state_changed(pim, up);
 
                /* IHR, Trigger SGRpt on *,G IIF to prune S,G from RPT towards
                   RP.
                   If I am RP for G then send S,G prune to its IIF. */
                if (pim_upstream_is_sg_rpt(up) && up->parent
-                   && !I_am_RP(up->channel_oil->pim, up->sg.grp)) {
+                   && !I_am_RP(pim, up->sg.grp)) {
                        if (PIM_DEBUG_PIM_TRACE_DETAIL)
                                zlog_debug(
                                        "%s: *,G IIF %s S,G IIF %s ",
@@ -901,13 +901,13 @@ void pim_upstream_update_join_desired(struct pim_instance *pim,
 
        /* switched from false to true */
        if (is_join_desired && !was_join_desired) {
-               pim_upstream_switch(up, PIM_UPSTREAM_JOINED);
+               pim_upstream_switch(pim, up, PIM_UPSTREAM_JOINED);
                return;
        }
 
        /* switched from true to false */
        if (!is_join_desired && was_join_desired) {
-               pim_upstream_switch(up, PIM_UPSTREAM_NOTJOINED);
+               pim_upstream_switch(pim, up, PIM_UPSTREAM_NOTJOINED);
                return;
        }
 }
@@ -1476,7 +1476,7 @@ int pim_upstream_inherited_olist(struct pim_instance *pim,
         * incoming packets so we don't bother the other stuff!
         */
        if (output_intf)
-               pim_upstream_switch(up, PIM_UPSTREAM_JOINED);
+               pim_upstream_switch(pim, up, PIM_UPSTREAM_JOINED);
        else
                forward_on(up);
 
index 3be1de70ad2be8b983ecc45c0c52011081747fb4..c4a8bc693068538a02ab69239c61d38e3d8d9cda 100644 (file)
@@ -192,7 +192,7 @@ void pim_upstream_start_register_stop_timer(struct pim_upstream *up,
 
 void pim_upstream_send_join(struct pim_upstream *up);
 
-void pim_upstream_switch(struct pim_upstream *up,
+void pim_upstream_switch(struct pim_instance *pim, struct pim_upstream *up,
                         enum pim_upstream_state new_state);
 
 const char *pim_upstream_state2str(enum pim_upstream_state join_state);