All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Phil Sutter <phil@nwl.cc>,
	netfilter-devel@vger.kernel.org, arturo@netfilter.org,
	fw@strlen.de
Subject: Re: [PATCH nftables,v2 2/2] src: add set element catch-all support
Date: Tue, 11 May 2021 16:24:00 +0200	[thread overview]
Message-ID: <20210511142400.GA20887@salvia> (raw)
In-Reply-To: <20210511133213.GT12403@orbyte.nwl.cc>

On Tue, May 11, 2021 at 03:32:13PM +0200, Phil Sutter wrote:
> On Tue, May 11, 2021 at 03:05:38PM +0200, Pablo Neira Ayuso wrote:
> [...]
> > diff --git a/src/expression.c b/src/expression.c
> > index 9fdf23d98446..4d80e37a5bb6 100644
> > --- a/src/expression.c
> > +++ b/src/expression.c
> > @@ -1270,7 +1270,11 @@ static void set_elem_expr_print(const struct expr *expr,
> >  {
> >  	struct stmt *stmt;
> >  
> > -	expr_print(expr->key, octx);
> > +	if (expr->key->etype == EXPR_SET_ELEM_CATCHALL)
> > +		nft_print(octx, "*");
> > +	else
> > +		expr_print(expr->key, octx);
> > +
> >  	list_for_each_entry(stmt, &expr->stmt_list, list) {
> >  		nft_print(octx, " ");
> >  		stmt_print(stmt, octx);
> > @@ -1299,7 +1303,9 @@ static void set_elem_expr_destroy(struct expr *expr)
> [...]
> > @@ -1328,6 +1334,24 @@ struct expr *set_elem_expr_alloc(const struct location *loc, struct expr *key)
> >  	return expr;
> >  }
> >  
> > +static void set_elem_catchall_expr_print(const struct expr *expr,
> > +					 struct output_ctx *octx)
> > +{
> > +	nft_print(octx, "_");
> > +}
> 
> This is a leftover from v1. Since this went unnoticed, maybe you could
> drop the special casing in set_elem_expr_print() and rely on
> expr_print(expr->key, octx) to call the above? Or am I (probably)
> confusing things?

Yes, I'll call expr_print() from set_elem_expr_print() instead which
will invoke set_elem_catchall_expr_print().

  reply	other threads:[~2021-05-11 14:24 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-11 13:05 [PATCH nftables,v2 2/2] src: add set element catch-all support Pablo Neira Ayuso
2021-05-11 13:32 ` Phil Sutter
2021-05-11 14:24   ` Pablo Neira Ayuso [this message]
2021-05-11 15:31   ` Pablo Neira Ayuso

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=20210511142400.GA20887@salvia \
    --to=pablo@netfilter.org \
    --cc=arturo@netfilter.org \
    --cc=fw@strlen.de \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.