summaryrefslogtreecommitdiffstats
path: root/src/evaluate.c
diff options
context:
space:
mode:
authorAnatole Denis <anatole@rezel.net>2016-11-28 17:43:10 +0100
committerPablo Neira Ayuso <pablo@netfilter.org>2016-11-29 22:46:57 +0100
commit601506d95267059c707685a998416221768ae4cf (patch)
treee4d6940fce1fd7b4545f82725643c5fe2345d803 /src/evaluate.c
parent081f5a2a916ce5f3ccb1a9aca48028e99199498f (diff)
Revert "evaluate: check for NULL datatype in rhs in lookup expr"
This reverts commit 5afa5a164ff1c066af1ec56d875b91562882bd50. This commit is obsoleted by removing the possibility for a NULL right->dtype in the first place, at set declaration. Signed-off-by: Anatole Denis <anatole@rezel.net> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'src/evaluate.c')
-rw-r--r--src/evaluate.c31
1 files changed, 8 insertions, 23 deletions
diff --git a/src/evaluate.c b/src/evaluate.c
index b12af14e..51d644fe 100644
--- a/src/evaluate.c
+++ b/src/evaluate.c
@@ -1467,33 +1467,18 @@ static int expr_evaluate_relational(struct eval_ctx *ctx, struct expr **expr)
switch (rel->op) {
case OP_LOOKUP:
- switch (right->ops->type) {
- case EXPR_SET:
- /* A literal set expression implicitly declares
- * the set
- */
+ /* A literal set expression implicitly declares the set */
+ if (right->ops->type == EXPR_SET)
right = rel->right =
implicit_set_declaration(ctx, "__set%d",
left->dtype,
left->len, right);
- break;
- case EXPR_SET_REF:
- if (right->dtype == NULL)
- return expr_binary_error(ctx->msgs, right,
- left, "the referenced"
- " set does not "
- "exist");
- if (!datatype_equal(left->dtype, right->dtype))
- return expr_binary_error(ctx->msgs, right,
- left, "datatype "
- "mismatch, expected "
- "%s, set has type %s",
- left->dtype->desc,
- right->dtype->desc);
- break;
- default:
- BUG("Unknown expression %s\n", right->ops->name);
- }
+ else if (!datatype_equal(left->dtype, right->dtype))
+ return expr_binary_error(ctx->msgs, right, left,
+ "datatype mismatch, expected %s, "
+ "set has type %s",
+ left->dtype->desc,
+ right->dtype->desc);
/* Data for range lookups needs to be in big endian order */
if (right->set->flags & SET_F_INTERVAL &&