[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240131064041.3445212-5-thinker.li@gmail.com>
Date: Tue, 30 Jan 2024 22:40:40 -0800
From: thinker.li@...il.com
To: netdev@...r.kernel.org,
ast@...nel.org,
martin.lau@...ux.dev,
kernel-team@...a.com,
davem@...emloft.net,
dsahern@...nel.org,
edumazet@...gle.com,
kuba@...nel.org,
pabeni@...hat.com,
liuhangbin@...il.com
Cc: sinquersw@...il.com,
kuifeng@...a.com,
Kui-Feng Lee <thinker.li@...il.com>
Subject: [PATCH net-next 4/5] net/ipv6: set expires in modify_prefix_route() if RTF_EXPIRES is set.
From: Kui-Feng Lee <thinker.li@...il.com>
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.
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.
Signed-off-by: Kui-Feng Lee <thinker.li@...il.com>
---
net/ipv6/addrconf.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 36bfa987c314..2f6cf6314646 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -4788,7 +4788,7 @@ static int modify_prefix_route(struct inet6_ifaddr *ifp,
} else {
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 {
--
2.34.1
Powered by blists - more mailing lists