netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pablo Neira Ayuso <pablo@netfilter.org>
To: netfilter-devel@vger.kernel.org
Subject: [PATCH nft 0/7] named sets with intervals
Date: Mon, 18 Apr 2016 20:14:28 +0200	[thread overview]
Message-ID: <1461003275-2330-1-git-send-email-pablo@netfilter.org> (raw)

This patchset updates the set interval support to work with named sets,
that requires the following kernel patches that I have already submitted:

http://patchwork.ozlabs.org/patch/609733/
http://patchwork.ozlabs.org/patch/609734/
http://patchwork.ozlabs.org/patch/609735/
http://patchwork.ozlabs.org/patch/609736/

Several comments on this:

1) nft supports automerging of adjacent intervals when they are added in
   the same command, eg.

	nft add element filter myset { 192.168.0.0/24, 192.168.1.0/24 }

   this results in one single interval 192.168.0.0/23.

   However, if you add them in two command invocations:

	nft add element filter myset { 192.168.0.0/24 }
	nft add element filter myset { 192.168.0.1/24 }

   You get two intervals, ie. 192.168.0.0/24 and 192.168.1.0/24. Automerging
   for this case should be possible from userspace, by removing the previous
   interval and adding the new one. This code is not yet available though.

2) There is currently no check in userspace for interval shadowing, eg.

	nft add element filter myset { 192.168.0.0/24 }
	nft add element filter myset { 192.168.0.0/16 }

    In this case, the largest segment is prioritized over the smaller one.
    The code to detect this shadowing from userspace is missing.

3) The first non-matching end interval (ie. all-zero) is specific of the
   rbtree implementation, I don't need this in my bitmap set
   representation. This is already part of the API though, so my plan is to
   add this node to the rbtree set from the kernel and ignore whenever we
   receive it from userspace, so we can deprecate having to send this from
   userspace at some point.

4) Support for named interval map is also missing. This requires a very
   small oneliner fix for the parser. Interval shadowing is particularly
   problematic in this scenario, for this reason, the oneliner fix should
   come with the shadowing detection code too. Meanwhile we don't have
   proper support for named interval maps.

Pablo Neira Ayuso (7):
  segtree: perform stricter expression type validation from expr_value()
  segtree: clone full expression from interval_map_decompose()
  segtree: handle adjacent interval nodes from expr_value_cmp()
  segtree: explicit initialization via set_to_intervals()
  rule: support for incremental set interval element updates
  segtree: special handling for the first non-matching segment
  evaluate: bail out on prefix or range to non-interval set

 include/expression.h |  3 ++-
 src/evaluate.c       | 15 +++++++++++
 src/rule.c           | 52 +++++++++++++++++++++++++++++-------
 src/segtree.c        | 75 +++++++++++++++++++++++++++++++++++++++++-----------
 4 files changed, 118 insertions(+), 27 deletions(-)

-- 
2.1.4


             reply	other threads:[~2016-04-18 18:14 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-18 18:14 Pablo Neira Ayuso [this message]
2016-04-18 18:14 ` [PATCH nft 1/7] segtree: perform stricter expression type validation from expr_value() Pablo Neira Ayuso
2016-04-18 18:14 ` [PATCH nft 2/7] segtree: clone full expression from interval_map_decompose() Pablo Neira Ayuso
2016-04-18 18:14 ` [PATCH nft 3/7] segtree: handle adjacent interval nodes from expr_value_cmp() Pablo Neira Ayuso
2016-04-18 18:14 ` [PATCH nft 4/7] segtree: explicit initialization via set_to_intervals() Pablo Neira Ayuso
2016-04-18 18:14 ` [PATCH nft 5/7] rule: support for incremental set interval element updates Pablo Neira Ayuso
2016-04-18 18:14 ` [PATCH nft 6/7] segtree: special handling for the first non-matching segment Pablo Neira Ayuso
2016-04-18 18:14 ` [PATCH nft 7/7] evaluate: bail out on prefix or range to non-interval set 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=1461003275-2330-1-git-send-email-pablo@netfilter.org \
    --to=pablo@netfilter.org \
    --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).