- 23 Nov, 2016 2 commits
-
-
Cam Cope authored
Signed-off-by:Cam Cope <cam@dropbox.com>
-
Christian Brauner authored
The identifiers for namespaces used with lxc-unshare and lxc-attach as given on the manpage do not align with the standard identifiers. This affects network, mount, and uts namespaces. The standard identifiers are: "mnt", "uts", and "net" whereas lxc-unshare and lxc-attach use "MOUNT", "UTSNAME", and "NETWORK". I'm weary to hack this into namespace.{c.h} by e.g. adding additional members to the ns_info struct or to special case this in lxc_fill_namespace_flags(). Internally, we should only accept standard identifiers to ensure that we are always correctly aligned with the kernel. So let's use some cheap memmove()s to replace them by their standard identifiers in lxc-unshare and lxc-attach. Signed-off-by:Christian Brauner <christian.brauner@ubuntu.com>
-
- 22 Nov, 2016 38 commits
-
-
Christian Brauner authored
Signed-off-by:Christian Brauner <christian.brauner@canonical.com>
-
Christian Brauner authored
Signed-off-by:Christian Brauner <christian.brauner@canonical.com>
-
Christian Brauner authored
Signed-off-by:Christian Brauner <christian.brauner@canonical.com>
-
Christian Brauner authored
Signed-off-by:Christian Brauner <christian.brauner@canonical.com>
-
Christian Brauner authored
Signed-off-by:Christian Brauner <christian.brauner@canonical.com>
-
Christian Brauner authored
Signed-off-by:Christian Brauner <christian.brauner@canonical.com>
-
Christian Brauner authored
Signed-off-by:Christian Brauner <christian.brauner@canonical.com>
-
Christian Brauner authored
Signed-off-by:Christian Brauner <christian.brauner@canonical.com>
-
Christian Brauner authored
Signed-off-by:Christian Brauner <christian.brauner@canonical.com>
-
Christian Brauner authored
Signed-off-by:Christian Brauner <christian.brauner@canonical.com>
-
Christian Brauner authored
Signed-off-by:Christian Brauner <christian.brauner@canonical.com>
-
Christian Brauner authored
Signed-off-by:Christian Brauner <christian.brauner@canonical.com>
-
Christian Brauner authored
Signed-off-by:Christian Brauner <christian.brauner@canonical.com>
-
Christian Brauner authored
Signed-off-by:Christian Brauner <christian.brauner@canonical.com>
-
Christian Brauner authored
Signed-off-by:Christian Brauner <christian.brauner@canonical.com>
-
Christian Brauner authored
Signed-off-by:Christian Brauner <christian.brauner@canonical.com>
-
Christian Brauner authored
Signed-off-by:Christian Brauner <christian.brauner@canonical.com>
-
Christian Brauner authored
Signed-off-by:Christian Brauner <christian.brauner@canonical.com>
-
Christian Brauner authored
Signed-off-by:Christian Brauner <christian.brauner@canonical.com>
-
Christian Brauner authored
Signed-off-by:Christian Brauner <christian.brauner@canonical.com>
-
Christian Brauner authored
Signed-off-by:Christian Brauner <christian.brauner@canonical.com>
-
Christian Brauner authored
Signed-off-by:Christian Brauner <christian.brauner@canonical.com>
-
Christian Brauner authored
Signed-off-by:Christian Brauner <christian.brauner@canonical.com>
-
Christian Brauner authored
Signed-off-by:Christian Brauner <christian.brauner@canonical.com>
-
Christian Brauner authored
Signed-off-by:Christian Brauner <christian.brauner@canonical.com>
-
Christian Brauner authored
Signed-off-by:Christian Brauner <christian.brauner@canonical.com>
-
Christian Brauner authored
This function safely parses an unsigned integer. On success it returns 0 and stores the unsigned integer in @converted. On error it returns a negative errno. Signed-off-by:Christian Brauner <christian.brauner@canonical.com>
-
Christian Brauner authored
If the file "/sys/devices/system/cpu/isolated" doesn't exist, we can't just simply bail. We still need to check whether we need to copy the parents cpu settings. Signed-off-by:Christian Brauner <christian.brauner@canonical.com>
-
Christian Brauner authored
- add more logging - only write to cpuset.cpus if we really have to - simplify cleanup on error and success Signed-off-by:Christian Brauner <christian.brauner@canonical.com>
-
Christian Brauner authored
Move the user namespace at the first position in the array so that we always attach to it first when iterating over the struct and using setns() to switch namespaces. This especially affects lxc_attach(): Suppose you cloned a new user namespace and mount namespace as an unprivileged user on the host and want to setns() to the mount namespace. This requires you to attach to the user namespace first otherwise the kernel will fail this check: if (!ns_capable(mnt_ns->user_ns, CAP_SYS_ADMIN) || !ns_capable(current_user_ns(), CAP_SYS_CHROOT) || !ns_capable(current_user_ns(), CAP_SYS_ADMIN)) return -EPERM; in linux/fs/namespace.c:mntns_install(). Signed-off-by:Christian Brauner <christian.brauner@canonical.com>
-
Christian Brauner authored
Using custom structs in attach.c risks getting out of sync with the commonly used ns_info[LXC_NS_MAX] struct and thus attaching to wrong namespaces. Switch to using ns_info[LXC_NS_MAX]. Signed-off-by:Christian Brauner <christian.brauner@canonical.com>
-
Christian Brauner authored
- simply check /proc/self/ns - improve SYSERROR() report - use #define to prevent gcc & clang to use a VLA Signed-off-by:Christian Brauner <christian.brauner@canonical.com>
-
Christian Brauner authored
It's much more appropriate there and makes start.{c,h} cleaner and leaner. Signed-off-by:Christian Brauner <christian.brauner@canonical.com>
-
Christian Brauner authored
Improve log and comments in a bunch of places to make it easier for us on bug reports. Signed-off-by:Christian Brauner <christian.brauner@canonical.com>
-
Christian Brauner authored
- Allocating an error message that the caller must free seems pointless. We can just print the error message in preserve_ns() itself. This also allows us to avoid using the GNU extension asprintf(). - Improve lxc_preserve_ns(): By passing in NULL or "" as the second argument the function can now also be used to check whether namespaces are supported by the kernel. - Use lxc_preserve_ns() in preserve_ns(). Signed-off-by:Christian Brauner <christian.brauner@canonical.com>
-
Christian Brauner authored
- So far we blindly called lxc_delete_network() to make sure that we deleted all network interfaces. This resulted in pointless netlink calls, especially when a container had multiple networks defined. Let's be smarter and have lxc_delete_network() return a boolean that indicates whether *all* configured networks have been deleted. If so, don't needlessly try to delete them again in start.c. This also decreases confusing error messages a user might see. - When we receive -ENODEV from one of our lxc_netdev_delete_*() functions, let's assume that either the network device already got deleted or that it got moved to a different network namespace. Inform the user about this but do not report an error in this case. - When we have explicitly deleted the host side of a veth pair let's immediately free(priv.veth_attr.pair) and NULL it, or memset(priv.veth_attr.pair, ...) the corresponding member so we don't needlessly try to destroy them again when we have to call lxc_delete_network() again in start.c Signed-off-by:Christian Brauner <christian.brauner@canonical.com>
-
Christian Brauner authored
Signed-off-by:Christian Brauner <christian.brauner@canonical.com>
-
Christian Brauner authored
Signed-off-by:Christian Brauner <christian.brauner@canonical.com>
-