public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2 net] ipv6: addrconf: fix temp address generation after prefix deprecation
@ 2026-05-03 22:11 Fernando Fernandez Mancera
  2026-05-03 22:11 ` [PATCH 2/2 net] selftests: fib_tests: add temporary IPv6 address renewal test Fernando Fernandez Mancera
  2026-05-04 16:35 ` [PATCH 1/2 net] ipv6: addrconf: fix temp address generation after prefix deprecation Ido Schimmel
  0 siblings, 2 replies; 7+ messages in thread
From: Fernando Fernandez Mancera @ 2026-05-03 22:11 UTC (permalink / raw)
  To: netdev
  Cc: linux-kselftest, horms, pabeni, kuba, edumazet, davem, idosch,
	dsahern, Fernando Fernandez Mancera, Łukasz Stelmach

When a router temporarily deprecates an IPv6 prefix (either by sending a
Router Advertisement with Preferred Lifetime = 0 or by letting the
lifetime expire) and later restores it, the kernel permanently loses its
ability to generate temporary privacy addresses (RFC 8981) for that
prefix.

This happens because the address worker attempts to generate a
replacement temporary address when the current one nears expiration. As
the base prefix is deprecated already, the generation fails, burning the
retry counter for temporary address generation of that prefix.

When the router eventually restores the prefix, the temporary address
becomes active again. However, once it naturally expires, the kernel
sees the exhausted retry limit and permanently stops generating new
privacy addresses.

Fix this by verifying that the base prefix has sufficient preferred
lifetime remaining before attempting to generate a new temporary
address. This prevents the worker from burning through its retry counter
during temporary network deprecation events like a router reboot.

Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Reported-by: Łukasz Stelmach <steelman@post.pl>
Closes: https://lore.kernel.org/netdev/87340td30q.fsf%25steelman@post.pl/
Signed-off-by: Fernando Fernandez Mancera <fmancera@suse.de>
---
 net/ipv6/addrconf.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 5476b6536eb7..f6a3d9da3cb1 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -4654,9 +4654,11 @@ static void addrconf_verify_rtnl(struct net *net)
 			    !ifp->regen_count && ifp->ifpub) {
 				/* This is a non-regenerated temporary addr. */
 
+				unsigned long pub_age = (now - READ_ONCE(ifp->ifpub->tstamp)) / HZ;
 				unsigned long regen_advance = ipv6_get_regen_advance(ifp->idev);
 
-				if (age + regen_advance >= ifp->prefered_lft) {
+				if (age + regen_advance >= ifp->prefered_lft &&
+				    pub_age + regen_advance < READ_ONCE(ifp->ifpub->prefered_lft)) {
 					struct inet6_ifaddr *ifpub = ifp->ifpub;
 					if (time_before(ifp->tstamp + ifp->prefered_lft * HZ, next))
 						next = ifp->tstamp + ifp->prefered_lft * HZ;
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2026-05-04 22:58 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-03 22:11 [PATCH 1/2 net] ipv6: addrconf: fix temp address generation after prefix deprecation Fernando Fernandez Mancera
2026-05-03 22:11 ` [PATCH 2/2 net] selftests: fib_tests: add temporary IPv6 address renewal test Fernando Fernandez Mancera
2026-05-04 16:41   ` Ido Schimmel
2026-05-04 19:45     ` Fernando Fernandez Mancera
2026-05-04 16:35 ` [PATCH 1/2 net] ipv6: addrconf: fix temp address generation after prefix deprecation Ido Schimmel
2026-05-04 19:51   ` Fernando Fernandez Mancera
2026-05-04 22:58     ` Fernando Fernandez Mancera

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox