From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Patrick McHardy <kaber@trash.net>
Cc: netfilter-devel@vger.kernel.org, admin@rollinix.net,
niels@kristensen.io, tom@compton.nu
Subject: Re: [PATCH nft 3/3] rule: fix use of intervals in set declarations
Date: Sat, 20 Jun 2015 13:06:43 +0200 [thread overview]
Message-ID: <20150620110643.GA4159@salvia> (raw)
In-Reply-To: <28C126EF-7F7A-438A-9882-BA84FB960517@trash.net>
On Fri, Jun 19, 2015 at 08:15:01PM +0200, Patrick McHardy wrote:
[...]
> >OK, so that transformation would look like:
> >
> >1) Fetch the existing elements in the set via netlink.
> >2) Handle merges with the elements that the user has passed through
> > command line.
> >3) Build the segtree.
> >4) Push it into the kernel. We need to mark all existing elements for
> > the deletion plus add the new elements, all that in one single
> > transaction.
> >
> >Is this your idea? So it looks like we need a bit more userspace code.
> >
> >With the existing approach, the kernel rejects overlapping segments
> >with -EEXIST, so if the user is careful to avoid them there should be
> >no problem. It's more restrictive than what the logic above, but set
> >declarations with intervals will work until that code lands in the
> >tree.
>
> Sorry, missed this part. Are you sure about that? I'm pretty sure we
> only reject exact duplicates. Otherwise I'd agree, that would be
> fine for now.
Yes, overlapping segments are rejected:
# nft add element test myset { 1.2.3.0/24 }
# nft add element test myset { 1.2.3.1 }
<cmdline>:1:1-34: Error: Could not process rule: File exists
add element test myset { 1.2.3.1 }
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
# nft add element test myset { 1.2.3.0 }
<cmdline>:1:1-34: Error: Could not process rule: File exists
add element test myset { 1.2.3.0 }
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
# nft add element test myset { 1.2.3.255 }
<cmdline>:1:1-36: Error: Could not process rule: File exists
add element test myset { 1.2.3.255 }
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
# nft add element test myset { 1.2.3.30-1.2.4.30 }
<cmdline>:1:1-44: Error: Could not process rule: File exists
add element test myset { 1.2.3.30-1.2.4.30 }
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
I'll send a v2 of this patch to replace the netlink_get_set() call so
this also works for set declarations in one single transaction.
Thanks.
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
next prev parent reply other threads:[~2015-06-20 11:01 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-19 13:15 [PATCH nft 1/3] rule: use netlink_add_setelems() when creating literal sets Pablo Neira Ayuso
2015-06-19 13:15 ` [PATCH nft 2/3] segtree: pass element expression as parameter to set_to_intervals() Pablo Neira Ayuso
2015-06-19 13:15 ` [PATCH nft 3/3] rule: fix use of intervals in set declarations Pablo Neira Ayuso
2015-06-19 13:13 ` Patrick McHardy
2015-06-19 13:48 ` Pablo Neira Ayuso
2015-06-19 13:44 ` Patrick McHardy
2015-06-19 13:59 ` Pablo Neira Ayuso
2015-06-19 13:59 ` Patrick McHardy
2015-06-19 17:40 ` Pablo Neira Ayuso
2015-06-19 18:01 ` Patrick McHardy
2015-06-19 18:15 ` Patrick McHardy
2015-06-20 11:06 ` Pablo Neira Ayuso [this message]
2015-06-20 11:41 ` Patrick McHardy
2015-06-20 18:37 ` 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=20150620110643.GA4159@salvia \
--to=pablo@netfilter.org \
--cc=admin@rollinix.net \
--cc=kaber@trash.net \
--cc=netfilter-devel@vger.kernel.org \
--cc=niels@kristensen.io \
--cc=tom@compton.nu \
/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).