#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,
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, addr_str,
pim_addr_dump("<nexthop?>", &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) {
pim_inet4_dump("<addr?>", 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);
}
}
} 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;
}