* [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
* [LTP] [PATCH v2 2/2] nfsstat02.sh: Force use of nested net namespace
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 ` 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
1 sibling, 1 reply; 4+ messages in thread
From: Petr Vorel @ 2026-10-30 15:40 UTC (permalink / raw)
To: ltp; +Cc: Sebastian Chlad
Use TST_NET_FORCE_NETNS=1 because test tests net namespace itself.
Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
Changes in v2:
* Use TST_NET_FORCE_NETNS=1
testcases/network/nfs/nfsstat01/nfsstat02.sh | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/testcases/network/nfs/nfsstat01/nfsstat02.sh b/testcases/network/nfs/nfsstat01/nfsstat02.sh
index 75a1a01b5b..06b4dff855 100755
--- a/testcases/network/nfs/nfsstat01/nfsstat02.sh
+++ b/testcases/network/nfs/nfsstat01/nfsstat02.sh
@@ -3,6 +3,7 @@
# Copyright (c) 2024 SUSE LLC <mdoucha@suse.cz>
TST_TESTFUNC="do_test"
+TST_NET_FORCE_NETNS=1
# PURPOSE: Check that /proc/net/rpc/nfs exists in nested network namespaces
# d47151b79e32 ("nfs: expose /proc/net/sunrpc/nfs in net namespaces")
@@ -19,8 +20,5 @@ do_test()
fi
}
-# Force use of nested net namespace
-unset RHOST
-
. nfs_lib.sh
tst_run
--
2.56.0
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [LTP] tst_net.sh: Allow test to force netns
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-10-30 18:54 ` linuxtestproject.agent
1 sibling, 0 replies; 4+ messages in thread
From: linuxtestproject.agent @ 2026-10-30 18:54 UTC (permalink / raw)
To: Petr Vorel; +Cc: ltp
Hi Petr,
On Fri Oct 30 16:40:00 2026 +0100, Petr Vorel <pvorel@suse.cz> wrote:
> tst_net.sh: Allow test to force netns
Verdict - Reviewed
---
Note:
The agent can sometimes produce false positives although often its
findings are genuine. If you find issues with the review, please
comment this email or ignore the suggestions.
Regards,
LTP AI Reviewer
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [LTP] [PATCH v2 2/2] nfsstat02.sh: Force use of nested net namespace
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
0 siblings, 0 replies; 4+ messages in thread
From: Petr Vorel @ 2026-11-04 7:45 UTC (permalink / raw)
To: ltp; +Cc: Sebastian Chlad
Hi all,
FYI merged.
Kind regards,
Petr
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [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.