[PATCH nft 3/5] src: use set_is_anonymous()

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

 



Signed-off-by: Pablo Neira Ayuso <pablo@xxxxxxxxxxxxx>
---
 src/evaluate.c    | 2 +-
 src/expression.c  | 4 ++--
 src/json.c        | 4 ++--
 src/monitor.c     | 4 ++--
 src/parser_json.c | 2 +-
 src/rule.c        | 4 ++--
 src/segtree.c     | 2 +-
 7 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/src/evaluate.c b/src/evaluate.c
index f915187165cc..e35291d28b6a 100644
--- a/src/evaluate.c
+++ b/src/evaluate.c
@@ -1642,7 +1642,7 @@ static int __binop_transfer(struct eval_ctx *ctx,
 		}
 		break;
 	case EXPR_SET_REF:
-		if (!((*right)->set->flags & NFT_SET_ANONYMOUS))
+		if (!set_is_anonymous((*right)->set->flags))
 			return 0;
 
 		return __binop_transfer(ctx, left, &(*right)->set->init);
diff --git a/src/expression.c b/src/expression.c
index 5d0b4f82cae4..cb49e0b73f5a 100644
--- a/src/expression.c
+++ b/src/expression.c
@@ -851,7 +851,7 @@ static const char *calculate_delim(const struct expr *expr, int *count)
 	const char *newline = ",\n\t\t\t     ";
 	const char *singleline = ", ";
 
-	if (expr->set_flags & NFT_SET_ANONYMOUS)
+	if (set_is_anonymous(expr->set_flags))
 		return singleline;
 
 	if (!expr->dtype)
@@ -1035,7 +1035,7 @@ 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 (expr->set->flags & NFT_SET_ANONYMOUS) {
+	if (set_is_anonymous(expr->set->flags)) {
 		if (expr->set->flags & NFT_SET_EVAL)
 			nft_print(octx, "%s", expr->set->handle.set.name);
 		else
diff --git a/src/json.c b/src/json.c
index f40dc51883b7..b21677efea91 100644
--- a/src/json.c
+++ b/src/json.c
@@ -522,7 +522,7 @@ json_t *set_expr_json(const struct expr *expr, struct output_ctx *octx)
 
 json_t *set_ref_expr_json(const struct expr *expr, struct output_ctx *octx)
 {
-	if (expr->set->flags & NFT_SET_ANONYMOUS) {
+	if (set_is_anonymous(expr->set->flags)) {
 		return expr_print_json(expr->set->init, octx);
 	} else {
 		return json_pack("s+", "@", expr->set->handle.set.name);
@@ -1473,7 +1473,7 @@ static json_t *table_print_json_full(struct netlink_ctx *ctx,
 		json_array_append_new(root, tmp);
 	}
 	list_for_each_entry(set, &table->sets, list) {
-		if (set->flags & NFT_SET_ANONYMOUS)
+		if (set_is_anonymous(set->flags))
 			continue;
 		tmp = set_print_json(&ctx->nft->output, set);
 		json_array_append_new(root, tmp);
diff --git a/src/monitor.c b/src/monitor.c
index 5b25c9d4854e..40c381149cda 100644
--- a/src/monitor.c
+++ b/src/monitor.c
@@ -275,7 +275,7 @@ static int netlink_events_set_cb(const struct nlmsghdr *nlh, int type,
 
 	nls = netlink_set_alloc(nlh);
 	flags = nftnl_set_get_u32(nls, NFTNL_SET_FLAGS);
-	if (flags & NFT_SET_ANONYMOUS)
+	if (set_is_anonymous(flags))
 		goto out;
 
 	set = netlink_delinearize_set(monh->ctx, nls);
@@ -392,7 +392,7 @@ static int netlink_events_setelem_cb(const struct nlmsghdr *nlh, int type,
 		goto out;
 	}
 
-	if (set->flags & NFT_SET_ANONYMOUS)
+	if (set_is_anonymous(set->flags))
 		goto out;
 
 	/* we want to 'delinearize' the set_elem, but don't
diff --git a/src/parser_json.c b/src/parser_json.c
index f701ebdf1858..9add6f88d09e 100644
--- a/src/parser_json.c
+++ b/src/parser_json.c
@@ -3598,7 +3598,7 @@ static uint64_t handle_from_nlmsg(const struct nlmsghdr *nlh)
 	case NFT_MSG_NEWSET:
 		nls = netlink_set_alloc(nlh);
 		flags = nftnl_set_get_u32(nls, NFTNL_SET_FLAGS);
-		if (!(flags & NFT_SET_ANONYMOUS))
+		if (!set_is_anonymous(flags))
 			handle = nftnl_set_get_u64(nls, NFTNL_SET_HANDLE);
 		nftnl_set_free(nls);
 		break;
diff --git a/src/rule.c b/src/rule.c
index e04fc09b0a5b..52d8181f0d92 100644
--- a/src/rule.c
+++ b/src/rule.c
@@ -388,7 +388,7 @@ struct set *set_lookup_fuzzy(const char *set_name,
 
 	list_for_each_entry(table, &cache->list, list) {
 		list_for_each_entry(set, &table->sets, list) {
-			if (set->flags & NFT_SET_ANONYMOUS)
+			if (set_is_anonymous(set->flags))
 				continue;
 			if (!strcmp(set->handle.set.name, set_name)) {
 				*t = table;
@@ -1272,7 +1272,7 @@ static void table_print(const struct table *table, struct output_ctx *octx)
 		delim = "\n";
 	}
 	list_for_each_entry(set, &table->sets, list) {
-		if (set->flags & NFT_SET_ANONYMOUS)
+		if (set_is_anonymous(set->flags))
 			continue;
 		nft_print(octx, "%s", delim);
 		set_print(set, octx);
diff --git a/src/segtree.c b/src/segtree.c
index a21270a08c46..eff0653a8dfb 100644
--- a/src/segtree.c
+++ b/src/segtree.c
@@ -440,7 +440,7 @@ static bool segtree_needs_first_segment(const struct set *set,
 		 * 3) New empty set and, separately, new elements are added.
 		 * 4) This set is created with a number of initial elements.
 		 */
-		if ((set->flags & NFT_SET_ANONYMOUS) ||
+		if ((set_is_anonymous(set->flags)) ||
 		    (set->init && set->init->size == 0) ||
 		    (set->init == NULL && init) ||
 		    (set->init == init)) {
-- 
2.11.0




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

  Powered by Linux