net: ipv6/addrconf: introduce a regen_min_advance sysctl

In RFC 8981, REGEN_ADVANCE cannot be less than 2 seconds, and the RFC
does not permit the creation of temporary addresses with lifetimes
shorter than that:

> When processing a Router Advertisement with a
> Prefix Information option carrying a prefix for the purposes of
> address autoconfiguration (i.e., the A bit is set), the host MUST
> perform the following steps:

> 5.  A temporary address is created only if this calculated preferred
>     lifetime is greater than REGEN_ADVANCE time units.

However, some users want to change their IPv6 address as frequently as
possible regardless of the RFC's arbitrary minimum lifetime. For the
benefit of those users, add a regen_min_advance sysctl parameter that
can be set to below or above 2 seconds.

Link: https://datatracker.ietf.org/doc/html/rfc8981
Signed-off-by: Alex Henrie <alexhenrie24@gmail.com>
Reviewed-by: David Ahern <dsahern@kernel.org>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
This commit is contained in:
Alex Henrie
2024-02-13 23:26:31 -07:00
committed by Paolo Abeni
parent 2aa8f155b0
commit a5fcea2d2f
4 changed files with 24 additions and 3 deletions

View File

@@ -2535,6 +2535,16 @@ max_desync_factor - INTEGER
Default: 600
regen_min_advance - INTEGER
How far in advance (in seconds), at minimum, to create a new temporary
address before the current one is deprecated. This value is added to
the amount of time that may be required for duplicate address detection
to determine when to create a new address. Linux permits setting this
value to less than the default of 2 seconds, but a value less than 2
does not conform to RFC 8981.
Default: 2
regen_max_retry - INTEGER
Number of attempts before give up attempting to generate
valid temporary addresses.