Re: [PATCH net 2/4] netfilter: flowtable: restore the GRE conntrack timeout on teardown
From: Pablo Neira Ayuso
Date: Sat Nov 21 2026 - 18:10:53 EST
Hi Florian,
On Wed, Nov 18, 2026 at 12:12:48PM -0800, Florian Fainelli wrote:
> flow_offload_add() sets the timeout of the conntrack entry to NF_CT_DAY
> for every offloaded flow, and the GC keeps extending it for GRE too.
> flow_offload_fixup_ct() only restores the conntrack timeout of TCP and
> UDP flows when the flow is torn down, so an offloaded GRE entry which does
> not see any other packet on the slow path stays for up to a day instead
> of expiring after the GRE conntrack timeout.
>
> Restore the GRE timeout, replied or unreplied, as for UDP. GRE has no
> offload timeout of its own, flow_offload_get_timeout() uses the default
> flowtable timeout for it, so use that one when the flow expired.
I think GRE has never worked then. I have been a bit skeptical about
this support, but tc/ct developers wanted to have this in.
I think no crash is going, so let's better route this through
nf-next.git.
> Fixes: 4e8d9584d154 ("netfilter: flowtable: Support GRE")
> Signed-off-by: Florian Fainelli <florian.fainelli@xxxxxxxxxxxx>
> ---
> net/netfilter/nf_flow_table_core.c | 12 ++++++++++++
> 1 file changed, 12 insertions(+)
>
> diff --git a/net/netfilter/nf_flow_table_core.c b/net/netfilter/nf_flow_table_core.c
> index 2aa2647ed9df..051b15aecd89 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]);
> + expired = nf_flow_has_expired(flow);
> + /* GRE has no offload timeout: see flow_offload_get_timeout(). */
> + offload_timeout = NF_FLOW_TIMEOUT;
> +#endif
> } else {
> return;
> }
> --
> 2.53.0
>
>