Re: [PATCH net-next v3 1/3] ipv6: stamp the default route node with a fresh serial on link failure
From: netdev-bot+sashiko
Date: Thu Nov 19 2026 - 04:23:03 EST
Thank you for your contribution! Sashiko AI review found more severe
issue(s) in other patches of this series. This mail is only an FYI, in case
you want to address the nit picks below when you respin.
Low priority / nit picks for your consideration:
- [Low] ip6_link_failure() (net/ipv6/route.c) used to do one idempotent
store, WRITE_ONCE(fn->fn_sernum, -1).
- [Low] The patch reuses rt6_exception_net() in ip6_link_failure() for a
dst that is not an exception (the !RTF_CACHE, RTF_DEFAULT branch).
--
ipv6: stamp the default route node with a fresh serial on link failure
For a non-cached RTF_DEFAULT dst, ip6_link_failure() used to write -1
into fn_sernum. With this patch it takes tb6_lock and calls
fib6_update_sernum() instead. That stamps the node with a fresh serial and
advances net->ipv6.fib6_sernum, so the lookup-cookie checks added later in
the series can tell repeated invalidations apart.
> diff --git a/net/ipv6/route.c b/net/ipv6/route.c
> index 4a4c5ace63c54..cc505817399ba 100644
> --- a/net/ipv6/route.c
> +++ b/net/ipv6/route.c
> @@ -2873,13 +2873,13 @@ static void ip6_link_failure(struct sk_buff *skb)
> rt6_remove_exception_rt(rt);
> } else {
> struct fib6_info *from;
> - struct fib6_node *fn;
>
> 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 && from->fib6_table &&
> + (rt->rt6i_flags & RTF_DEFAULT)) {
> + spin_lock_bh(&from->fib6_table->tb6_lock);
> + fib6_update_sernum(rt6_exception_net(rt), from);
> + spin_unlock_bh(&from->fib6_table->tb6_lock);
[Severity: Low]
The old code did a single store that gave the same result every time.
The new code takes the table-wide tb6_lock and advances the netns-wide
net->ipv6.fib6_sernum on every call. ip6_link_failure() runs once per
skb, not once per event.
Is that per-skb cost intended on these paths?
For example, neigh_invalidate()->ndisc_error_report() calls
dst_link_failure() for every skb queued on the default router's
arp_queue:
net/ipv6/ndisc.c:ndisc_error_report() {
...
dst_link_failure(skb);
...
}
The err_count paths in ip6_tnl_xmit() and ipip6_tunnel_xmit() also reach
this code, at one link failure per received ICMP error. These are 1:1, so
they don't amplify anything. The sit path can't be reached for ISATAP,
because ipip6_err() returns before incrementing err_count when
parms->iph.daddr == 0.
Each bump goes through fib6_new_sernum():
} while (!atomic_try_cmpxchg(&net->ipv6.fib6_sernum, &old, new));
Nexthop-object pcpu dsts are seeded from that generation in
ip6_rt_pcpu_alloc() and checked against it:
net/ipv6/route.c:rt6_is_valid() {
return rt6->sernum == rt_genid_ipv6(dev_net(rt6->dst.dev));
}
So each call drops and reallocates every nexthop-object pcpu dst in the
netns. ip6_dst_check() also rejects every socket-cached one, which forces
a re-lookup.
The commit message says:
Advancing the namespace generation also invalidates unrelated dsts using
nexthop objects, which are validated against that generation.
and the v3 changelog calls this harmless. Could the commit message say
that this happens once per skb? That includes bursts when the neighbor
entry for a default router fails.
For reference, rt6_insert_exception() already does the same tb6_lock plus
fib6_update_sernum() once per event. Per-event invalidation is also part
of the fix itself: coalescing would let dsts cached between two failures
survive. The later patches in the series don't change ip6_link_failure(),
and "ipv6: add ip6_dst_lookup_flow_cookie" relies on this generation
bump.
[Severity: Low]
This isn't a bug, but rt6_exception_net() is now used for a dst that is
not an exception (the !RTF_CACHE, RTF_DEFAULT branch). Here it picks the
netns whose fib6_sernum gets advanced. Its name and comment still only
describe exception accounting:
/* Exceptions are accounted to the netns their dst was allocated in.
* Unlike dev_net(dst->dev), it does not change when the device moves to
* another netns or when dst_dev_put() points the dst to blackhole_netdev.
*/
static struct net *rt6_exception_net(const struct rt6_info *rt)
The netns it returns looks correct here, and dev_net(rt->dst.dev) would
be wrong after dst_dev_put(). Other readers of the same counter, such as
rt6_is_valid() and ip6_rt_pcpu_alloc(), use dev_net(), so it isn't
obvious why this one is different.
Would it make sense to update the comment, or rename the helper, so that
it covers this use?
[ ... ]
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/cover.1794906743.git.ralf%40mandelbit.com