🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #22957

[PATCH net] ipv6: advance the serial after rebalancing in fib6_ifup and fib6_ifdown

#22957
From: Ralf Lici
Date: Thu, 26 Nov 2026 08:13
73 lines
11800 bytes
fib6_ifup and fib6_ifdown update the node serial before calling
rt6_multipath_rebalance. A lookup that runs between the two can select a
nexthop using the old ECMP upper bounds and read the new serial as its
cookie. The cached dst then passes dst_check although it was selected
from the old state, until the next relevant change.

Update the serial after rt6_multipath_rebalance, so that it is published
only after the routing state it describes. fib6_new_sernum allocates the
serial with a fully ordered atomic_try_cmpxchg, which orders the
rebalance before the serial update. The invalidation scope is unchanged:
fib6_ifup still updates the node and its ancestors, fib6_ifdown only the
node.

Validating dsts against the generation sampled before the lookup, as
proposed in "ipv6: validate cached dsts against the netns route
generation", relies on this order as well: a lookup that reads the new
generation must also observe the routing change it describes.

Reported by Sashiko while reviewing an earlier version of this change.

Fixes: d7dedee184e7 ("ipv6: Calculate hash thresholds for IPv6 nexthops")
Fixes: 4bc852006b62 ("ipv6: update route serial number on NETDEV_CHANGE")
Link: https://lore.kernel.org/netdev/cover.1795642432.git.dahern@nvidia.com/
Signed-off-by: Ralf Lici <ralf@mandelbit.com>
Reviewed-by: Xia Yan <yanxia@cmss.chinamobile.com>
---
Split out of v5 of "ipv6: tie dst validation to the lookup that
returned the dst", which is withdrawn in favour of the series in the
Link above:
https://lore.kernel.org/netdev/cover.1795537128.git.ralf@mandelbit.com/

 net/ipv6/route.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index 1b2dcc066e19..194432f1fd66 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -4911,8 +4911,8 @@ static int fib6_ifup(struct fib6_info *rt, void *p_arg)
 	if (rt != net->ipv6.fib6_null_entry && !rt->nh &&
 	    rt->fib6_nh->fib_nh_dev == arg->dev) {
 		rt->fib6_nh->fib_nh_flags &= ~arg->nh_flags;
-		fib6_update_sernum_upto_root(net, rt);
 		rt6_multipath_rebalance(rt);
+		fib6_update_sernum_upto_root(net, rt);
 	}
 
 	return 0;
@@ -5015,8 +5015,8 @@ static int fib6_ifdown(struct fib6_info *rt, void *p_arg)
 			}
 			rt6_multipath_nh_flags_set(rt, dev, RTNH_F_DEAD |
 						   RTNH_F_LINKDOWN);
-			fib6_update_sernum(net, rt);
 			rt6_multipath_rebalance(rt);
+			fib6_update_sernum(net, rt);
 		}
 		return -2;
 	case NETDEV_CHANGE:
@@ -5024,8 +5024,8 @@ static int fib6_ifdown(struct fib6_info *rt, void *p_arg)
 		    rt->fib6_flags & (RTF_LOCAL | RTF_ANYCAST))
 			break;
 		rt->fib6_nh->fib_nh_flags |= RTNH_F_LINKDOWN;
-		fib6_update_sernum(net, rt);
 		rt6_multipath_rebalance(rt);
+		fib6_update_sernum(net, rt);
 		break;
 	}
 

base-commit: ef3e21c61baa74e39a49b75318bd4541562ec43f
-- 
2.56.0
Technical Details
Message-ID: <20261126081353.55240-1-ralf@mandelbit.com>
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-371944-linux-kernel-netdev=dewy.ru

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-371944-linux-kernel-netdev=dewy.ru
From: ralf@mandelbit.com (Ralf Lici)
Newsgroups: linux.kernel.netdev
Subject: [PATCH net] ipv6: advance the serial after rebalancing in fib6_ifup and fib6_ifdown
Date: Thu, 26 Nov 2026 09:13:51 +0100
Organization: Usenet Network
Message-ID: <20261126081353.55240-1-ralf@mandelbit.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="414394"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:E0w7xjhdm4ghKzMjAelBNv/tAE0= sha256:iYy3/dFhA9dg7+NrP9eBYfa5I2L2tf8wCRN1Iy++tRQ=
	sha1:UlmT3EA+YZpRoinA51BJORFtn3k= sha256:Jb6aRKhz/gF50AESYmeloWBn41NfsVH69QjHCqXUvKE=
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 7C9AE125EB5; Thu, 26 Nov 2026 11:14:47 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.05
X-Spam-Status: No, score=-3.05 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.249,
	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 mcE8g9CHCuiS;
	Thu, 26 Nov 2026 11:14:43 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-371944-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 8664D125EB0; Thu, 26 Nov 2026 11:14: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 3FCAD3B894; Thu, 26 Nov 2026 08:14:23 +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=1795680861;
	b=F22PTWZxd2Ffr86BR0ZqpDcNe8q9PdUJYv69cq7lZa5Ds3KTWR9nuHyiVScMhdeU1/Hv
	 Mz1szPyVeCwktFzQZf+0yOGTdjzYkS/PtujPYnNp9voPrehnhMc2pX9KM8z392YN+5GlP
	 q6ZInKt8lxuJ8sGiw1wWud5BPjxnmUDskM9DgNEYHneGq+P8D/mrZwI8KDBBTHcFnU7GQ
	 POlIjEzA326nXcqp8nZhJ1JCCQkCJgBF4BK6aCHEQ30L25gwW+kwycXF7NF55tPTc4CWd
	 JVDvMx+HWUcgg/ot/pFXi3uOH9AozxNPvtMcaIDQwBwB2fg6MgTUwFTKCpgqTTbyMqw==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795680861;
	h=X-Original-To:Received:DMARC-Filter:Received:DKIM-Signature:From:To:
	 Cc:Subject:Date:Message-ID:X-Mailer: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=7J2wkcrNkzeTtVxHfayLP87adFuogRPt/IEKd/fTAXM=;
	b=DMhZNxL6kOE8bxyMJnm2q19B0uBk96BlUQCYuJIoMC7sYFlhiEGeThkRkNuVfxeK8JAi
	 k4Acz1BvKHTCukaS6zlfRJCrN67sGP/EJYn6brQahQoR/mF95FWlfQK1dD9tFrLPBYFK1
	 WkmPXzVqVMdGDMpFx47eHwtFoMebjCsVEyDlEFaIj+bF1k+ulGjjBYE1x1NunhG4CD06X
	 arxpp12zwRkEaZQkc0ej8VhhBbqdJTGSXedUw6FdCkjViDRYXMMQSF+zamvaQ8RY9bYUI
	 m2VbE/bxnahAKje9fg3ApLZo1JRAbqYTuLmW42mOA7MamYkH28UUxsGqJ7Ah2vOIMvg==
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=I8oXpLGw;
	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 C9AAA606A6A7;
	Thu, 26 Nov 2026 08:14:21 +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=I8oXpLGw
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=1795680856;
	b=b2fFgi8jaIAfPx885qLkig2Ae5ee74k29GVng8ORykIG2aBoxmp7975i2aCT0asW05Zz
	 DOndmgqlO/C7jPs7qUA9aO8FpXF8lOeQ+sJRWZ9R9Og5AeIJXgUqXBmZAfXEvXTQLGMaR
	 FU2I09eL2BoMBBc9CruL37y6ewyXWgfL5lCHvnhUDcob+MVMXllNE2xUX7gjq25MZETGl
	 pW2fLJLaEjPtBogpnmHemT2A8gd2ZGlgxcNlIzaoUwoijs2Lw2hNMj8mkqJU4SUmdQZpK
	 quLu6QaTW1cfDOT/DF/H+HVVtOjaYYdI5vEcCtzv28YOrugW341yD/cH052sH+ou4eg==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795680856;
	h=DMARC-Filter:Received:DKIM-Signature:From:To:Cc:Subject:Date:
	 Message-ID:X-Mailer:MIME-Version:Content-Transfer-Encoding:
	 X-Rspamd-Queue-Id;
	bh=7J2wkcrNkzeTtVxHfayLP87adFuogRPt/IEKd/fTAXM=;
	b=W3fTK6CWXiP5K35Bxu8e8SxED5tg5yXzKLWR2jsWvbXAwXx2kj6VpkTfpIF3D1sOJOkm
	 pCjQtoPltR2MzsEoonpfGWHcONWP3teYIgQuh+majW+QRVdOzMeNGdkb7EV/3Q9GO72GB
	 Ots30bvMKnqfS7lUPzOs/5i7aCqkNXS0j6XxDPoKQmGcNSl0IX2lClv7newLy6CEqs+RT
	 SHiAHxhywZ+/SQG6kK6htmRra2Di+mUBWrFgBEq8diW1rjMuRgd8tWCeSK1lRkG6yvZDW
	 s7bEiq3k2kj6rD7e87K/WqdMMXsZc4kIMV3tu6Ax0dBFrY1/Ny76RZbktFIzb32pmlw==
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=I8oXpLGw;
	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 A065F606A336;
	Thu, 26 Nov 2026 08:14:14 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org A065F606A336
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 smtp2.mailbox.org (smtp2.mailbox.org [IPv6:2001:67c:2050:b231:465::2])
	(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 4jZq7x2Z6hz5wrZ;
	Thu, 26 Nov 2026 09:14:05 +0100 (CET)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mandelbit.com;
	s=MBO0001; t=1795680845;
	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;
	bh=7J2wkcrNkzeTtVxHfayLP87adFuogRPt/IEKd/fTAXM=;
	b=I8oXpLGwdlJGKsH57NjV3Pq/hBt/2kfABUdikdqOm+EIP5W1XX+v1Z8kbvizChYqWVPK7N
	64+8OPnoxCVJkuqOOKJ2S5RQ4kzK14kTPBxaiSnBSyuqQ2uuwmlCpOFuv2uKXvrhoSowxm
	LKRIMN2C9shao99leI4qAfWbY50Ihyfv6U5SuknjYk6p0frWhYLXdT+FXqRVcjixEgM+aY
	FTJ9fHseDU2IesJ9X3wYGvcvuWGWiBLhKssRd5nfFkq8ma+Uvo7F6fbh3LPpFPdMILEdZ/
	3xPMPpl8KV7GFAO+XQ4LqkKKJnupY8wVE7ts9cuCcGqkv1/vQw5Ns8lxMyZRnw==
X-Authentication-Results: outgoing_mbo_mout;
	dkim=none;
	spf=pass (outgoing_mbo_mout: domain of ralf@mandelbit.com designates 2001:67c:2050:b231:465::2 as permitted sender) smtp.mailfrom=ralf@mandelbit.com
X-Cc: Ralf Lici <ralf@mandelbit.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>,
	Willem de Bruijn <willemb@google.com>,
	Simon Horman <horms@kernel.org>,
	Sagarika Sharma <sharmasagarika@google.com>,
	Kuniyuki Iwashima <kuniyu@google.com>,
	Xia Yan <yanxia@cmss.chinamobile.com>,
	linux-kernel@vger.kernel.org
X-Mailer: git-send-email 2.56.0
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: 4jZq7x2Z6hz5wrZ