<html>
<head>
<meta content="text/html; charset=windows-1252"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">Hi,<br>
On 21.07.2017 7:04, Petr Vorel wrote:<br>
</div>
<blockquote cite="mid:20170721040407.868-8-pvorel@suse.cz"
type="cite">
<pre wrap="">This function is useful when we know we broke netns (e.g. by unloading
network driver).
Signed-off-by: Petr Vorel <a class="moz-txt-link-rfc2396E" href="mailto:pvorel@suse.cz"><pvorel@suse.cz></a>
---
testcases/lib/test_net.sh | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/testcases/lib/test_net.sh b/testcases/lib/test_net.sh
index 0cafe1514..cecb0bab2 100644
--- a/testcases/lib/test_net.sh
+++ b/testcases/lib/test_net.sh
@@ -42,7 +42,7 @@ init_ltp_netspace()
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}"
+ export LTP_NETNS="ns_exec $pid net,mnt"</pre>
</blockquote>
<br>
It is better to reset LTP_NETNS variable before calling
init_ltp_netspace in reset_ltp_netspace().<br>
<br>
Thanks,<br>
Alexey<br>
<br>
<blockquote cite="mid:20170721040407.868-8-pvorel@suse.cz"
type="cite">
<pre wrap="">
tst_restore_ipaddr
tst_restore_ipaddr rhost
@@ -50,6 +50,18 @@ init_ltp_netspace()
tst_wait_ipv6_dad
}
+# Force to reset netns.
+reset_ltp_netspace()
+{
+ [ -n "$TST_USE_NETNS" ] || return
+
+ tst_resm TINFO "reset netns"
+ ip link delete ltp_ns_veth2 2> /dev/null
+ rm -f /var/run/netns/ltp_ns
+ pkill ns_create
+ init_ltp_netspace
+}
+
# Run command on remote host.
# Options:
# -b run in background
</pre>
</blockquote>
<p><br>
</p>
</body>
</html>