This caused stuck ndp cache entries as found by naddy, sorry.
-/* $OpenBSD: ip6_forward.c,v 1.107 2022/08/08 15:56:35 kn Exp $ */
+/* $OpenBSD: ip6_forward.c,v 1.108 2022/08/09 21:10:02 kn Exp $ */
/* $KAME: ip6_forward.c,v 1.75 2001/06/29 12:42:13 jinmei Exp $ */
/*
if ((m->m_flags & (M_BCAST|M_MCAST)) != 0 ||
IN6_IS_ADDR_MULTICAST(&ip6->ip6_dst) ||
IN6_IS_ADDR_UNSPECIFIED(&ip6->ip6_src)) {
- time_t uptime;
-
ip6stat_inc(ip6s_cantforward);
- uptime = getuptime();
-
- if (ip6_log_time + ip6_log_interval < uptime) {
- ip6_log_time = uptime;
+ if (ip6_log_time + ip6_log_interval < getuptime()) {
+ ip6_log_time = getuptime();
inet_ntop(AF_INET6, &ip6->ip6_src, src6, sizeof(src6));
inet_ntop(AF_INET6, &ip6->ip6_dst, dst6, sizeof(dst6));
log(LOG_DEBUG,
*/
if (in6_addr2scopeid(m->m_pkthdr.ph_ifidx, &ip6->ip6_src) !=
in6_addr2scopeid(rt->rt_ifidx, &ip6->ip6_src)) {
- time_t uptime;
-
ip6stat_inc(ip6s_cantforward);
ip6stat_inc(ip6s_badscope);
- uptime = getuptime();
- if (ip6_log_time + ip6_log_interval < uptime) {
- ip6_log_time = uptime;
+ if (ip6_log_time + ip6_log_interval < getuptime()) {
+ ip6_log_time = getuptime();
inet_ntop(AF_INET6, &ip6->ip6_src, src6, sizeof(src6));
inet_ntop(AF_INET6, &ip6->ip6_dst, dst6, sizeof(dst6));
log(LOG_DEBUG,
-/* $OpenBSD: ip6_mroute.c,v 1.133 2022/08/08 15:56:35 kn Exp $ */
+/* $OpenBSD: ip6_mroute.c,v 1.134 2022/08/09 21:10:03 kn Exp $ */
/* $NetBSD: ip6_mroute.c,v 1.59 2003/12/10 09:28:38 itojun Exp $ */
/* $KAME: ip6_mroute.c,v 1.45 2001/03/25 08:38:51 itojun Exp $ */
* (although such packets must normally set 1 to the hop limit field).
*/
if (IN6_IS_ADDR_UNSPECIFIED(&ip6->ip6_src)) {
- time_t uptime;
-
ip6stat_inc(ip6s_cantforward);
- uptime = getuptime();
-
- if (ip6_log_time + ip6_log_interval < uptime) {
+ if (ip6_log_time + ip6_log_interval < getuptime()) {
char src[INET6_ADDRSTRLEN], dst[INET6_ADDRSTRLEN];
- ip6_log_time = uptime;
+ ip6_log_time = getuptime();
inet_ntop(AF_INET6, &ip6->ip6_src, src, sizeof(src));
inet_ntop(AF_INET6, &ip6->ip6_dst, dst, sizeof(dst));
-/* $OpenBSD: nd6.c,v 1.245 2022/08/08 17:47:59 kn Exp $ */
+/* $OpenBSD: nd6.c,v 1.246 2022/08/09 21:10:03 kn Exp $ */
/* $KAME: nd6.c,v 1.280 2002/06/08 19:52:07 itojun Exp $ */
/*
nd6_timer(void *unused)
{
struct llinfo_nd6 *ln, *nln;
- time_t uptime, expire;
-
- uptime = getuptime();
- expire = uptime + nd6_gctimer;
+ time_t expire = getuptime() + nd6_gctimer;
+ int secs;
NET_LOCK();
TAILQ_FOREACH_SAFE(ln, &nd6_list, ln_list, nln) {
struct rtentry *rt = ln->ln_rt;
- if (rt->rt_expire && rt->rt_expire <= uptime)
+ if (rt->rt_expire && rt->rt_expire <= getuptime())
if (nd6_llinfo_timer(rt))
continue;
expire = rt->rt_expire;
}
+ secs = expire - getuptime();
+ if (secs < 0)
+ secs = 0;
if (!TAILQ_EMPTY(&nd6_list)) {
- nd6_timer_next = expire;
- timeout_add_sec(&nd6_timer_to, nd6_gctimer);
+ nd6_timer_next = getuptime() + secs;
+ timeout_add_sec(&nd6_timer_to, secs);
}
NET_UNLOCK();
nd6_expire_timer_update(struct in6_ifaddr *ia6)
{
time_t expire_time = INT64_MAX;
+ int secs;
KERNEL_ASSERT_LOCKED();
if (!timeout_pending(&nd6_expire_timeout) ||
nd6_expire_next > expire_time) {
- int secs;
-
secs = expire_time - getuptime();
if (secs < 0)
secs = 0;