From: Pablo Neira Ayuso <pablo@netfilter.org>
To: netfilter-devel@vger.kernel.org
Subject: [PATCH nft 0/4] unbreak element deletion in map with ranges
Date: Thu, 4 Jul 2024 23:34:19 +0200 [thread overview]
Message-ID: <20240704213423.254356-1-pablo@netfilter.org> (raw)
Hi,
The following series fixes element deletion in maps with ranges
(ie. those with interval flag set on):
# nft delete element ip filter mymap { 0-2400000 }
BUG: invalid range expression type set element
nft: src/expression.c:1472: range_expr_value_low: Assertion `0' failed.
Aborted
Same BUG notice is reported when deleting catchall in maps with ranges,
this is related to the src/interval.c code that deals with element
deletions.
Patch #1 sets on expr->len for catchall elements since this is required
by map element deletion, which relies on mergesort.
Patch #2 sets on EXPR_F_KERNEL for catchall elements which is required
by map element deletion to identify matching elements already
in the kernel.
Patch #3 fixes set element deletion in maps with ranges. Use expr->left
to fetch the key range but still expr->flags to fetch
EXPR_F_REMOVE and the expression itself when moving elements
to the purge list.
Patch #4 extends test coverage for this usecase.
Pablo Neira Ayuso (4):
evaluate: set on expr->len for catchall set elements
segtree: set on EXPR_F_KERNEL flag for catchall elements in the cache
intervals: fix element deletions with maps
tests: shell: cover set element deletion in maps
src/evaluate.c | 12 ++++++-
src/intervals.c | 31 +++++++++-------
src/segtree.c | 4 ++-
tests/shell/testcases/maps/delete_element | 28 +++++++++++++++
.../testcases/maps/delete_element_catchall | 35 +++++++++++++++++++
.../maps/dumps/delete_elem_catchall.nft | 12 +++++++
.../testcases/maps/dumps/delete_element.nft | 12 +++++++
7 files changed, 119 insertions(+), 15 deletions(-)
create mode 100755 tests/shell/testcases/maps/delete_element
create mode 100755 tests/shell/testcases/maps/delete_element_catchall
create mode 100644 tests/shell/testcases/maps/dumps/delete_elem_catchall.nft
create mode 100644 tests/shell/testcases/maps/dumps/delete_element.nft
--
2.30.2
next reply other threads:[~2024-07-04 21:34 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-04 21:34 Pablo Neira Ayuso [this message]
2024-07-04 21:34 ` [PATCH nft 1/4] evaluate: set on expr->len for catchall set elements Pablo Neira Ayuso
2024-07-04 21:34 ` [PATCH nft 2/4] segtree: set on EXPR_F_KERNEL flag for catchall elements in the cache Pablo Neira Ayuso
2024-07-04 21:34 ` [PATCH nft 3/4] intervals: fix element deletions with maps Pablo Neira Ayuso
2024-07-04 21:34 ` [PATCH nft 4/4] tests: shell: cover set element deletion in maps 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=20240704213423.254356-1-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).