From: thinker.li@gmail.com
To: netdev@vger.kernel.org, ast@kernel.org, martin.lau@linux.dev,
kernel-team@meta.com, davem@davemloft.net, dsahern@kernel.org,
edumazet@google.com, kuba@kernel.org, pabeni@redhat.com,
liuhangbin@gmail.com
Cc: sinquersw@gmail.com, kuifeng@meta.com,
Kui-Feng Lee <thinker.li@gmail.com>
Subject: [PATCH net-next v4 4/5] net/ipv6: set expires in modify_prefix_route() if RTF_EXPIRES is set.
Date: Mon, 5 Feb 2024 13:40:32 -0800 [thread overview]
Message-ID: <20240205214033.937814-5-thinker.li@gmail.com> (raw)
In-Reply-To: <20240205214033.937814-1-thinker.li@gmail.com>
From: Kui-Feng Lee <thinker.li@gmail.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.
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>
Signed-off-by: Kui-Feng Lee <thinker.li@gmail.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 58c5270396f6..486ec83b4668 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 {
--
2.34.1
next prev parent reply other threads:[~2024-02-05 21:40 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-05 21:40 [PATCH net-next v4 0/5] Remove expired routes with a separated list of routes thinker.li
2024-02-05 21:40 ` [PATCH net-next v4 1/5] net/ipv6: set expires in rt6_add_dflt_router() thinker.li
2024-02-05 21:40 ` [PATCH net-next v4 2/5] net/ipv6: Remove unnecessary clean thinker.li
2024-02-05 21:40 ` [PATCH net-next v4 3/5] net/ipv6: Remove expired routes with a separated list of routes thinker.li
2024-02-07 15:58 ` David Ahern
2024-02-07 16:00 ` Kui-Feng Lee
2024-02-05 21:40 ` thinker.li [this message]
2024-02-07 15:59 ` [PATCH net-next v4 4/5] net/ipv6: set expires in modify_prefix_route() if RTF_EXPIRES is set David Ahern
2024-02-05 21:40 ` [PATCH net-next v4 5/5] selftests/net: Adding test cases of replacing routes and route advertisements thinker.li
2024-02-07 16:03 ` David Ahern
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240205214033.937814-5-thinker.li@gmail.com \
--to=thinker.li@gmail.com \
--cc=ast@kernel.org \
--cc=davem@davemloft.net \
--cc=dsahern@kernel.org \
--cc=edumazet@google.com \
--cc=kernel-team@meta.com \
--cc=kuba@kernel.org \
--cc=kuifeng@meta.com \
--cc=liuhangbin@gmail.com \
--cc=martin.lau@linux.dev \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=sinquersw@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).