On Wed, Oct 30, 2024 at 10:38:11PM +0100, Pablo Neira Ayuso wrote: > On Wed, Oct 30, 2024 at 07:19:47PM +0100, Phil Sutter wrote: > > On Tue, Oct 29, 2024 at 09:12:19PM +0100, Florian Westphal wrote: > > [...] > > > diff --git a/tests/monitor/testcases/set-simple.t b/tests/monitor/testcases/set-simple.t > > > index 8ca4f32463fd..6853a0ebbb0c 100644 > > > --- a/tests/monitor/testcases/set-simple.t > > > +++ b/tests/monitor/testcases/set-simple.t > > > @@ -37,9 +37,10 @@ J {"add": {"element": {"family": "ip", "table": "t", "name": "portrange", "elem" > > > # make sure half open before other element works > > > I add element ip t portrange { 1024-65535 } > > > I add element ip t portrange { 100-200 } > > > -O - > > > -J {"add": {"element": {"family": "ip", "table": "t", "name": "portrange", "elem": {"set": [{"range": [1024, 65535]}]}}}} > > > +O add element ip t portrange { 100-200 } > > > +O add element ip t portrange { 1024-65535 } > > > J {"add": {"element": {"family": "ip", "table": "t", "name": "portrange", "elem": {"set": [{"range": [100, 200]}]}}}} > > > +J {"add": {"element": {"family": "ip", "table": "t", "name": "portrange", "elem": {"set": [{"range": [1024, 65535]}]}}}} > > > > This is odd: Why does monitor output reverse input? If nft reorders > > input, the test ("make sure half open before other element works") is > > probably moot anyway. > > Because elements are collapsed in one single command. > > I add element ip t portrange { 1024-65535 } > I add element ip t portrange { 100-200 } > > and there is qsort() to search for interval overlaps. > > this becomes one single command with { 100-200, 1024-65535 } > > I have a patch to remove the overlap check using qsort() from > userspace which should remove this reordering, but it seems there is a > overlap case that kernel does not handle yet. I can also revert the patch if you don't like, but it is saving _a lot_ of memory from userspace for the silly one element per line case.