]> git.ipfire.org Git - thirdparty/nftables.git/commitdiff
Revert "evaluate: check for NULL datatype in rhs in lookup expr"
authorAnatole Denis <anatole@rezel.net>
Mon, 28 Nov 2016 16:43:10 +0000 (17:43 +0100)
committerPablo Neira Ayuso <pablo@netfilter.org>
Tue, 29 Nov 2016 21:46:57 +0000 (22:46 +0100)
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>
src/evaluate.c

index b12af14ec10504c5e07974a8149df8569b974d16..51d644fe55f912af8b7ebc19a30f18e28189f3ea 100644 (file)
@@ -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 &&