From: Ryan Walklin <ryan@testtoast.com>
To: ell@lists.linux.dev
Cc: Ryan Walklin <ryan@testtoast.com>
Subject: [PATCH 4/6] netconfig: Fix the RFC 4862 2-hour rule
Date: Tue, 17 Nov 2026 11:27:50 +1300 [thread overview]
Message-ID: <20261116222756.2921577-5-ryan@testtoast.com> (raw)
In-Reply-To: <20261116222756.2921577-1-ryan@testtoast.com>
RFC 4862 Section 5.5.3 e) says that when an RA's Valid Lifetime is no
longer than 2 hours or the address's remaining lifetime, the remaining
lifetime is kept if it's 2 hours or less and cut to 2 hours otherwise.
netconfig sets it to 2 hours in both cases, so a prefix being withdrawn
with short lifetimes gets its address's lifetime raised to 2 hours
whenever less than that remained.
Fixes: 6adf0f5db455 ("netconfig: Create SLAAC address")
---
ell/netconfig.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/ell/netconfig.c b/ell/netconfig.c
index 7e20de6..2eb9cae 100644
--- a/ell/netconfig.c
+++ b/ell/netconfig.c
@@ -823,9 +823,14 @@ static void netconfig_set_slaac_address_lifetimes(struct l_netconfig *nc,
if (memcmp(prefix->prefix, addr, 8))
continue;
- /* RFC4862 Section 5.5.3 e) */
- if (v < 120 * 60 && v < remaining)
- v = 120 * 60; /* 2 hours */
+ /*
+ * RFC4862 Section 5.5.3 e): use the received Valid Lifetime
+ * if it's over 2 hours or over the remaining lifetime.
+ * Otherwise keep the remaining lifetime if that's 2 hours or
+ * less, else cut it to 2 hours.
+ */
+ if (v <= 120 * 60 && v <= remaining)
+ v = remaining < 120 * 60 ? remaining : 120 * 60;
l_rtnl_address_set_lifetimes(nc->v6_address,
p != 0xffffffff ? p : 0,
--
2.55.0
next prev parent reply other threads:[~2026-11-16 22:28 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-16 22:27 [PATCH 0/6] netconfig: RA route, SLAAC lifetime and DNS fixes Ryan Walklin
2026-11-16 22:27 ` [PATCH 1/6] netconfig: Allocate the expired lists Ryan Walklin
2026-11-16 22:27 ` [PATCH 2/6] netconfig: Fix leak of RA route data Ryan Walklin
2026-11-16 22:27 ` [PATCH 3/6] netconfig: Expire RA routes never refreshed Ryan Walklin
2026-11-16 22:27 ` Ryan Walklin [this message]
2026-11-16 22:27 ` [PATCH 5/6] netconfig: Skip duplicate DNS servers and domains Ryan Walklin
2026-11-16 22:27 ` [PATCH 6/6] icmp6: Fix RA leak when stopped from a handler Ryan Walklin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261116222756.2921577-5-ryan@testtoast.com \
--to=ryan@testtoast.com \
--cc=ell@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox