netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Phil Sutter <phil@nwl.cc>
Cc: netfilter-devel@vger.kernel.org
Subject: Re: [nft PATCH 4/5] fib: Support existence check
Date: Fri, 10 Mar 2017 19:07:25 +0100	[thread overview]
Message-ID: <20170310180725.GB25458@salvia> (raw)
In-Reply-To: <20170310171353.28868-5-phil@nwl.cc>

On Fri, Mar 10, 2017 at 06:13:52PM +0100, Phil Sutter wrote:
[...]
> diff --git a/tests/py/inet/fib.t.payload b/tests/py/inet/fib.t.payload
> index f5258165384dc..e928a19649133 100644
> --- a/tests/py/inet/fib.t.payload
> +++ b/tests/py/inet/fib.t.payload
> @@ -20,3 +20,13 @@ __map%d test-ip 0
>  ip test-ip prerouting
>    [ fib daddr . iif type => reg 1 ]
>    [ lookup reg 1 set __map%d dreg 0 ]
> +
> +# fib daddr oif exists
> +ip test-ip prerouting
> +  [ fib daddr oif => reg 1 ]

Instead of casting out the flag like this:

@@ -173,7 +173,7 @@  nftnl_expr_fib_snprintf_default(char *buf, size_t size,
 {
        struct nftnl_expr_fib *fib = nftnl_expr_data(e);
        int len = size, offset = 0, ret, i;
-       uint32_t flags = fib->flags;
+       uint32_t flags = fib->flags & ~NFTA_FIB_F_PRESENT;
        static const struct {
                int bit;
                const char *name;

I think it would be better if we have a different fib output for the
present case, eg.

        [ fib daddr oif present => reg 1 ]

So we can see from --debug=netlink this generates bytecode to check
the presence.

Same thing applies to:

# exthdr hbh exists
ip6 test-ip6 input
  [ exthdr load 1b @ 43 + 0 => reg 1 ]
  [ cmp eq reg 1 0x00000001 ]

Instead, I'd suggest something like:

  [ exthdr 43 present => reg 1 ]
  [ cmp eq reg 1 0x00000001 ]

You would need to send a follow up to amend test for 3/5, but that
should be no problem.

Thanks!

  reply	other threads:[~2017-03-10 18:07 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-10 17:13 [nft PATCH 0/5] Introduce boolean type and existence checks Phil Sutter
2017-03-10 17:13 ` [nft PATCH 1/5] Introduce boolean datatype and boolean expression Phil Sutter
2017-03-10 17:13 ` [nft PATCH 2/5] exthdr: Add support for exthdr specific flags Phil Sutter
2017-03-10 17:13 ` [nft PATCH 3/5] exthdr: Implement existence check Phil Sutter
2017-03-10 17:13 ` [nft PATCH 4/5] fib: Support " Phil Sutter
2017-03-10 18:07   ` Pablo Neira Ayuso [this message]
2017-03-10 21:41     ` Phil Sutter
2017-03-10 17:13 ` [nft PATCH 5/5] doc: Document boolean type and applications Phil Sutter
2017-03-10 18:14   ` Pablo Neira Ayuso
2017-03-10 18:02 ` [nft PATCH 0/5] Introduce boolean type and existence checks 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=20170310180725.GB25458@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).