diff options
author | Donald Sharp <sharpd@cumulusnetworks.com> | 2019-04-02 15:40:41 +0200 |
---|---|---|
committer | Donald Sharp <sharpd@cumulusnetworks.com> | 2019-04-05 17:12:59 +0200 |
commit | 43763b11d0d51b60809cddc4722daae359a4d1a9 (patch) | |
tree | 4316e397b407dd65797e583d3947637893afed1d /pimd/pim_rpf.c | |
parent | pimd: Determining if we are the RP should happen always (diff) | |
download | frr-43763b11d0d51b60809cddc4722daae359a4d1a9.tar.xz frr-43763b11d0d51b60809cddc4722daae359a4d1a9.zip |
pimd: Tracking of RPF is *separate* from the lookup
Start the separation of tracking a Destination from the act
of looking it up. The cojoining of these two concepts led
to a bunch of code that had to think about both problems leading
to weird situations and code paths. Simplify the code by making
pim_ecmp_nexthop_search a static function and we only ever
call pim_ecmp_nexthop_lookup when we need to do a RPF().
pim_ecmp_nexthop_lookup will now attempt to find a stored pnc
and if it finds one it will report on the answer from it.
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Diffstat (limited to 'pimd/pim_rpf.c')
-rw-r--r-- | pimd/pim_rpf.c | 18 |
1 files changed, 4 insertions, 14 deletions
diff --git a/pimd/pim_rpf.c b/pimd/pim_rpf.c index 55f788b5b..8cc8b7481 100644 --- a/pimd/pim_rpf.c +++ b/pimd/pim_rpf.c @@ -201,7 +201,6 @@ enum pim_rpf_result pim_rpf_update(struct pim_instance *pim, struct pim_rpf *rpf = &up->rpf; struct pim_rpf saved; struct prefix nht_p; - struct pim_nexthop_cache pnc; struct prefix src, grp; bool neigh_needed = true; @@ -232,23 +231,14 @@ enum pim_rpf_result pim_rpf_update(struct pim_instance *pim, grp.family = AF_INET; grp.prefixlen = IPV4_MAX_BITLEN; grp.u.prefix4 = up->sg.grp; - memset(&pnc, 0, sizeof(struct pim_nexthop_cache)); if ((up->sg.src.s_addr == INADDR_ANY && I_am_RP(pim, up->sg.grp)) || PIM_UPSTREAM_FLAG_TEST_FHR(up->flags)) neigh_needed = FALSE; - if (pim_find_or_track_nexthop(pim, &nht_p, up, NULL, &pnc)) { - if (pnc.nexthop_num) { - if (!pim_ecmp_nexthop_search(pim, &pnc, - &up->rpf.source_nexthop, - &src, &grp, neigh_needed)) - return PIM_RPF_FAILURE; - } - } else { - if (!pim_ecmp_nexthop_lookup(pim, &rpf->source_nexthop, &src, - &grp, neigh_needed)) - return PIM_RPF_FAILURE; - } + pim_find_or_track_nexthop(pim, &nht_p, up, NULL, NULL); + if (!pim_ecmp_nexthop_lookup(pim, &rpf->source_nexthop, &src, &grp, + neigh_needed)) + return PIM_RPF_FAILURE; rpf->rpf_addr.family = AF_INET; rpf->rpf_addr.u.prefix4 = pim_rpf_find_rpf_addr(up); |