X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=pimd%2Fpim_rpf.c;h=221c1ee4af54868da005d182e69d011405bc9740;hb=807407d7d6a2839c135ff2bf3a0808ddec716420;hp=36c6c894ef04be6410865306876250b8b837b16d;hpb=0ecfe5bf38cd803aef891fb9bedb5633949b39bc;p=mirror_frr.git diff --git a/pimd/pim_rpf.c b/pimd/pim_rpf.c index 36c6c894e..221c1ee4a 100644 --- a/pimd/pim_rpf.c +++ b/pimd/pim_rpf.c @@ -37,17 +37,15 @@ #include "pim_nht.h" #include "pim_oil.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); -void pim_rpf_set_refresh_time(void) +void pim_rpf_set_refresh_time(struct pim_instance *pim) { - last_route_change_time = pim_time_monotonic_usec(); + pim->last_route_change_time = pim_time_monotonic_usec(); if (PIM_DEBUG_TRACE) - zlog_debug("%s: New last route change time: %lld", - __PRETTY_FUNCTION__, last_route_change_time); + zlog_debug("%s: vrf(%s) New last route change time: %" PRId64, + __PRETTY_FUNCTION__, pim->vrf->name, + pim->last_route_change_time); } int pim_nexthop_lookup(struct pim_instance *pim, struct pim_nexthop *nexthop, @@ -61,8 +59,16 @@ int pim_nexthop_lookup(struct pim_instance *pim, struct pim_nexthop *nexthop, int found = 0; int i = 0; + /* + * We should not attempt to lookup a + * 255.255.255.255 address, since + * it will never work + */ + if (addr.s_addr == INADDR_NONE) + return -1; + if ((nexthop->last_lookup.s_addr == addr.s_addr) - && (nexthop->last_lookup_time > last_route_change_time)) { + && (nexthop->last_lookup_time > pim->last_route_change_time)) { if (PIM_DEBUG_TRACE) { char addr_str[INET_ADDRSTRLEN]; pim_inet4_dump("", addr, addr_str, @@ -71,12 +77,12 @@ int pim_nexthop_lookup(struct pim_instance *pim, struct pim_nexthop *nexthop, pim_addr_dump("", &nexthop->mrib_nexthop_addr, nexthop_str, sizeof(nexthop_str)); zlog_debug( - "%s: Using last lookup for %s at %lld, %lld addr%s", + "%s: Using last lookup for %s at %lld, %" PRId64 " addr%s", __PRETTY_FUNCTION__, addr_str, nexthop->last_lookup_time, - last_route_change_time, nexthop_str); + pim->last_route_change_time, nexthop_str); } - nexthop_lookups_avoided++; + pim->nexthop_lookups_avoided++; return 0; } else { if (PIM_DEBUG_TRACE) { @@ -84,10 +90,10 @@ int pim_nexthop_lookup(struct pim_instance *pim, struct pim_nexthop *nexthop, pim_inet4_dump("", addr, addr_str, sizeof(addr_str)); zlog_debug( - "%s: Looking up: %s, last lookup time: %lld, %lld", + "%s: Looking up: %s, last lookup time: %lld, %" PRId64, __PRETTY_FUNCTION__, addr_str, nexthop->last_lookup_time, - last_route_change_time); + pim->last_route_change_time); } } @@ -233,9 +239,10 @@ enum pim_rpf_result pim_rpf_update(struct pim_instance *pim, } else { if (!pim_ecmp_nexthop_lookup( pim, &rpf->source_nexthop, up->upstream_addr, &src, - &grp, !PIM_UPSTREAM_FLAG_TEST_FHR(up->flags) - && !PIM_UPSTREAM_FLAG_TEST_SRC_IGMP( - up->flags))) + &grp, + !PIM_UPSTREAM_FLAG_TEST_FHR(up->flags) + && !PIM_UPSTREAM_FLAG_TEST_SRC_IGMP( + up->flags))) return PIM_RPF_FAILURE; }