summaryrefslogtreecommitdiffstats
path: root/net/ipv6/addrconf.c
diff options
context:
space:
mode:
authorAlex Henrie <alexhenrie24@gmail.com>2023-10-24 23:23:07 +0200
committerJakub Kicinski <kuba@kernel.org>2023-10-26 03:23:06 +0200
commitbfbf81b31093e0dc3d61b390a9bd0904d3bf5374 (patch)
tree8e70c55912babaf5ec60949e6de23d067602bc4c /net/ipv6/addrconf.c
parentMerge branch 'ipv6-avoid-atomic-fragment-on-gso-output' (diff)
downloadlinux-bfbf81b31093e0dc3d61b390a9bd0904d3bf5374.tar.xz
linux-bfbf81b31093e0dc3d61b390a9bd0904d3bf5374.zip
net: ipv6/addrconf: clamp preferred_lft to the maximum allowed
Without this patch, there is nothing to stop the preferred lifetime of a temporary address from being greater than its valid lifetime. If that was the case, the valid lifetime was effectively ignored. Signed-off-by: Alex Henrie <alexhenrie24@gmail.com> Reviewed-by: David Ahern <dsahern@kernel.org> Link: https://lore.kernel.org/r/20231024212312.299370-2-alexhenrie24@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to '')
-rw-r--r--net/ipv6/addrconf.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index c2d471ad7922..26aedaab3647 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -1399,6 +1399,7 @@ retry:
idev->cnf.temp_valid_lft + age);
cfg.preferred_lft = cnf_temp_preferred_lft + age - idev->desync_factor;
cfg.preferred_lft = min_t(__u32, ifp->prefered_lft, cfg.preferred_lft);
+ cfg.preferred_lft = min_t(__u32, cfg.valid_lft, cfg.preferred_lft);
cfg.plen = ifp->prefix_len;
tmp_tstamp = ifp->tstamp;