From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Wei Fang <void0red@gmail.com>
Cc: fw@strlen.de, netfilter-devel@vger.kernel.org,
netdev@vger.kernel.org, k.chen@smail.nju.edu.cn
Subject: Re: [nf_tables] rbtree interval set: in one batch, re-adding element E0 makes deleting an unrelated interval E1 fail with -ENOENT
Date: Tue, 11 Aug 2026 18:51:13 +0200 [thread overview]
Message-ID: <antTASZYV9q81Ucc@chamomile> (raw)
In-Reply-To: <CANE+tVpU7gL3ZJ9ro4oNKsqdN01mDMBpUou0ABakiO2WrT5gSw@mail.gmail.com>
On Tue, Aug 11, 2026 at 05:22:01PM +0800, Wei Fang wrote:
[...]
> Problem
> -------
> On an interval set that already contains two intervals, one batch
> that does both of the following fails on the second operation:
>
> 1. re-add element E0 without NLM_F_EXCL (update semantics);
> 2. delete a different interval E1.
>
> The delete returns -ENOENT. Sending the same two operations in
> separate messages succeeds. A transaction must not change what an
> operation does: batched and unbatched execution must behave the same.
>
> Steps to reproduce
> ------------------
> One batch on an ipv4_addr INTERVAL set with two existing intervals:
>
> 1. re-add E0 = [10.0.1.0..10.0.2.0) without NLM_F_EXCL;
> 2. delete E1 = [10.0.2.0..10.0.3.0).
>
> Raw netlink is required: the nft CLI re-sorts interval elements and
> hides the ordering.
What do you mean by "hides the ordering"? It sounds negative, actually
what is does is to pass a list of elements to the kernel that make
sense when interpreting the interval?
Ordering is paramount in this loose interface, your program does:
...
put_interval_elem(&q, 0, E1_END, 1);
put_interval_elem(&q, 1, E1, 0);
Deleting E1_END element before E1, makes no sense, the interval
representation is reversed.
next prev parent reply other threads:[~2026-08-11 16:51 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-11 9:22 [nf_tables] rbtree interval set: in one batch, re-adding element E0 makes deleting an unrelated interval E1 fail with -ENOENT Wei Fang
2026-08-11 16:51 ` Pablo Neira Ayuso [this message]
2026-08-12 1:10 ` Wei Fang
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=antTASZYV9q81Ucc@chamomile \
--to=pablo@netfilter.org \
--cc=fw@strlen.de \
--cc=k.chen@smail.nju.edu.cn \
--cc=netdev@vger.kernel.org \
--cc=netfilter-devel@vger.kernel.org \
--cc=void0red@gmail.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.