From: Leone Fernando <leone4fernando@gmail.com>
To: davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
pabeni@redhat.com, dsahern@kernel.org, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: [RFC PATCH net-next v2 1/3] net: route: expire rt if the dst it holds is expired
Date: Mon, 12 Feb 2024 12:30:40 +0100 [thread overview]
Message-ID: <152dec8c-176c-4012-bef8-25ccc5785241@gmail.com> (raw)
In-Reply-To: <3a17c86d-08a5-46d2-8622-abc13d4a411e@gmail.com>
The function rt_is_expired is used to verify that a cached dst is valid.
Currently, this function ignores the rt.dst->expires value.
Add a check to rt_is_expired that validates that the dst is not expired.
Signed-off-by: Leone Fernando <leone4fernando@gmail.com>
---
net/ipv4/route.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index 16615d107cf0..7c5e68117ee2 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -392,7 +392,8 @@ static inline int ip_rt_proc_init(void)
static inline bool rt_is_expired(const struct rtable *rth)
{
- return rth->rt_genid != rt_genid_ipv4(dev_net(rth->dst.dev));
+ return rth->rt_genid != rt_genid_ipv4(dev_net(rth->dst.dev)) ||
+ (rth->dst.expires && time_after(jiffies, rth->dst.expires));
}
void rt_cache_flush(struct net *net)
--
2.34.1
next prev parent reply other threads:[~2024-02-12 11:31 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-12 11:22 [RFC PATCH net-next v2 0/3] net: route: improve route hinting Leone Fernando
2024-02-12 11:30 ` Leone Fernando [this message]
2024-02-12 11:33 ` [RFC PATCH net-next v2 2/3] net: dst_cache: add input_dst_cache API Leone Fernando
2024-02-12 11:34 ` [RFC PATCH net-next v2 3/3] net: route: replace route hints with input_dst_cache Leone Fernando
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=152dec8c-176c-4012-bef8-25ccc5785241@gmail.com \
--to=leone4fernando@gmail.com \
--cc=davem@davemloft.net \
--cc=dsahern@kernel.org \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.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