netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pablo Neira Ayuso <pablo@netfilter.org>
To: netfilter-devel@vger.kernel.org
Cc: phil@nwl.cc
Subject: Re: [PATCH nftables] src: use opencoded NFT_SET_ANONYMOUS set flag check by set_is_anonymous()
Date: Mon, 14 Jun 2021 15:04:18 +0200	[thread overview]
Message-ID: <20210614130418.GA28343@salvia> (raw)
In-Reply-To: <20210614125919.47217-1-pablo@netfilter.org>

Proposed patch subject should be instead:

src: replace opencoded NFT_SET_ANONYMOUS set flag check by set_is_anonymous()

On Mon, Jun 14, 2021 at 02:59:19PM +0200, Pablo Neira Ayuso wrote:
> Use set_is_anonymous() to check for the NFT_SET_ANONYMOUS set flag
> instead.
> 
> Reported-by: Phil Sutter <phil@nwl.cc>
> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
> ---
>  src/evaluate.c            | 2 +-
>  src/mnl.c                 | 2 +-
>  src/netlink_delinearize.c | 2 +-
>  src/segtree.c             | 2 +-
>  4 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/src/evaluate.c b/src/evaluate.c
> index 4397bacf662b..aa7ec9bee4ae 100644
> --- a/src/evaluate.c
> +++ b/src/evaluate.c
> @@ -3781,7 +3781,7 @@ static int set_evaluate(struct eval_ctx *ctx, struct set *set)
>  	struct stmt *stmt;
>  	const char *type;
>  
> -	if (!(set->flags & NFT_SET_ANONYMOUS)) {
> +	if (!set_is_anonymous(set->flags)) {
>  		table = table_cache_find(&ctx->nft->cache.table_cache,
>  					 set->handle.table.name,
>  					 set->handle.family);
> diff --git a/src/mnl.c b/src/mnl.c
> index ce58ae7219ec..f28d6605835f 100644
> --- a/src/mnl.c
> +++ b/src/mnl.c
> @@ -1045,7 +1045,7 @@ static void set_key_expression(struct netlink_ctx *ctx,
>  	struct nftnl_udata *nest1, *nest2;
>  
>  	if (expr->flags & EXPR_F_CONSTANT ||
> -	    set_flags & NFT_SET_ANONYMOUS ||
> +	    set_is_anonymous(set_flags) ||
>  	    !expr_ops(expr)->build_udata)
>  		return;
>  
> diff --git a/src/netlink_delinearize.c b/src/netlink_delinearize.c
> index 57af71a75609..5c80397db26c 100644
> --- a/src/netlink_delinearize.c
> +++ b/src/netlink_delinearize.c
> @@ -1591,7 +1591,7 @@ static void netlink_parse_dynset(struct netlink_parse_ctx *ctx,
>  				 &stmt->map.stmt_list);
>  	} else {
>  		if (!list_empty(&dynset_parse_ctx.stmt_list) &&
> -		    set->flags & NFT_SET_ANONYMOUS) {
> +		    set_is_anonymous(set->flags)) {
>  			stmt = meter_stmt_alloc(loc);
>  			stmt->meter.set  = set_ref_expr_alloc(loc, set);
>  			stmt->meter.key  = expr;
> diff --git a/src/segtree.c b/src/segtree.c
> index 9de5422c7d7f..5eaf684578bf 100644
> --- a/src/segtree.c
> +++ b/src/segtree.c
> @@ -537,7 +537,7 @@ static void segtree_linearize(struct list_head *list, const struct set *set,
>  			 */
>  			mpz_add_ui(p, prev->right, 1);
>  			if (mpz_cmp(p, ei->left) < 0 ||
> -			    (!(set->flags & NFT_SET_ANONYMOUS) && !merge)) {
> +			    (!set_is_anonymous(set->flags) && !merge)) {
>  				mpz_sub_ui(q, ei->left, 1);
>  				nei = ei_alloc(p, q, NULL, EI_F_INTERVAL_END);
>  				list_add_tail(&nei->list, list);
> -- 
> 2.30.2
> 

      parent reply	other threads:[~2021-06-14 13:04 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-14 12:59 [PATCH nftables] src: use opencoded NFT_SET_ANONYMOUS set flag check by set_is_anonymous() Pablo Neira Ayuso
2021-06-14 13:03 ` Phil Sutter
2021-06-14 13:04 ` Pablo Neira Ayuso [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210614130418.GA28343@salvia \
    --to=pablo@netfilter.org \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=phil@nwl.cc \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).