summaryrefslogtreecommitdiffstats
path: root/pimd
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@cumulusnetworks.com>2017-05-26 15:07:16 +0200
committerDonald Sharp <sharpd@cumulusnetworks.com>2017-07-24 19:51:38 +0200
commit1eca85760bf623884459bf3360afe11a02117291 (patch)
treef0325362487c0ba804ddc3d127e40008698ed6ff /pimd
parentpimd: Cleanup some basic crashes from mistakes made converting to vrf (diff)
downloadfrr-1eca85760bf623884459bf3360afe11a02117291.tar.xz
frr-1eca85760bf623884459bf3360afe11a02117291.zip
pimd: Fix crash when attempting to use channel_oil->pim before it is assigned
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Diffstat (limited to 'pimd')
-rw-r--r--pimd/pim_ifchannel.c3
-rw-r--r--pimd/pim_mroute.c3
-rw-r--r--pimd/pim_msdp.c4
-rw-r--r--pimd/pim_msdp.h3
-rw-r--r--pimd/pim_upstream.c14
-rw-r--r--pimd/pim_upstream.h2
6 files changed, 16 insertions, 13 deletions
diff --git a/pimd/pim_ifchannel.c b/pimd/pim_ifchannel.c
index e3e0e9abc..5f3901e49 100644
--- a/pimd/pim_ifchannel.c
+++ b/pimd/pim_ifchannel.c
@@ -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);
}
}
diff --git a/pimd/pim_mroute.c b/pimd/pim_mroute.c
index 765c4c5e8..5b826b058 100644
--- a/pimd/pim_mroute.c
+++ b/pimd/pim_mroute.c
@@ -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",
diff --git a/pimd/pim_msdp.c b/pimd/pim_msdp.c
index fa884266b..3578f005d 100644
--- a/pimd/pim_msdp.c
+++ b/pimd/pim_msdp.c
@@ -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);
diff --git a/pimd/pim_msdp.h b/pimd/pim_msdp.h
index ef2ee260f..a24883b5d 100644
--- a/pimd/pim_msdp.h
+++ b/pimd/pim_msdp.h
@@ -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,
diff --git a/pimd/pim_upstream.c b/pimd/pim_upstream.c
index 31437e26f..7880bfd49 100644
--- a/pimd/pim_upstream.c
+++ b/pimd/pim_upstream.c
@@ -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);
diff --git a/pimd/pim_upstream.h b/pimd/pim_upstream.h
index 3be1de70a..c4a8bc693 100644
--- a/pimd/pim_upstream.h
+++ b/pimd/pim_upstream.h
@@ -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);