mirror of
https://git.proxmox.com/git/mirror_lxc
synced 2025-07-27 11:13:50 +00:00
lxccontainer: only attach netns on netdev detach
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>
This commit is contained in:
parent
b69dfc9fcb
commit
acbfeda88b
@ -4450,10 +4450,12 @@ static bool do_lxcapi_detach_interface(struct lxc_container *c, const char *ifna
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (pid == 0) { /* child */
|
if (pid == 0) { /* child */
|
||||||
int ret = 0;
|
pid_t init_pid;
|
||||||
if (!enter_net_ns(c)) {
|
|
||||||
ERROR("failed to enter namespace");
|
init_pid = do_lxcapi_init_pid(c);
|
||||||
exit(-1);
|
if (!switch_to_ns(init_pid, "net")) {
|
||||||
|
ERROR("Failed to enter network namespace");
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = lxc_netdev_isup(ifname);
|
ret = lxc_netdev_isup(ifname);
|
||||||
|
Loading…
Reference in New Issue
Block a user