Skip to contentSkip to conversation

netfilter: nf_tables: fix bidirectional offload regression

PATCH Applied Felix Fietkau 3 participants 3 messages Feb 14, 2024 – Feb 15, 2024

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

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

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")
---
 net/netfilter/nft_flow_offload.c | 1 +
 1 file changed, 1 insertion(+)
net/netfilter/nft_flow_offload.c +1 -0
index 397351fa4d5f..ab9576098701 100644
@@ -361,6 +361,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.43.0
#1 lore raw
Quoted 4 lines · Felix Fietkau

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 :)

Thanks for fixing up this, patch is fine.

Quoted 24 lines
Cc Vlad Buslov <[email protected]>
Fixes 8f84780b84d6 ("netfilter: flowtable: allow unidirectional rules")
---
 net/netfilter/nft_flow_offload.c | 1 +
 1 file changed, 1 insertion(+)
net/netfilter/nft_flow_offload.c +1 -0
index 397351fa4d5f..ab9576098701 100644
@@ -361,6 +361,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.43.0
#2 lore raw
In reply to Felix Fietkau
This patch was applied to netdev/net.git (main) by Pablo Neira Ayuso <[email protected]>:

Hello:

This patch was applied to netdev/net.git (main)
by Pablo Neira Ayuso <[email protected]>:

Quoted 11 lines · On Wed, 14 Feb 2024 15:42:35 +0100 you wrote:

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")

[...]

Here is the summary with links:
- [net] netfilter: nf_tables: fix bidirectional offload regression

    https://git.kernel.org/netdev/net/c/84443741faab

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html