Article View: linux.kernel.netdev
Article #5514Re: [PATCH net 1/1] ovpn: avoid caching stale IPv6 dst after FIB changes
From: Ralf Lici
Date: Tue, 20 Oct 2026 13:27
Date: Tue, 20 Oct 2026 13:27
63 lines
11832 bytes
11832 bytes
Hi David,
On Tue, 13 Oct 2026 07:52:29 -0600, David Ahern <dsahern@kernel.org> wrote:
> On 10/8/26 6:33 PM, Antonio Quartulli wrote:
> > You're right that a cached dst can go stale later and that reuse-time
> > validation handles that. This case is different, because it breaks
> > reuse-time validation.
> >
> > dst_cache_set_ip6() samples the cookie itself:
> >
> > dst_cache_per_cpu_dst_set(idst, dst,
> > rt6_get_cookie(dst_rt6_info(dst)));
> >
> > rt6_get_cookie() only returns a route-tied value when rt->sernum is
> > non-zero, which happens in ip6_rt_pcpu_alloc() and only for nexthop
> > routes. Everything else reads the current node generation:
> >
> > *cookie = READ_ONCE(fn->fn_sernum);
>
> Have you tried setting sernum for all dst_entry when they are created?
>
We have considered that, but the existing field cannot simply be
populated for every dst. A nonzero rt6_info->sernum currently selects
global validation: ip6_dst_check and rt6_get_pcpu_route compare it with
rt_genid_ipv6. It is populated only for external nexthop objects, while
ordinary routes leave it zero and validate through their
fib6_node->fn_sernum, as commit 8f34e53b60b3 ("ipv6: Use global sernum
for dst validation with nexthop objects") explains.
If by setting it for every dst you mean assigning the global
rt_genid_ipv6 value, that would fix the race, but it would turn ordinary
IPv6 dst validation from per-node invalidation into namespace-wide
invalidation, similarly to IPv4.
> This deferred reading of fn_sernum seems to be the problem. fib entries
> have sernum set. dst_entries are created from the fib entries and should
> carry the sernum from the fib entry at that moment.
>
Yes, that is precisely the core issue. The candidate node's fn_sernum
must be sampled as part of route selection and preserved together with
the selected dst, rather than recovered from the dst's fib6_node later.
So there seems to be two possible solutions:
1. add a separate lookup-time cookie to rt6_info, while retaining the
existing sernum as the external nexthop / global validation marker;
2. have cache-producing lookup APIs return the explicit (dst, cookie)
pair proposed in the RFC.
The former keeps existing cache users unchanged, but the stored cookie
would have to remain immutable, and reusable per-CPU or exception dsts
would need to be replaced when their node serial changes. The latter
keeps provenance per lookup but requires propagating the pair through
cache-producing callers. What would you prefer?
Thanks!
--
Ralf Lici
Mandelbit Srl
Technical Details
Message-ID:
<20261020132817.468329-1-ralf@mandelbit.com>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-349313-linux-kernel-netdev=dewy.ruReferences:
<76f16ff2-3102-44e9-b4e0-5818044bbc75@kernel.org>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-349313-linux-kernel-netdev=dewy.ru From: ralf@mandelbit.com (Ralf Lici) Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net 1/1] ovpn: avoid caching stale IPv6 dst after FIB changes Date: Tue, 20 Oct 2026 15:27:51 +0200 Organization: Usenet Network Message-ID: <20261020132817.468329-1-ralf@mandelbit.com> References: <76f16ff2-3102-44e9-b4e0-5818044bbc75@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="3861412"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:VHd+To5O+UTeywqmKOGjS6jQBrc= sha256:yoFVAvEVNfWDeHffQeiizCy0/K8r/ApL0+gmy3Gg5aw= sha1:py+eACtOj3GDINQR7JQrJZ/iyKw= sha256:Bwp0U/pdwN/7xDnSXe/N/CrankFvdLaVLzjc7Wi67ME= 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 494BF110D0C; Tue, 20 Oct 2026 16:34:37 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.149 X-Spam-Status: No, score=-3.149 tagged_above=-9999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.25, 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 HlaahUcJ5MHN; Tue, 20 Oct 2026 16:34:34 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.232.135.74; helo=sto.lore.kernel.org; envelope-from=netdev+bounces-349313-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 sto.lore.kernel.org (sto.lore.kernel.org [172.232.135.74]) by mail.dewy.ru (Postfix) with ESMTPS id 3DD40110D08; Tue, 20 Oct 2026 16:34:25 +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 83212613DFF; Tue, 20 Oct 2026 13:28:36 +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=1792502912; b=yKQ4qsj8ZDuXhu12F+6QfMQtftjFz6ZgF6UQ47RLCILd0PhW4CyhTwf5dwgilFTJrb2a BzfRXF1Wm6uBzWsOlxWctsoR/KIwdlMO/CQVoOarHlAHk0qrX5MiRQnpYawAbbIdDlEHv uOPy8hqccHIi+dWAQX6BGsZExTfezHx3Nu2H9b+3e2KQfVVJ1kXL28AKa5mrvhPVOPn0Z cPV4LjB5m0sNenRLYZ18Xk++LWdVOrXB6b4bJ0IncfJEvvOYfgXkrzp+beJGn6x7JzF4u Q3+nPVEmks8hAkrgOn3iAanNigd9JXcOdAH557QsytsqAC+m2z7QLEelwmAuwJa/FQQ== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1792502912; h=X-Original-To:Received:DMARC-Filter: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-Type: Content-Transfer-Encoding:X-Rspamd-Queue-Id; bh=yD4NZqQkZcgC/qMOJAMjYqm5tfju7uAvh2VL+0fWkls=; b=iKL7WdN9bNPYKq0V8k5fPKqY7m6r2tGgC88gXGR+zxGnMXqTgukD/9b8khace4cy/rTi zVngLoY/QSllPyr96VA91VaATAag2p16LEnMFs9wM3SPQqSEPnlO7hhtTO46ZWNyChCMw It5BhRU7RkLiZA2U6uWVuKdCbvgbMeq3MMmRJQmu0bfxbEFOLYZc5SxHCqYl3r3sjADjz g+ezciefoY+M3rQ26pIic9BRm0Xj//Jw4eB7xPZ0guyrfZ1Z8Ejz7MjRV8PZgDNwHcXqx GV4mpxxJoAl1nbVqzFKk9KWOBs3HeXhEmMC07lYvFP4F8tMikDpWR9czxwU/8kx/YUw== 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=JAT7ObAu; 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 BBD53606A323; Tue, 20 Oct 2026 13:28:32 +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=JAT7ObAu X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=195.10.208.40 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1792502911; b=Z3oHYHyYQbHOaYqmeNBBLkqhdKsyfVGQx3u6hRC1P9EfHOgutEDRQhDoxhcfsKF1GPht wPApUniOlgJFUsn6AtEONi32nSg90v1z2Cy6GRronrX3QxY2bx8lB+F0gTlovxFgzueuV ZJhH6p+0gn2Cm3vnZGSVEFiuolfZ9AcXIytOGox6azmcGMECbaXRqlghvWyLcttbBJF5V t4LZVXaEYP9HOiVudZksFSH7b7sTnFvDvRbx0QwyCqeMlnBS1whUzYtFDrjj16Kpc/bZM 5Vf4I0egSRWfkrwgPCh7HyP2vgEtMJufVjB31UJtMhiNaJgiVIw57jFkJNOFdZHZE8A== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1792502911; h=DMARC-Filter:Received:DKIM-Signature:From:To:Cc:Subject:Date: Message-ID:X-Mailer:In-Reply-To:References:MIME-Version:Content-Type: Content-Transfer-Encoding:X-Rspamd-Queue-Id; bh=yD4NZqQkZcgC/qMOJAMjYqm5tfju7uAvh2VL+0fWkls=; b=cKxwyPTi05jL4dV3Ets5Bn9D8zwKLjMzMSMKBKLShL5m5k7QEbzSIwxHmFFdsOrlQ5ES f+9Lb3mheC3EyjFOg5eU0ckTC5Jz6iUbVnwDCIYKXdh5bmlMtrTl5VmBI/K/CU3GltD9x u3TSMZ3bBlGZBEnQyQ/5CXpaIdgmSsAjCD96YvIu9ztJ1ol4uZLvspMw6601dNt9bZy+s TnsDOyOV46GPwuUR0+7Z6+XjiwHTWJix9Fg+HfPhE8gux67dISAvlAxB4xqtAekO2B66f Uycr7EG7SKQPf621r7UhLICA9pj7ezFM8Y5VrTTRph6e8QSSlbsIyUVggDyIsSAhUfA== 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=JAT7ObAu; arc=none smtp.remote-ip=195.10.208.40 X-Received: from mout-b-210.mailbox.org (mout-b-210.mailbox.org [195.10.208.40]) (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 CBA88606A336 for <netdev@vger.kernel.org>; Tue, 20 Oct 2026 13:28:29 +0000 (UTC) X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org CBA88606A336 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 smtp1.mailbox.org (smtp1.mailbox.org [IPv6:2001:67c:2050:b231:465::1]) (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-210.mailbox.org (Postfix) with ESMTPS id 4j8Csc4W49zFqsZ; Tue, 20 Oct 2026 15:28:20 +0200 (CEST) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mandelbit.com; s=MBO0001; t=1792502900; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=yD4NZqQkZcgC/qMOJAMjYqm5tfju7uAvh2VL+0fWkls=; b=JAT7ObAuUyVUwa3K2SINWVbPN611hvT+mZ/n3RNOipzn8xkG4RB59xwVKqP9slDHKRTYod Tx7JQeJs2aZCycG7oSVz6htY4RmkBvYS879MSNbSwhZ9m+7CiEXC3XtE7ytuLn/2mHgrzo S1PLG/aW7nJGkdWX1jxwYqSFJRvT+5uA0JLhLw/cWiaBRv/qsZKDInfbC/KfN1go/PlVqp C4ss924jy4d1OoswsdJyXQ6OorMmYSSLIzvvWHcoZjmXYSfz6yVL1j2NbSmCEya+HGeske adS70A+tXqAGJd5Br7pBfZflFwNgIiSXrGTO4gh8WqeUxZ8kbVLjcyqSfaQt/Q== X-Authentication-Results: outgoing_mbo_mout; dkim=none; spf=pass (outgoing_mbo_mout: domain of ralf@mandelbit.com designates 2001:67c:2050:b231:465::1 as permitted sender) smtp.mailfrom=ralf@mandelbit.com X-Cc: Antonio Quartulli <antonio@openvpn.net>, netdev@vger.kernel.org, Sabrina Dubroca <sd@queasysnail.net>, Andrew Lunn <andrew+netdev@lunn.ch>, "David S. Miller" <davem@davemloft.net>, Eric Dumazet <edumazet@google.com>, Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>, Simon Horman <horms@kernel.org>, Ido Schimmel <idosch@nvidia.com> X-Mailer: git-send-email 2.55.0 X-In-Reply-To: <76f16ff2-3102-44e9-b4e0-5818044bbc75@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 X-Rspamd-Queue-Id: 4j8Csc4W49zFqsZ