From 44312d7c9f05706b821e54ef781a0b68d13e47dd Mon Sep 17 00:00:00 2001 From: Packit Service Date: Mar 06 2021 06:16:37 +0000 Subject: Apply patch 0033-evaluate-Perform-set-evaluation-on-implicitly-declar.patch patch_name: 0033-evaluate-Perform-set-evaluation-on-implicitly-declar.patch present_in_specfile: true location_in_specfile: 33 --- diff --git a/src/evaluate.c b/src/evaluate.c index 578dcae..fc45cef 100644 --- a/src/evaluate.c +++ b/src/evaluate.c @@ -75,6 +75,7 @@ static void key_fix_dtype_byteorder(struct expr *key) datatype_set(key, set_datatype_alloc(dtype, key->byteorder)); } +static int set_evaluate(struct eval_ctx *ctx, struct set *set); static struct expr *implicit_set_declaration(struct eval_ctx *ctx, const char *name, struct expr *key, @@ -105,6 +106,8 @@ static struct expr *implicit_set_declaration(struct eval_ctx *ctx, list_add_tail(&cmd->list, &ctx->cmd->list); } + set_evaluate(ctx, set); + return set_ref_expr_alloc(&expr->location, set); } @@ -3171,12 +3174,6 @@ static int stmt_evaluate_objref_map(struct eval_ctx *ctx, struct stmt *stmt) mappings = implicit_set_declaration(ctx, "__objmap%d", key, mappings); - - mappings->set->data = constant_expr_alloc(&netlink_location, - &string_type, - BYTEORDER_HOST_ENDIAN, - NFT_OBJ_MAXNAMELEN * BITS_PER_BYTE, - NULL); mappings->set->objtype = stmt->objref.type; map->mappings = mappings; @@ -3381,6 +3378,13 @@ static int set_evaluate(struct eval_ctx *ctx, struct set *set) } + /* Default timeout value implies timeout support */ + if (set->timeout) + set->flags |= NFT_SET_TIMEOUT; + + if (set_is_anonymous(set->flags)) + return 0; + ctx->set = set; if (set->init != NULL) { expr_set_context(&ctx->ectx, set->key->dtype, set->key->len); @@ -3392,10 +3396,6 @@ static int set_evaluate(struct eval_ctx *ctx, struct set *set) if (set_lookup(table, set->handle.set.name) == NULL) set_add_hash(set_get(set), table); - /* Default timeout value implies timeout support */ - if (set->timeout) - set->flags |= NFT_SET_TIMEOUT; - return 0; }