All of lore.kernel.org
 help / color / mirror / Atom feed
* [LTP] [PATCH v2 1/2] tst_net.sh: Allow test to force netns
@ 2026-10-30 15:40 Petr Vorel
  2026-10-30 15:40 ` [LTP] [PATCH v2 2/2] nfsstat02.sh: Force use of nested net namespace Petr Vorel
  2026-10-30 18:54 ` [LTP] tst_net.sh: Allow test to force netns linuxtestproject.agent
  0 siblings, 2 replies; 4+ messages in thread
From: Petr Vorel @ 2026-10-30 15:40 UTC (permalink / raw)
  To: ltp; +Cc: Sebastian Chlad

Add $TST_NET_FORCE_NETNS variable for tests which test network
namespaces therefore they should not use as rhost the real 2nd host
configured when using 2 hosts setup.

Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
New in v2 to fix chicken and egg problem pointed out the agent.

 testcases/lib/tst_net.sh  | 7 +++++++
 testcases/lib/tst_test.sh | 2 +-
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/testcases/lib/tst_net.sh b/testcases/lib/tst_net.sh
index 4e7fc26fa0..7b7656dae0 100644
--- a/testcases/lib/tst_net.sh
+++ b/testcases/lib/tst_net.sh
@@ -1144,6 +1144,13 @@ tst_net_detect_ipv6
 
 [ -n "$TST_NET_SKIP_VARIABLE_INIT" ] && return 0
 
+
+# Force use of nested net namespace
+if [ "$TST_NET_FORCE_NETNS" = 1 ]; then
+	unset IPV4_LHOST IPV4_RHOST IPV6_LHOST IPV6_RHOST LHOST_HWADDRS \
+		LHOST_IFACES RHOST RHOST_HWADDRS RHOST_IFACES
+fi
+
 # Management Link
 [ -z "$RHOST" ] && TST_USE_NETNS="yes"
 export RHOST="$RHOST"
diff --git a/testcases/lib/tst_test.sh b/testcases/lib/tst_test.sh
index b3e7e29bbf..f83b096a27 100644
--- a/testcases/lib/tst_test.sh
+++ b/testcases/lib/tst_test.sh
@@ -699,7 +699,7 @@ tst_run()
 			CHECKPOINT_WAKE2|CHECKPOINT_WAKE_AND_WAIT);;
 			DEV_EXTRA_OPTS|DEV_FS_OPTS|FORMAT_DEVICE|MOUNT_DEVICE);;
 			SKIP_FILESYSTEMS|SKIP_IN_LOCKDOWN|SKIP_IN_SECUREBOOT);;
-			DEVICE_SIZE|USR_UID|USR_GID);;
+			DEVICE_SIZE|USR_UID|USR_GID|NET_FORCE_NETNS);;
 			*) tst_res TWARN "Reserved variable TST_$_tst_i used!";;
 			esac
 		done
-- 
2.56.0


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

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

end of thread, other threads:[~2026-11-04  7:46 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-30 15:40 [LTP] [PATCH v2 1/2] tst_net.sh: Allow test to force netns Petr Vorel
2026-10-30 15:40 ` [LTP] [PATCH v2 2/2] nfsstat02.sh: Force use of nested net namespace Petr Vorel
2026-11-04  7:45   ` Petr Vorel
2026-10-30 18:54 ` [LTP] tst_net.sh: Allow test to force netns linuxtestproject.agent

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.