summaryrefslogtreecommitdiffstats
path: root/pimd
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@cumulusnetworks.com>2017-05-24 16:37:23 +0200
committerDonald Sharp <sharpd@cumulusnetworks.com>2017-07-24 19:51:38 +0200
commit2002dcdb94aa9d71bd6389687e52047e19585e51 (patch)
treece45fec04905820897d97f11d1714b8853d4a055 /pimd
parentpimd: Fix crash in 'show ip multicast vrf..' (diff)
downloadfrr-2002dcdb94aa9d71bd6389687e52047e19585e51.tar.xz
frr-2002dcdb94aa9d71bd6389687e52047e19585e51.zip
pimd: Cleanup some basic crashes from mistakes made converting to vrf
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Diffstat (limited to 'pimd')
-rw-r--r--pimd/pim_iface.c4
-rw-r--r--pimd/pim_ifchannel.c3
-rw-r--r--pimd/pim_mroute.c6
-rw-r--r--pimd/pim_msdp.c2
-rw-r--r--pimd/pim_nht.c2
-rw-r--r--pimd/pim_register.c3
-rw-r--r--pimd/pim_rpf.c4
-rw-r--r--pimd/pim_rpf.h3
-rw-r--r--pimd/pim_upstream.c26
-rw-r--r--pimd/pim_upstream.h3
-rw-r--r--pimd/pim_zebra.c2
11 files changed, 31 insertions, 27 deletions
diff --git a/pimd/pim_iface.c b/pimd/pim_iface.c
index d3b5aa3a5..124166880 100644
--- a/pimd/pim_iface.c
+++ b/pimd/pim_iface.c
@@ -594,8 +594,8 @@ void pim_if_addr_add(struct connected *ifc)
detect_address_change(ifp, 0, __PRETTY_FUNCTION__);
- if (ifc->address->family != AF_INET)
- return;
+ // if (ifc->address->family != AF_INET)
+ // return;
if (PIM_IF_TEST_IGMP(pim_ifp->options)) {
struct igmp_sock *igmp;
diff --git a/pimd/pim_ifchannel.c b/pimd/pim_ifchannel.c
index 469d33318..e3e0e9abc 100644
--- a/pimd/pim_ifchannel.c
+++ b/pimd/pim_ifchannel.c
@@ -521,7 +521,8 @@ struct pim_ifchannel *pim_ifchannel_add(struct interface *ifp,
pim_ifp = ifp->info;
- up = pim_upstream_add(sg, NULL, flags, __PRETTY_FUNCTION__);
+ up = pim_upstream_add(pim_ifp->pim, sg, NULL, flags,
+ __PRETTY_FUNCTION__);
if (!up) {
zlog_err(
"%s: could not attach upstream (S,G)=%s on interface %s",
diff --git a/pimd/pim_mroute.c b/pimd/pim_mroute.c
index c452cc799..765c4c5e8 100644
--- a/pimd/pim_mroute.c
+++ b/pimd/pim_mroute.c
@@ -40,6 +40,7 @@
#include "pim_ifchannel.h"
#include "pim_zlookup.h"
#include "pim_ssm.h"
+#include "pim_sock.h"
static void mroute_read_on(struct pim_instance *pim);
@@ -231,7 +232,7 @@ static int pim_mroute_msg_wholepkt(int fd, struct interface *ifp,
up = pim_upstream_find(pim_ifp->pim, &star);
if (up && PIM_UPSTREAM_FLAG_TEST_SRC_IGMP(up->flags)) {
- up = pim_upstream_add(&sg, ifp,
+ up = pim_upstream_add(pim_ifp->pim, &sg, ifp,
PIM_UPSTREAM_FLAG_MASK_SRC_LHR,
__PRETTY_FUNCTION__);
if (!up) {
@@ -502,7 +503,8 @@ static int pim_mroute_msg_wrvifwhole(int fd, struct interface *ifp,
if (!oil->installed)
pim_mroute_add(oil, __PRETTY_FUNCTION__);
if (pim_if_connected_to_source(ifp, sg.src)) {
- up = pim_upstream_add(&sg, ifp, PIM_UPSTREAM_FLAG_MASK_FHR,
+ up = pim_upstream_add(pim_ifp->pim, &sg, ifp,
+ PIM_UPSTREAM_FLAG_MASK_FHR,
__PRETTY_FUNCTION__);
if (!up) {
if (PIM_DEBUG_MROUTE)
diff --git a/pimd/pim_msdp.c b/pimd/pim_msdp.c
index 80305203b..fa884266b 100644
--- a/pimd/pim_msdp.c
+++ b/pimd/pim_msdp.c
@@ -203,7 +203,7 @@ static void pim_msdp_sa_upstream_update(struct pim_msdp_sa *sa,
/* RFC3618: "RP triggers a (S, G) join event towards the data source
* as if a JP message was rxed addressed to the RP itself." */
- up = pim_upstream_add(&sa->sg, NULL /* iif */,
+ up = pim_upstream_add(sa->pim, &sa->sg, NULL /* iif */,
PIM_UPSTREAM_FLAG_MASK_SRC_MSDP,
__PRETTY_FUNCTION__);
diff --git a/pimd/pim_nht.c b/pimd/pim_nht.c
index 13f41458c..eb487b962 100644
--- a/pimd/pim_nht.c
+++ b/pimd/pim_nht.c
@@ -350,7 +350,7 @@ static int pim_update_upstream_nh(struct pim_instance *pim,
struct pim_rpf old;
old.source_nexthop.interface = up->rpf.source_nexthop.interface;
- rpf_result = pim_rpf_update(up, &old, 0);
+ rpf_result = pim_rpf_update(pim, up, &old, 0);
if (rpf_result == PIM_RPF_FAILURE)
continue;
diff --git a/pimd/pim_register.c b/pimd/pim_register.c
index 9448dd818..744bc8e94 100644
--- a/pimd/pim_register.c
+++ b/pimd/pim_register.c
@@ -368,7 +368,8 @@ int pim_register_recv(struct interface *ifp, struct in_addr dest_addr,
*/
if (!upstream) {
upstream = pim_upstream_add(
- &sg, ifp, PIM_UPSTREAM_FLAG_MASK_SRC_STREAM,
+ pim_ifp->pim, &sg, ifp,
+ PIM_UPSTREAM_FLAG_MASK_SRC_STREAM,
__PRETTY_FUNCTION__);
if (!upstream) {
zlog_warn("Failure to create upstream state");
diff --git a/pimd/pim_rpf.c b/pimd/pim_rpf.c
index 3bde1bb83..36c6c894e 100644
--- a/pimd/pim_rpf.c
+++ b/pimd/pim_rpf.c
@@ -188,7 +188,8 @@ static int nexthop_mismatch(const struct pim_nexthop *nh1,
|| (nh1->mrib_route_metric != nh2->mrib_route_metric);
}
-enum pim_rpf_result pim_rpf_update(struct pim_upstream *up, struct pim_rpf *old,
+enum pim_rpf_result pim_rpf_update(struct pim_instance *pim,
+ struct pim_upstream *up, struct pim_rpf *old,
uint8_t is_new)
{
struct pim_rpf *rpf = &up->rpf;
@@ -196,7 +197,6 @@ enum pim_rpf_result pim_rpf_update(struct pim_upstream *up, struct pim_rpf *old,
struct prefix nht_p;
struct pim_nexthop_cache pnc;
struct prefix src, grp;
- struct pim_instance *pim = up->channel_oil->pim;
saved.source_nexthop = rpf->source_nexthop;
saved.rpf_addr = rpf->rpf_addr;
diff --git a/pimd/pim_rpf.h b/pimd/pim_rpf.h
index 9f7ae8679..86032f1c2 100644
--- a/pimd/pim_rpf.h
+++ b/pimd/pim_rpf.h
@@ -63,7 +63,8 @@ int pim_rpf_equal(const void *arg1, const void *arg2);
int pim_nexthop_lookup(struct pim_instance *pim, struct pim_nexthop *nexthop,
struct in_addr addr, int neighbor_needed);
-enum pim_rpf_result pim_rpf_update(struct pim_upstream *up, struct pim_rpf *old,
+enum pim_rpf_result pim_rpf_update(struct pim_instance *pim,
+ struct pim_upstream *up, struct pim_rpf *old,
uint8_t is_new);
int pim_rpf_addr_is_inaddr_none(struct pim_rpf *rpf);
diff --git a/pimd/pim_upstream.c b/pimd/pim_upstream.c
index acaa8df80..31437e26f 100644
--- a/pimd/pim_upstream.c
+++ b/pimd/pim_upstream.c
@@ -599,12 +599,13 @@ int pim_upstream_compare(void *arg1, void *arg2)
return 0;
}
-static struct pim_upstream *
-pim_upstream_new(struct prefix_sg *sg, struct interface *incoming, int flags)
+static struct pim_upstream *pim_upstream_new(struct pim_instance *pim,
+ struct prefix_sg *sg,
+ struct interface *incoming,
+ int flags)
{
enum pim_rpf_result rpf_result;
struct pim_interface *pim_ifp;
- struct pim_instance *pim;
struct pim_upstream *up;
up = XCALLOC(MTYPE_PIM_UPSTREAM, sizeof(*up));
@@ -614,8 +615,6 @@ pim_upstream_new(struct prefix_sg *sg, struct interface *incoming, int flags)
return NULL;
}
- pim_ifp = incoming->info;
- pim = pim_ifp->pim;
up->sg = *sg;
pim_str_sg_set(sg, up->sg_str);
up = hash_get(pim->upstream_hash, up, hash_alloc_intern);
@@ -667,7 +666,7 @@ pim_upstream_new(struct prefix_sg *sg, struct interface *incoming, int flags)
if (up->sg.src.s_addr != INADDR_ANY)
wheel_add_item(pim->upstream_sg_wheel, up);
- rpf_result = pim_rpf_update(up, NULL, 1);
+ rpf_result = pim_rpf_update(pim, up, NULL, 1);
if (rpf_result == PIM_RPF_FAILURE) {
struct prefix nht_p;
@@ -679,7 +678,7 @@ pim_upstream_new(struct prefix_sg *sg, struct interface *incoming, int flags)
nht_p.family = AF_INET;
nht_p.prefixlen = IPV4_MAX_BITLEN;
nht_p.u.prefix4 = up->upstream_addr;
- pim_delete_tracked_nexthop(pim_ifp->pim, &nht_p, up, NULL);
+ pim_delete_tracked_nexthop(pim, &nht_p, up, NULL);
if (up->parent) {
listnode_delete(up->parent->sources, up);
@@ -749,7 +748,7 @@ struct pim_upstream *pim_upstream_find_or_add(struct prefix_sg *sg,
up->ref_count);
}
} else
- up = pim_upstream_add(sg, incoming, flags, name);
+ up = pim_upstream_add(pim_ifp->pim, sg, incoming, flags, name);
return up;
}
@@ -764,21 +763,20 @@ void pim_upstream_ref(struct pim_upstream *up, int flags, const char *name)
up->ref_count);
}
-struct pim_upstream *pim_upstream_add(struct prefix_sg *sg,
+struct pim_upstream *pim_upstream_add(struct pim_instance *pim,
+ struct prefix_sg *sg,
struct interface *incoming, int flags,
const char *name)
{
struct pim_upstream *up = NULL;
- struct pim_interface *pim_ifp;
int found = 0;
- pim_ifp = incoming->info;
- up = pim_upstream_find(pim_ifp->pim, sg);
+ up = pim_upstream_find(pim, sg);
if (up) {
pim_upstream_ref(up, flags, name);
found = 1;
} else {
- up = pim_upstream_new(sg, incoming, flags);
+ up = pim_upstream_new(pim, sg, incoming, flags);
}
if (PIM_DEBUG_TRACE) {
@@ -1511,7 +1509,7 @@ void pim_upstream_find_new_rpf(struct pim_instance *pim)
zlog_debug(
"Upstream %s without a path to send join, checking",
up->sg_str);
- pim_rpf_update(up, NULL, 1);
+ pim_rpf_update(pim, up, NULL, 1);
}
}
}
diff --git a/pimd/pim_upstream.h b/pimd/pim_upstream.h
index a9d84bb9b..3be1de70a 100644
--- a/pimd/pim_upstream.h
+++ b/pimd/pim_upstream.h
@@ -143,7 +143,8 @@ struct pim_upstream *pim_upstream_find(struct pim_instance *pim,
struct pim_upstream *pim_upstream_find_or_add(struct prefix_sg *sg,
struct interface *ifp, int flags,
const char *name);
-struct pim_upstream *pim_upstream_add(struct prefix_sg *sg,
+struct pim_upstream *pim_upstream_add(struct pim_instance *pim,
+ struct prefix_sg *sg,
struct interface *ifp, int flags,
const char *name);
void pim_upstream_ref(struct pim_upstream *up, int flags, const char *name);
diff --git a/pimd/pim_zebra.c b/pimd/pim_zebra.c
index 88b234900..47b97339f 100644
--- a/pimd/pim_zebra.c
+++ b/pimd/pim_zebra.c
@@ -379,7 +379,7 @@ static void scan_upstream_rpf_cache()
old.source_nexthop.interface =
up->rpf.source_nexthop.interface;
old.source_nexthop.nbr = up->rpf.source_nexthop.nbr;
- rpf_result = pim_rpf_update(up, &old, 0);
+ rpf_result = pim_rpf_update(pim, up, &old, 0);
if (rpf_result == PIM_RPF_FAILURE)
continue;