🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #26906

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

#26906
From: Ralf Lici
Date: Fri, 04 Dec 2026 11:28
68 lines
11962 bytes
ip6_link_failure invalidates the cached dsts of an RTF_DEFAULT route by
writing -1 into the node's fn_sernum. Once the node already holds -1,
another link failure leaves the serial unchanged, so dsts cached with
that cookie can survive subsequent failures. The assignment also leaves
net->ipv6.fib6_sernum unchanged, and -1 is outside the range that
fib6_new_sernum allocates from, so the serial cannot be ordered against
the namespace generation.

Use fib6_update_sernum under tb6_lock to allocate and stamp a fresh
serial instead.

Advancing the namespace generation also invalidates unrelated dsts using
nexthop objects, which are validated against that generation. This
happens once per ip6_link_failure call: once per queued skb when the
neighbour of the default router fails, and once per packet on the
tunnel transmit error paths that call dst_link_failure, some of which a
remote host can trigger with ICMP errors. These are error paths and add
no cost to the fast path.

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

Signed-off-by: Ralf Lici <ralf@mandelbit.com>
---
 net/ipv6/route.c | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index d3c77941d2cf..b641df277483 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -1532,9 +1532,11 @@ static struct rt6_info *rt6_make_pcpu_route(struct net *net,
  */
 static DEFINE_SPINLOCK(rt6_exception_lock);
 
-/* 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.
+/* Return the netns the dst was allocated in, which owns the fib6 table of
+ * its route. Exceptions are accounted to it, and ip6_link_failure advances
+ * its generation. 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)
 {
@@ -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);
 			}
 		}
 		rcu_read_unlock();
-- 
2.56.1
Technical Details
Message-ID: <9b0213020e4e2965acea95513181eba738a54a38.1796382778.git.ralf@mandelbit.com>
Path: mbox-mo1.pugleaf.net!feed-us-txt.newsdeef.eu!feed-us-ny.newsdeef.eu!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-377304-linux-kernel-netdev=dewy.ru
References: <cover.1796382778.git.ralf@mandelbit.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!feed-us-txt.newsdeef.eu!feed-us-ny.newsdeef.eu!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-377304-linux-kernel-netdev=dewy.ru
From: ralf@mandelbit.com (Ralf Lici)
Newsgroups: linux.kernel.netdev
Subject: [PATCH net-next 1/2] ipv6: stamp the default route node with a fresh serial on link failure
Date: Fri,  4 Dec 2026 12:28:03 +0100
Organization: Usenet Network
Message-ID: <9b0213020e4e2965acea95513181eba738a54a38.1796382778.git.ralf@mandelbit.com>
References: <cover.1796382778.git.ralf@mandelbit.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="2750955"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:0zBIUKRMaVQcDLH3l7paM/6EQWY= sha256:XO/N6wvWXQk/AgUwemFKGnQaxBeYMFvyFMm9nYbkD+E=
	sha1:3P7y89sNA2r0Oz+FwVKtatSmleM= sha256:FkDTVan0mW3Qqv+T9lrOzpqPV+Zr40uABaQ89zMshPs=
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 CCD2E117B8B; Fri,  4 Dec 2026 14:29:08 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.298
X-Spam-Status: No, score=-3.298 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1,
	DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.001,
	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=mandelbit.com
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 BNu4CUEyAtK9;
	Fri,  4 Dec 2026 14:29:06 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-377304-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=none (p=none dis=none) header.from=mandelbit.com
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
	by mail.dewy.ru (Postfix) with ESMTPS id 5851F117BB8; Fri,  4 Dec 2026 14:28:57 +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 B58EF3B80C; Fri,  4 Dec 2026 11:28:39 +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=1796383718;
	b=ZTD/h1jUO7GlvFZneephQ39yE62Lcm2VJrrtwjdVZdfaOALi2Z2WXoJ6DsSX2OmsM52I
	 upqjijA8qpMnyZc8HJPDSxivRxqFhlVFg3kxgAvXFqRXPTn3zUj9ZBe6zJEyf05rc8Cer
	 0DPDOen3cGD/nkaTiBFnkYrpXj1pC7ycm+YzVwN6hVctWDl6j+CQ1mDz8Xb0d8JtXLoG2
	 6V8osjkXm32IQfn+hrFv/RPCDJug1ojYyCSdL7i83tOwmis2aZSsnnA5sxvXF/fBlGjeE
	 K325SYPW0nMAIcbRsUR5kFAfrCTgIPK5vqCwh2yQsmxMmeaqRhHNMxs3T8o9lTmj5mg==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796383718;
	h=X-Original-To:Received:DMARC-Filter:Received:DKIM-Signature:From:To:
	 Cc:Subject:Date:Message-ID:X-Mailer:In-Reply-To:References:
	 X-Mailing-List:List-Id:List-Post:List-Help:List-Subscribe:
	 List-Unsubscribe:List-Owner:Precedence:MIME-Version:
	 Content-Transfer-Encoding:X-Rspamd-Queue-Id;
	bh=LiMKbuYThzvX8HRIObzaA8usS9+GsNbcRTonl7e/4hI=;
	b=0bxL1cgS8YOuZCCKZBdMBNFxcA7ZXG1BPt2gc6txpXvUi6RSHi+2bEIRG9kxdQvW2YJr
	 sf1+Vm6q0wxrpfTrQu88EPe8wlwHMWrpneE9sXaQuA6jYnq3GbK3uyIQ32pzupovX8Uvh
	 cr0dWUxQJshyXSz3V+ez0m5SB7KCpLFkqNLiO3tz7WkwDjGXB1vjvlDff5icP9vn9TIfP
	 3GRSaqxWkFQYYYJO0APDiCXTIZpt34x/ShWmy5sYmmyt4LV2hC+/IWnnjGUPXKLNOnMqR
	 bKRXTNwxqL1N0OmeU0EJgB1eO2JxuckwDVqH2G+XxA0Ggd0a7g5DjZUxenuGOdHJP7A==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=mandelbit.com header.i=@mandelbit.com header.a=rsa-sha256 header.s=MBO0001 header.b=qXApDj72;
	dmarc=none header.from=mandelbit.com;
	spf=pass smtp.mailfrom=mandelbit.com;
	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 E0F8B606A686;
	Fri,  4 Dec 2026 11:28:32 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key, unprotected) header.d=mandelbit.com header.i=@mandelbit.com header.a=rsa-sha256 header.s=MBO0001 header.b=qXApDj72
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=195.10.208.42
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1796383712;
	b=HjizI0mS3HKgiuNz+bL4zbjsIGjOf7kvgZh8YbrxbnZzvO4VOO73I5dMVB9oC8vhH0us
	 KoTnh8LoHodTTYPKCJbCb3W86JpwJLIiPbhqBeMIlb5sMYXN0Q+pRKD71ukoU2PBv/6S9
	 +xcuR2ToEFTrDu+mbF3szjNXaHm3535tOkEtoPr4ys+BY/OEQc6iy2aH+cuI2I0r5EfIR
	 gh4tv4M7jta0vM1osN8NR9Swwcs5ZV9AbgKR06ItGiFmu44DGMtQLebl3NkJltauE0vV0
	 T+nlCdxPAvnB2P20xQvODbB76ffzU5jTng1ZcC8pdNJaUIT8mYSYYw7RT+5DzN8R8Ng==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796383712;
	h=DMARC-Filter:Received:DKIM-Signature:From:To:Cc:Subject:Date:
	 Message-ID:X-Mailer:In-Reply-To:References:MIME-Version:
	 Content-Transfer-Encoding:X-Rspamd-Queue-Id;
	bh=LiMKbuYThzvX8HRIObzaA8usS9+GsNbcRTonl7e/4hI=;
	b=uoILqilo4+DnR7e/a2qxujjI4DZz/JaNTtRwgu/EcaOwCOtclLO1X78iDbLPLxvVSc3P
	 DKZF/H/8UwZhvRpq74kzlMjf7yJjnA2bUV1VTXRwSRd7cYEpSWSHffdtyu4dkjbrJ0Z51
	 kW87y0ihc6w9MvjEHzxLMLtOzmbJJl690zt9rL9Poj30oiHTAF7Jn0tc0FhU+KT1verCl
	 Vh8hLUDoYh8erIX8PWZPoPHLti+jzqvp2IvnZyL2v3ZcesQP2X1jpQxiaVq+grZu6X4ad
	 v3W4bAZL+UE+mb8qXmsuyDlmvdxsdWxAvqEnU4qUlf8x79GX+BOaPbc8yvLkYDvY29w==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dmarc=none header.from=mandelbit.com;
	spf=pass smtp.mailfrom=mandelbit.com;
	dkim=pass header.d=mandelbit.com header.i=@mandelbit.com header.a=rsa-sha256 header.s=MBO0001 header.b=qXApDj72;
	arc=none smtp.remote-ip=195.10.208.42
X-Received: from mout-b-112.mailbox.org (mout-b-112.mailbox.org [195.10.208.42])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256)
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4B0EE606A32F;
	Fri,  4 Dec 2026 11:28:29 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 4B0EE606A32F
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=mandelbit.com
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=mandelbit.com
X-Received: from smtp102.mailbox.org (smtp102.mailbox.org [IPv6:2001:67c:2050:b231:465::102])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519MLKEM768 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(No client certificate requested)
	by mout-b-112.mailbox.org (Postfix) with ESMTPS id 4jgq4N3h7Yz5vW9;
	Fri, 04 Dec 2026 12:28:20 +0100 (CET)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mandelbit.com;
	s=MBO0001; t=1796383700;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:cc:mime-version:mime-version:
	 content-transfer-encoding:content-transfer-encoding:
	 in-reply-to:in-reply-to:references:references;
	bh=LiMKbuYThzvX8HRIObzaA8usS9+GsNbcRTonl7e/4hI=;
	b=qXApDj72KfIX00OZonyWxUONw/1IN75s5XkHlZZjfrU2YLOi4xi1iK8wAmEQGs5WPSOOpb
	znb0iLtlJZdcel8MGoeZkSFBRjmiDav7jeaRny7MkDU61deLDKFY2HwFJ0QnFZMPAHmr1c
	6NF4ALFz7D5xrenroKhv5ddgmayCjfCvX+NcSW4UzNEF9GD06pmEqkC+PF/Xr6Hrykt51W
	zwvsJe9X6qAurPQo7p5UfSnHKIu8i/ohVc4jAtTgUq9quWbogRI+xWzZGMZgob63f/yhLV
	zZz2n0MsK0ZC/Xprl2DS1gpVYf6LSBcvVMaJSdQtGGGR9+p/E6cb9mjjbz28Qg==
X-Authentication-Results: outgoing_mbo_mout;
	dkim=none;
	spf=pass (outgoing_mbo_mout: domain of ralf@mandelbit.com designates 2001:67c:2050:b231:465::102 as permitted sender) smtp.mailfrom=ralf@mandelbit.com
X-Cc: David Ahern <dsahern@kernel.org>,
	Ido Schimmel <idosch@nvidia.com>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@kernel.org>,
	Jakub Kicinski <kuba@kernel.org>,
	Paolo Abeni <pabeni@redhat.com>,
	Willem de Bruijn <willemb@google.com>,
	Simon Horman <horms@kernel.org>,
	linux-kernel@vger.kernel.org,
	Antonio Quartulli <antonio@mandelbit.com>
X-Mailer: git-send-email 2.56.1
X-In-Reply-To: <cover.1796382778.git.ralf@mandelbit.com>
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-Rspamd-Queue-Id: 4jgq4N3h7Yz5vW9