From: Florian Westphal <fw@strlen.de>
To: <netfilter-devel@vger.kernel.org>
Cc: kadlec@netfilter.org, Florian Westphal <fw@strlen.de>
Subject: [PATCH ipset 2/7] tests: runtest.sh: run inside namespace
Date: Thu, 9 Jul 2026 22:03:53 +0200 [thread overview]
Message-ID: <20260709200358.15504-3-fw@strlen.de> (raw)
In-Reply-To: <20260709200358.15504-1-fw@strlen.de>
re-exec the script in case IPSET_UNSHARED environment
variable isn't set yet.
Add a dummy device named 'eth0' as thats what tests expect
to be present.
Signed-off-by: Florian Westphal <fw@strlen.de>
---
tests/runtest.sh | 21 ++++++++++++++++++++-
1 file changed, 20 insertions(+), 1 deletion(-)
diff --git a/tests/runtest.sh b/tests/runtest.sh
index d102305fff5f..766335fda768 100755
--- a/tests/runtest.sh
+++ b/tests/runtest.sh
@@ -18,13 +18,32 @@ tests="$tests hash:net,port,net hash:net6,port,net6"
tests="$tests hash:net,iface.t hash:mac.t"
tests="$tests comment setlist restore"
# tests="$tests iptree iptreemap"
+
+if [ "$IPSET_UNSHARED" = "" ]; then
+ # Re-execute in new network namespace
+ export IPSET_UNSHARED="yes"
+ sysctl net.netfilter.nf_log_all_netns=1
+ exec unshare -n -- "$0" "$@"
+fi
+
+sysctl net.ipv4.conf.all.rp_filter=0
+
cleanup() {
rm -f "$tmpdir"/.foo*
rm -f "$tmpdir/.loglines"
rmdir "$tmpdir"
+ ip link del eth0
}
trap cleanup EXIT
-tmpdir=$(mktemp -t -d ipset-XXXXXXXX)
+tmpdir=$(mktemp -t -d ip-set-XXXXXXXX)
+
+ip link set lo up
+
+# test cases send and expect packets on eth0.
+ip link add dev eth0 type dummy
+ip link set eth0 up
+ip addr add 10.255.255.64/8 dev eth0
+sysctl net.ipv4.conf.eth0.rp_filter=0
# For correct sorting:
LC_ALL=C
--
2.54.0
next prev parent reply other threads:[~2026-07-09 20:04 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-09 20:03 [PATCH ipset 0/7] test updates Florian Westphal
2026-07-09 20:03 ` [PATCH ipset 1/7] tests: make runtest.sh work with readonly-cwd Florian Westphal
2026-07-09 20:03 ` Florian Westphal [this message]
2026-07-09 20:03 ` [PATCH ipset 3/7] tests: diff.sh: preserve file name Florian Westphal
2026-07-09 20:03 ` [PATCH ipset 4/7] tests: check_klog.sh: unclutter stderr Florian Westphal
2026-07-09 20:03 ` [PATCH ipset 5/7] tests: setlist_ns.sh: use local ipset binary and don't rely on userns Florian Westphal
2026-07-09 20:03 ` [PATCH ipset 6/7] tests: make setlist_resize.sh more verbose on error Florian Westphal
2026-07-09 20:03 ` [PATCH ipset 7/7] tests: runtest.sh: add sendip emulation via scapy Florian Westphal
2026-07-13 13:35 ` [PATCH ipset 0/7] test updates Jozsef Kadlecsik
2026-07-13 14:11 ` Pablo Neira Ayuso
2026-07-13 14:25 ` 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=20260709200358.15504-3-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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox