mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 1/2] selftests: bpf: run test_xdp_features in its own netns
@ 2026-09-17  1:55 Eva Kurchatova
  2026-09-17  1:55 ` [PATCH 2/2] selftests: bpf: size the map in test_lru_sanity3 to whole refills Eva Kurchatova
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Eva Kurchatova @ 2026-09-17  1:55 UTC (permalink / raw)
  To: Alexei Starovoitov, Daniel Borkmann, David S. Miller,
	Jakub Kicinski, Jesper Dangaard Brouer, John Fastabend,
	Stanislav Fomichev, Andrii Nakryiko, Eduard Zingerman,
	Kumar Kartikeya Dwivedi, Martin KaFai Lau, Song Liu,
	Yonghong Song, Jiri Olsa, Emil Tsalapatis, Ihor Solodrai,
	Shuah Khan
  Cc: linux-kernel, Eva Kurchatova, netdev, bpf, linux-kselftest

The test creates its devices in the namespace it is started in and binds
an IPv6 socket to talk between the two ends. Both are unnecessary
demands on the host it runs on.

The device name is fixed, v1, so a host that already has a device by
that name cannot run the test at all. The IPv6 control socket depends on
the host's firewall rules, and where those reject ICMPv6 or the port the
test picks, the two ends never meet:

  Failed connecting to the Device Under Test control socket

Cleanup is trapped for signals only, not for a normal exit, so a run
that fails leaves both the device and the namespace behind. Every later
run then stops in setup, before it prints anything.

Re-exec in a new network namespace, where the device name is free and no
rule of the host applies, and everything the test made goes away with
the namespace when it exits.

Signed-off-by: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
---
 tools/testing/selftests/bpf/test_xdp_features.sh | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/tools/testing/selftests/bpf/test_xdp_features.sh b/tools/testing/selftests/bpf/test_xdp_features.sh
index 0aa71c4455c0..1f6be4af6718 100755
--- a/tools/testing/selftests/bpf/test_xdp_features.sh
+++ b/tools/testing/selftests/bpf/test_xdp_features.sh
@@ -1,6 +1,19 @@
 #!/bin/bash
 # SPDX-License-Identifier: GPL-2.0
 
+# The device under test listens on the veth address of the namespace this
+# script runs in and the tester connects to it, so a firewall on the
+# machine can refuse the control connection:
+#   Failed connecting to the Device Under Test control socket
+# That side of the pair is also always called v1, and cleanup only runs
+# on a signal, so a failed run leaves the device behind and every later
+# run stops in setup.  A namespace of our own has no such rules, and
+# takes the leftovers with it when the test ends.
+if [ -z "${XDP_FEATURES_NETNS:-}" ]; then
+	XDP_FEATURES_NETNS=1 export XDP_FEATURES_NETNS
+	exec unshare -n sh -c 'ip link set lo up; exec "$0" "$@"' "$0" "$@"
+fi
+
 readonly NS="ns1-$(mktemp -u XXXXXX)"
 readonly V0_IP4=10.10.0.11
 readonly V1_IP4=10.10.0.1
-- 
2.55.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-09-17  2:45 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-17  1:55 [PATCH 1/2] selftests: bpf: run test_xdp_features in its own netns Eva Kurchatova
2026-09-17  1:55 ` [PATCH 2/2] selftests: bpf: size the map in test_lru_sanity3 to whole refills Eva Kurchatova
2026-09-17  2:13 ` [PATCH 1/2] selftests: bpf: run test_xdp_features in its own netns Alexei Starovoitov
2026-09-17  2:45 ` bot+bpf-ci

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®