Thread View: linux.kernel.netdev
4 messages
4 total messages
Started by Xia Yan
Sat, 31 Oct 2026 11:44
Re: [PATCH net v3] ipv6: reject wrapped temporary address preferred lifetimes
Author: Xia Yan
Date: Sat, 31 Oct 2026 11:44
Date: Sat, 31 Oct 2026 11:44
33 lines
10244 bytes
10244 bytes
Hi, One question on the clamp added by f4bcbf360ac8, separate from the wrap fixed here - I don't think this patch needs to address it. I have only followed the source and have not run this case. As far as I can tell the clamp's termination relies on cfg.valid_lft and if_public_preferred_lft being finite. Consider a public address with both lifetimes at INFINITY_LIFETIME and a large regen_advance, with no wrap involved. For example with regen_min_advance=2, regen_max_retry=3, dad_transmits=1, an RA Retrans Timer around 28,600,000 ms and HZ=1000, regen_advance is around 85802; raising regen_max_retry via sysctl has the same effect. If temp_prefered_lft is set below regen_advance, the effective max_desync_factor goes negative, desync_factor is reset to 0, and the clamp engages on every creation. The clamped preferred lifetime regen_advance + age + 1 then passes all three checks, including the new one. But the temporary address inherits the public address's tstamp, so addrconf_verify_rtnl() finds it due for regeneration one second after each creation: one new temporary address per second, each living about temp_valid_lft. Creation is only refused once age grows enough that regen_advance + age + 1 exceeds cfg.valid_lft, which here is just temp_valid_lft, so the accumulation is bounded, but with the numbers above it can still reach tens of thousands of addresses. Is this finite-lifetime assumption part of the intended behavior of the clamp, or would it be worth tightening separately? Thanks, Xia
Re: [PATCH net v3] ipv6: reject wrapped temporary address preferred lifetimes
Author: Alex Henrie
Date: Sun, 01 Nov 2026 22:08
Date: Sun, 01 Nov 2026 22:08
54 lines
15113 bytes
15113 bytes
On Sat, Oct 31, 2026 at 5:44 AM Xia Yan <yanxia@cmss.chinamobile.com> wrote: > One question on the clamp added by f4bcbf360ac8, separate from the > wrap fixed here - I don't think this patch needs to address it. I have > only followed the source and have not run this case. > > As far as I can tell the clamp's termination relies on cfg.valid_lft > and if_public_preferred_lft being finite. Consider a public address > with both lifetimes at INFINITY_LIFETIME and a large regen_advance, > with no wrap involved. For example with regen_min_advance=2, > regen_max_retry=3, dad_transmits=1, an RA Retrans Timer around > 28,600,000 ms and HZ=1000, regen_advance is around 85802; raising > regen_max_retry via sysctl has the same effect. > > If temp_prefered_lft is set below regen_advance, the effective > max_desync_factor goes negative, desync_factor is reset to 0, and the > clamp engages on every creation. The clamped preferred lifetime > regen_advance + age + 1 then passes all three checks, including the > new one. But the temporary address inherits the public address's > tstamp, so addrconf_verify_rtnl() finds it due for regeneration one > second after each creation: one new temporary address per second, > each living about temp_valid_lft. Creation is only refused once age > grows enough that regen_advance + age + 1 exceeds cfg.valid_lft, > which here is just temp_valid_lft, so the accumulation is bounded, > but with the numbers above it can still reach tens of thousands of > addresses. > > Is this finite-lifetime assumption part of the intended behavior of > the clamp, or would it be worth tightening separately? Hello Xia, that is a good question. In that extreme scenario, creating one temporary address per second is intentional. As you noted, regen_advance is not a constant. Before I added the clamp, Linux would just stop creating temporary addresses if regen_advance increased to a value larger than the preferred lifetime that the user specified. No new addresses were created until the network interface was restarted, even if later on regen_advance dropped to below the user's preferred lifetime. Temporary address generation was effectively disabled, eliminating the privacy protections that the user thought that they had enabled. When I wrote the patch, I did not consider that the temporary addresses might be based on a static address that has an infinite lifetime. If having a static address causes Linux to refuse to create more temporary addresses after a certain period of time, that's a bug. However, I have not been able to reproduce the problem: On my machine, with a static address, max_desync_factor=10, temp_prefered_lft=30, regen_min_advance=60, and temp_valid_lft=90, Linux 7.2 never stops creating new temporary addresses. Is there another combination of parameters that might cause a problem? -Alex
Re: [PATCH net v3] ipv6: reject wrapped temporary address preferred lifetimes
Author: Xia Yan
Date: Mon, 02 Nov 2026 07:51
Date: Mon, 02 Nov 2026 07:51
30 lines
10119 bytes
10119 bytes
On 11/1/26 22:08, Alex Henrie wrote: > Is there another combination of parameters that might cause a problem? Hi Alex, Thanks for explaining the reasoning behind the clamp. I was wrong about creation eventually being refused as the public address gets older. I had missed the "+ age" in cfg.valid_lft. With an infinite-lifetime parent, cfg.valid_lft grows with age too. For the values you tested, I don't see an age-dependent cutoff in that lifetime check. Normal successful regenerations don't reach the retry limit either: addrconf_verify_rtnl() resets the parent's regen_count before each regeneration. Repeated ipv6_add_addr() or DAD failures can still exhaust the retries. I don't have a reproducer for another refusal case. The remaining worry for me is retention. With a short preferred lifetime and temp_valid_lft at its two-day default, deprecated temporary addresses stay on the interface until their valid lifetime expires, and this path does not check max_addresses. Your 90-second configuration ages them out fast; with the default I would expect many more addresses held at once, but I have not tested that or measured the cost. The creation rate also depends on DAD timing, so my earlier one-address-per-second estimate was too definite. Thanks, Xia
Re: [PATCH net v3] ipv6: reject wrapped temporary address preferred lifetimes
Author: Alex Henrie
Date: Tue, 03 Nov 2026 16:59
Date: Tue, 03 Nov 2026 16:59
54 lines
15316 bytes
15316 bytes
On Mon, Nov 2, 2026 at 12:51 AM Xia Yan <yanxia@cmss.chinamobile.com> wrote: > The remaining worry for me is retention. With a short preferred > lifetime and temp_valid_lft at its two-day default, deprecated > temporary addresses stay on the interface until their valid lifetime > expires, and this path does not check max_addresses. Your 90-second > configuration ages them out fast; with the default I would expect > many more addresses held at once, but I have not tested that or > measured the cost. The creation rate also depends on DAD timing, so > my earlier one-address-per-second estimate was too definite. With the default temp_valid_lft of 2 days, creating 1 temporary address per second would result in a maximum of 172,800 temporary addresses. If the user explicitly sets temp_prefered_lft=1, regen_min_advance=0, and dad_transmits=0, that's exactly what should happen. When I tested that scenario on my desktop computer today, Firefox worked and overall system stability was fine, but Chromium failed to load any pages and NetworkManager became unresponsive. It seems that some software doesn't mind that there are tens of thousands of IPv6 addresses and other software won't tolerate it. I'm not convinced that using max_addresses to limit the number of temporary addresses is a good idea. The default value of max_addresses is 16, so in the worst-case scenario, after 16 seconds temporary address creation would be effectively disabled until the addresses expire 2 days later. Similarly, if the user sets temp_prefered_lft to 1 hour (a perfectly reasonable value), the limit would be silently reached after 16 hours. If we increase max_addresses to 48 to be sure that 1 temporary address per hour can be created for 2 days, a brief period of worst-case router advertisements would still use up all of the addresses in 48 seconds. To protect the user's privacy, new temporary addresses must continue to be created no matter what is happening on the network. (With one exception: If the SLAAC address's lifetime is so short that it's effectively a temporary address already.) We already have regen_min_advance which specifies the lower limit of regen_advance. Maybe we should also have a regen_max_advance to specify an upper limit. That way, a misconfigured router could not cause a Linux client to create a new temporary address long before the current temporary address expires, nor could a misconfigured router cause Linux to use a long-lived SLAAC address without creating any temporary addresses at all. The maximum number of simultaneous temporary addresses would become temp_valid_lft / (temp_prefered_lft - max_desync_factor - regen_max_advance), and the user would be expected to set temp_prefered_lft to a value larger than max_desync_factor + regen_max_advance. With temp_valid_lft=172800 (2 days), temp_prefered_lft=3600 (1 hour), max_desync_factor=600 (10 minutes), and regen_max_advance=300 (5 minutes), there would be a maximum of 64 temporary addresses at any given time. -Alex
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads