[Devel] [PATCH RHEL10 COMMIT] selftests: net: run reuseport tests in netns to avoid port conflicts
Konstantin Khorenko
khorenko at virtuozzo.com
Thu Dec 25 14:14:37 MSK 2025
The commit is pushed to "branch-rh10-6.12.0-55.13.1.3.x.vz10-ovz" and will appear at git at bitbucket.org:openvz/vzkernel.git
after rh10-6.12.0-55.13.1.3.28.vz10
------>
commit 6fddea051a204caee19a955ea3f490a7e805e959
Author: Konstantin Khorenko <khorenko at virtuozzo.com>
Date: Tue Dec 23 22:22:47 2025 +0000
selftests: net: run reuseport tests in netns to avoid port conflicts
Some net kselftests use fixed ports which overlap with process-exporter
service already running on the host. When such a conflict happens,
the test fail with:
failed to bind receive socket: Address already in use
Instead of changing port numbers, run the affected tests in isolated
network namespace to avoid conflicts with running daemons.
This approach is consistent with upstream solution used in
fc49b804967e5 ("selftests: netfilter: run conntrack_dump_flush in netns")
and follows the pattern already used by reuseport_addr_any.sh test.
https://virtuozzo.atlassian.net/browse/VSTOR-120995
Signed-off-by: Konstantin Khorenko <khorenko at virtuozzo.com>
Reviewed-by: Pavel Tikhomirov <ptikhomirov at virtuozzo.com>
Feature: fix selftests
---
tools/testing/selftests/net/Makefile | 5 +++--
tools/testing/selftests/net/reuseport_bpf.sh | 4 ++++
tools/testing/selftests/net/reuseport_bpf_cpu.sh | 4 ++++
tools/testing/selftests/net/reuseport_bpf_numa.sh | 4 ++++
tools/testing/selftests/net/reuseport_dualstack.sh | 4 ++++
5 files changed, 19 insertions(+), 2 deletions(-)
diff --git a/tools/testing/selftests/net/Makefile b/tools/testing/selftests/net/Makefile
index 744c8827650c3..3ecd2c34b3d1f 100644
--- a/tools/testing/selftests/net/Makefile
+++ b/tools/testing/selftests/net/Makefile
@@ -11,6 +11,7 @@ TEST_PROGS := run_netsocktests run_afpackettests test_bpf.sh netdevice.sh \
TEST_PROGS += fib_tests.sh fib-onlink-tests.sh pmtu.sh udpgso.sh ip_defrag.sh
TEST_PROGS += udpgso_bench.sh fib_rule_tests.sh msg_zerocopy.sh psock_snd.sh
TEST_PROGS += udpgro_bench.sh udpgro.sh test_vxlan_under_vrf.sh reuseport_addr_any.sh
+TEST_PROGS += reuseport_bpf.sh reuseport_bpf_cpu.sh reuseport_bpf_numa.sh reuseport_dualstack.sh
TEST_PROGS += test_vxlan_fdb_changelink.sh so_txtime.sh ipv6_flowlabel.sh
TEST_PROGS += tcp_fastopen_backup_key.sh fcnal-test.sh l2tp.sh traceroute.sh
TEST_PROGS += fin_ack_lat.sh fib_nexthop_multiprefix.sh fib_nexthops.sh fib_nexthop_nongw.sh
@@ -69,8 +70,8 @@ TEST_GEN_FILES += hwtstamp_config rxtimestamp timestamping txtimestamp
TEST_GEN_FILES += ipsec
TEST_GEN_FILES += ioam6_parser
TEST_GEN_FILES += gro
-TEST_GEN_PROGS = reuseport_bpf reuseport_bpf_cpu reuseport_bpf_numa
-TEST_GEN_PROGS += reuseport_dualstack reuseaddr_conflict tls tun tap epoll_busy_poll
+TEST_GEN_FILES += reuseport_bpf reuseport_bpf_cpu reuseport_bpf_numa reuseport_dualstack
+TEST_GEN_PROGS = reuseaddr_conflict tls tun tap epoll_busy_poll
TEST_GEN_FILES += toeplitz
TEST_GEN_FILES += cmsg_sender
TEST_GEN_FILES += stress_reuseport_listen
diff --git a/tools/testing/selftests/net/reuseport_bpf.sh b/tools/testing/selftests/net/reuseport_bpf.sh
new file mode 100755
index 0000000000000..75014a5462a15
--- /dev/null
+++ b/tools/testing/selftests/net/reuseport_bpf.sh
@@ -0,0 +1,4 @@
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0
+
+./in_netns.sh ./reuseport_bpf
diff --git a/tools/testing/selftests/net/reuseport_bpf_cpu.sh b/tools/testing/selftests/net/reuseport_bpf_cpu.sh
new file mode 100755
index 0000000000000..243dc5bee0142
--- /dev/null
+++ b/tools/testing/selftests/net/reuseport_bpf_cpu.sh
@@ -0,0 +1,4 @@
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0
+
+./in_netns.sh ./reuseport_bpf_cpu
diff --git a/tools/testing/selftests/net/reuseport_bpf_numa.sh b/tools/testing/selftests/net/reuseport_bpf_numa.sh
new file mode 100755
index 0000000000000..eccab95a32029
--- /dev/null
+++ b/tools/testing/selftests/net/reuseport_bpf_numa.sh
@@ -0,0 +1,4 @@
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0
+
+./in_netns.sh ./reuseport_bpf_numa
diff --git a/tools/testing/selftests/net/reuseport_dualstack.sh b/tools/testing/selftests/net/reuseport_dualstack.sh
new file mode 100755
index 0000000000000..82cc8e345a835
--- /dev/null
+++ b/tools/testing/selftests/net/reuseport_dualstack.sh
@@ -0,0 +1,4 @@
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0
+
+./in_netns.sh ./reuseport_dualstack
More information about the Devel
mailing list