From: Phil Sutter <phil@nwl.cc>
To: Arturo Borrero Gonzalez <arturo@netfilter.org>
Cc: netfilter-devel@vger.kernel.org, Pablo Neira Ayuso <pablo@netfilter.org>
Subject: Re: [PATCH] monitor: fix printing of range elements in named sets
Date: Tue, 11 Jul 2017 20:11:04 +0200 [thread overview]
Message-ID: <20170711181104.GP16375@orbyte.nwl.cc> (raw)
In-Reply-To: <149935174634.19966.16018870027671610502.stgit@nfdev2.cica.es>
Hi,
On Thu, Jul 06, 2017 at 04:36:45PM +0200, Arturo Borrero Gonzalez wrote:
> If you add set elements to interval sets, the output is wrong.
> Fix this by caching first element of the range (first event),
> then wait for the second element of the range (second event) to
> print them both at the same time.
As promised, I am preparing my own solution for side-by-side comparison.
Though I'm running into problems and want to use the occasion to discuss
them first:
What I wasn't able to solve yet are half-open ranges, like so:
| nft add set ip t portrange { type inet_service; flags interval; }
| nft add element ip t portrange { 1024-65535 }
In this case there is only a single element with value 1024 which
doesn't have EXPR_F_INTERVAL_END set. Looking at
interval_map_decompose(), this is identified to be a range till the end
of the scope if it's the last element in the set.
In monitor code though, I can't predict whether an interval end element
will come afterwards or not, so I end up caching the element and
everything turns into a mess. I'm pretty sure your solution has the same
problem, could you check that?
Right now, I only see two ways to get this sorted:
1) Change kernel code to always include both start end end of a range in
a single notification. This would eliminate the need for any caching
in netlink_events_setelem_cb() altogether!
2) Change monitor code to cache all events until the final NFTA_GEN_ID
message, then handle all messages at once.
What do you think?
Thanks, Phil
next prev parent reply other threads:[~2017-07-11 18:11 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-06 14:36 [PATCH] monitor: fix printing of range elements in named sets Arturo Borrero Gonzalez
2017-07-11 18:11 ` Phil Sutter [this message]
2017-07-12 11:24 ` Arturo Borrero Gonzalez
2017-07-12 12:13 ` Phil Sutter
2017-07-17 16:26 ` 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=20170711181104.GP16375@orbyte.nwl.cc \
--to=phil@nwl.cc \
--cc=arturo@netfilter.org \
--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).