๐Ÿš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #19060

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

#19060
From: netdev-bot+sashiko
Date: Thu, 19 Nov 2026 09:22
122 lines
12763 bytes
Thank you for your contribution! Sashiko AI review found more severe
issue(s) in other patches of this series. This mail is only an FYI, in case
you want to address the nit picks below when you respin.

Low priority / nit picks for your consideration:

- [Low] ip6_link_failure() (net/ipv6/route.c) used to do one idempotent
  store, WRITE_ONCE(fn->fn_sernum, -1).
- [Low] The patch reuses rt6_exception_net() in ip6_link_failure() for a
  dst that is not an exception (the !RTF_CACHE, RTF_DEFAULT branch).

--

ipv6: stamp the default route node with a fresh serial on link failure

For a non-cached RTF_DEFAULT dst, ip6_link_failure() used to write -1
into fn_sernum. With this patch it takes tb6_lock and calls
fib6_update_sernum() instead. That stamps the node with a fresh serial and
advances net->ipv6.fib6_sernum, so the lookup-cookie checks added later in
the series can tell repeated invalidations apart.

> diff --git a/net/ipv6/route.c b/net/ipv6/route.c
> index 4a4c5ace63c54..cc505817399ba 100644
> --- a/net/ipv6/route.c
> +++ b/net/ipv6/route.c
> @@ -2873,13 +2873,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);

[Severity: Low]
The old code did a single store that gave the same result every time.
The new code takes the table-wide tb6_lock and advances the netns-wide
net->ipv6.fib6_sernum on every call. ip6_link_failure() runs once per
skb, not once per event.

Is that per-skb cost intended on these paths?

For example, neigh_invalidate()->ndisc_error_report() calls
dst_link_failure() for every skb queued on the default router's
arp_queue:

net/ipv6/ndisc.c:ndisc_error_report() {
    ...
	dst_link_failure(skb);
    ...
}

The err_count paths in ip6_tnl_xmit() and ipip6_tunnel_xmit() also reach
this code, at one link failure per received ICMP error. These are 1:1, so
they don't amplify anything. The sit path can't be reached for ISATAP,
because ipip6_err() returns before incrementing err_count when
parms->iph.daddr == 0.

Each bump goes through fib6_new_sernum():

	} while (!atomic_try_cmpxchg(&net->ipv6.fib6_sernum, &old, new));

Nexthop-object pcpu dsts are seeded from that generation in
ip6_rt_pcpu_alloc() and checked against it:

net/ipv6/route.c:rt6_is_valid() {
	return rt6->sernum == rt_genid_ipv6(dev_net(rt6->dst.dev));
}

So each call drops and reallocates every nexthop-object pcpu dst in the
netns. ip6_dst_check() also rejects every socket-cached one, which forces
a re-lookup.

The commit message says:

    Advancing the namespace generation also invalidates unrelated dsts using
    nexthop objects, which are validated against that generation.

and the v3 changelog calls this harmless. Could the commit message say
that this happens once per skb? That includes bursts when the neighbor
entry for a default router fails.

For reference, rt6_insert_exception() already does the same tb6_lock plus
fib6_update_sernum() once per event. Per-event invalidation is also part
of the fix itself: coalescing would let dsts cached between two failures
survive. The later patches in the series don't change ip6_link_failure(),
and "ipv6: add ip6_dst_lookup_flow_cookie" relies on this generation
bump.

[Severity: Low]
This isn't a bug, but rt6_exception_net() is now used for a dst that is
not an exception (the !RTF_CACHE, RTF_DEFAULT branch). Here it picks the
netns whose fib6_sernum gets advanced. Its name and comment still only
describe exception accounting:

/* 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.
 */
static struct net *rt6_exception_net(const struct rt6_info *rt)

The netns it returns looks correct here, and dev_net(rt->dst.dev) would
be wrong after dst_dev_put(). Other readers of the same counter, such as
rt6_is_valid() and ip6_rt_pcpu_alloc(), use dev_net(), so it isn't
obvious why this one is different.

Would it make sense to update the comment, or rename the helper, so that
it covers this use?

[ ... ]

-- 
Sashiko AI review ยท https://netdev-ai.bots.linux.dev/sashiko/#/patchset/cover.1794906743.git.ralf%40mandelbit.com
Technical Details
Message-ID: <179508017302.3136.6673661223156092826@kernel.org>
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!news-wdc.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-366882-linux-kernel-netdev=dewy.ru
References: <5b59512a6c51c7a5d7c7b4e16728de3c522d9a1e.1794906743.git.ralf@mandelbit.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!news-wdc.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-366882-linux-kernel-netdev=dewy.ru
From: netdev-bot+sashiko@kernel.org
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net-next v3 1/3] ipv6: stamp the default route node with a
 fresh serial on link failure
Date: Thu, 19 Nov 2026 09:22:53 +0000
Organization: Usenet Network
Message-ID: <179508017302.3136.6673661223156092826@kernel.org>
References: <5b59512a6c51c7a5d7c7b4e16728de3c522d9a1e.1794906743.git.ralf@mandelbit.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="2837624"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:Iio9FDY7OfpjhqaZ1uyBo++1zJ4= sha256:nKRmQf3RwrjB7Sh1I1tt0WhvDtoY1CRue6XdwJVysUg=
	sha1:WH5S8pzHAYBfxXq1mgOosxWkigM= sha256:KKytL2PFAnPJduILwR50g6Cgq2KI84nLWIM7tDC7Jqc=
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 2D2BE115582; Thu, 19 Nov 2026 12:23:14 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.5
X-Spam-Status: No, score=-3.5 tagged_above=-9999 required=6.31
	tests=[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,
	URIBL_BLOCKED=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 paJvHyM4ZyG8;
	Thu, 19 Nov 2026 12:23:05 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.232.135.74; helo=sto.lore.kernel.org; envelope-from=netdev+bounces-366882-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 sto.lore.kernel.org (sto.lore.kernel.org [172.232.135.74])
	by mail.dewy.ru (Postfix) with ESMTPS id A70CF11557A; Thu, 19 Nov 2026 12:22:57 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sto.lore.kernel.org (Postfix) with ESMTP id 1683B61EFD6; Thu, 19 Nov 2026 09:22:57 +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=1795080175;
	b=TFTMFveKplAHcjfLbyIBcACvRKkeaDm9OWKLsHjkYTfyWbH4c+0AbY15xy6bY33FEZfW
	 nLYdKuclxa8869x2FmWm9I7cXuFw+5on/16ToiwEAg6TMpwf1Qgf9+W6HoNg6CSgtFlHj
	 /dfsPsdcev1sFZ7Td8a1LQiOsw/vZsrJTmsjvMNyl7ZAZorHcc8GwvMHW5z11x+fJ/i/n
	 vdwP+dmYNsa+fBdgBvTe3e6irAIa5nAEqiazzIHIiSuIkQnZ3sltMjpxtwUuPjbJz5cPL
	 ZvsywkvEsSWLTG5XGogY25epRqBQ1SXqRXkEHgupHyEZjxeKtqUmWPYwbhxJ36WGxjQ==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795080175;
	h=X-Original-To:Received:Received:DKIM-Signature:Subject:From:To:Cc:
	 Date:Message-ID:In-Reply-To:References:X-sashiko-severity:
	 Content-Type:Content-Transfer-Encoding:X-Mailing-List:List-Id:
	 List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner:
	 Precedence:MIME-Version;
	bh=kzTbXStisJTpwvkLD7D1wA2Fot0EqQtg6G0ERSDfDCo=;
	b=1UnonLvd5QgJLfms+YnmtO4/4d7knxT0vHq57s0lfkN47dv7rdSgeixwyQpQtYUk/vb0
	 O4afPLFRp7n3GMpV3++08cEH54PLnJyRUNfzNAbEi1U3B+OkmQP4BEtJxy0Bj/ha9Ll7n
	 LwPVq1ZH4Hluy2R7Qgy7/QFgBET2w8AbnAu9VuDP+WotLINgA/yeWqRIMHwtV4sKebKWS
	 x5tfKzJ166XEIoKol3dCXym8XYWsI+9CWaH7/9aJ18SeuyqUp4WNFqCGJGe18fY00PfA5
	 +v9iN5LZcxC34fhXQwupqPKycwbGjK/c3WsZHviG6AvqaBgy6dmpC4ToR0l5bBgwD0w==
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=QXqaXkXQ;
	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 93306606A334;
	Thu, 19 Nov 2026 09:22:55 +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=QXqaXkXQ
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=1795080174;
	b=x/d6UIVzOh7KpnH9rZsbNGHYBPq6uqwhpmpghHot3SXYBKG9lBMp3CK4ZNZL30u/KJrj
	 dRr06X3mRtHHDDkPw3DOGDSrVVuBdMV91PgSQFg1sHJtdY/ggtJx92dqaVhvzCFoLxFpY
	 vGlu7Fh5z8tFP2k7sc2LS55W2nLRIvsz3B9Txn2ydJz80OI5zPxztCdE2stO7I0VnO8ba
	 swi1GFLbvgb+Jl7O6VArrsHrwAOahSYewqaB8WKn31ZE1nVKq1fbpe0f9zYS1Gml6t9EI
	 D7J3Ppjwop4wiatrtJRLO3O5iTUNIfHxOFTdt/7KPHzpS8nj1kundRFiAb9PSTA/J6Q==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795080174;
	h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID:
	 In-Reply-To:References:X-sashiko-severity:Content-Type:
	 Content-Transfer-Encoding:MIME-Version;
	bh=kzTbXStisJTpwvkLD7D1wA2Fot0EqQtg6G0ERSDfDCo=;
	b=IleecB4l4CaL08TCfMX16BSj9MrzCn7yZbSSHIsnUld6OLpae3gVCbLgaxsMxsJTpn2/
	 AmqoyJ8fNZZvEzFNCl1yh2EYNc2FdLqXTM7Q9+JE/dUYbjy/Pn0Wz84khpsvyWFXjbLsY
	 Zst7iUxXuCxXpfjsCePVbzNc5oZUnfYzs7lYmzhA1zFOa5fcagOROX6cHi0RLUVHeP3UP
	 +IIWizrt1droGfG4dB1JWyyQYRBr57tYpsCe6RR/0KYS41mDUDRnMpSWLDevy5q0UIKuG
	 dZxjjjK1AfPP0oJG5tR2kle3FXu0XKLGNz9JwNhkM18eHV45Suf/JZdsb8a6DttNtyA==
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=QXqaXkXQ;
	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 B1167606A320;
	Thu, 19 Nov 2026 09:22:54 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7211D1F000C4;
	Thu, 19 Nov 2026 09:22:53 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1795080174;
	bh=kzTbXStisJTpwvkLD7D1wA2Fot0EqQtg6G0ERSDfDCo=;
	h=Subject:From:To:Cc:Date:In-Reply-To:References;
	b=QXqaXkXQPXl7Kk3MSyfTRPZhH03G20sdcA5zC5JeO2TGjpB3UZ8ftYutCUfeycJg+
	 CN3RR37P7K9LvcTlDBCAQgkpVKCk+pxOUp2pmoNMptf/mbqMGbJ+W6uNCnGMcVtxWb
	 f9pA5/yn5BBq3JAEabrqbfH4V6AIO7/DQQlt9emt5MkwXhi4lH4UXvXMUppi033Bv5
	 mLbBlaEbDPZQWY+89LcKubTC1GUrXLbT4LE/aU5+NHnnedgWWCPdtUBHqs8VE+P+qK
	 bsAVJ6kenqiMHJKmSeqnAmWBZXy46EMafKXnxxCcyLV2rMYuvSnD2Vv94gTta5ltw2
	 ASrvP+zsl34wA==
X-Cc: netdev@vger.kernel.org, dsahern@kernel.org, idosch@nvidia.com,
 davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com,
 horms@kernel.org, ncardwell@google.com, kuniyu@google.com,
 steffen.klassert@secunet.com, herbert@gondor.apana.org.au, fw@strlen.de,
 sd@queasysnail.net, antonio@mandelbit.com, linux-kernel@vger.kernel.org
X-In-Reply-To: <5b59512a6c51c7a5d7c7b4e16728de3c522d9a1e.1794906743.git.ralf@mandelbit.com>
X-sashiko-severity: Low
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