diff options
author | Pablo Neira Ayuso <pablo@netfilter.org> | 2024-01-10 18:18:50 +0100 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2024-01-12 12:19:55 +0100 |
commit | 6bc6673fc88c8a3e3dd5504b2d24a6d6bc2f8427 (patch) | |
tree | ae628cf77d2c0f87b220f44b72f5a311eb5c83ff /src/evaluate.c | |
parent | 4121175cc243a15bdb8c226a335f67cedd98680e (diff) |
evaluate: skip anonymous set optimization for concatenations
Concatenation is only supported with sets. Moreover, stripping of the
set leads to broken ruleset listing, therefore, skip this optimization
for the concatenations.
Fixes: fa17b17ea74a ("evaluate: revisit anonymous set with single element optimization")
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'src/evaluate.c')
-rw-r--r-- | src/evaluate.c | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/src/evaluate.c b/src/evaluate.c index b13e7c02..78732c6e 100644 --- a/src/evaluate.c +++ b/src/evaluate.c @@ -2580,15 +2580,17 @@ static int expr_evaluate_relational(struct eval_ctx *ctx, struct expr **expr) return expr_binary_error(ctx->msgs, right, left, "Cannot be used with right hand side constant value"); - switch (rel->op) { - case OP_EQ: - case OP_IMPLICIT: - case OP_NEQ: - if (right->etype == EXPR_SET && right->size == 1) - optimize_singleton_set(rel, &right); - break; - default: - break; + if (left->etype != EXPR_CONCAT) { + switch (rel->op) { + case OP_EQ: + case OP_IMPLICIT: + case OP_NEQ: + if (right->etype == EXPR_SET && right->size == 1) + optimize_singleton_set(rel, &right); + break; + default: + break; + } } switch (rel->op) { |