]> git.ipfire.org Git - thirdparty/nftables.git/commit
intervals: add support to automerge with kernel elements
authorPablo Neira Ayuso <pablo@netfilter.org>
Wed, 13 Apr 2022 02:01:17 +0000 (04:01 +0200)
committerPablo Neira Ayuso <pablo@netfilter.org>
Wed, 13 Apr 2022 11:43:55 +0000 (13:43 +0200)
commit3da9643fb9ff9a2e8386abe142138256d1e2c4d2
tree4b728a30170e39fc74bbdd15b12456f10a208c76
parent7b061e6376f52999a631f4c5784588c976f47b9c
intervals: add support to automerge with kernel elements

Extend the interval codebase to support for merging elements in the
kernel with userspace element updates.

Add a list of elements to be purged to cmd and set objects. These
elements representing outdated intervals are deleted before adding the
updated ranges.

This routine splices the list of userspace and kernel elements, then it
mergesorts to identify overlapping and contiguous ranges. This splice
operation is undone so the set userspace cache remains consistent.

Incrementally update the elements in the cache, this allows to remove
dd44081d91ce ("segtree: Fix add and delete of element in same batch").

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
include/intervals.h
src/cache.c
src/evaluate.c
src/intervals.c
src/rule.c
tests/shell/testcases/sets/0069interval_merge_0 [new file with mode: 0755]
tests/shell/testcases/sets/dumps/0069interval_merge_0.nft [new file with mode: 0644]