]> git.ipfire.org Git - thirdparty/lxc.git/commit
lxccontainer: fix enter_net_ns helper to work when netns is inherited 4497/head
authorJef Steelant <jef.steelant_ext@softathome.com>
Fri, 6 Dec 2024 10:20:20 +0000 (11:20 +0100)
committerJef Steelant <jef.steelant_ext@softathome.com>
Thu, 12 Dec 2024 20:01:06 +0000 (21:01 +0100)
commit87dcdecf524bc3218b9380dab696ff4a153dfbe0
treed983c53630b9f22c9d267cd048b268f9f58b55c7
parent31012d49a50eca8927ff2c6f1d9bdafc4c8a79d8
lxccontainer: fix enter_net_ns helper to work when netns is inherited

If a network namespace is shared by setting lxc.namespace.share.net and
the container is unprivileged, then the network namespace should be
entered before entering the user namespace. However, if an unprivileged
user started a container, then the network namespace should be entered
after entering the user namespace. To solve this, we try to enter the
network namespace before entering the user namespace. If it did not
succeed, it will be tried again inside the uder namespace.

Signed-off-by: Jef Steelant <jef.steelant_ext@softathome.com>
src/lxc/lxccontainer.c