* [PATCH net-next v5 0/4] selftests: net: fix false failures due to missing features and host interference
@ 2026-03-19 10:31 Aleksei Oladko
2026-03-19 10:31 ` [PATCH net-next v5 1/4] selftests: net: run reuseport in an isolated netns Aleksei Oladko
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: Aleksei Oladko @ 2026-03-19 10:31 UTC (permalink / raw)
To: David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Simon Horman, Shuah Khan, Aaron Conole, Ilya Maximets,
Eelco Chaudron, Stefano Brivio
Cc: netdev, linux-kselftest, linux-kernel, dev, Aleksei Oladko
Hi,
This series addresses several issues in the networking kselftests
that cause false-positive failures depending on the host environment,
kernel configuration, or library versions.
The main focus of these changes is to isolate tests from the host
environment (using namespaces) and to ensure proper fallback or
skipping when dependencies are missing.
Summary of changes:
1. Fixes ovs-dpctl.py to return a non-zero exit code when pyroute2
is too old. This allows pmtu.sh to correctly fall back to ovs-vsctl
instead of assuming the configuration was successful.
2-4. Move reuseport test into dedicated network namespaces. This prevents
failures caused by port conflicts with host processes or interference
from host firewall rules.
5. Ensures io_uring is enabled via sysctl before running io_uring_zerocopy
test, preventing failures on systems where kernel.io_uring_disabled
is set.
Signed-off-by: Aleksei Oladko <aleksey.oladko@virtuozzo.com>
Changes in v2:
- Fixed a typo by adding the missing backslash in Makefile
- Added a Fixes: tag to the appropriate commit as requested
- Link to v1: https://lore.kernel.org/linux-kselftest/20260120230558.328423-1-aleksey.oladko@virtuozzo.com
Changes in v3:
- renamed pmtu.sh to pmtu-test.sh and used pmtu.sh as the name
of the wrapper.
- since the test now runs in a dedicated netns, updates the ovs
test case to correctly move network interfaces into the target
namespace.
- Link to v2: https://lore.kernel.org/linux-kselftest/f7t1pj9v8h7.fsf@redhat.com/T/#t
Changes in v4:
- dropped the patch "selftests: net: fib_tests: skip rp_filter test if
cls_basic is unavailable" since the test environment is expected to
have all mandatory config options enabled.
- moved isolation logic from in_netns.sh wrapper to unshare() call in
reuseport_ tests
- Link to v3: https://lore.kernel.org/linux-kselftest/20260306000127.519064-1-aleksey.oladko@virtuozzo.com/T/#t
Changes in v4:
- changed patch prefix/tag from "net" to "next-next"
- Link to v4: https://lore.kernel.org/linux-kselftest/20260309152013.565216-1-aleksey.oladko@virtuozzo.com/T/#t
Aleksei Oladko (3):
selftests: net: run reuseport in an isolated netns
selftests: net: rename pmtu.sh to pmtu-test.sh
selftests: net: io_uring_zerocopy: enable io_uring for the test
Konstantin Khorenko (1):
selftests: net: run pmtu.sh in netns to avoid host firewall
interference
tools/testing/selftests/net/Makefile | 1 +
.../selftests/net/io_uring_zerocopy_tx.sh | 9 +
tools/testing/selftests/net/pmtu-test.sh | 2492 +++++++++++++++++
tools/testing/selftests/net/pmtu.sh | 2492 +----------------
tools/testing/selftests/net/reuseport_bpf.c | 11 +
.../testing/selftests/net/reuseport_bpf_cpu.c | 10 +
.../selftests/net/reuseport_bpf_numa.c | 10 +
.../selftests/net/reuseport_dualstack.c | 11 +
8 files changed, 2546 insertions(+), 2490 deletions(-)
create mode 100755 tools/testing/selftests/net/pmtu-test.sh
--
2.43.0
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH net-next v5 1/4] selftests: net: run reuseport in an isolated netns
2026-03-19 10:31 [PATCH net-next v5 0/4] selftests: net: fix false failures due to missing features and host interference Aleksei Oladko
@ 2026-03-19 10:31 ` Aleksei Oladko
2026-03-19 10:31 ` [PATCH net-next v5 2/4] selftests: net: rename pmtu.sh to pmtu-test.sh Aleksei Oladko
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Aleksei Oladko @ 2026-03-19 10:31 UTC (permalink / raw)
To: David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Simon Horman, Shuah Khan, Aaron Conole, Ilya Maximets,
Eelco Chaudron, Stefano Brivio
Cc: netdev, linux-kselftest, linux-kernel, dev, Aleksei Oladko
The reuseport_* tests (bpf, bpf_cpu, bpf_numa, dualstack) currently use
a fixed port range. This can cause intermittent test failures when the
ports are already in use by other services:
failed to bind receive socket: Address already in use
To avoid conflicts, run these tests in separate network namespaces using
unshare. Each test now has its own isolated network stack, preventing
port collisions with the host services.
Signed-off-by: Aleksei Oladko <aleksey.oladko@virtuozzo.com>
---
tools/testing/selftests/net/reuseport_bpf.c | 11 +++++++++++
tools/testing/selftests/net/reuseport_bpf_cpu.c | 10 ++++++++++
tools/testing/selftests/net/reuseport_bpf_numa.c | 10 ++++++++++
tools/testing/selftests/net/reuseport_dualstack.c | 11 +++++++++++
4 files changed, 42 insertions(+)
diff --git a/tools/testing/selftests/net/reuseport_bpf.c b/tools/testing/selftests/net/reuseport_bpf.c
index b6634d6da3d6..12e48b97b862 100644
--- a/tools/testing/selftests/net/reuseport_bpf.c
+++ b/tools/testing/selftests/net/reuseport_bpf.c
@@ -23,6 +23,7 @@
#include <sys/socket.h>
#include <sys/resource.h>
#include <unistd.h>
+#include <sched.h>
#include "kselftest.h"
@@ -455,8 +456,18 @@ static __attribute__((destructor)) void main_dtor(void)
setrlimit(RLIMIT_MEMLOCK, &rlim_old);
}
+static void setup_netns(void)
+{
+ if (unshare(CLONE_NEWNET))
+ error(1, errno, "failed to unshare netns");
+ if (system("ip link set lo up"))
+ error(1, 0, "failed to bring up lo interface in netns");
+}
+
int main(void)
{
+ setup_netns();
+
fprintf(stderr, "---- IPv4 UDP ----\n");
/* NOTE: UDP socket lookups traverse a different code path when there
* are > 10 sockets in a group. Run the bpf test through both paths.
diff --git a/tools/testing/selftests/net/reuseport_bpf_cpu.c b/tools/testing/selftests/net/reuseport_bpf_cpu.c
index 2d646174729f..ddfe92f6597a 100644
--- a/tools/testing/selftests/net/reuseport_bpf_cpu.c
+++ b/tools/testing/selftests/net/reuseport_bpf_cpu.c
@@ -228,10 +228,20 @@ static void test(int *rcv_fd, int len, int family, int proto)
close(rcv_fd[cpu]);
}
+static void setup_netns(void)
+{
+ if (unshare(CLONE_NEWNET))
+ error(1, errno, "failed to unshare netns");
+ if (system("ip link set lo up"))
+ error(1, 0, "failed to bring up lo interface in netns");
+}
+
int main(void)
{
int *rcv_fd, cpus;
+ setup_netns();
+
cpus = sysconf(_SC_NPROCESSORS_ONLN);
if (cpus <= 0)
error(1, errno, "failed counting cpus");
diff --git a/tools/testing/selftests/net/reuseport_bpf_numa.c b/tools/testing/selftests/net/reuseport_bpf_numa.c
index 2ffd957ffb15..8ec52fc5ef41 100644
--- a/tools/testing/selftests/net/reuseport_bpf_numa.c
+++ b/tools/testing/selftests/net/reuseport_bpf_numa.c
@@ -230,10 +230,20 @@ static void test(int *rcv_fd, int len, int family, int proto)
close(rcv_fd[node]);
}
+static void setup_netns(void)
+{
+ if (unshare(CLONE_NEWNET))
+ error(1, errno, "failed to unshare netns");
+ if (system("ip link set lo up"))
+ error(1, 0, "failed to bring up lo interface in netns");
+}
+
int main(void)
{
int *rcv_fd, nodes;
+ setup_netns();
+
if (numa_available() < 0)
ksft_exit_skip("no numa api support\n");
diff --git a/tools/testing/selftests/net/reuseport_dualstack.c b/tools/testing/selftests/net/reuseport_dualstack.c
index fb7a59ed759e..0eaf739d0c85 100644
--- a/tools/testing/selftests/net/reuseport_dualstack.c
+++ b/tools/testing/selftests/net/reuseport_dualstack.c
@@ -25,6 +25,7 @@
#include <sys/types.h>
#include <sys/socket.h>
#include <unistd.h>
+#include <sched.h>
static const int PORT = 8888;
@@ -156,10 +157,20 @@ static void test(int *rcv_fds, int count, int proto)
close(epfd);
}
+static void setup_netns(void)
+{
+ if (unshare(CLONE_NEWNET))
+ error(1, errno, "failed to unshare netns");
+ if (system("ip link set lo up"))
+ error(1, 0, "failed to bring up lo interface in netns");
+}
+
int main(void)
{
int rcv_fds[32], i;
+ setup_netns();
+
fprintf(stderr, "---- UDP IPv4 created before IPv6 ----\n");
build_rcv_fd(AF_INET, SOCK_DGRAM, rcv_fds, 5);
build_rcv_fd(AF_INET6, SOCK_DGRAM, &(rcv_fds[5]), 5);
--
2.43.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH net-next v5 2/4] selftests: net: rename pmtu.sh to pmtu-test.sh
2026-03-19 10:31 [PATCH net-next v5 0/4] selftests: net: fix false failures due to missing features and host interference Aleksei Oladko
2026-03-19 10:31 ` [PATCH net-next v5 1/4] selftests: net: run reuseport in an isolated netns Aleksei Oladko
@ 2026-03-19 10:31 ` Aleksei Oladko
2026-03-19 10:31 ` [PATCH net-next v5 3/4] selftests: net: run pmtu.sh in netns to avoid host firewall interference Aleksei Oladko
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Aleksei Oladko @ 2026-03-19 10:31 UTC (permalink / raw)
To: David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Simon Horman, Shuah Khan, Aaron Conole, Ilya Maximets,
Eelco Chaudron, Stefano Brivio
Cc: netdev, linux-kselftest, linux-kernel, dev, Aleksei Oladko
Rename the pmtu.sh test script to pmtu-test.sh. No functional
changes are made, only the file name is updated.
Signed-off-by: Aleksei Oladko <aleksey.oladko@virtuozzo.com>
---
tools/testing/selftests/net/Makefile | 2 +-
tools/testing/selftests/net/{pmtu.sh => pmtu-test.sh} | 0
2 files changed, 1 insertion(+), 1 deletion(-)
rename tools/testing/selftests/net/{pmtu.sh => pmtu-test.sh} (100%)
diff --git a/tools/testing/selftests/net/Makefile b/tools/testing/selftests/net/Makefile
index 605c54c0e8a3..8fa6ef771757 100644
--- a/tools/testing/selftests/net/Makefile
+++ b/tools/testing/selftests/net/Makefile
@@ -63,7 +63,7 @@ TEST_PROGS := \
netns-name.sh \
netns-sysctl.sh \
nl_netdev.py \
- pmtu.sh \
+ pmtu-test.sh \
psock_snd.sh \
reuseaddr_ports_exhausted.sh \
reuseport_addr_any.sh \
diff --git a/tools/testing/selftests/net/pmtu.sh b/tools/testing/selftests/net/pmtu-test.sh
similarity index 100%
rename from tools/testing/selftests/net/pmtu.sh
rename to tools/testing/selftests/net/pmtu-test.sh
--
2.43.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH net-next v5 3/4] selftests: net: run pmtu.sh in netns to avoid host firewall interference
2026-03-19 10:31 [PATCH net-next v5 0/4] selftests: net: fix false failures due to missing features and host interference Aleksei Oladko
2026-03-19 10:31 ` [PATCH net-next v5 1/4] selftests: net: run reuseport in an isolated netns Aleksei Oladko
2026-03-19 10:31 ` [PATCH net-next v5 2/4] selftests: net: rename pmtu.sh to pmtu-test.sh Aleksei Oladko
@ 2026-03-19 10:31 ` Aleksei Oladko
2026-03-19 10:31 ` [PATCH net-next v5 4/4] selftests: net: io_uring_zerocopy: enable io_uring for the test Aleksei Oladko
2026-03-20 16:25 ` [PATCH net-next v5 0/4] selftests: net: fix false failures due to missing features and host interference Simon Horman
4 siblings, 0 replies; 6+ messages in thread
From: Aleksei Oladko @ 2026-03-19 10:31 UTC (permalink / raw)
To: David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Simon Horman, Shuah Khan, Aaron Conole, Ilya Maximets,
Eelco Chaudron, Stefano Brivio
Cc: netdev, linux-kselftest, linux-kernel, dev, Konstantin Khorenko,
Aleksei Oladko
From: Konstantin Khorenko <khorenko@virtuozzo.com>
The pmtu.sh kselftest sets up a multi-namespace test topology where the
host network itself is part of the test setup. Test packets originating
from the created namespace are expected to reach test interface created
in the host. When firewall rules are present on the host, this traffic
may be blocked, causing the test to fail.
Run the test in an isolated network namespace to avoid interference
from host firewall rules.
Signed-off-by: Konstantin Khorenko <khorenko@virtuozzo.com>
Signed-off-by: Aleksei Oladko <aleksey.oladko@virtuozzo.com>
---
tools/testing/selftests/net/Makefile | 3 ++-
tools/testing/selftests/net/pmtu-test.sh | 4 ++--
tools/testing/selftests/net/pmtu.sh | 4 ++++
3 files changed, 8 insertions(+), 3 deletions(-)
create mode 100755 tools/testing/selftests/net/pmtu.sh
diff --git a/tools/testing/selftests/net/Makefile b/tools/testing/selftests/net/Makefile
index 8fa6ef771757..09bcfd2db593 100644
--- a/tools/testing/selftests/net/Makefile
+++ b/tools/testing/selftests/net/Makefile
@@ -63,7 +63,7 @@ TEST_PROGS := \
netns-name.sh \
netns-sysctl.sh \
nl_netdev.py \
- pmtu-test.sh \
+ pmtu.sh \
psock_snd.sh \
reuseaddr_ports_exhausted.sh \
reuseport_addr_any.sh \
@@ -190,6 +190,7 @@ TEST_FILES := \
fcnal-test.sh \
in_netns.sh \
lib.sh \
+ pmtu-test.sh \
settings \
# end of TEST_FILES
diff --git a/tools/testing/selftests/net/pmtu-test.sh b/tools/testing/selftests/net/pmtu-test.sh
index a3323c21f001..2ba6bc0252f0 100755
--- a/tools/testing/selftests/net/pmtu-test.sh
+++ b/tools/testing/selftests/net/pmtu-test.sh
@@ -976,7 +976,7 @@ setup_ovs_bridge() {
run_cmd ip link set ovs_br0 up
run_cmd ${ns_c} ip link add veth_C-A type veth peer name veth_A-C
- run_cmd ${ns_c} ip link set veth_A-C netns 1
+ run_cmd ${ns_c} ip link set veth_A-C netns $$
run_cmd ip link set veth_A-C up
run_cmd ${ns_c} ip link set veth_C-A up
@@ -985,7 +985,7 @@ setup_ovs_bridge() {
setup_ovs_add_if veth_A-C
# Move veth_A-R1 to init
- run_cmd ${ns_a} ip link set veth_A-R1 netns 1
+ run_cmd ${ns_a} ip link set veth_A-R1 netns $$
run_cmd ip addr add ${prefix4}.${a_r1}.1/${veth4_mask} dev veth_A-R1
run_cmd ip addr add ${prefix6}:${a_r1}::1/${veth6_mask} dev veth_A-R1
run_cmd ip link set veth_A-R1 up
diff --git a/tools/testing/selftests/net/pmtu.sh b/tools/testing/selftests/net/pmtu.sh
new file mode 100755
index 000000000000..1805fa44a2de
--- /dev/null
+++ b/tools/testing/selftests/net/pmtu.sh
@@ -0,0 +1,4 @@
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0
+
+./in_netns.sh ./pmtu-test.sh "$@"
--
2.43.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH net-next v5 4/4] selftests: net: io_uring_zerocopy: enable io_uring for the test
2026-03-19 10:31 [PATCH net-next v5 0/4] selftests: net: fix false failures due to missing features and host interference Aleksei Oladko
` (2 preceding siblings ...)
2026-03-19 10:31 ` [PATCH net-next v5 3/4] selftests: net: run pmtu.sh in netns to avoid host firewall interference Aleksei Oladko
@ 2026-03-19 10:31 ` Aleksei Oladko
2026-03-20 16:25 ` [PATCH net-next v5 0/4] selftests: net: fix false failures due to missing features and host interference Simon Horman
4 siblings, 0 replies; 6+ messages in thread
From: Aleksei Oladko @ 2026-03-19 10:31 UTC (permalink / raw)
To: David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Simon Horman, Shuah Khan, Aaron Conole, Ilya Maximets,
Eelco Chaudron, Stefano Brivio
Cc: netdev, linux-kselftest, linux-kernel, dev, Aleksei Oladko,
Konstantin Khorenko
The io_uring_zerocopy.sh kselftest assumes that io_uring support is
enabled on the host system. When io_uring is disabled via the
kernel.io_uring_disabled sysctl, the test fails.
Explicitly enable io_uring for the test by setting
kernel.io_uring_disabled=0.
Save the original value of kernel.io_uring_disabled before changing
it and restore it in cleanup handler to ensure the system state is
restored regardless of test outcome.
Signed-off-by: Aleksei Oladko <aleksey.oladko@virtuozzo.com>
Signed-off-by: Konstantin Khorenko <khorenko@virtuozzo.com>
---
tools/testing/selftests/net/io_uring_zerocopy_tx.sh | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/tools/testing/selftests/net/io_uring_zerocopy_tx.sh b/tools/testing/selftests/net/io_uring_zerocopy_tx.sh
index 123439545013..8c3647de9b4c 100755
--- a/tools/testing/selftests/net/io_uring_zerocopy_tx.sh
+++ b/tools/testing/selftests/net/io_uring_zerocopy_tx.sh
@@ -77,9 +77,13 @@ esac
# Start of state changes: install cleanup handler
+old_io_uring_disabled=0
cleanup() {
ip netns del "${NS2}"
ip netns del "${NS1}"
+ if [ "$old_io_uring_disabled" -ne 0 ]; then
+ sysctl -w -q kernel.io_uring_disabled="$old_io_uring_disabled" 2>/dev/null || true
+ fi
}
trap cleanup EXIT
@@ -122,5 +126,10 @@ do_test() {
wait
}
+old_io_uring_disabled=$(sysctl -n kernel.io_uring_disabled 2>/dev/null || echo "0")
+if [ "$old_io_uring_disabled" -ne 0 ]; then
+ sysctl -w -q kernel.io_uring_disabled=0
+fi
+
do_test "${EXTRA_ARGS}"
echo ok
--
2.43.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH net-next v5 0/4] selftests: net: fix false failures due to missing features and host interference
2026-03-19 10:31 [PATCH net-next v5 0/4] selftests: net: fix false failures due to missing features and host interference Aleksei Oladko
` (3 preceding siblings ...)
2026-03-19 10:31 ` [PATCH net-next v5 4/4] selftests: net: io_uring_zerocopy: enable io_uring for the test Aleksei Oladko
@ 2026-03-20 16:25 ` Simon Horman
4 siblings, 0 replies; 6+ messages in thread
From: Simon Horman @ 2026-03-20 16:25 UTC (permalink / raw)
To: Aleksei Oladko
Cc: David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Shuah Khan, Aaron Conole, Ilya Maximets, Eelco Chaudron,
Stefano Brivio, netdev, linux-kselftest, linux-kernel, dev
On Thu, Mar 19, 2026 at 10:31:19AM +0000, Aleksei Oladko wrote:
> Hi,
>
> This series addresses several issues in the networking kselftests
> that cause false-positive failures depending on the host environment,
> kernel configuration, or library versions.
>
> The main focus of these changes is to isolate tests from the host
> environment (using namespaces) and to ensure proper fallback or
> skipping when dependencies are missing.
>
> Summary of changes:
> 1. Fixes ovs-dpctl.py to return a non-zero exit code when pyroute2
> is too old. This allows pmtu.sh to correctly fall back to ovs-vsctl
> instead of assuming the configuration was successful.
> 2-4. Move reuseport test into dedicated network namespaces. This prevents
> failures caused by port conflicts with host processes or interference
> from host firewall rules.
> 5. Ensures io_uring is enabled via sysctl before running io_uring_zerocopy
> test, preventing failures on systems where kernel.io_uring_disabled
> is set.
>
> Signed-off-by: Aleksei Oladko <aleksey.oladko@virtuozzo.com>
Hi,
Unfortunately this series does not apply cleanly to net-next,
which breaks out CI.
Please rebase and repost.
Thanks!
--
pw-bot: changes-requested
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2026-03-20 16:25 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-19 10:31 [PATCH net-next v5 0/4] selftests: net: fix false failures due to missing features and host interference Aleksei Oladko
2026-03-19 10:31 ` [PATCH net-next v5 1/4] selftests: net: run reuseport in an isolated netns Aleksei Oladko
2026-03-19 10:31 ` [PATCH net-next v5 2/4] selftests: net: rename pmtu.sh to pmtu-test.sh Aleksei Oladko
2026-03-19 10:31 ` [PATCH net-next v5 3/4] selftests: net: run pmtu.sh in netns to avoid host firewall interference Aleksei Oladko
2026-03-19 10:31 ` [PATCH net-next v5 4/4] selftests: net: io_uring_zerocopy: enable io_uring for the test Aleksei Oladko
2026-03-20 16:25 ` [PATCH net-next v5 0/4] selftests: net: fix false failures due to missing features and host interference Simon Horman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox