Re: Issues with nft typeof

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Apr 28, 2020 at 03:51:46PM +0200, michael-dev wrote:
[...] 
> table bridge t {
>         set s3 {
>                 typeof meta ibrpvid
>                 elements = { 2, 3, 103 }
>         }
[...]
> }
> 
> So I'm unsure if this is a display error when reading back? Or is the wrong
> value written to the kernel?

Looks like wrong value written to the kernel:

# nft --debug=netlink -f /tmp/x
s3 t 0
s3 t 0
        element 00000100  : 0 [end]     element 00000200  : 0 [end]     element 00000300  : 0 [end]
                ^^^^^^^^

That should be 00000001 instead.

where /tmp/x contains:

table ip t {
        set s3 {
                typeof meta ibrpvid
                elements = { 1, 2, 3 }
        }
}

This seems to be related with the integer_type, that sets the
byteorder to BYTEORDER_INVALID (which is implicitly handled as
BYTEORDER_BIG_ENDIAN).

Could you give a try to the following patch?

If this works for you, I'd really appreciate if you could extend
testcases/sets/typeof_sets_0 to include the 'meta ibrpvid' usecase
above.

Thanks.
diff --git a/src/evaluate.c b/src/evaluate.c
index 8c227eb11402..597141317000 100644
--- a/src/evaluate.c
+++ b/src/evaluate.c
@@ -3544,7 +3544,8 @@ static int set_evaluate(struct eval_ctx *ctx, struct set *set)
 
 	ctx->set = set;
 	if (set->init != NULL) {
-		expr_set_context(&ctx->ectx, set->key->dtype, set->key->len);
+		__expr_set_context(&ctx->ectx, set->key->dtype,
+				   set->key->byteorder, set->key->len, 0);
 		if (expr_evaluate(ctx, &set->init) < 0)
 			return -1;
 	}

[Index of Archives]     [Netfitler Users]     [Berkeley Packet Filter]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux