From 10da7d5dc5829008dd39910e0e32bfe0edf58378 Mon Sep 17 00:00:00 2001 From: florian Date: Tue, 9 Jul 2024 16:15:42 +0000 Subject: [PATCH] Skip prefixes with vltime 0. Servers indicate unusable prefixes with vltime 0 when we are in state reboot and probably hand us new, valid prefixes. In IPv4 dhcp we would receive a NACK instead... --- sbin/dhcp6leased/engine.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/sbin/dhcp6leased/engine.c b/sbin/dhcp6leased/engine.c index 9e457f8bad0..e708f8ea1fd 100644 --- a/sbin/dhcp6leased/engine.c +++ b/sbin/dhcp6leased/engine.c @@ -1,4 +1,4 @@ -/* $OpenBSD: engine.c,v 1.15 2024/07/09 13:27:18 florian Exp $ */ +/* $OpenBSD: engine.c,v 1.16 2024/07/09 16:15:42 florian Exp $ */ /* * Copyright (c) 2017, 2021, 2024 Florian Obser @@ -977,18 +977,25 @@ parse_ia_pd_options(uint8_t *p, size_t len, struct prefix *prefix) ntohl(iaprefix.vltime), inet_ntop(AF_INET6, &iaprefix.prefix, ntopbuf, INET6_ADDRSTRLEN), iaprefix.prefix_len); + if (ntohl(iaprefix.vltime) < ntohl(iaprefix.pltime)) { log_warnx("%s: vltime < pltime, ignoring IA_PD", __func__); break; } + if (ntohl(iaprefix.vltime) == 0) { + log_debug("%s: vltime == 0, ignoring IA_PD", + __func__); + break; + } + prefix->prefix = iaprefix.prefix; prefix->prefix_len = iaprefix.prefix_len; prefix->vltime = ntohl(iaprefix.vltime); prefix->pltime = ntohl(iaprefix.pltime); - /* make sure prefix is mask correctly */ + /* make sure prefix is masked correctly */ memset(&mask, 0, sizeof(mask)); in6_prefixlen2mask(&mask, prefix->prefix_len); for (i = 0; i < 16; i++) -- 2.20.1