Skip to contentSkip to conversation

netfilter: nf_conntrack_expect: run expectation eviction with no helper

PATCH New Pablo Neira Ayuso 1 participant 1 message Jun 22

Subsystems (2)
lore
Share & tools
lore

Pablo Neira Ayuso

author maintainer
#0 lore raw

PATCH 1/1 netfilter: nf_conntrack_expect: run expectation eviction with no helper

Run expectation eviction if no helper is specified to deal with the nft_ct expectation support.

Cap the maximum expectation limit per master conntrack to NF_CT_EXPECT_MAX_CNT (255).

Fixes 857b46027d6f ("netfilter: nft_ct: add ct expectations support")
---
 net/netfilter/nf_conntrack_expect.c | 7 +++++++
 1 file changed, 7 insertions(+)
net/netfilter/nf_conntrack_expect.c +7 -0
index 9454913e1b33..113bb1cb1683 100644
@@ -499,6 +499,13 @@ static inline int __nf_ct_expect_check(struct nf_conntrack_expect *expect,
 		if (p->max_expected &&
 		    master_help->expecting[expect->class] >= p->max_expected)
 			evict_oldest_expect(master_help, expect, p);
+	} else {
+		const struct nf_conntrack_expect_policy default_exp_policy = {
+			.max_expected = NF_CT_EXPECT_MAX_CNT,
+		};
+
+		if (master_help->expecting[expect->class] >= default_exp_policy.max_expected)
+			evict_oldest_expect(master_help, expect, &default_exp_policy);
 	}
 
 	cnet = nf_ct_pernet(net);
Signature · 1 line
2.47.3