* [PATCH net v4 0/5] selftests: net: fix false failures due to missing features and host interference
@ 2026-03-09 15:20 Aleksei Oladko
2026-03-09 15:20 ` [PATCH net v4 1/5] selftests: net: make ovs-dpctl.py fail when pyroute2 is unsupported Aleksei Oladko
` (5 more replies)
0 siblings, 6 replies; 14+ messages in thread
From: Aleksei Oladko @ 2026-03-09 15:20 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
Aleksei Oladko (4):
selftests: net: make ovs-dpctl.py fail when pyroute2 is unsupported
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 +
.../selftests/net/openvswitch/ovs-dpctl.py | 2 +-
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 +
9 files changed, 2547 insertions(+), 2491 deletions(-)
create mode 100755 tools/testing/selftests/net/pmtu-test.sh
--
2.43.0
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH net v4 1/5] selftests: net: make ovs-dpctl.py fail when pyroute2 is unsupported
2026-03-09 15:20 [PATCH net v4 0/5] selftests: net: fix false failures due to missing features and host interference Aleksei Oladko
@ 2026-03-09 15:20 ` Aleksei Oladko
2026-03-11 12:48 ` Aaron Conole
2026-03-09 15:20 ` [PATCH net v4 2/5] selftests: net: run reuseport in an isolated netns Aleksei Oladko
` (4 subsequent siblings)
5 siblings, 1 reply; 14+ messages in thread
From: Aleksei Oladko @ 2026-03-09 15:20 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 pmtu.sh kselftest configures OVS using ovs-dpctl.py and falls back
to ovs-vsctl only when ovs-dpctl.py fails. However, ovs-dpctl.py exits
with a success status when the installed pyroute2 package version is
lower than 0.6, even though the OVS datapath is not configured.
As a result, pmtu.sh assumes that the setup was successful and
continues running the test, which later fails due to the missing
OVS configuration.
Fix the exit code handling in ovs-dpctl.py so that pmtu.sh can detect
that the setup did not complete successfully and fall back to
ovs-vsctl.
Fixes: 962e8a01eab9 ("selftests: openvswitch: Add version check for pyroute2")
Signed-off-by: Aleksei Oladko <aleksey.oladko@virtuozzo.com>
---
tools/testing/selftests/net/openvswitch/ovs-dpctl.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/testing/selftests/net/openvswitch/ovs-dpctl.py b/tools/testing/selftests/net/openvswitch/ovs-dpctl.py
index b521e0dea506..848f61fdcee0 100644
--- a/tools/testing/selftests/net/openvswitch/ovs-dpctl.py
+++ b/tools/testing/selftests/net/openvswitch/ovs-dpctl.py
@@ -2583,7 +2583,7 @@ def main(argv):
prverscheck = pyroute2.__version__.split(".")
if int(prverscheck[0]) == 0 and int(prverscheck[1]) < 6:
print("Need to upgrade the python pyroute2 package to >= 0.6.")
- sys.exit(0)
+ sys.exit(1)
parser = argparse.ArgumentParser()
parser.add_argument(
--
2.43.0
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH net v4 2/5] selftests: net: run reuseport in an isolated netns
2026-03-09 15:20 [PATCH net v4 0/5] selftests: net: fix false failures due to missing features and host interference Aleksei Oladko
2026-03-09 15:20 ` [PATCH net v4 1/5] selftests: net: make ovs-dpctl.py fail when pyroute2 is unsupported Aleksei Oladko
@ 2026-03-09 15:20 ` Aleksei Oladko
2026-03-10 16:38 ` Stefano Brivio
2026-03-09 15:20 ` [PATCH net v4 3/5] selftests: net: rename pmtu.sh to pmtu-test.sh Aleksei Oladko
` (3 subsequent siblings)
5 siblings, 1 reply; 14+ messages in thread
From: Aleksei Oladko @ 2026-03-09 15:20 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] 14+ messages in thread
* [PATCH net v4 3/5] selftests: net: rename pmtu.sh to pmtu-test.sh
2026-03-09 15:20 [PATCH net v4 0/5] selftests: net: fix false failures due to missing features and host interference Aleksei Oladko
2026-03-09 15:20 ` [PATCH net v4 1/5] selftests: net: make ovs-dpctl.py fail when pyroute2 is unsupported Aleksei Oladko
2026-03-09 15:20 ` [PATCH net v4 2/5] selftests: net: run reuseport in an isolated netns Aleksei Oladko
@ 2026-03-09 15:20 ` Aleksei Oladko
2026-03-10 16:38 ` Stefano Brivio
2026-03-12 3:10 ` Jakub Kicinski
2026-03-09 15:20 ` [PATCH net v4 4/5] selftests: net: run pmtu.sh in netns to avoid host firewall interference Aleksei Oladko
` (2 subsequent siblings)
5 siblings, 2 replies; 14+ messages in thread
From: Aleksei Oladko @ 2026-03-09 15:20 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] 14+ messages in thread
* [PATCH net v4 4/5] selftests: net: run pmtu.sh in netns to avoid host firewall interference
2026-03-09 15:20 [PATCH net v4 0/5] selftests: net: fix false failures due to missing features and host interference Aleksei Oladko
` (2 preceding siblings ...)
2026-03-09 15:20 ` [PATCH net v4 3/5] selftests: net: rename pmtu.sh to pmtu-test.sh Aleksei Oladko
@ 2026-03-09 15:20 ` Aleksei Oladko
2026-03-09 15:20 ` [PATCH net v4 5/5] selftests: net: io_uring_zerocopy: enable io_uring for the test Aleksei Oladko
2026-03-12 3:08 ` [PATCH net v4 0/5] selftests: net: fix false failures due to missing features and host interference Jakub Kicinski
5 siblings, 0 replies; 14+ messages in thread
From: Aleksei Oladko @ 2026-03-09 15:20 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] 14+ messages in thread
* [PATCH net v4 5/5] selftests: net: io_uring_zerocopy: enable io_uring for the test
2026-03-09 15:20 [PATCH net v4 0/5] selftests: net: fix false failures due to missing features and host interference Aleksei Oladko
` (3 preceding siblings ...)
2026-03-09 15:20 ` [PATCH net v4 4/5] selftests: net: run pmtu.sh in netns to avoid host firewall interference Aleksei Oladko
@ 2026-03-09 15:20 ` Aleksei Oladko
2026-03-12 3:08 ` [PATCH net v4 0/5] selftests: net: fix false failures due to missing features and host interference Jakub Kicinski
5 siblings, 0 replies; 14+ messages in thread
From: Aleksei Oladko @ 2026-03-09 15:20 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] 14+ messages in thread
* Re: [PATCH net v4 2/5] selftests: net: run reuseport in an isolated netns
2026-03-09 15:20 ` [PATCH net v4 2/5] selftests: net: run reuseport in an isolated netns Aleksei Oladko
@ 2026-03-10 16:38 ` Stefano Brivio
0 siblings, 0 replies; 14+ messages in thread
From: Stefano Brivio @ 2026-03-10 16:38 UTC (permalink / raw)
To: Aleksei Oladko
Cc: David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Simon Horman, Shuah Khan, Aaron Conole, Ilya Maximets,
Eelco Chaudron, netdev, linux-kselftest, linux-kernel, dev
Sorry for the late review, just one hint here (no changes requested):
On Mon, 9 Mar 2026 15:20:10 +0000
Aleksei Oladko <aleksey.oladko@virtuozzo.com> wrote:
> 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");
I don't have much against this approach, except that it needs root /
UID 0 (but these are BPF tests anyway, and that was also the case for
3/5 before), and that it's a bit ugly to invoke ip-link like that.
Anyway, should you or somebody else ever need a snippet that does this
as unprivileged user (giving CLONE_NEWUSER at the same time) and without
external tools or libraries, I made this a while ago:
https://archives.passt.top/passt-dev/20231206160808.3d312733@elisabeth/
It detaches the network namespace, brings up 'lo' with a minimalistic
netlink implementation, and lets you do whatever you need there.
I guess ideally it could live under selftests/net/lib/ and be used from
C programs or as stand-alone tool for shell scripts as well.
I don't see myself polishing things up and proposing that in the
foreseeable future, but I thought maybe you're interested in it.
> +}
> +
> 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);
--
Stefano
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH net v4 3/5] selftests: net: rename pmtu.sh to pmtu-test.sh
2026-03-09 15:20 ` [PATCH net v4 3/5] selftests: net: rename pmtu.sh to pmtu-test.sh Aleksei Oladko
@ 2026-03-10 16:38 ` Stefano Brivio
2026-03-12 3:10 ` Jakub Kicinski
1 sibling, 0 replies; 14+ messages in thread
From: Stefano Brivio @ 2026-03-10 16:38 UTC (permalink / raw)
To: Aleksei Oladko
Cc: David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Simon Horman, Shuah Khan, Aaron Conole, Ilya Maximets,
Eelco Chaudron, netdev, linux-kselftest, linux-kernel, dev
Nit, only in case this needs a re-spin for whatever reason:
On Mon, 9 Mar 2026 15:20:11 +0000
Aleksei Oladko <aleksey.oladko@virtuozzo.com> wrote:
> Rename the pmtu.sh test script to pmtu-test.sh. No functional
> changes are made, only the file name is updated.
I don't think pmtu-test.sh is very descriptive. I think leaving it as
pmtu.sh and having the new pmtu.sh named pmtu_run.sh would be more
self-explanatory. But it's not a strong preference either way.
> 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
--
Stefano
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH net v4 1/5] selftests: net: make ovs-dpctl.py fail when pyroute2 is unsupported
2026-03-09 15:20 ` [PATCH net v4 1/5] selftests: net: make ovs-dpctl.py fail when pyroute2 is unsupported Aleksei Oladko
@ 2026-03-11 12:48 ` Aaron Conole
0 siblings, 0 replies; 14+ messages in thread
From: Aaron Conole @ 2026-03-11 12:48 UTC (permalink / raw)
To: Aleksei Oladko
Cc: David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Simon Horman, Shuah Khan, Ilya Maximets, Eelco Chaudron,
Stefano Brivio, netdev, linux-kselftest, linux-kernel, dev
Aleksei Oladko <aleksey.oladko@virtuozzo.com> writes:
> The pmtu.sh kselftest configures OVS using ovs-dpctl.py and falls back
> to ovs-vsctl only when ovs-dpctl.py fails. However, ovs-dpctl.py exits
> with a success status when the installed pyroute2 package version is
> lower than 0.6, even though the OVS datapath is not configured.
>
> As a result, pmtu.sh assumes that the setup was successful and
> continues running the test, which later fails due to the missing
> OVS configuration.
>
> Fix the exit code handling in ovs-dpctl.py so that pmtu.sh can detect
> that the setup did not complete successfully and fall back to
> ovs-vsctl.
>
> Fixes: 962e8a01eab9 ("selftests: openvswitch: Add version check for pyroute2")
> Signed-off-by: Aleksei Oladko <aleksey.oladko@virtuozzo.com>
> ---
Still LGTM (but this is already in net-next as 0bcac7b11262 so does it
need to be included still? Actually I think it should be in 'net')
(including tag just in case)
Reviewed-by: Aaron Conole <aconole@redhat.com>
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH net v4 0/5] selftests: net: fix false failures due to missing features and host interference
2026-03-09 15:20 [PATCH net v4 0/5] selftests: net: fix false failures due to missing features and host interference Aleksei Oladko
` (4 preceding siblings ...)
2026-03-09 15:20 ` [PATCH net v4 5/5] selftests: net: io_uring_zerocopy: enable io_uring for the test Aleksei Oladko
@ 2026-03-12 3:08 ` Jakub Kicinski
5 siblings, 0 replies; 14+ messages in thread
From: Jakub Kicinski @ 2026-03-12 3:08 UTC (permalink / raw)
To: Aleksei Oladko
Cc: David S . Miller, Eric Dumazet, Paolo Abeni, Simon Horman,
Shuah Khan, Aaron Conole, Ilya Maximets, Eelco Chaudron,
Stefano Brivio, netdev, linux-kselftest, linux-kernel, dev
On Mon, 9 Mar 2026 15:20:08 +0000 Aleksei Oladko wrote:
> Subject: [PATCH net v4 0/5] selftests: net: fix false failures due to missing features and host interference
Please post for net-next, "PATCH net-next v5"
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH net v4 3/5] selftests: net: rename pmtu.sh to pmtu-test.sh
2026-03-09 15:20 ` [PATCH net v4 3/5] selftests: net: rename pmtu.sh to pmtu-test.sh Aleksei Oladko
2026-03-10 16:38 ` Stefano Brivio
@ 2026-03-12 3:10 ` Jakub Kicinski
2026-03-12 3:12 ` Jakub Kicinski
2026-03-15 19:25 ` Aleksei Oladko
1 sibling, 2 replies; 14+ messages in thread
From: Jakub Kicinski @ 2026-03-12 3:10 UTC (permalink / raw)
To: Aleksei Oladko
Cc: David S . Miller, Eric Dumazet, Paolo Abeni, Simon Horman,
Shuah Khan, Aaron Conole, Ilya Maximets, Eelco Chaudron,
Stefano Brivio, netdev, linux-kselftest, linux-kernel, dev
On Mon, 9 Mar 2026 15:20:11 +0000 Aleksei Oladko wrote:
> Rename the pmtu.sh test script to pmtu-test.sh. No functional
> changes are made, only the file name is updated.
Please try to fix the test ?
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH net v4 3/5] selftests: net: rename pmtu.sh to pmtu-test.sh
2026-03-12 3:10 ` Jakub Kicinski
@ 2026-03-12 3:12 ` Jakub Kicinski
2026-03-15 19:25 ` Aleksei Oladko
1 sibling, 0 replies; 14+ messages in thread
From: Jakub Kicinski @ 2026-03-12 3:12 UTC (permalink / raw)
To: Aleksei Oladko
Cc: David S . Miller, Eric Dumazet, Paolo Abeni, Simon Horman,
Shuah Khan, Aaron Conole, Ilya Maximets, Eelco Chaudron,
Stefano Brivio, netdev, linux-kselftest, linux-kernel, dev
On Wed, 11 Mar 2026 20:10:57 -0700 Jakub Kicinski wrote:
> On Mon, 9 Mar 2026 15:20:11 +0000 Aleksei Oladko wrote:
> > Rename the pmtu.sh test script to pmtu-test.sh. No functional
> > changes are made, only the file name is updated.
>
> Please try to fix the test ?
BTW IIRC there's a way to make the runner run every test in a new netns.
But personally I'm not sure whether that should free us from making the
tests not break the host, probably not..
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH net v4 3/5] selftests: net: rename pmtu.sh to pmtu-test.sh
2026-03-12 3:10 ` Jakub Kicinski
2026-03-12 3:12 ` Jakub Kicinski
@ 2026-03-15 19:25 ` Aleksei Oladko
2026-03-16 20:55 ` Stefano Brivio
1 sibling, 1 reply; 14+ messages in thread
From: Aleksei Oladko @ 2026-03-15 19:25 UTC (permalink / raw)
To: Jakub Kicinski
Cc: David S . Miller, Eric Dumazet, Paolo Abeni, Simon Horman,
Shuah Khan, Aaron Conole, Ilya Maximets, Eelco Chaudron,
Stefano Brivio, netdev, linux-kselftest, linux-kernel, dev
In v2
(https://lore.kernel.org/linux-kselftest/f7t1pj9v8h7.fsf@redhat.com/T/#m80f10ade0ba8963ac6b09b8aba07163cb3e4cf59),
I was asked to rename the main script for tracking purposes. Should I
proceed with this setup?
On 3/12/26 4:10 AM, Jakub Kicinski wrote:
> On Mon, 9 Mar 2026 15:20:11 +0000 Aleksei Oladko wrote:
>> Rename the pmtu.sh test script to pmtu-test.sh. No functional
>> changes are made, only the file name is updated.
> Please try to fix the test ?
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH net v4 3/5] selftests: net: rename pmtu.sh to pmtu-test.sh
2026-03-15 19:25 ` Aleksei Oladko
@ 2026-03-16 20:55 ` Stefano Brivio
0 siblings, 0 replies; 14+ messages in thread
From: Stefano Brivio @ 2026-03-16 20:55 UTC (permalink / raw)
To: Aleksei Oladko
Cc: Jakub Kicinski, David S . Miller, Eric Dumazet, Paolo Abeni,
Simon Horman, Shuah Khan, Aaron Conole, Ilya Maximets,
Eelco Chaudron, netdev, linux-kselftest, linux-kernel, dev
On Sun, 15 Mar 2026 20:25:31 +0100
Aleksei Oladko <aleksey.oladko@virtuozzo.com> wrote:
> In v2
> (https://lore.kernel.org/linux-kselftest/f7t1pj9v8h7.fsf@redhat.com/T/#m80f10ade0ba8963ac6b09b8aba07163cb3e4cf59),
> I was asked to rename the main script for tracking purposes. Should I
> proceed with this setup?
Ah, sorry, I missed Jakub's comment as it came just before Aaron Cc'ed
me (that's the Message-ID above).
I didn't consider that when I suggested to keep the current pmtu.sh as
pmtu.sh instead (this seems to be missing from your quote). Never mind
then!
--
Stefano
^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2026-03-16 20:55 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-09 15:20 [PATCH net v4 0/5] selftests: net: fix false failures due to missing features and host interference Aleksei Oladko
2026-03-09 15:20 ` [PATCH net v4 1/5] selftests: net: make ovs-dpctl.py fail when pyroute2 is unsupported Aleksei Oladko
2026-03-11 12:48 ` Aaron Conole
2026-03-09 15:20 ` [PATCH net v4 2/5] selftests: net: run reuseport in an isolated netns Aleksei Oladko
2026-03-10 16:38 ` Stefano Brivio
2026-03-09 15:20 ` [PATCH net v4 3/5] selftests: net: rename pmtu.sh to pmtu-test.sh Aleksei Oladko
2026-03-10 16:38 ` Stefano Brivio
2026-03-12 3:10 ` Jakub Kicinski
2026-03-12 3:12 ` Jakub Kicinski
2026-03-15 19:25 ` Aleksei Oladko
2026-03-16 20:55 ` Stefano Brivio
2026-03-09 15:20 ` [PATCH net v4 4/5] selftests: net: run pmtu.sh in netns to avoid host firewall interference Aleksei Oladko
2026-03-09 15:20 ` [PATCH net v4 5/5] selftests: net: io_uring_zerocopy: enable io_uring for the test Aleksei Oladko
2026-03-12 3:08 ` [PATCH net v4 0/5] selftests: net: fix false failures due to missing features and host interference Jakub Kicinski
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox