From: Patrick McHardy <kaber@trash.net>
To: Florian Westphal <fw@strlen.de>
Cc: Pablo Neira Ayuso <pablo@netfilter.org>, netfilter-devel@vger.kernel.org
Subject: Re: [PATCH nft] src: add interface wildcard matching
Date: Sun, 18 Oct 2015 22:39:06 +0200 [thread overview]
Message-ID: <20151018203906.GE7250@macbook.localdomain> (raw)
In-Reply-To: <20151018194330.GB4386@breakpoint.cc>
On 18.10, Florian Westphal wrote:
> Patrick McHardy <kaber@trash.net> wrote:
> > On 18.10, Florian Westphal wrote:
> > > Pablo Neira Ayuso <pablo@netfilter.org> wrote:
> > > > Contrary to iptables, we use '*' as wildcard as in udev since the '+' can be
> > > > used as a valid interface name.
> > >
> > > '*' can also be part of an interface name, seems only '/', ':', and ' '
> > > (space) are disallowed.
> > >
> > > > # nft --debug=netlink add rule test test iifname eth\*
> > > > ip test test
> > > > [ meta load iifname => reg 1 ]
> > > > [ bitwise reg 1 = (reg=1 & 0x00ffffff 0x00000000 0x00000000 0x00000000 ) ^ 0x00000000 0x00000000 0x00000000 0x00000000 ]
> > > > [ cmp eq reg 1 0x2a687465 0x00000000 0x00000000 0x00000000 ]
> > >
> > > Why do we need a bitwise op for this?
> > >
> > > Instead we could just ask for cmp of 3 bytes ('eth' instead of 4 'eth\0')?
> > >
> > > You might recall ancient RFC patch for this:
> > > https://patchwork.ozlabs.org/patch/283639/
> >
> > This is actually something I think should be implemented as general
> > optimzation. It also applies to network address matches, where we
> > can also avoid loading unnecessary data. Other cases will benefit
> > from this as well.
>
> Sorry, I'm dense.
>
> So what you're saying is that Pablos patch with bitwise op + cmp is fine
> and that you'd suggest to later add code to e.g. netlink serialize step
> that checks if bitop+cmp can be replaced by a single cmp operation?
I wouldn't add Pablo's patch as is because I don't think the wildcard string
special casing is the right thing to do. I'd say it should probably use a
prefix expression since that's what it actually is.
Regarding the optimization, I'm not necessarily saying later, just that it
should be done in a way that is not specific to strings.
next prev parent reply other threads:[~2015-10-18 20:39 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-18 18:02 [PATCH nft] src: add interface wildcard matching Pablo Neira Ayuso
2015-10-18 18:33 ` Florian Westphal
2015-10-18 19:04 ` Patrick McHardy
2015-10-18 19:43 ` Florian Westphal
2015-10-18 20:39 ` Patrick McHardy [this message]
2015-10-18 20:14 ` Pablo Neira Ayuso
2015-10-18 20:18 ` Florian Westphal
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=20151018203906.GE7250@macbook.localdomain \
--to=kaber@trash.net \
--cc=fw@strlen.de \
--cc=netfilter-devel@vger.kernel.org \
--cc=pablo@netfilter.org \
/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).