net: set the root net ns after restoring all namespaces

Submitted by Kirill Tkhai on March 29, 2017, 9:38 a.m.

Details

Message ID a2cd0ccc-463a-a2f0-53b2-c1ca0a5a00e6@virtuozzo.com
State New
Series "net: set the root net ns after restoring all namespaces"
Headers show

Commit Message

Kirill Tkhai March 29, 2017, 9:38 a.m.
On 28.03.2017 22:56, Andrei Vagin wrote:
> From: Andrei Vagin <avagin@virtuozzo.com>
> 
> Then we will create transport sockets and we want to know where
> they will be created.
> 
> Cc: Kirill Tkhai <ktkhai@virtuozzo.com>
> Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>

Looks good for me. Thanks.

Reviewed-by: Kirill Tkhai <ktkhai@virtuozzo.com>

Though, the issue with tun still remains. The patch below for reproduction

Patch hide | download patch | download mbox

diff --git a/test/zdtm/static/tun.c b/test/zdtm/static/tun.c
index c53b8fa8..23b5a1c0 100644
--- a/test/zdtm/static/tun.c
+++ b/test/zdtm/static/tun.c
@@ -1,3 +1,5 @@ 
+#define _GNU_SOURCE
+#include <sched.h>
 #include <unistd.h>
 #include <string.h>
 #include <fcntl.h>
@@ -119,6 +121,11 @@  int main(int argc, char **argv)
 
 	test_init(argc, argv);
 
+	if (unshare(CLONE_NEWNET) < 0) {
+		pr_perror("unshare");
+		return -1;
+	}
+
 	/* fd[0] -- opened file */
 	fds[0] = __open_tun();
 	if (fds[0] < 0) {