[LTP] [PATCH 4/9] tst_net.sh: Remove unneeded $TST_INIT_NETNS variable

Petr Vorel
2023-01-26T21:55:02Z

Similarly to the previous commit, also $TST_INIT_NETNS guarder is not
needed since a93c34f914 which introduced $TST_LIB_NET_LOADED guarder at
the top of the file.

Also use tst_net_use_netns() instead of the variable (encapsulation).

Fixes: a93c34f914 ("tst_net.sh: Introduce TST_LIB_NET_LOADED")

Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
testcases/lib/tst_net.sh | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/testcases/lib/tst_net.sh b/testcases/lib/tst_net.sh
index 1b3a7e6683..425f0b8b7e 100644
--- a/testcases/lib/tst_net.sh
+++ b/testcases/lib/tst_net.sh
@@ -150,8 +150,6 @@ init_ltp_netspace()
LHOST_IFACES="${LHOST_IFACES:-ltp_ns_veth2}"
RHOST_IFACES="${RHOST_IFACES:-ltp_ns_veth1}"

- export TST_INIT_NETNS="no"
-
pid="$(echo $(readlink /var/run/netns/ltp_ns) | cut -f3 -d'/')"
export LTP_NETNS="${LTP_NETNS:-ns_exec $pid net,mnt}"

@@ -1015,7 +1013,7 @@ if [ "$TST_NET_IPV6_ENABLED" = 1 ]; then
eval $(tst_net_ip_prefix -r $IPV6_RHOST || echo "exit $?")
fi

-[ -n "$TST_USE_NETNS" -a "$TST_INIT_NETNS" != "no" ] && init_ltp_netspace
+tst_net_use_netns && init_ltp_netspace

eval $(tst_net_iface_prefix $IPV4_LHOST || echo "exit $?")
eval $(tst_rhost_run -c 'tst_net_iface_prefix -r '$IPV4_RHOST \