Skip to content

Commit 8cdafdd

Browse files
alexhenriekuba-moo
authored andcommitted
Revert "net: ipv6/addrconf: clamp preferred_lft to the minimum required"
The commit had a bug and might not have been the right approach anyway. Fixes: 629df67 ("net: ipv6/addrconf: clamp preferred_lft to the minimum required") Fixes: ec575f8 ("Documentation: networking: explain what happens if temp_prefered_lft is too small or too large") Reported-by: Dan Moulding <[email protected]> Closes: https://lore.kernel.org/netdev/[email protected]/ Link: https://lore.kernel.org/netdev/CAMMLpeTdYhd=7hhPi2Y7pwdPCgnnW5JYh-bu3hSc7im39uxnEA@mail.gmail.com/ Signed-off-by: Alex Henrie <[email protected]> Reviewed-by: David Ahern <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 61fa249 commit 8cdafdd

File tree

2 files changed

+6
-14
lines changed

2 files changed

+6
-14
lines changed

Documentation/networking/ip-sysctl.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2511,7 +2511,7 @@ temp_valid_lft - INTEGER
25112511
temp_prefered_lft - INTEGER
25122512
Preferred lifetime (in seconds) for temporary addresses. If
25132513
temp_prefered_lft is less than the minimum required lifetime (typically
2514-
5 seconds), the preferred lifetime is the minimum required. If
2514+
5 seconds), temporary addresses will not be created. If
25152515
temp_prefered_lft is greater than temp_valid_lft, the preferred lifetime
25162516
is temp_valid_lft.
25172517

net/ipv6/addrconf.c

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1407,23 +1407,15 @@ static int ipv6_create_tempaddr(struct inet6_ifaddr *ifp, bool block)
14071407

14081408
write_unlock_bh(&idev->lock);
14091409

1410-
/* From RFC 4941:
1411-
*
1412-
* A temporary address is created only if this calculated Preferred
1413-
* Lifetime is greater than REGEN_ADVANCE time units. In
1414-
* particular, an implementation must not create a temporary address
1415-
* with a zero Preferred Lifetime.
1416-
*
1417-
* Clamp the preferred lifetime to a minimum of regen_advance, unless
1418-
* that would exceed valid_lft.
1419-
*
1410+
/* A temporary address is created only if this calculated Preferred
1411+
* Lifetime is greater than REGEN_ADVANCE time units. In particular,
1412+
* an implementation must not create a temporary address with a zero
1413+
* Preferred Lifetime.
14201414
* Use age calculation as in addrconf_verify to avoid unnecessary
14211415
* temporary addresses being generated.
14221416
*/
14231417
age = (now - tmp_tstamp + ADDRCONF_TIMER_FUZZ_MINUS) / HZ;
1424-
if (cfg.preferred_lft <= regen_advance + age)
1425-
cfg.preferred_lft = regen_advance + age + 1;
1426-
if (cfg.preferred_lft > cfg.valid_lft) {
1418+
if (cfg.preferred_lft <= regen_advance + age) {
14271419
in6_ifa_put(ifp);
14281420
in6_dev_put(idev);
14291421
ret = -1;

0 commit comments

Comments
 (0)