[CRIU] [PATCH 3/8] net_ns: Make net_ns check in do_restore_task_net_ns more universal

Kirill Tkhai ktkhai at virtuozzo.com
Wed Jun 28 14:48:58 MSK 2017


setns() on the same net_ns is OK (just a noop),
while the task has permissions to do that.
But if the namespace is inherited from parent task,
we can't do that.

So, 1)speedup existing cases, and 2)support "inherited ns" case.

Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
 criu/net.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/criu/net.c b/criu/net.c
index 15aae2be4..18c13e4ae 100644
--- a/criu/net.c
+++ b/criu/net.c
@@ -2162,7 +2162,7 @@ static int do_restore_task_net_ns(struct ns_id *nsid, struct pstree_item *curren
 {
 	int fd;
 
-	if (!(root_ns_mask & CLONE_NEWNET))
+	if (current->net_ns == nsid)
 		return 0;
 
 	fd = fdstore_get(nsid->net.nsfd_id);



More information about the CRIU mailing list