diff options
author | Chirag Shah <chirag@cumulusnetworks.com> | 2017-02-22 16:28:36 +0100 |
---|---|---|
committer | Donald Sharp <sharpd@cumulusnetworks.com> | 2017-03-16 23:53:28 +0100 |
commit | 1bc9827622572b24c7c47656565dc1a2601d6dc5 (patch) | |
tree | eda923517f772ca214aa507de5fc313bff1a24dd /pimd/pim_rpf.c | |
parent | Merge pull request #270 from donaldsharp/cares (diff) | |
download | frr-1bc9827622572b24c7c47656565dc1a2601d6dc5.tar.xz frr-1bc9827622572b24c7c47656565dc1a2601d6dc5.zip |
pimd: Nexthop tracking support
Add pim Nexthop tracking feature 1st part where, specific RP or Source address (unicast address)
register with Zebra. Once nexthop update received from Zebra for a given address, scan RP or upstream
entries impacted by the change in nexthop.
Reviewed By: CCR-5761, Donald Sharp <sharpd@cumulusnetworks.com>
Testing Done: Tested with multiple RPs and multiple *,G entries at LHR.
Add new Nexthop or remove one of the link towards RP and verify RP and upstream nexthop update.
similar test done at RP with multiple S,G entries to reach source.
Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
Diffstat (limited to 'pimd/pim_rpf.c')
-rw-r--r-- | pimd/pim_rpf.c | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/pimd/pim_rpf.c b/pimd/pim_rpf.c index ff8a6054c..3d278f12a 100644 --- a/pimd/pim_rpf.c +++ b/pimd/pim_rpf.c @@ -34,11 +34,12 @@ #include "pim_zlookup.h" #include "pim_ifchannel.h" #include "pim_time.h" +#include "pim_nht.h" static long long last_route_change_time = -1; long long nexthop_lookups_avoided = 0; -static struct in_addr pim_rpf_find_rpf_addr(struct pim_upstream *up); +static struct in_addr pim_rpf_find_rpf_addr (struct pim_upstream *up); void pim_rpf_set_refresh_time (void) @@ -184,14 +185,31 @@ 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_upstream *up, struct pim_rpf *old, uint8_t is_new) { struct pim_rpf *rpf = &up->rpf; struct pim_rpf saved; + struct prefix nht_p; saved.source_nexthop = rpf->source_nexthop; saved.rpf_addr = rpf->rpf_addr; + if (is_new) + { + if (PIM_DEBUG_ZEBRA) + { + char source_str[INET_ADDRSTRLEN]; + pim_inet4_dump("<source?>", up->upstream_addr, source_str, sizeof(source_str)); + zlog_debug ("%s: NHT Register upstream %s addr %s with Zebra.", + __PRETTY_FUNCTION__, up->sg_str, source_str); + } + /* Register addr with Zebra NHT */ + nht_p.family = AF_INET; + nht_p.prefixlen = IPV4_MAX_BITLEN; + nht_p.u.prefix4.s_addr = up->upstream_addr.s_addr; + pim_find_or_track_nexthop (&nht_p, up, NULL); + } + if (pim_nexthop_lookup(&rpf->source_nexthop, up->upstream_addr, !PIM_UPSTREAM_FLAG_TEST_FHR (up->flags) && |