🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #21318

[RFC net-next v2 2/7] ipv6: invalidate the failing dst in ip6_link_failure()

#21318
From: David Ahern
Date: Mon, 23 Nov 2026 21:26
50 lines
9126 bytes
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
Technical Details
Message-ID: <20261123212623.106153-3-dsahern@kernel.org>
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-369778-linux-kernel-netdev=dewy.ru
References: <20261123212623.106153-1-dsahern@kernel.org>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-369778-linux-kernel-netdev=dewy.ru
From: dsahern@kernel.org (David Ahern)
Newsgroups: linux.kernel.netdev
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
Organization: Usenet Network
Message-ID: <20261123212623.106153-3-dsahern@kernel.org>
References: <20261123212623.106153-1-dsahern@kernel.org>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="3988462"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:oAHWIEWUXTMnl3dTaeilfKAEX28= sha256:enMu6t67rQy9RapmhRfpOB+G5BKwGx107anyxYxbAGg=
	sha1:aBri3A+FfAZD1IviD23v6REUgcE= sha256:q6z3yCPgMzTi6JKY3G6zjRS6THNvbN2KrY/0QZ86xgQ=
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 918FC125DCA; Tue, 24 Nov 2026 00:26:50 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.401
X-Spam-Status: No, score=-3.401 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.001, 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] 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 MV3Q1wyZl6j2;
	Tue, 24 Nov 2026 00:26:47 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-369778-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 4F335125DC6; Tue, 24 Nov 2026 00:26:38 +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 5E54A36378; Mon, 23 Nov 2026 21:26:32 +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=1795469191;
	b=ej2lpXQXDBlBLdc9uJuuesAPljDTRvyTWVaqn0vTm7gs2Rx/XNRSmd+WHNGPyiu5wZlh
	 csRvyV21VrkXAPZpeZw1g6U6Vyrqeol7tG3k3LlnjL7ZI2TrRtieS7879tF1ERoUKFh3x
	 N3566kxP6ylsS6NWwMiMqvkSrYFhYngBVcGNofkgo+fZxkpaYVZf/WYaKNl9bLllHp70h
	 hxGIlrYY8aleOyHNYl+YsUMVDwheJRJDcaJ9WhcTOep7a/YsqbDneGVMb1M3gY8z+wE9z
	 yr6RlwVM2QCIV/KfsE4lL3GezmN62I6F7kNNTuKUGizdMecrtD4OlezTEFNQfRnCRwg==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795469191;
	h=X-Original-To:Received: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;
	bh=oQx1HExhx0RCsnyejYc4L7AmX+11wbvwreIsD3Nmy6Y=;
	b=1UTjufwKdc2o8MqnQ2UuDvmSteu6YdnvZcJe+lydD75snmy/B9RLG9eCnePVonuWT296
	 HzGLKJnRQxQo7Na2U58a4Uy96gx190XRgSnwZW2/6xGit2dnnxSpKC0RBi7Vanf28wcSV
	 t39OoYJcts+IGpYTAP32r7+vfuKiG9MewDvitnGqeQeVS4dUq48n0dcyTmSJJVSJ5wW8C
	 qQFzpOk4d9Flq1wS5v4P0rnWvmY3/a5S2GFrbER1GOf77JhDP96mggDrBUAr8ZkTE0ijA
	 SpI4uqwNe9/GAzb6+YKRgp5uzIsLJyI8UJWd10VjPvRHBVDK9kGY9uQY01A+yem+GEQ==
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="Hi/TcFNj";
	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 72C0B606A681;
	Mon, 23 Nov 2026 21:26:31 +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=Hi/TcFNj
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=1795469190;
	b=hBmMfG74nz1cg4GHQ103sg5gfUNQeeaD0fx/cN3VHyVZxn9ZWfAb7W9bEKu0R/zuJlRP
	 cqY6gEE0ceo0+tv6pZ4+VAviXcNTmZpNr74U3ubKETXnA7zJIhEo0g5EjQ4ha9qec0GxW
	 c4M8+BL4L2WC3gvBHNawI8Seo9iNAup+OGlcXnjYZLJpaLtRK9Iu3IVJLvuz+iRYn/74h
	 v0rH3aR5CQzXrVObpo+A1Jy3Hti1YOXV33O57ZJw5MAPik/+LHlhXk828qxXhxl76emZP
	 n/MBaftaAzQs9TQMY234SWNZV5TuOhvKldNGPRCzn+funn9L5xqqA6tuTYV3tCtf41g==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795469190;
	h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer:
	 In-Reply-To:References:MIME-Version:Content-Transfer-Encoding;
	bh=oQx1HExhx0RCsnyejYc4L7AmX+11wbvwreIsD3Nmy6Y=;
	b=Ma12SiQuPuzwqzsCtpWB8Az24iM3niv4cU3gNyLJ1I2Z8hc5dYAqrycC3MEpY0yp4oSA
	 UXzI2zMzd0fPH9Beg2iG/eJ9NsYsXJeqFYjc8Bv+LCH87rdA+upMKNYI/pWGQI8z2XL6A
	 Hsyr6/2WsOykDLPaViR21nLIRipEBP4BZIAVScw1m0Uuw0lmZt5PQAkIFVzh1cQ+fMyPp
	 /CtbytsNpi4SUU8t5z3B72TCVpbVM9aF/S3UXawOjHBwqE8WPoY2DkJTF6xMIm7qr+n94
	 5XVWSS5WH4a39lEMwapowZKu9KipMWMtz2QHSZPsXxnFodyNOlqkqY7d5hdZs25Xrsw==
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="Hi/TcFNj";
	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 8EFC4606A331
	for <netdev@vger.kernel.org>; Mon, 23 Nov 2026 21:26:30 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 409AE1F000E6;
	Mon, 23 Nov 2026 21:26:30 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1795469190;
	bh=oQx1HExhx0RCsnyejYc4L7AmX+11wbvwreIsD3Nmy6Y=;
	h=From:To:Cc:Subject:Date:In-Reply-To:References;
	b=Hi/TcFNj0ofbvJra8fLhZ6s/g6WcQXP5YNSeLPVjGx+XkXMms+XnWaG7Ygly0IthN
	 K5GNVyqY8a94zQANbUbJEVtmsGoxvPPaFL5Rref7giwKmA/wruOSU57qDqsdcpmpiC
	 U6ksnaHR73t3SVP20FuATprWch5vaRa+XVWNLYPX2UZzsWJJ0vPW1J9Eu6T5xMKXMv
	 0S+e2x5oeFKUbTkNOBsZa4X8JdRPs4QwgqhALlGE6DkbNnv70xq1idNSALv5XhjfRF
	 7/sYMdL2V17wu1wUtc/x97LdW8KmB3LAblxohYvAlff2PyQ6pU5hm/Rnw15PVwRn9I
	 wO2tlRt/GikRw==
X-Cc: ralf@mandelbit.com,
	David Ahern <dahern@nvidia.com>
X-Mailer: git-send-email 2.43.0
X-In-Reply-To: <20261123212623.106153-1-dsahern@kernel.org>
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