From: Florian Westphal <fw@strlen.de>
To: <netfilter-devel@vger.kernel.org>
Cc: Jozsef Kadlecsik <kadlec@netfilter.org>, Florian Westphal <fw@strlen.de>
Subject: [PATCH ipset] tests: hash:net,iface.t: add test case for wildcard matching behaviour
Date: Wed, 28 Oct 2026 14:02:03 +0100 [thread overview]
Message-ID: <20261028130203.1398-1-fw@strlen.de> (raw)
Document the existing behaviour of wildcard matching.
Signed-off-by: Florian Westphal <fw@strlen.de>
---
LLM generated. Passes on nf, fails with
rhashtable conversion patches.
tests/hash:net,iface.t | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)
diff --git a/tests/hash:net,iface.t b/tests/hash:net,iface.t
index 556d56df5c4b..b1d92bef26f8 100644
--- a/tests/hash:net,iface.t
+++ b/tests/hash:net,iface.t
@@ -235,4 +235,30 @@
0 ipset list
# Counters and timeout: destroy set
0 ipset x test
+# Re-Create the set for wildcard tests.
+0 ipset create test hash:net,iface hashsize 128
+# Add a specific entry first, a wildcard entry for the same net second.
+0 ipset add test 10.0.1.0/24,eth0
+0 ipset add test 10.0.1.0/24,eth wildcard
+# Delete the specific entry.
+0 ipset del test 10.0.1.0/24,eth0
+# The wildcard entry should still be there and match eth1 via its prefix.
+0 ipset test test 10.0.1.0/24,eth1
+0 ipset flush test
+# Same layout: specific entry first, wildcard entry second.
+0 ipset add test 10.0.2.0/24,eth0
+0 ipset add test 10.0.2.0/24,eth wildcard
+# Re-add the specific entry with -exist, expecting a no-op refresh.
+0 ipset -exist add test 10.0.2.0/24,eth0
+# The wildcard entry should have survived the refresh and still match eth1.
+0 ipset test test 10.0.2.0/24,eth1
+0 ipset flush test
+# Add a nomatch exception first, a wildcard entry for the same net second.
+0 ipset add test 10.0.3.0/24,eth0 nomatch
+0 ipset add test 10.0.3.0/24,eth wildcard
+# eth1 isn't excluded, so the wildcard should match it.
+0 ipset test test 10.0.3.0/24,eth1
+# eth0 is excluded by the nomatch entry; it must not match via the wildcard.
+1 ipset test test 10.0.3.0/24,eth0
+0 ipset destroy test
# eof
--
2.55.0
next reply other threads:[~2026-10-28 13:02 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-28 13:02 Florian Westphal [this message]
2026-11-15 16:39 ` [PATCH ipset] tests: hash:net,iface.t: add test case for wildcard matching behaviour Jozsef Kadlecsik
2026-11-15 18:21 ` Florian Westphal
2026-11-17 16:26 ` Jozsef Kadlecsik
2026-11-17 17:10 ` Florian Westphal
2026-11-15 16:45 ` Jozsef Kadlecsik
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261028130203.1398-1-fw@strlen.de \
--to=fw@strlen.de \
--cc=kadlec@netfilter.org \
--cc=netfilter-devel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.