Skip to contentSkip to conversation

netfilter: nf_tables: fix ct untracked match breakage

PATCH Applied Florian Westphal 2 participants 2 messages May 3, 2023

Subsystems (2)
lore
Share & tools
lore

Florian Westphal

author maintainer
#0 lore raw

PATCH 1/1 netfilter: nf_tables: fix ct untracked match breakage

"ct untracked" no longer works properly due to erroneous NFT_BREAK. We have to check ctinfo enum first.

Fixes d9e789147605 ("netfilter: nf_tables: avoid retpoline overhead for some ct expression calls")
---
 net/netfilter/nft_ct_fast.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)
net/netfilter/nft_ct_fast.c +10 -4
index 89983b0613fa..e684c8a91848 100644
@@ -15,10 +15,6 @@ void nft_ct_get_fast_eval(const struct nft_expr *expr,
 	unsigned int state;
 
 	ct = nf_ct_get(pkt->skb, &ctinfo);
-	if (!ct) {
-		regs->verdict.code = NFT_BREAK;
-		return;
-	}
 
 	switch (priv->key) {
 	case NFT_CT_STATE:
@@ -30,6 +26,16 @@ void nft_ct_get_fast_eval(const struct nft_expr *expr,
 			state = NF_CT_STATE_INVALID_BIT;
 		*dest = state;
 		return;
+	default:
+		break;
+	}
+
+	if (!ct) {
+		regs->verdict.code = NFT_BREAK;
+		return;
+	}
+
+	switch (priv->key) {
 	case NFT_CT_DIRECTION:
 		nft_reg_store8(dest, CTINFO2DIR(ctinfo));
 		return;
Signature · 1 line
2.40.1
maintainer Applied
#1 lore raw
Quoted 2 lines · Florian Westphal

"ct untracked" no longer works properly due to erroneous NFT_BREAK. We have to check ctinfo enum first.

Applied, thanks