sync with OpenBSD -current

This commit is contained in:
purplerain 2024-02-08 01:46:44 +00:00
parent 8a8a1e99b4
commit b4e8a16d44
Signed by: purplerain
GPG key ID: F42C07F07E2E35B7
25 changed files with 1362 additions and 209 deletions

View file

@ -1,4 +1,4 @@
/* $OpenBSD: route.c,v 1.428 2024/02/05 23:16:39 bluhm Exp $ */
/* $OpenBSD: route.c,v 1.430 2024/02/07 23:52:20 bluhm Exp $ */
/* $NetBSD: route.c,v 1.14 1996/02/13 22:00:46 christos Exp $ */
/*
@ -230,6 +230,38 @@ route_cache(struct route *ro, struct in_addr addr, u_int rtableid)
satosin(&ro->ro_dst)->sin_addr = addr;
}
#ifdef INET6
void
route6_cache(struct route_in6 *ro, const struct in6_addr *addr,
u_int rtableid)
{
u_long gen;
gen = atomic_load_long(&rtgeneration);
membar_consumer();
if (rtisvalid(ro->ro_rt) &&
ro->ro_generation == gen &&
ro->ro_tableid == rtableid &&
ro->ro_dst.sin6_family == AF_INET6 &&
IN6_ARE_ADDR_EQUAL(&ro->ro_dst.sin6_addr, addr)) {
ip6stat_inc(ip6s_rtcachehit);
return;
}
ip6stat_inc(ip6s_rtcachemiss);
rtfree(ro->ro_rt);
ro->ro_rt = NULL;
ro->ro_generation = gen;
ro->ro_tableid = rtableid;
memset(&ro->ro_dst, 0, sizeof(ro->ro_dst));
ro->ro_dst.sin6_family = AF_INET6;
ro->ro_dst.sin6_len = sizeof(struct sockaddr_in6);
ro->ro_dst.sin6_addr = *addr;
}
#endif
/*
* Returns 1 if the (cached) ``rt'' entry is still valid, 0 otherwise.
*/