netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pablo Neira Ayuso <pablo@netfilter.org>
To: "Pablo M. Bermudo Garay" <pablombg@gmail.com>
Cc: netfilter-devel@vger.kernel.org
Subject: Re: [PATCH nft] evaluate: fix "list set" unexpected behaviour
Date: Wed, 1 Jun 2016 11:20:56 +0200	[thread overview]
Message-ID: <20160601092056.GA2711@salvia> (raw)
In-Reply-To: <20160601085117.6717-1-pablombg@gmail.com>

On Wed, Jun 01, 2016 at 10:51:17AM +0200, Pablo M. Bermudo Garay wrote:
> Special sets like maps and flow tables have their own commands to be
> listed and inspected.
> 
> Before this patch, "nft list set" was able to display these special sets
> content:
> 
>   # nft list set filter test
>   table ip filter {
>           map test {
>                   type ipv4_addr : inet_service
>                   elements = { 192.168.1.101 : http-alt}
>           }
>   }
> 
> Now an error is shown:
> 
>   # nft list set filter test
>   <cmdline>:1:1-20: Error: Could not process rule: Set 'test' does not exist
>   list set filter test
>   ^^^^^^^^^^^^^^^^^^^^
> 
> Signed-off-by: Pablo M. Bermudo Garay <pablombg@gmail.com>
> ---
>  src/evaluate.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/src/evaluate.c b/src/evaluate.c
> index 423523f..86884a2 100644
> --- a/src/evaluate.c
> +++ b/src/evaluate.c
> @@ -2674,7 +2674,9 @@ static int cmd_evaluate_list(struct eval_ctx *ctx, struct cmd *cmd)
>  		if (table == NULL)
>  			return cmd_error(ctx, "Could not process rule: Table '%s' does not exist",
>  					 cmd->handle.table);
> -		if (set_lookup(table, cmd->handle.set) == NULL)
> +		set = set_lookup(table, cmd->handle.set);
> +		if (set == NULL || set->flags & SET_F_MAP ||
> +		    set->flags & SET_F_EVAL)

I'd suggest:

                    set == NULL && set->flags & (SET_F_EVAL | SET_F_MAP)

>  			return cmd_error(ctx, "Could not process rule: Set '%s' does not exist",
>  					 cmd->handle.set);
>  		return 0;
> -- 
> 2.8.3
> 

  reply	other threads:[~2016-06-01  9:21 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-01  8:51 [PATCH nft] evaluate: fix "list set" unexpected behaviour Pablo M. Bermudo Garay
2016-06-01  9:20 ` Pablo Neira Ayuso [this message]
2016-06-01 10:14   ` Pablo M. Bermudo Garay

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=20160601092056.GA2711@salvia \
    --to=pablo@netfilter.org \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=pablombg@gmail.com \
    /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).