[CRIU] [PATCH v2 25/30] net_ns: Make net_ns check in do_restore_task_net_ns more universal

Kirill Tkhai ktkhai at virtuozzo.com
Wed Jun 7 14:30:40 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, speedup existing cases, and support "inherited ns"
case.

v2: New

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 410a3d2a7..2e7599b7c 100644
--- a/criu/net.c
+++ b/criu/net.c
@@ -2175,7 +2175,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