Article View: linux.kernel.netdev
Article #20526Re: [PATCH net 2/4] netfilter: flowtable: restore the GRE conntrack timeout on teardown
From: netdev-bot+sashiko
Date: Sun, 22 Nov 2026 21:17
Date: Sun, 22 Nov 2026 21:17
96 lines
11687 bytes
11687 bytes
Thank you for your contribution! Sashiko AI review found 1 potential
issue(s) to consider.
Critical: 0 ยท High: 0 ยท Medium: 1 ยท Low: 0
If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).
- [Medium] The patch adds a GRE branch to flow_offload_fixup_ct()
(net/netfilter/nf_flow_table_core.c).
--
netfilter: flowtable: restore the GRE conntrack timeout on teardown
This commit adds a GRE branch to flow_offload_fixup_ct(). When a GRE flow
is torn down, its conntrack timeout is restored to the GRE replied or
unreplied timeout. Without this, the entry keeps the NF_CT_DAY timeout it
got at offload time. GRE has no offload timeout of its own, so
NF_FLOW_TIMEOUT is subtracted when the flow has expired.
> diff --git a/net/netfilter/nf_flow_table_core.c b/net/netfilter/nf_flow_table_core.c
> index 2aa2647ed9df0..051b15aecd893 100644
> --- a/net/netfilter/nf_flow_table_core.c
> +++ b/net/netfilter/nf_flow_table_core.c
> @@ -237,6 +237,18 @@ static void flow_offload_fixup_ct(struct flow_offload *flow)
> timeout = READ_ONCE(tn->timeouts[state]);
> expired = nf_flow_has_expired(flow);
> offload_timeout = READ_ONCE(tn->offload_timeout);
> +#ifdef CONFIG_NF_CT_PROTO_GRE
> + } else if (l4num == IPPROTO_GRE) {
> + const struct nf_gre_net *tn = nf_gre_pernet(net);
> + enum gre_conntrack state =
> + test_bit(IPS_SEEN_REPLY_BIT, &ct->status) ?
> + GRE_CT_REPLIED : GRE_CT_UNREPLIED;
> +
> + timeout = READ_ONCE(tn->timeouts[state]);
[Severity: Medium]
Should this read the per-conntrack GRE timeouts instead of the per-netns
defaults?
The GRE tracker does not refresh entries with the pernet values directly.
In nf_conntrack_gre_packet(), the per-ct fields are set from an attached
timeout policy when one exists. The pernet defaults are only the fallback:
net/netfilter/nf_conntrack_proto_gre.c:nf_conntrack_gre_packet() {
...
if (!nf_ct_is_confirmed(ct)) {
unsigned int *timeouts = nf_ct_timeout_lookup(ct);
if (!timeouts)
timeouts = gre_get_timeouts(nf_ct_net(ct));
...
ct->proto.gre.stream_timeout = timeouts[GRE_CT_REPLIED];
ct->proto.gre.timeout = timeouts[GRE_CT_UNREPLIED];
}
...
}
Every later refresh then uses ct->proto.gre.stream_timeout or
ct->proto.gre.timeout.
GRE registers .ctnl_timeout, so an nft ct timeout object or an
nfnetlink_cttimeout policy can be attached. nft_flow_offload_eval()
rejects GRE flows that are NATed, keyed, or have a helper. It does not
reject flows that have a timeout policy.
As an example, take a policy that sets the GRE replied timeout to 2h. An
offloaded GRE v0 flow goes idle, and the GC tears it down with expired
set to true. This branch then computes the default 180s minus
NF_FLOW_TIMEOUT, which is 150s. Since nf_flow_timeout_delta(ct->timeout)
is larger than that, nf_ct_refresh() makes the entry expire in about 2.5
minutes instead of 2h.
The reverse also happens: with a policy shorter than the sysctl value, the
longer default replaces it.
Would reading ct->proto.gre.stream_timeout and ct->proto.gre.timeout here
match what the GRE tracker actually uses? The UDP branch above has the
same pattern, but that code predates this patch.
> + expired = nf_flow_has_expired(flow);
> + /* GRE has no offload timeout: see flow_offload_get_timeout(). */
> + offload_timeout = NF_FLOW_TIMEOUT;
> +#endif
> } else {
> return;
> }
--
Sashiko AI review ยท https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261118201250.2075007-1-florian.fainelli%40broadcom.com
Technical Details
Message-ID:
<179538224582.3135.4873472373234094009@kernel.org>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-368825-linux-kernel-netdev=dewy.ruReferences:
<20261118201250.2075007-3-florian.fainelli@broadcom.com>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-368825-linux-kernel-netdev=dewy.ru From: netdev-bot+sashiko@kernel.org Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net 2/4] netfilter: flowtable: restore the GRE conntrack timeout on teardown Date: Sun, 22 Nov 2026 21:17:25 +0000 Organization: Usenet Network Message-ID: <179538224582.3135.4873472373234094009@kernel.org> References: <20261118201250.2075007-3-florian.fainelli@broadcom.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="3724897"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:bIjsn47ixrDmhfKhm+Z7IToCE2Q= sha256:LxfR/hqVHhkkg1vWIXs/HehwdserOS8BR9S1Fgz+Zjk= sha1:lG5TwD6cNHyBlbGnk0fegT0Tmtc= sha256:5PFkv2YiR6cs41VFSEIQ44q6aQEdpx9SszCx2lokSqY= 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 B58B7125D88; Mon, 23 Nov 2026 00:17:47 +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 e799cQ2XkkKn; Mon, 23 Nov 2026 00:17: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-368825-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 sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10]) by mail.dewy.ru (Postfix) with ESMTPS id 43C55125D83; Mon, 23 Nov 2026 00:17: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 317F32DBD3; Sun, 22 Nov 2026 21:17:29 +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=1795382248; b=iszZeDmR0dqrbwA/EkSh6T2NkaKYiRZRLCT+PJadnbsXpLQYQN7KRwi0FjhiKuQFnLg8 YEcxA8zERVH3qvB3BgRkTTY24hx8mY5tsZxmVifDZ6iEpXWITNmmfRMo9/Ug59bkiKZWe EXLvqsrd3RHAphWUNgVwNW3aXYT1rPG0YOcaa/GG+BZxDT2b9/jwp+eVhIATiL8TkQEfS Aut/SiAWol2ouMZLbpS1T2KyFzsB3PHyHJtK3R8S1e5Q79LBYUyaBwBrcg75EXd9i+Q80 +Pyn4Q/2x527C+6adBRH2AHNi7M8XfKmzzTBaBzZzuDJ9Gd3NGDCNyUa9IpDkmC3n1w== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795382248; 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=VEH5Z1+w3LaZYxRFfj703Jy4TbGcg5XJ26mZdw8z3OI=; b=D9cvaPG3WCUCzHdHg8Crqp25j6erixTZaV5EB+tq8FaHlUS4pub3nRfChp5QFzMNTaei QtQTTqvnNvG/aMJR765LpSfQ5i/NagxXwNbhzHoNjHNPJ43IlZgcIUrSAz42JHMEfOoA6 3ExN2PLUbT/N1gkpSDVlJA/RKflbaUK3Mhg3vs6Py7pMKyyzSrWx5PyF+x6Nms0SGYHHJ cTzAIRZgT3XYmi96af2O2AzSxTl+g8yms102lrhfJpdYVJv/iw3DO75XYEPZH0Jvw4kuw 9tfALi8BHSySfJzKFZegAoP3Pbc7mb2DnjJm3zXljryJXfbicRpZBPr7HQanICF52FQ== 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=Wlz1CzPd; 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 5D52E606A33A; Sun, 22 Nov 2026 21:17:28 +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=Wlz1CzPd 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=1795382247; b=p7B4jHPhgh3jd1dmlggVi6Pdk0Aim4MrxbDoZ/BQSBK0fEpXhNMMFGGqzI7XzZefoH+Q 6Jl2pdPLb/r8hhYnL4re5WoRFfHODL/imOI5bmlNPmLu9+f5Sb7ZE6gb0LqXD/u9R518B 94d08Se4VXumCuglo8GTf6NKQMi4GmQryeadLA++JomXpdLOuKEZgyRCz/QlJ8ypSXa// C2L3lehKmsnCHk2bW3Z2uLBeAxBGhomWU5dmxCFQLLy1mYv9WqgsWDxJrkqPxFUqEa9NN Ue7pH+TMXxDoHW6NrfryRHNCwjClEYVATWHGrSDr0o726M/OdKthv0EiP9oGAa07T3w== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795382247; 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=VEH5Z1+w3LaZYxRFfj703Jy4TbGcg5XJ26mZdw8z3OI=; b=Gv4ZqWMxlht2p7FjmgHJo/1daidgr3iwTaR4abZOoJ1h/DKkk279EYqMY0ibdwbb1PJo sjPfIefeW+ChDBZBsW9SgNFQUVduxBKyH5nB83sudpNE0p9cz/gNQNyf2YT/i3nenOfBB Xut23Ij0p6vDSmP32ZSVhWwUrlB0uPXmPM4GwEpXCql1BsSs1GVUUYQS14YPrwuEQcCtu Mexzd4SsRZPhzBSqgT5apDO9mJGPrydUo1N/zM2XkdDnHREgM3RQkPcIylmKdouIGiXMa gCciaqy8eIGXAnYCgwC1zC+jei+L2VrRz/3EUlN9zAoA2A4GeDU2nB+ZrRe3+CghAbw== 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=Wlz1CzPd; 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 7EF08606A33C; Sun, 22 Nov 2026 21:17:27 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 457031F000D3; Sun, 22 Nov 2026 21:17:26 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1795382247; bh=VEH5Z1+w3LaZYxRFfj703Jy4TbGcg5XJ26mZdw8z3OI=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=Wlz1CzPdrOU749KaM+PJC+HqR0Y+mhjW99jS9BMg6ZQBdQ14QnKMjHKyt3BGkHkau A9tlIMBfE50CoIwE1eCsq+96XiUn3BSCrcqZv8ZYgZfkfyJFX4fjY99fhFBGOktnGR ZijA1+e/3uAjHquZWN+zf9QT9SfKTXlYLU0LY2ke+iAtq+nzaQbTgWB8z/584jC6qc tFbKOlsvVTXRXLutSIWK579VysHrvZ4y1w86T1/JdIY881YmoR32kE6Lq+K5h6Expg lXwtNPI/BQHbV9yKixycfyKm3IayW3KrjS8ZaT6NrOZvJ0FYFznQFY+zxoG42OWuVg f/kyNTkUqEm5Q== X-Cc: netdev@vger.kernel.org, pablo@netfilter.org, fw@strlen.de, phil@nwl.cc, davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com, horms@kernel.org, shuah@kernel.org, toshiaki.makita1@gmail.com, linux-kernel@vger.kernel.org, netfilter-devel@vger.kernel.org, coreteam@netfilter.org, linux-kselftest@vger.kernel.org X-In-Reply-To: <20261118201250.2075007-3-florian.fainelli@broadcom.com> X-sashiko-severity: Medium 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