diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/evaluate.c | 6 | ||||
-rw-r--r-- | src/expression.c | 12 | ||||
-rw-r--r-- | src/json.c | 4 | ||||
-rw-r--r-- | src/rule.c | 9 |
4 files changed, 13 insertions, 18 deletions
diff --git a/src/evaluate.c b/src/evaluate.c index 81230fc7..e54eaf1a 100644 --- a/src/evaluate.c +++ b/src/evaluate.c @@ -3888,8 +3888,7 @@ static int cmd_evaluate_list(struct eval_ctx *ctx, struct cmd *cmd) if (set == NULL) return set_not_found(ctx, &ctx->cmd->handle.set.location, ctx->cmd->handle.set.name); - else if (!(set->flags & NFT_SET_EVAL) || - !(set->flags & NFT_SET_ANONYMOUS)) + else if (!set_is_meter(set->flags)) return cmd_error(ctx, &ctx->cmd->handle.set.location, "%s", strerror(ENOENT)); @@ -4037,8 +4036,7 @@ static int cmd_evaluate_flush(struct eval_ctx *ctx, struct cmd *cmd) if (set == NULL) return set_not_found(ctx, &ctx->cmd->handle.set.location, ctx->cmd->handle.set.name); - else if (!(set->flags & NFT_SET_EVAL) || - !(set->flags & NFT_SET_ANONYMOUS)) + else if (!set_is_meter(set->flags)) return cmd_error(ctx, &ctx->cmd->handle.set.location, "%s", strerror(ENOENT)); diff --git a/src/expression.c b/src/expression.c index e456010f..5070b101 100644 --- a/src/expression.c +++ b/src/expression.c @@ -1051,14 +1051,12 @@ struct expr *map_expr_alloc(const struct location *loc, struct expr *arg, static void set_ref_expr_print(const struct expr *expr, struct output_ctx *octx) { - if (set_is_anonymous(expr->set->flags)) { - if (expr->set->flags & NFT_SET_EVAL) - nft_print(octx, "%s", expr->set->handle.set.name); - else - expr_print(expr->set->init, octx); - } else { + if (set_is_meter(expr->set->flags)) + nft_print(octx, "%s", expr->set->handle.set.name); + else if (set_is_anonymous(expr->set->flags)) + expr_print(expr->set->init, octx); + else nft_print(octx, "@%s", expr->set->handle.set.name); - } } static void set_ref_expr_clone(struct expr *new, const struct expr *expr) @@ -86,7 +86,7 @@ static json_t *set_print_json(struct output_ctx *octx, const struct set *set) } else if (set_is_objmap(set->flags)) { type = "map"; datatype_ext = obj_type_name(set->objtype); - } else if (set->flags & NFT_SET_EVAL) { + } else if (set_is_meter(set->flags)) { type = "meter"; } else { type = "set"; @@ -1684,7 +1684,7 @@ static json_t *do_list_sets_json(struct netlink_ctx *ctx, struct cmd *cmd) !set_is_literal(set->flags)) continue; if (cmd->obj == CMD_OBJ_METERS && - !(set->flags & NFT_SET_EVAL)) + !set_is_meter(set->flags)) continue; if (cmd->obj == CMD_OBJ_MAPS && !map_is_literal(set->flags)) @@ -446,8 +446,7 @@ static void set_print_declaration(const struct set *set, const char *type; uint32_t flags; - if ((set->flags & (NFT_SET_EVAL | NFT_SET_ANONYMOUS)) == - (NFT_SET_EVAL | NFT_SET_ANONYMOUS)) + if (set_is_meter(set->flags)) type = "meter"; else if (set_is_map(set->flags)) type = "map"; @@ -534,11 +533,11 @@ static void set_print_declaration(const struct set *set, } static void do_set_print(const struct set *set, struct print_fmt_options *opts, - struct output_ctx *octx) + struct output_ctx *octx) { set_print_declaration(set, opts, octx); - if ((set->flags & NFT_SET_EVAL && nft_output_stateless(octx)) || + if ((set_is_meter(set->flags) && nft_output_stateless(octx)) || nft_output_terse(octx)) { nft_print(octx, "%s}%s", opts->tab, opts->nl); return; @@ -1691,7 +1690,7 @@ static int do_list_sets(struct netlink_ctx *ctx, struct cmd *cmd) !set_is_literal(set->flags)) continue; if (cmd->obj == CMD_OBJ_METERS && - !(set->flags & NFT_SET_EVAL)) + !set_is_meter(set->flags)) continue; if (cmd->obj == CMD_OBJ_MAPS && !map_is_literal(set->flags)) |