From: David Ahern <dsahern@kernel.org>
To: netdev@vger.kernel.org
Cc: ralf@mandelbit.com, David Ahern <dahern@nvidia.com>
Subject: [RFC net-next v2 2/7] ipv6: invalidate the failing dst in ip6_link_failure()
Date: Mon, 23 Nov 2026 14:26:04 -0700 [thread overview]
Message-ID: <20261123212623.106153-3-dsahern@kernel.org> (raw)
In-Reply-To: <20261123212623.106153-1-dsahern@kernel.org>
From: David Ahern <dahern@nvidia.com>
When a default route's neighbour fails, ip6_link_failure() wrote -1
to the fn_sernum of the route's node so that users of dsts under that
node would look the route up again and let router selection pick
another default router.
dsts are now validated against the netns route generation, so that
write no longer invalidates anything. Clear the sernum of the failing
dst instead; 0 never matches the generation, so its users do the
lookup again. Only that dst is invalidated, which for a pcpu dst is
one CPU's copy, rather than every dst under the node. Bumping the
netns generation here would be much costlier, since a failing router
can trigger this for every packet sent through it.
Signed-off-by: David Ahern <dahern@nvidia.com>
---
Changes since v1:
- None.
net/ipv6/route.c | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index 6fa76c95b1d2..a132d33259a2 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -2874,14 +2874,13 @@ static void ip6_link_failure(struct sk_buff *skb)
rt6_remove_exception_rt(rt);
} else {
struct fib6_info *from;
- struct fib6_node *fn;
+ /* Force sockets using this dst to look the route up
+ * again; 0 never matches the netns generation.
+ */
from = rcu_dereference(rt->from);
- if (from) {
- fn = rcu_dereference(from->fib6_node);
- if (fn && (rt->rt6i_flags & RTF_DEFAULT))
- WRITE_ONCE(fn->fn_sernum, -1);
- }
+ if (from && (rt->rt6i_flags & RTF_DEFAULT))
+ WRITE_ONCE(rt->sernum, 0);
}
rcu_read_unlock();
}
--
2.43.0
next prev parent reply other threads:[~2026-11-23 21:26 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-23 21:26 [RFC net-next v2 0/7] ipv6: validate dsts against the netns route generation at lookup David Ahern
2026-11-23 21:26 ` [RFC net-next v2 1/7] ipv6: validate dsts against the netns route generation David Ahern
2026-11-23 21:26 ` David Ahern [this message]
2026-11-23 21:26 ` [RFC net-next v2 3/7] nexthop: factor out nh_has_f6i() David Ahern
2026-11-23 21:26 ` [RFC net-next v2 4/7] nexthop: bump the IPv6 route generation on group changes David Ahern
2026-11-23 21:26 ` [RFC net-next v2 5/7] ipv6: scope exception invalidation to the affected nexthop David Ahern
2026-11-23 21:26 ` [RFC net-next v2 6/7] ipv6: make rt_genid_bump_ipv6() a plain counter increment David Ahern
2026-11-23 21:26 ` [RFC net-next v2 7/7] ipv6: stamp dsts with the generation sampled before the FIB lookup 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=20261123212623.106153-3-dsahern@kernel.org \
--to=dsahern@kernel.org \
--cc=dahern@nvidia.com \
--cc=netdev@vger.kernel.org \
--cc=ralf@mandelbit.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