Skip to content

unbreak element deletion in map with ranges

Pablo Neira Ayuso netfilter-devel 1 version New

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest4 patches 0 repliesNew

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4evaluate: set on expr->len for catchall set elementssrc/evaluate.c+11 -10 replies
2/4segtree: set on EXPR_F_KERNEL flag for catchall elements in the cachesrc/segtree.c+3 -10 replies
3/4intervals: fix element deletions with mapssrc/intervals.c+18 -130 replies
4/4tests: shell: cover set element deletion in mapstests/shell/testcases/maps/delete_element tests/shell/testcases/maps/delete_element_catchall tests/shell/testcases/maps/dumps/delete_elem_catchall.nft +1 more+87 -00 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH nft 0/4] unbreak element deletion in map with ranges

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
Signature · 1 line
2.30.2