mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-03 11:01:48 +00:00
pimd: Cleanup some basic crashes from mistakes made converting to vrf
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
This commit is contained in:
parent
bc14b6c7a4
commit
2002dcdb94
@ -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;
|
||||
|
@ -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",
|
||||
|
@ -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)
|
||||
|
@ -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__);
|
||||
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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");
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user