🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #20563

Re: [RFC net-next 0/6] ipv6: validate dsts against the netns route generation

#20563
From: David Ahern
Date: Sun, 22 Nov 2026 22:30
48 lines
10328 bytes
On 11/22/26 3:26 PM, David Ahern wrote:
> From: David Ahern <dahern@nvidia.com>
> 
> An IPv6 dst has never carried the fib6 serial number it was created
> under. rt6_get_cookie() reads fn->fn_sernum through rt->from when a
> socket, dst_cache or xfrm bundle stores its cookie, so a FIB change
> that lands between the route lookup and the cookie capture is folded
> into the cookie and a stale dst looks valid. The only dsts stamped at
> creation are pcpu dsts of nexthop-object routes, which store the netns
> genid in rt->sernum.
> 
> Looking at this I found that rt_genid_ipv6() and the fib6 serial
> number are already the same counter: net->ipv6.fib6_sernum, which
> fib6_new_sernum() advances on every FIB change. fn_sernum is a per-node
> copy of it. So this series moves dst validation onto that counter, the
> way IPv4 uses rt_genid, instead of adding another one:
> 
>  1. Stamp every dst with the counter in ip6_dst_alloc() and validate by
>     comparison in ip6_dst_check(). Long-lived dsts (pcpu dsts of routes
>     with an embedded fib6_nh, and exception dsts) are re-stamped when a
>     lookup finds them again, otherwise they would stay invalid.
> 
>  2. ip6_link_failure() forced a new lookup by writing -1 to fn_sernum.
>     That no longer invalidates anything, so clear the failing dst's
>     sernum instead.
> 
>  3-4. Nexthop objects: factor out nh_has_f6i(), then bump the counter
>     when a nexthop used through a group is replaced, and when a member
>     is removed from a group.
> 
>  5. A new PMTU or redirect exception used to bump the counter, which
>     with (1) would invalidate every dst in the namespace. Do what IPv4
>     does in update_or_create_fnhe() and invalidate only the pcpu dsts
>     of the affected fib6_nh. Route dumps still need to see that an
>     exception was added to the root node, so add a per-table sequence
>     for that rather than inventing fn_sernum values the counter could
>     later issue again.
> 
>  6. Since nothing validates against fn_sernum any more,
>     rt_genid_bump_ipv6() no longer needs to walk every node of every
>     table. Make it an atomic increment like rt_genid_bump_ipv4(), and
>     drop the __fib6_flush_trees pointer. fn_sernum remains only for
>     route dump consistency, so nexthop, address and rule changes no
>     longer restart in-progress dumps.
> 

Ralf: This aligns with the direction I meant in my reply on October 13.
Technical Details
Message-ID: <a31eccac-79fb-4fcd-81ea-243592f20c58@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-368862-linux-kernel-netdev=dewy.ru
References: <20261122222717.126333-1-dsahern@kernel.org> <20261122222717.126333-2-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-368862-linux-kernel-netdev=dewy.ru
From: dsahern@kernel.org (David Ahern)
Newsgroups: linux.kernel.netdev
Subject: Re: [RFC net-next 0/6] ipv6: validate dsts against the netns route
 generation
Date: Sun, 22 Nov 2026 15:30:29 -0700
Organization: Usenet Network
Message-ID: <a31eccac-79fb-4fcd-81ea-243592f20c58@kernel.org>
References: <20261122222717.126333-1-dsahern@kernel.org>
 <20261122222717.126333-2-dsahern@kernel.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
Injection-Info: usenet.network;
	logging-data="3738451"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:K7a7HmHmRRPYUMca0o+73gEL+ig= sha256:LUYOaGRz2f1G5RCUHiGvjKlMllUK18iNnk9SRWBNqPI=
	sha1:Bq2wtRfK4XWsIg9vUJ/TOv0La5w= sha256:MgXXQArEfwinmpD/aFJJU33m5Iitv87hcWeniKfR1rs=
Content-Language: en-US
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 4AE4E125D88; Mon, 23 Nov 2026 01:30: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 GVIPv4I2DkH5;
	Mon, 23 Nov 2026 01:30:43 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-368862-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 tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114])
	by mail.dewy.ru (Postfix) with ESMTPS id 41272125D83; Mon, 23 Nov 2026 01:30:35 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by tor.lore.kernel.org (Postfix) with ESMTP id A1784243BD; Sun, 22 Nov 2026 22:30:33 +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=1795386631;
	b=PgUgzQD2TO8FRniElG1TDbnBYikTgZ5MyQjBIcdwrEc00+STZiMmNM18G9pDFrEB7hsZ
	 ujRz3wGwwpOF0bn9CQMg1e6tT/rQHN7Xk46HNd5TbdO4GllFQ5k8zTVv6DG4hqQUIde5X
	 CqX/xrpVaHhqW+eTI25TqzpNDZEuESQJ8g+abhMB75vgHvStyWiFCTL6IsPQAcqblsHlu
	 sq2c2iPNaX71Lq8VopOYuFIC/6mHWjkaQ0s2d/+UBGwGXq5caZjlk64g8B2KMir6CztD5
	 x3g3kPrRaqpfx4GoDM8y4FaG8NILz+vNAbnT017a9I9qiswS+9rfZ0y3PmmyW/ZxErg==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795386631;
	h=X-Original-To:Received:Received:DKIM-Signature:Message-ID:Date:
	 X-Mailing-List:List-Id:List-Post:List-Help:List-Subscribe:
	 List-Unsubscribe:List-Owner:Precedence:MIME-Version:User-Agent:
	 Subject:Content-Language:To:Cc:References:From:In-Reply-To:
	 Content-Type:Content-Transfer-Encoding;
	bh=df1EiFED+Ng8Vy98ChQa21Dqutb4xnhJtsqjG2a3KC4=;
	b=mgL1GBgQZc7xDOgZfkJ4tjXdSMuq7xFztrJN3zbWTNZGZuRFH/UhkR1zZjWIuyrJJ8Wg
	 IfV7h2kGwshVAkP65P/XzbfVerzNbubv6dF4+GaPOM3vUUSQx9BrfImrzn3B2kalT9nr3
	 ZVgjBNUNTVkFL8bj40Ouv/j5cgMwMVmJwPB4WMkmvjB50ZO9UX4y/37TT/Tm2d3CLPpEM
	 PDQw8GBEG5g5vvb8FskS7z8tBYTuxiYP8n6DCxoOnfAayglr9pH3i5hg4Eeeg81WJu4dU
	 4OFoCCkbP+jFTknlqCnewvP2v8dGXHxCytgNEBladLIjVBjX1LRwwNzEyfL0FMBXqug==
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=EWQFOm9Z;
	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 9D1A4606A32C;
	Sun, 22 Nov 2026 22:30: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=EWQFOm9Z
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=1795386630;
	b=ei39oxZlbBUDODEPM8P1gyjQkrMKKdwE5sqfMUwARhirLqW9LZhZ4yOEMxEK5BP6GVv9
	 QlYOzOVeP3tXqIdlK45YEjdB2TA0zUZfiVhaVKPy7iZYIki2zj/p6hYfWmfzk5fhmMZh3
	 eaRPf1vgXjIc4ROohM3J5uN0d39YdaBnjdky/nTgfKTDDFt4Mho6upsAu2yLNJogJ/Mea
	 AcqMGStAI2H8juRfTkyGqVwzv0RzE8GT9IsY4OCacMoBNZjKmlXqb+PlGRms+H+1+3tFG
	 /9+pd9jHDWh6W9ItZAAeuNBlZK4jhPnMp0pT5e41TMZYiDo/eekFDN3GKL9u71U8wvQ==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795386630;
	h=Received:DKIM-Signature:Message-ID:Date:MIME-Version:User-Agent:
	 Subject:Content-Language:To:Cc:References:From:In-Reply-To:
	 Content-Type:Content-Transfer-Encoding;
	bh=df1EiFED+Ng8Vy98ChQa21Dqutb4xnhJtsqjG2a3KC4=;
	b=HNJst4k9OrtfeQACgZ9L4u0bVQCz5D9elsp+p7GrXul2EJImq1ZzsjPxMfUk3tVjQ9ma
	 KoYxMDgCfBSbOZhONnm0T/tXMkFi8O03GhztNZAhrpY7sZ6YKGlaxLWyZRY06EC7x045F
	 Kh4SgMg0jWS57fqa2Bw/co6oOK5F0zYfmzgLluxNJ1KWIhgezQAk/EgJgw8E5bB6WstKv
	 sHhYo6YL1JzFSmC+FIpzOq8o+gPMEeNqGH/GsOmxg7Itd/J9FK9W8zqgWcQA7FGunMQxl
	 maMYQ5brFBYWagLYDqp2Ul2P+/4uZOjv5zA9oRxgUD/jfvmNCOoJqBw4eS32r78HCUA==
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=EWQFOm9Z;
	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 B8575606A31D
	for <netdev@vger.kernel.org>; Sun, 22 Nov 2026 22:30:30 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id C38FB1F000C0;
	Sun, 22 Nov 2026 22:30:29 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1795386630;
	bh=df1EiFED+Ng8Vy98ChQa21Dqutb4xnhJtsqjG2a3KC4=;
	h=Date:Subject:To:Cc:References:From:In-Reply-To;
	b=EWQFOm9ZRnocwq9fo7ctTzYOT5zoX+ref3KTCEaKm8DWKcvnDO+wWSUGzVy8MgBbe
	 1LOyLzDIRfV61xR76yYNVlRv+ympRZNnaLmxi1d4w2t8QdUz3uZV6FT7EvdySIpVTC
	 XfjGMeP4dnD0dKltY5Ea9tyelg6Ubibuj2dVH3Y+t06LFrWEcdEJZg0n4wY+QPw3yD
	 4NA7+/26d4P8/zppXdesM4DRQivrq//dy03oS0LMj/AcUATcg5ZOgf5HPdURSp1kdq
	 IjHAoJDEKuWHI+r6Bq+1cDrSk+RzyyBZiUnd8pUvlFQpkIHgQbYd6BW08Td39RDeJ/
	 ffM7RMWX1NSSA==
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-User-Agent: Mozilla Thunderbird
X-Cc: David Ahern <dahern@nvidia.com>, 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>
X-In-Reply-To: <20261122222717.126333-2-dsahern@kernel.org>