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

Petr Vorel
2021-02-05T14:20:50Z

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