[LTP] [PATCH 1/2] tst_net.sh: Add API function to check netns use

Petr Vorel pvorel@suse.cz
Fri Feb 5 15:20:50 CET 2021


Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
Hi Alexey,

or do we want to allow using TST_USE_NETNS?

Kind regards,
Petr

 testcases/lib/tst_net.sh | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/testcases/lib/tst_net.sh b/testcases/lib/tst_net.sh
index 1ddef2fea..d4633c509 100644
--- a/testcases/lib/tst_net.sh
+++ b/testcases/lib/tst_net.sh
@@ -131,6 +131,12 @@ init_ltp_netspace()
 	tst_restore_ipaddr rhost
 }
 
+# return 0: use ssh, 1: use netns
+tst_net_use_netns()
+{
+	[ -n "$TST_USE_NETNS" ]
+}
+
 # Run command on remote host.
 # tst_rhost_run -c CMD [-b] [-s] [-u USER]
 # Options:
-- 
2.30.0



More information about the ltp mailing list