Linux Netfilter development
 help / color / mirror / Atom feed
* [PATCH nft 0/4] unbreak element deletion in map with ranges
@ 2024-07-04 21:34 Pablo Neira Ayuso
  2024-07-04 21:34 ` [PATCH nft 1/4] evaluate: set on expr->len for catchall set elements Pablo Neira Ayuso
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Pablo Neira Ayuso @ 2024-07-04 21:34 UTC (permalink / raw)
  To: netfilter-devel

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


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-07-04 21:34 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-04 21:34 [PATCH nft 0/4] unbreak element deletion in map with ranges Pablo Neira Ayuso
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox