netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Florian Westphal <fw@strlen.de>
To: Arturo Borrero Gonzalez <arturo.borrero.glez@gmail.com>
Cc: Florian Westphal <fw@strlen.de>,
	Pablo Neira Ayuso <pablo@netfilter.org>,
	Netfilter Development Mailing list
	<netfilter-devel@vger.kernel.org>
Subject: Re: [RFC] nftables: reverse path filtering for nft
Date: Wed, 14 Sep 2016 23:13:40 +0200	[thread overview]
Message-ID: <20160914211340.GB4925@breakpoint.cc> (raw)
In-Reply-To: <CAOkSjBheup7MmfT74FF0ZE3irCf=7OFGL5acWfMen5dkxvOy8Q@mail.gmail.com>

Arturo Borrero Gonzalez <arturo.borrero.glez@gmail.com> wrote:
> Hi Florian,
> 
> thanks for working on this, here my comments.
> 
> On 14 September 2016 at 19:45, Florian Westphal <fw@strlen.de> wrote:
> > Pablo Neira Ayuso <pablo@netfilter.org> wrote:
> >> On Mon, Sep 12, 2016 at 09:00:25PM +0200, Florian Westphal wrote:
> >> > Pablo Neira Ayuso <pablo@netfilter.org> wrote:
> >> > >         fib lookup ip daddr . oif
> >> > >
> >> > > As you are basically looking for the route based on IPv4 address and
> >> > > the output interface, so this boils down to:
> >> > >
> >> > >         fib lookup $expr $flags
> >> >
> >> > How would the kernel disentangle the register data?
> >>
> >> What I'm proposing is to represent this as a concatenation, since this
> >> represents the tuple that you use to look up for route.
> >>
> >> > (i.e., how do i know where in the sreg e.g. the daddr is
> >> >  that i need to stuff in the flowi struct?)
> >>
> >> You can iterate over the concatenation compound from the
> >> netlink_linearize path, it is just a list of expressions. Then, you
> >> can set the NFTA_FIB_* netlink attribute using them.
> >
> > I found this to be ugly and cumbersome, I'd propose following
> > syntax instead:
> >
> > FIB     fib_type     fib_family   '{' fib_addr fib_key_flags '}'
> >
> > The {} are needed because I'd like to use 'mark' and 'oif' in flags but
> > these can also be expressions, i.e. I need something that tells
> > the parser when end of FIB flags are reached (so instead of { }
> > it could also use single ';' or something else ...)
> >
> > This gives following examples:
> >
> >  fib oif { saddr }  # ip route get $saddr, place ifindex into register)
> >  fib oif { saddr mark,saddr,oif } # same, but populate flowi .saddr,mark,oif
> >                                     members as well
> >
> >  fib oif { daddr mark,saddr,oif } # same, except that flowi.daddr is set
> >                                   # to iph->daddr)
> >
> 
> 
> Using {} in the syntax for something which is not a set or a map seems
> a bit confusing to me.

We also use it for the flow statement, but I agree its not nice.

Other solution I see is to not use mark and oif and come up
with new/different keyword, but thats not good either.

Yet another option:

FIB     fib_type     fib_family   fib_key_flags	fib_addr

Which is not ambiguous anymore as either saddr or daddr will terminate
the statement.  We'd have to remove the saddr option but I don't think its a
problem (the iptables rpfilter modules set flowi.saddr if packet daddr
is unicast address).

Would give following syntax :

fib oif mark saddr
fib oif saddr
fib oif mark,oif daddr

fib addrtype oif  daddr

Or remove unqualified meta keywords, that should work as well.

  reply	other threads:[~2016-09-14 21:13 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-10 20:01 [RFC] nftables: reverse path filtering for nft Florian Westphal
2016-09-12 12:04 ` Pablo Neira Ayuso
2016-09-12 12:21   ` Florian Westphal
2016-09-12 18:52     ` Pablo Neira Ayuso
2016-09-12 19:00       ` Florian Westphal
2016-09-12 19:14         ` Pablo Neira Ayuso
2016-09-12 19:19           ` Florian Westphal
2016-09-12 22:46             ` Florian Westphal
2016-09-14 17:45           ` Florian Westphal
2016-09-14 18:23             ` Arturo Borrero Gonzalez
2016-09-14 21:13               ` Florian Westphal [this message]
2016-09-14 22:00                 ` Florian Westphal
2016-09-15  8:24                 ` Arturo Borrero Gonzalez
2016-09-15  8:27                 ` Arturo Borrero Gonzalez

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=20160914211340.GB4925@breakpoint.cc \
    --to=fw@strlen.de \
    --cc=arturo.borrero.glez@gmail.com \
    --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).