netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Florian Westphal <fw@strlen.de>
To: Patrick McHardy <kaber@trash.net>
Cc: Florian Westphal <fw@strlen.de>, netfilter-devel@vger.kernel.org
Subject: Re: [PATCH v6 -next 2/4] netfilter: nftables: add connlabel set support
Date: Mon, 25 Apr 2016 23:54:12 +0200	[thread overview]
Message-ID: <20160425215412.GC17538@breakpoint.cc> (raw)
In-Reply-To: <20160425213519.GA29318@macbook.localdomain>

Patrick McHardy <kaber@trash.net> wrote:
> > If not, I see no choice other than resubmitting the original V1 kernel
> > patch that simply copied the entire sreg into the label area, this way
> > no userspace changes are needed.
> 
> I have to follow up on the previous discussion. Just wondering, what's wrong
> with simply memcpy'ing and supplying the full set of labels?

Ok, here is a summary.

iptables: userspace gives u16 indicating bit, kernel test_bit()s or
set_bits depending if set or get is wanted.

The checkentry hook tells the kernel that label extension for X bits should be
allocated for new conntracks (where X is what userspace gave in the
match struct).


nftables:
get operation simply copies the label area to the sreg.
Since we only support up to 129 labels at the moment this fits into
an nft register.

nft ct label bla

simply expands to a bit test on the sreg filled from nft_ct expression.

There is currently no 'please enable labels for new conntracks'.

First proposal for set operation was to simply expect userspace to
populate the label space for us and memcpy the sreg to the label area.

So

nft label set bla

will *replace* the entire area with the sreg content, i.e. we delete
any other label(s) present.

To only set a label, one has to use

ct labels set ct labels | bla

I have no preference; this is the most simple patch/approach since
it requires no userspace changes (except documenting it).

Second drawback is that we don't know which label(s) will be set or
requested so we either have to unconditionally allocate 16 byte
in the conntrack extension, or, alternatively, raise the 'use this many
bits when allocating a new conntrack' variable in the packet path (should
not be a huge deal since after some time all conntracks would have
sufficient space).

3rd drawback is that its not atomic anymore since we replace
the entire thing (but I don't think this is a problem in practice).

  parent reply	other threads:[~2016-04-25 21:54 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-21 14:34 [PATCH -next v6] nftables: connlabel set support Florian Westphal
2016-04-21 14:34 ` [PATCH -next 1/4] netfilter: nft_ct: rename struct nft_ct to nft_ct_reg Florian Westphal
2016-04-21 14:34 ` [PATCH v6 -next 2/4] netfilter: nftables: add connlabel set support Florian Westphal
2016-04-25 10:35   ` Patrick McHardy
2016-04-25 10:59     ` Florian Westphal
2016-04-25 11:16       ` Patrick McHardy
2016-04-25 11:56         ` Florian Westphal
2016-04-25 12:16           ` Pablo Neira Ayuso
2016-04-25 12:29             ` Florian Westphal
2016-04-25 17:05           ` Patrick McHardy
2016-04-25 21:19             ` Florian Westphal
2016-04-25 21:35               ` Patrick McHardy
2016-04-25 21:38                 ` Pablo Neira Ayuso
2016-04-25 22:03                   ` Patrick McHardy
2016-04-25 21:54                 ` Florian Westphal [this message]
2016-04-26  2:19                   ` Florian Westphal
2016-04-25 21:34             ` Pablo Neira Ayuso
2016-04-21 14:34 ` [PATCH libnftnl 3/4] ct: " Florian Westphal
2016-04-21 14:34 ` [PATCH nft 4/4] ct: add conntrack label " 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=20160425215412.GC17538@breakpoint.cc \
    --to=fw@strlen.de \
    --cc=kaber@trash.net \
    --cc=netfilter-devel@vger.kernel.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).