netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Shivani Bhardwaj <shivanib134@gmail.com>
Cc: netfilter-devel@vger.kernel.org
Subject: Re: [PATCH nft v2] src: evaluate: Show error for fanout without balance
Date: Fri, 8 Apr 2016 13:26:52 +0200	[thread overview]
Message-ID: <20160408112652.GA3580@salvia> (raw)
In-Reply-To: <20160407172854.GA3233@shivani>

On Thu, Apr 07, 2016 at 10:58:54PM +0530, Shivani Bhardwaj wrote:
> The idea of fanout option is to improve the performance by indexing CPU
> ID to map packets to the queues. This is used for load balancing.
> Fanout option is not required when there is a single queue specified.
> 
> According to iptables, queue balance should be specified in order to use
> fanout. Following that, throw an error in nftables if the range of
> queues for load balancing is not specified with the fanout option.
> 
> After this patch,
> 
> $ sudo nft add rule ip filter forward counter queue num 0 fanout
> <cmdline>:1:46-46: Error: fanout requires queue num range to be specified
> add rule ip filter forward counter queue num 0 fanout
>                                              ^

Thanks, I'm applying this with updates, basically adding this chunk to
your patch:

diff --git a/src/parser_bison.y b/src/parser_bison.y
index 4b7c1f5..444ed4c 100644
--- a/src/parser_bison.y
+++ b/src/parser_bison.y
@@ -1722,6 +1722,7 @@ queue_stmt_args           :       queue_stmt_arg
 queue_stmt_arg         :       QUEUENUM        stmt_expr
                        {
                                $<stmt>0->queue.queue = $2;
+                               $<stmt>0->queue.queue->location = @$;
                        }
                        |       queue_stmt_flags
                        {

I'm basically reseting the location here.

So the error printing look like:

    $ sudo nft add rule ip filter forward counter queue num 0 fanout
    <cmdline>:1:46-46: Error: fanout requires a range to be specified
    add rule ip filter forward counter queue num 0 fanout
                                             ^^^^^

which seems slightly better.

We can probably use expr_binary_error() instead expr_error() so we get
something like:

    $ sudo nft add rule ip filter forward counter queue num 0 fanout
    <cmdline>:1:46-46: Error: fanout requires a range to be specified
    add rule ip filter forward counter queue num 0 fanout
                                             ^^^^^ ~~~~~~

But this requires revisiting the parser to convert the flags to
expressions, let's have a look at this later.

      reply	other threads:[~2016-04-08 11:27 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-07 17:28 [PATCH nft v2] src: evaluate: Show error for fanout without balance Shivani Bhardwaj
2016-04-08 11:26 ` 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=20160408112652.GA3580@salvia \
    --to=pablo@netfilter.org \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=shivanib134@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).