aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv6
diff options
context:
space:
mode:
authorKui-Feng Lee <thinker.li@gmail.com>2024-02-08 14:06:52 -0800
committerDavid S. Miller <davem@davemloft.net>2024-02-12 10:24:12 +0000
commit768e06a8bcab045de9eac87dd071a769119cd0fd (patch)
tree16409355cc4f2c4021fc3962efa13935788c1c5b /net/ipv6
parent5eb902b8e7193cdcb33242af0a56502e6b5206e9 (diff)
downloadlinux-768e06a8bcab045de9eac87dd071a769119cd0fd.tar.gz
net/ipv6: set expires in modify_prefix_route() if RTF_EXPIRES is set.
Make the decision to set or clean the expires of a route based on the RTF_EXPIRES flag, rather than the value of the "expires" argument. This patch doesn't make difference logically, but make inet6_addr_modify() and modify_prefix_route() consistent. The function inet6_addr_modify() is the only caller of modify_prefix_route(), and it passes the RTF_EXPIRES flag and an expiration value. The RTF_EXPIRES flag is turned on or off based on the value of valid_lft. The RTF_EXPIRES flag is turned on if valid_lft is a finite value (not infinite, not 0xffffffff). Even if valid_lft is 0, the RTF_EXPIRES flag remains on. The expiration value being passed is equal to the valid_lft value if the flag is on. However, if the valid_lft value is infinite, the expiration value becomes 0 and the RTF_EXPIRES flag is turned off. Despite this, modify_prefix_route() decides to set the expiration value if the received expiration value is not zero. This mixing of infinite and zero cases creates an inconsistency. Reviewed-by: Hangbin Liu <liuhangbin@gmail.com> Reviewed-by: David Ahern <dsahern@kernel.org> Signed-off-by: Kui-Feng Lee <thinker.li@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6')
-rw-r--r--net/ipv6/addrconf.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 0ea44563454f0..ca1b719323c0b 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -4783,7 +4783,7 @@ static int modify_prefix_route(struct inet6_ifaddr *ifp,
table = f6i->fib6_table;
spin_lock_bh(&table->tb6_lock);
- if (!expires) {
+ if (!(flags & RTF_EXPIRES)) {
fib6_clean_expires(f6i);
fib6_remove_gc_list(f6i);
} else {