]> git.ipfire.org Git - thirdparty/nftables.git/commitdiff
evaluate: set up integer type to shift expression
authorPablo Neira Ayuso <pablo@netfilter.org>
Thu, 23 Mar 2023 11:36:08 +0000 (12:36 +0100)
committerPablo Neira Ayuso <pablo@netfilter.org>
Tue, 28 Mar 2023 08:26:34 +0000 (10:26 +0200)
Otherwise expr_evaluate_value() fails with invalid datatype:

 # nft --debug=netlink add rule ip x y 'ct mark set ip dscp & 0x0f << 1'
 BUG: invalid basetype invalid
 nft: evaluate.c:440: expr_evaluate_value: Assertion `0' failed.

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
src/evaluate.c

index 33b1aad72f66327bb77a8d4fb0c2c8278b6534e3..97752c0f7b66ee7675098942d479750ec6511176 100644 (file)
@@ -1308,6 +1308,7 @@ static int expr_evaluate_shift(struct eval_ctx *ctx, struct expr **expr)
        if (byteorder_conversion(ctx, &op->right, BYTEORDER_HOST_ENDIAN) < 0)
                return -1;
 
+       datatype_set(op, &integer_type);
        op->byteorder = BYTEORDER_HOST_ENDIAN;
        op->len       = max_shift_len;