🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #20558

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

#20558
From: David Ahern
Date: Sun, 22 Nov 2026 22:27
48 lines
9463 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>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
---
 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 1f7b2cdc1d9f..d355652a0520 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -2885,14 +2885,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: <20261122222717.126333-4-dsahern@kernel.org>
Path: mbox-mo1.pugleaf.net!news-can.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-368857-linux-kernel-netdev=dewy.ru
References: <20261122222717.126333-1-dsahern@kernel.org>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-can.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-368857-linux-kernel-netdev=dewy.ru
From: dsahern@kernel.org (David Ahern)
Newsgroups: linux.kernel.netdev
Subject: [RFC net-next 2/6] ipv6: invalidate the failing dst in ip6_link_failure()
Date: Sun, 22 Nov 2026 15:27:00 -0700
Organization: Usenet Network
Message-ID: <20261122222717.126333-4-dsahern@kernel.org>
References: <20261122222717.126333-1-dsahern@kernel.org>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="3737451"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:RqJAL+dOLBXuXGvyZEHHIIJt6gw= sha256:+nw1KcAfK7NwRz59HrsIP1Cz52pRDkwx81ska1btKww=
	sha1:9AphHfTFAUocBvbopI3njLxdCUA= sha256:qAr36w4vZQRekttTeR3K1fD5D8eNsX9YaQoDcNZhuXc=
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 EEA50125D8C; Mon, 23 Nov 2026 01:27:46 +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 Fb7AkHpd7zAv;
	Mon, 23 Nov 2026 01:27:44 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=104.64.211.4; helo=sin.lore.kernel.org; envelope-from=netdev+bounces-368857-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 sin.lore.kernel.org (sin.lore.kernel.org [104.64.211.4])
	by mail.dewy.ru (Postfix) with ESMTPS id A39F8125D87; Mon, 23 Nov 2026 01:27:34 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sin.lore.kernel.org (Postfix) with ESMTP id A1F2324141; Sun, 22 Nov 2026 22:27:31 +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=1795386446;
	b=zREiCTNTbKFOlOhAPixM3OV6W0dKvzFaeYtXEI6TavZ1NuJrM/XVw378Izhht6jD+j7j
	 i/bCXAZfQQ7CuMOFZqd2a1Sdn1ABjerOhqxYgpka2zxVhr6fNgJvxwbb1GK+VUQI57rfk
	 +XdEpPHGQqGyco4jE2Dr8aLs7g2GLRseRpj0RpaWp4ejE18k7QSVyV3bbX0oy83J3vYsP
	 45aHF8jo3MVXXWze4n9OsQ5OuR5anB3Pl9TvMUcEZvf2UjBq1Q10tj2pVGykWOkmaqWXv
	 tPZSpN8MqiHTYQsekQ0F7eXQnKxE1dUsqeuXp8nUkrWoJTJifQaWn8kpSDCnxoED6AA==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795386446;
	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=dfgFX1zjjeyXPlnELmVLZEr7Vw1O/9Vju7agU2TmpGg=;
	b=14O8znZ6cycpZpeqHfImOhw6keeE9Vw+jWVyUpsesGuXWhm2zVZyuxe9xbWb4TEZ9tJ5
	 fHlMclJBKHDdBk2rs9GJo0AoEFgSaiRqhQmZ60MEbuJbjJUeIL8vMPtIFgQ8QhgSFaYFz
	 BdMXcr1MM6IdeKBFYHByWxIXfZFNIK6e0ArxPLA3Hg03F2lHYM28V2B5lsnS80DgfOCoQ
	 IeQ8noS/nNXV52B6/sSxw11QznjXvR2NQ0iZ/zcK6zZHetN8jtcF0+9XPH9cM1J8u1+Tl
	 BuEcS4VVcQkiNl7TcSXjF5Kd2vRulnPzgOTGGrBzJC4eeCSyXUBsdWXz/J6xamH7iQw==
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=DlWGRujh;
	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 22F37606A691;
	Sun, 22 Nov 2026 22:27:26 +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=DlWGRujh
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=1795386445;
	b=eO4MOG9bG+GNuihfpeEpDI+kHW+2178R9emPden1N0jNMYd5iqDle2UVNUWEj5dhy3Tz
	 zvWYWmRPddoYa4vNz/x1mBVgIuyIwZ6gQqXZbrrGFcf4rkBq2ypM6x/CYQNwKmU5xlpv6
	 BKBCG+AlvacH79xVBGcUV88xu//XGj41gfmuKK1n1dafU7aH+wPj0CPbYgSQUOC7ut3qt
	 MYXNpTUMuGn2c/Z7yiDJ0WPR1AumK3KhO+og15FsbzjxOhebyMs4zZxtmAo09ZcRLtLBU
	 eAGC0Gomo7FN0WrvZ1y5Oc6S2JdShYRTswIpGGOwzWGOcspZ/cpYxU8NabNYgvZmmEg==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795386445;
	h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer:
	 In-Reply-To:References:MIME-Version:Content-Transfer-Encoding;
	bh=dfgFX1zjjeyXPlnELmVLZEr7Vw1O/9Vju7agU2TmpGg=;
	b=Is8rXJZcyUqHi3a55QqW4ALfDsdFC7WgBCG/fyT7vjxAtRj7Smd/ky4r47zFunPheF5Q
	 BtDCrVY0QaSnyqOEOpVxx2uGm+5A1a5I5Q5UNeuDyokQS+lbyC3rNEf00heNkCyasLrML
	 LPF7fgsdbbBxtvL2C3KzcTjxgkX5AXjH/yy1Jkbv92IlZEgqEGhOGTb9YyS2rcDJlm72B
	 tlcuWZgzVxN6m1HMj3/GtonwK3LfPflrYDGVfNi+vPv1IsgNXW752HPM64HI8ymAUrAqo
	 H7IWwvA+CBkCfIuxFW9u2i+TwaUmPqgd6BkWDV3TA5q8KsF/JnQEEOebd5/gkuGt6Vg==
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=DlWGRujh;
	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 40FF1606A686
	for <netdev@vger.kernel.org>; Sun, 22 Nov 2026 22:27:25 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 04F821F000D2;
	Sun, 22 Nov 2026 22:27:23 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1795386444;
	bh=dfgFX1zjjeyXPlnELmVLZEr7Vw1O/9Vju7agU2TmpGg=;
	h=From:To:Cc:Subject:Date:In-Reply-To:References;
	b=DlWGRujhwuPAs1vSW+fx8Uu6LRvCSEAOKi+/ICyLn4uNcUjr84BmQh5gdlDrpzuZv
	 CMNhij49RdLi+NbUBBb1ZOZ9oC0Szs2F3BFcId8Ypu3BeLemiZOm7OjDch4YXGOAv6
	 4nXzweFVMZ57kYIAn7eERY31JBipqwFv6v/b+F/GAnAQd4fDgFGIspd4gqyL+016pf
	 5AXckJGu5GOQeIKlizFjNY5y82Sip5Hb/X4D2+nArSINzxsZfl5NAaWse6gN8Svp3o
	 +JYvYF68OSzBLz8d5m6UlRE/F0Hacvkn84dfVK5I8Udj5U6Z0/KAbwAH7Z7MacPA4h
	 frx8ExIyjaBLw==
X-Cc: ralf@mandelbit.com,
	David Ahern <dahern@nvidia.com>,
	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>,
	Simon Horman <horms@kernel.org>,
	"Claude Sonnet 5 . 5" <noreply@anthropic.com>
X-Mailer: git-send-email 2.43.0
X-In-Reply-To: <20261122222717.126333-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