Skip to contentSkip to conversation

netfilter: nf_tables: fix bidirectional offload regression

PATCH Applied Gyokhan Kochmarla 2 participants 2 messages Oct 15

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 netfilter: nf_tables: fix bidirectional offload regression

From: Felix Fietkau <[email protected]>

commit 84443741faab9045d53f022a9ac6a6633067a481 upstream.

Commit 8f84780b84d6 ("netfilter: flowtable: allow unidirectional rules") made unidirectional flow offload possible, while completely ignoring (and breaking) bidirectional flow offload for nftables.
Add the missing flag that was left out as an exercise for the reader :)

Cc Vlad Buslov <[email protected]>
Fixes 8f84780b84d6 ("netfilter: flowtable: allow unidirectional rules")

---

8f84780b84d6 came into 5.10.y in 5.10.271 (238c7e7e0808) as a Stable-dep-of d644b23afe1e ("netfilter: flowtable: publish HW_DEAD after worker is done"), but this follow-up fix did not. Since then flow_offload_rule_add(), flow_offload_work_del() and flow_offload_work_stats() only handle the reply direction when NF_FLOW_HW_BIDIRECTIONAL is set, and nft_flow_offload never sets it, so nftables hardware offload only installs the original direction.

 net/netfilter/nft_flow_offload.c | 1 +
 1 file changed, 1 insertion(+)
net/netfilter/nft_flow_offload.c +1 -0
index c2a5d05f501f..98c60e4263f7 100644
@@ -127,6 +127,7 @@ static void nft_flow_offload_eval(const struct nft_expr *expr,
 		ct->proto.tcp.seen[1].flags |= IP_CT_TCP_FLAG_BE_LIBERAL;
 	}
 
+	__set_bit(NF_FLOW_HW_BIDIRECTIONAL, &flow->flags);
 	ret = flow_offload_add(flowtable, flow);
 	if (ret < 0)
 		goto err_flow_add;
Signature · 1 line
2.50.1
maintainer Applied
#1 lore raw
Quoted 4 lines

Commit 8f84780b84d6 ("netfilter: flowtable: allow unidirectional rules") made unidirectional flow offload possible, while completely ignoring (and breaking) bidirectional flow offload for nftables.
Add the missing flag that was left out as an exercise for the reader :)

Queued for 6.6, 6.1, 5.15 and 5.10, thanks.

Signature · 2 lines
Thanks,
Sasha