]> git.ipfire.org Git - thirdparty/nftables.git/commitdiff
netlink: delinearize: copy set keytype if needed
authorFlorian Westphal <fw@strlen.de>
Tue, 25 Jul 2023 16:51:34 +0000 (18:51 +0200)
committerFlorian Westphal <fw@strlen.de>
Wed, 26 Jul 2023 22:29:04 +0000 (00:29 +0200)
Output before:
add @dynmark { 0xa020304 [invalid type] timeout 1s : 0x00000002 } comment "also check timeout-gc"

after:
add @dynmark { 10.2.3.4 timeout 1s : 0x00000002 } comment "also check timeout-gc"

This is a followup to 76c358ccfea0 ("src: maps: update data expression dtype based on set"),
which did fix the map expression, but not the key.

Signed-off-by: Florian Westphal <fw@strlen.de>
src/netlink_delinearize.c

index 9241f46622ffc550e029e1633b510b271af2aef7..125b6c685f803dfce6cfb7690adb7a43eb302249 100644 (file)
@@ -1734,6 +1734,8 @@ static void netlink_parse_dynset(struct netlink_parse_ctx *ctx,
                expr = netlink_parse_concat_key(ctx, loc, sreg, set->key);
                if (expr == NULL)
                        return;
+       } else if (expr->dtype == &invalid_type) {
+               expr_set_type(expr, datatype_get(set->key->dtype), set->key->byteorder);
        }
 
        expr = set_elem_expr_alloc(&expr->location, expr);