Skip to contentSkip to conversation

tests: hash:net,iface.t: check wildcard refresh ordering

PATCH In review Florian Westphal 2 participants 2 messages Nov 5 – Nov 15 netfilter

lore
Share & tools
lore

Florian Westphal

author maintainer
#0 lore raw

PATCH 1/1 tests: hash:net,iface.t: check wildcard refresh ordering

When the first wildcard element gets re-added while '-exist (-!)' option is given that request must not have side effects.

Check that the verdict isn't altered.

---
Yet another problem with the rewrite.

 tests/hash:net,iface.t | 12 ++++++++++++
 1 file changed, 12 insertions(+)
tests/hash:net,iface.t +12 -0
index 9f3d9e36e232..216f7e8a0253 100644
@@ -289,5 +289,17 @@
 0 ipset del test 10.0.6.0/24,eth
 # Check the wildcard element was removed
 1 ipset test test 10.0.6.0/24,eth1
+0 ipset flush test
+# Wildcard refresh ordering: add first wildcard, marked nomatch
+0 ipset add test 10.0.0.0/24,eth wildcard nomatch
+# Wildcard refresh ordering: add second, overlapping wildcard, matching
+0 ipset add test 10.0.0.0/24,et wildcard
+# Wildcard refresh ordering: first-added wildcard must win: nomatch verdict
+1 ipset test test 10.0.0.1,eth0
+# Wildcard refresh ordering: refresh the first wildcard with -exist, data unchanged
+0 ipset -! add test 10.0.0.0/24,eth wildcard nomatch
+# Wildcard refresh ordering: verdict must still be nomatch.
+1 ipset test test 10.0.0.1,eth0
+# Wildcard refresh ordering: destroy set
 0 ipset destroy test
 # eof
Signature · 1 line
2.56.0
#1 lore raw

Hi Florian,

Quoted 17 lines · Florian Westphal

When the first wildcard element gets re-added while '-exist (-!)' option is given that request must not have side effects.

Check that the verdict isn't altered.

---
Yet another problem with the rewrite.

 tests/hash:net,iface.t | 12 ++++++++++++
 1 file changed, 12 insertions(+)
tests/hash:net,iface.t +0 -0
index 9f3d9e36e232..216f7e8a0253 100644

tests/hash:net,iface.t line 298

Quoted 10 lines
tests/hash:net,iface.t +7 -0
@@ -289,5 +289,17 @@
 0 ipset del test 10.0.6.0/24,eth
 # Check the wildcard element was removed
 1 ipset test test 10.0.6.0/24,eth1
+0 ipset flush test
+# Wildcard refresh ordering: add first wildcard, marked nomatch
+0 ipset add test 10.0.0.0/24,eth wildcard nomatch
+# Wildcard refresh ordering: add second, overlapping wildcard, matching
+0 ipset add test 10.0.0.0/24,et wildcard
+# Wildcard refresh ordering: first-added wildcard must win: nomatch verdict
+1 ipset test test 10.0.0.1,eth0

This also not handled with the current code: the wildcards are not ordered in the more-specific, then less specific order.

tests/hash:net,iface.t line 305

Quoted 7 lines
tests/hash:net,iface.t +5 -0
+# Wildcard refresh ordering: refresh the first wildcard with -exist, data unchanged
+0 ipset -! add test 10.0.0.0/24,eth wildcard nomatch
+# Wildcard refresh ordering: verdict must still be nomatch.
+1 ipset test test 10.0.0.1,eth0
+# Wildcard refresh ordering: destroy set
 0 ipset destroy test
 # eof

Best regards,
Jozsef

Signature · 3 lines
E-mail : [email protected], [email protected], [email protected]
Address: Wigner Research Centre for Physics
         H-1525 Budapest 114, POB. 49, Hungary