From: Phil Sutter <phil@nwl.cc>
To: Pablo Neira Ayuso <pablo@netfilter.org>
Cc: netfilter-devel@vger.kernel.org, Florian Westphal <fw@strlen.de>
Subject: Re: [nft PATCH 4/4] segtree: Refactor ei_insert()
Date: Tue, 28 Jan 2020 16:55:06 +0100 [thread overview]
Message-ID: <20200128155506.GL28318@orbyte.nwl.cc> (raw)
In-Reply-To: <20200128154217.zfnlvtriz575i4bb@salvia>
On Tue, Jan 28, 2020 at 04:42:17PM +0100, Pablo Neira Ayuso wrote:
> On Tue, Jan 28, 2020 at 03:14:16PM +0100, Phil Sutter wrote:
> > Hi Pablo,
> >
> > On Tue, Jan 28, 2020 at 01:23:12PM +0100, Pablo Neira Ayuso wrote:
> > > On Thu, Jan 23, 2020 at 03:30:49PM +0100, Phil Sutter wrote:
> > [...]
> > > > + if (!merge) {
> > > > + errno = EEXIST;
> > > > + return expr_binary_error(msgs, lei->expr, new->expr,
> > > > + "conflicting intervals specified");
> > > > }
> > >
> > > Not your fault, but I think this check is actually useless given that
> > > the overlap check happens before (unless you consider to consolidate
> > > the insertion and the overlap checks in ei_insert).
> >
> > That's interesting, indeed. What's more interesting is how
> > interval_cmp() works: I assumed it would just sort by start element when
> > in fact interval size is the prominent aspect.
>
> I overlook that this is ordered by the size.
Me too. %)
> > In practice, this means my changes work only as long as all
> > intervals are of equal or decreasing size. Does it make sense to
> > uphold this ordering scheme?
>
> I think if you change the ordering scheme to use the left side
> (instead of the size) your new logic will work fine. It will also make
> it probably easier to check for overlaps in the end.
I wondered if this sorting may be used (or even necessary) for prefixes
or something. If it's not mandatory, I think sorting differently would
indeed help. Anyway, it means back to drawing board for me and self-NACK
this series.
Thanks, Phil
prev parent reply other threads:[~2020-01-28 15:55 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-23 14:30 [nft PATCH 0/4] Covscan-induced review of ei_insert() Phil Sutter
2020-01-23 14:30 ` [nft PATCH 1/4] segtree: Drop needless insertion in ei_insert() Phil Sutter
2020-01-28 11:22 ` Pablo Neira Ayuso
2020-01-23 14:30 ` [nft PATCH 2/4] segtree: Drop dead code " Phil Sutter
2020-01-28 11:24 ` Pablo Neira Ayuso
2020-01-23 14:30 ` [nft PATCH 3/4] segtree: Simplify overlap case " Phil Sutter
2020-01-28 11:29 ` Pablo Neira Ayuso
2020-01-23 14:30 ` [nft PATCH 4/4] segtree: Refactor ei_insert() Phil Sutter
2020-01-28 12:23 ` Pablo Neira Ayuso
2020-01-28 14:14 ` Phil Sutter
2020-01-28 15:42 ` Pablo Neira Ayuso
2020-01-28 15:55 ` Phil Sutter [this message]
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=20200128155506.GL28318@orbyte.nwl.cc \
--to=phil@nwl.cc \
--cc=fw@strlen.de \
--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).