🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #27355

Re: [PATCH net-next 1/2] ipv6: stamp the default route node with a fresh serial on link failure

#27355
From: netdev-bot+sashiko
Date: Sat, 05 Dec 2026 11:47
185 lines
14985 bytes
Thank you for your contribution! Sashiko AI review found 3 potential
issue(s) to consider.

Critical: 0 · High: 0 · Medium: 1 · Low: 2

If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).

- [Medium] On non-RTF_CACHE RTF_DEFAULT dsts, every ip6_link_failure()
  call now does two things.
- [Low] The commit message describes a real, user-visible defect in the
  old code but presents the change only as "preparation", with no Fixes:…
- [Low] RA default routes (::/0) live on the table root node.

--

ipv6: stamp the default route node with a fresh serial on link failure

Before this change, ip6_link_failure() wrote -1 into a non-cached
RTF_DEFAULT route's fn_sernum. Now it takes tb6_lock and calls
fib6_update_sernum(), which stamps a fresh serial from fib6_new_sernum()
and advances the netns-wide generation. The commit says this prepares
for validating dsts by comparing serials by age.

> This is a preparation for validating dsts by comparing serials by age,
> which needs every node serial to come from fib6_new_sernum.

[Severity: Low]
The first paragraph of the message describes a user-visible defect in the
existing code. The change is presented only as preparation, though, and
has no Fixes: tag.

With the old WRITE_ONCE(fn->fn_sernum, -1), sockets that look the route up
again after the first failure cache cookie 0xFFFFFFFF from
rt6_get_cookie()->fib6_get_cookie_safe(). A second failure writes the same
-1, so fib6_check() still passes:

net/ipv6/route.c:fib6_check() {
    ...
	if (!fib6_get_cookie_safe(f6i, &rt_cookie) || rt_cookie != cookie)
		return false;
    ...
}

rt6_check() does the same comparison.

For example, take two RA routers A and B. A fails, a connected UDP socket
moves to B and caches -1, then B fails. The socket keeps B's dst until
something unrelated rewrites the root serial, such as a route add.

The -1 write predates git history. Blame on the current lines shows
aafc2e3285c2 ("ipv6: annotate accesses to fn->fn_sernum") on top of
c5cff8561d2d ("ipv6: add rcu grace period before freeing fib6_node") and
a68886a69180 ("net/ipv6: Make from in rt6_info rcu protected").

Should this carry a Fixes: tag? If not, should the message say that no
stable backport is intended, given the new netns-wide invalidation cost?

> diff --git a/net/ipv6/route.c b/net/ipv6/route.c
> index d3c77941d2cf8..b641df2774835 100644
> --- a/net/ipv6/route.c
> +++ b/net/ipv6/route.c

[ ... ]

> @@ -2874,13 +2876,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: Medium]
Can a remote host drive this path at packet rate?

Before this change, a repeated link failure on an RTF_DEFAULT dst was a
lockless store, and it became a no-op once the node held -1. Now every
ip6_link_failure() call takes the table writer lock with BH disabled. It
also advances net->ipv6.fib6_sernum through
fib6_update_sernum()->fib6_new_sernum(). Only the icmpv6_send() at the
top of the function is rate limited.

On the tunnel side, each received ICMP error that matches the tunnel
endpoints increments err_count in ip6gre_err() or ipip6_err().
ipip_err() and ipgre_err() do the same for IPv4 tunnels:

net/ipv6/ip6_gre.c:ip6gre_err() {
    ...
	if (time_before(jiffies, READ_ONCE(t->err_time) + IP6TUNNEL_ERR_TIMEO))
		WRITE_ONCE(t->err_count, READ_ONCE(t->err_count) + 1);
    ...
}

Each stored error is then used up by one transmitted packet:

net/ipv6/ip6_tunnel.c:ip6_tnl_xmit() {
    ...
			WRITE_ONCE(t->err_count, err_count - 1);

			dst_link_failure(skb);
    ...
}

ipip6_tunnel_xmit() in sit.c and ip_tunnel_xmit() follow the same
pattern. Separately, the tx_err_link_failure label in ip6_tnl_xmit() calls
dst_link_failure() for every packet whose outer route lookup fails.

Suppose the inner route is an RA-learned default route over that tunnel.
Each ICMP error then gives one tb6_lock acquisition and one netns-wide
generation bump, up to the tunnel's TX rate.

These tunnels are LLTX, so several CPUs can spin on tb6_lock with BH
disabled at the same time. The same lock is also held across whole-table
walks such as fib6_clean_all(), GC, ifdown and flush.

rt6_is_valid() validates nexthop-object dsts against rt_genid_ipv6(). Each
bump therefore also invalidates the cached dst of every socket in the
netns that uses a nexthop-object route.

The commit message says:

    These are error paths and add no cost to the fast path.

It does not mention the new serialization on tb6_lock. Is this per-packet
locking and invalidation acceptable on these paths, or should it be rate
limited?

There is also a possible side effect that I have not verified.
fib6_new_sernum() wraps at INT_MAX and validation is by equality. At this
rate the wrap comes much sooner, so could a stale dst briefly validate
again after it?

[Severity: Low]
For an RA default route (::/0), the fib6_node is the table root, because
fib6_add_1() returns tb6_root when plen == fn_bit == 0. With this change,
tb6_root.fn_sernum changes on every link failure. Before, repeated
failures kept writing the same -1.

The netlink dump and /proc/net/ipv6_route both treat a change in the root
serial as "tree changed" and rewind the walk:

net/ipv6/ip6_fib.c:fib6_dump_table() {
    ...
		int sernum = READ_ONCE(w->root->fn_sernum);
		if (cb->args[5] != sernum) {
			/* Begin at the root if the tree changed */
			cb->args[5] = sernum;
			w->state = FWS_INIT;
			w->node = w->root;
			w->skip = w->count;
    ...
}

ipv6_route_check_sernum() does the same for the proc iterator.

Suppose a sustained run of link failures hits a default route, for
example through the tunnel error path above. Could each dump batch or
proc read then rewind, so that dumping a large table costs roughly
O(n^2/batch)? The output itself stays correct.

Route adds through __fib6_update_sernum_upto_root() and PMTU exceptions
on default routes already cause the same rewinds. This adds a new trigger
with no limit on its rate. The commit message lists the namespace
generation side effect but not this one.

>  			}
>  		}
>  		rcu_read_unlock();

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/cover.1796382778.git.ralf%40mandelbit.com
Technical Details
Message-ID: <179647124270.3146.16244935232186723099@kernel.org>
Path: mbox-mo1.pugleaf.net!news-can.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer01.iad!feed-me.highwinds-media.com!peer03.ams4!peer.am4.highwinds-media.com!news.highwinds-media.com!feeder.usenetexpress.com!tr3.eu1.usenetexpress.com!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-377958-linux-kernel-netdev=dewy.ru
References: <9b0213020e4e2965acea95513181eba738a54a38.1796382778.git.ralf@mandelbit.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-can.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer01.iad!feed-me.highwinds-media.com!peer03.ams4!peer.am4.highwinds-media.com!news.highwinds-media.com!feeder.usenetexpress.com!tr3.eu1.usenetexpress.com!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-377958-linux-kernel-netdev=dewy.ru
From: netdev-bot+sashiko@kernel.org
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net-next 1/2] ipv6: stamp the default route node with a fresh serial on link failure
Date: Sat, 05 Dec 2026 11:47:22 +0000
Organization: Usenet Network
Message-ID: <179647124270.3146.16244935232186723099@kernel.org>
References: <9b0213020e4e2965acea95513181eba738a54a38.1796382778.git.ralf@mandelbit.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network; logging-data="3017967"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:8BtbkXg+ZI1jM04kNYpcxjMUlU4= sha256:LaUJMprtIkqgAVslU0NlI8tJXQNCckmasj8LGs9tm5I= sha1:ME/CGJeM/U3qqAPIY8F10DxOYvQ= sha256:UIiXMHxjBfOLnG6kL8IMIgfaFAoNa3/j9OErAmrM8PU=
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1]) by mail.dewy.ru (Postfix) with ESMTP id B92C5117E01; Sat,  5 Dec 2026 14:47:46 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.539
X-Spam-Status: No, score=-3.539 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.14, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key) header.d=kernel.org
X-Received: from mail.dewy.ru ([127.0.0.1]) by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 72MEJOcIW2U5; Sat,  5 Dec 2026 14:47:45 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-377958-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN>
X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10]) by mail.dewy.ru (Postfix) with ESMTPS id 9CA09117DFD; Sat,  5 Dec 2026 14:47:35 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sea.lore.kernel.org (Postfix) with ESMTP id 6B47C35FA4; Sat,  5 Dec 2026 11:47:30 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1796471250; b=QvmK/HxSIvZJTCi4YKmski5CtJPWmqJgh12ZKnaaYj1recsqaJotKsanJkCWuTlP/38p xDXv0TBPnrO0EKaIP3Y6/EZqO2FjjFsFFKk1APKqFer/cPFvFALmyJv99CaeiBZSxfWTD rVisqm47dYp2d8mum4Q+EnCihWS54WKsASwXx3Y2UMC6nEJn0R2ef98uzu51Hf0YR9PDg Zx21oyYDJBnGfCB8PMH6mWw243A1k4q8zTjufq7GZow4zNVrJ2W6Q1TiWZC1vRQ2S5mr7 VVfKcFp05bM/kkAKDckPf7K2xYcZ1ETjqcj3QabzRRPJ4N7lYtxVhOVuG/9h+C73PPA==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796471250; h=X-Original-To:Received:Received:DKIM-Signature:Subject:From:To:Cc: Date:Message-ID:In-Reply-To:References:X-sashiko-severity: Content-Type:Content-Transfer-Encoding:X-Mailing-List:List-Id: List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner: Precedence:MIME-Version; bh=f7J73Aq2E8jq6J73190825S9esqe+8x9bLa7FhU//PI=; b=Jmff8dTe74Im6KnE4WYxacO/F1dTQd2yDChoqshXR49CvWWjEh8BcOWLu3K/JCINWt3i K00qoZVEu3Qp2FNKCALSHpvlh/cXYsUgOXRs6u24gjuQxK+Zpg6AwNHnPifw1qizdDrLp 3poaFK4ookvFH+BToX6rZKOBnrYBQiWGuSAC7wH3X/c4lyBWFRiCRcvR83dchVCg+Mqty t03tZzstAgM5pS2bFRfdprZONqlfUvgEIRvj6YOBGGdRPOHuyWeQEh1lHa0jKuFM13Si5 6b6Lnq77Pu+9FgjLZhVWwSsO2jehM9IVJDFKJfJ7IhoPP2KK847SYksyX0MPjQ6cd2g==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=JPFN0CAm; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 074C6606A335; Sat,  5 Dec 2026 11:47:30 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=JPFN0CAm
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796471244; b=T8raPimGJMRCIOo8fmHVYJF+onXEAZzWA3m6TRBBWRPWzh13Xcv51kx4RblcrRYoCVCL 1bTLeZzGMM3lBYy4EBR1cA1zdS7psn+8vmNq6mxiqTTGKtgD+7k/xFhefcLSrBSdaIHb8 AaF3nnTNHZeCEJev9oX57h4IgCkhKXid+XVY0YdYOEV7SkM9PDSz6jp8FRHEyZDkppk1K yySsqVSHikb1xjnkZ6aTnf7uCp5p4iTjNKoFfsvzfMxf/AitCcb9b8sydPx/UT7Q1govv IY4FRlavP849LXC60Xdm8HhYIOkd1oIwRHk0JEQcrvnuY+bV0MLCTJsuvO9qBaTdLkQ==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796471244; h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID: In-Reply-To:References:X-sashiko-severity:Content-Type: Content-Transfer-Encoding:MIME-Version; bh=f7J73Aq2E8jq6J73190825S9esqe+8x9bLa7FhU//PI=; b=ENXsTxRi5R1VliiV1FdLOHFL+v7H5b7u0c8H9WUXrVYCE+I+ON3mS6gOMe96P+wfgpvz Peon+eDhjCoHpXrehWVf/cmqP7mx4ZvpI3LIc08gvJFT5K4lIAjzSeq7pb5oMPblSz2Gm NB6851Bx4WpcX5We6W/c8PpMJ+RaKPL8ktZ/1/cDBzaVyaDrp61b8yYnjPr2scMl8Z3p1 2TbdrwDQp1Fwa5xh1AZgVe6pJMAKcvgYaHmIo7xQftJWwDjMEdjIRANRq4/ayuVtN4uh0 gmjjSZh4+YrLpRAS3YCKDr4yaekLg4J/F3WYocD/sM32cZx6AKTJzwbH13qRrFWOXGg==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=JPFN0CAm; arc=none smtp.remote-ip=100.103.45.18
X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 260A4606A322; Sat,  5 Dec 2026 11:47:23 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2A90D1F0092B; Sat,  5 Dec 2026 11:47:23 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796471243; bh=f7J73Aq2E8jq6J73190825S9esqe+8x9bLa7FhU//PI=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=JPFN0CAmZX8N9ZF9PnCMqwhh5Scbkb2g2ReaAg3qWbS/oGA6uyDjhf1Af4Sj8+sPy n6q4rN2U1MxDrrTgB8L24oNJaj+sHAjEwDkmvacMcb9yGKIpFfkihaXl5a7y4U3z0G EwaZXyxRzikc4zeR+Hhiw4jlvbtL9JBU87Xz0vz4XydbMnqxnoQqAsvTO8bvCGujUx NFKcM5kQtAj66TF9IQ2XygEmkrSxkqOcDAjG5vxY6Yz3oa4Y9ImAw7Nu1vKMmeYh+A sWuNHq+SGxD+VQ8O64QHx1n67JjKsXRR+r/1rF/EwyBevX6N4gIHa33bvJoXBz2Yes LVAc38Zv2oiUQ==
X-Cc: netdev@vger.kernel.org, dsahern@kernel.org, idosch@nvidia.com, davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com, willemb@google.com, horms@kernel.org, linux-kernel@vger.kernel.org, antonio@mandelbit.com
X-In-Reply-To: <9b0213020e4e2965acea95513181eba738a54a38.1796382778.git.ralf@mandelbit.com>
X-sashiko-severity: Medium
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list
X-Received-Bytes: 14788