Detaching network namespaces as an unprivileged user is currently not possible
and attaching to the user namespace will mean we are not allowed to move the
network device into an ancestor network namespace.
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
return false;
}
- if (pid == 0) { // child
- int ret = 0;
- if (!enter_net_ns(c)) {
- ERROR("failed to enter namespace");
- exit(-1);
+ if (pid == 0) { /* child */
+ pid_t init_pid;
+
+ init_pid = do_lxcapi_init_pid(c);
+ if (!switch_to_ns(init_pid, "net")) {
+ ERROR("Failed to enter network namespace");
+ exit(EXIT_FAILURE);
}
ret = lxc_netdev_isup(ifname);