Commit Graph

11729 Commits

Author SHA1 Message Date
Stéphane Graber
8dd40b5abb
Merge pull request #4397 from PoneyClairDeLune/patch-1
Assign IPv6 address and enable IPv6 NAT by default
2024-02-23 18:11:49 -05:00
Lumière Élevé
e88883445a
lxc-net: Enable IPv6 by default
Signed-off-by: Lumière Élevé <88174309+PoneyClairDeLune@users.noreply.github.com>
2024-02-23 16:53:17 -05:00
Christian Brauner
eef26d26aa
Merge pull request #4403 from mihalicyn/meson_fixup_1
github: master -> main & ossfuzz build fixes
2024-02-19 13:38:08 +01:00
Alexander Mikhalitsyn
d78ca00bc6
tests/meson: attempt to fix ossfuzz builds
As we link statically with liblxc, we don't need to
link with liblxc_ext_sources, as all the symbols will come
from liblxc.a itself.

Signed-off-by: Alexander Mikhalitsyn <aleksandr.mikhalitsyn@canonical.com>
2024-02-19 10:06:14 +01:00
Alexander Mikhalitsyn
d18f993b39
github: master -> main
Our main branch is "main" for some time, but
in github scripts we still use "master" which is incorrect
and prevent some stuff from working.

Signed-off-by: Alexander Mikhalitsyn <aleksandr.mikhalitsyn@canonical.com>
2024-02-19 09:56:04 +01:00
Christian Brauner
4c5f4e7d4b
Merge pull request #4401 from mihalicyn/meson_link_dynamically_fix
[RFC] meson: link dynamically
2024-02-18 23:07:56 +01:00
Alexander Mikhalitsyn
86799f5542
meson: link with liblxc dynamically everywhere if possible
Link tests/tools/commands dynamically with liblxc if possible.

Signed-off-by: Alexander Mikhalitsyn <aleksandr.mikhalitsyn@canonical.com>
2024-02-18 17:12:49 +01:00
Alexander Mikhalitsyn
b90fecfda1
network: use IN_LIBLXC
Put a bunch of functions under #if IN_LIBLXC to compile-out
them when network.c is linked with tools/tests code.

Signed-off-by: Alexander Mikhalitsyn <aleksandr.mikhalitsyn@canonical.com>
2024-02-18 17:05:10 +01:00
Alexander Mikhalitsyn
9eee450d25
storage_utils: move get_fssize to utils
This helper is used in the lxc/tools and it's
fully independent of storage_utils code, let's move it
to utils.c

Signed-off-by: Alexander Mikhalitsyn <aleksandr.mikhalitsyn@canonical.com>
2024-02-18 16:04:54 +01:00
Alexander Mikhalitsyn
6eb0a73e22
storage_utils: unhide and rename is_valid_storage_type to lxc_is_valid_storage_type
Signed-off-by: Alexander Mikhalitsyn <aleksandr.mikhalitsyn@canonical.com>
2024-02-18 15:56:47 +01:00
Alexander Mikhalitsyn
42eeffcb05
confile: unhide lxc_config_parse_arch() helper
Looks safe enough to be available for liblxc users.

Signed-off-by: Alexander Mikhalitsyn <aleksandr.mikhalitsyn@canonical.com>
2024-02-18 15:43:20 +01:00
Alexander Mikhalitsyn
9bb3188816
conf: reorganize/split code to utils.c
Move run_script/run_script_argv helpers to utils.c

Signed-off-by: Alexander Mikhalitsyn <aleksandr.mikhalitsyn@canonical.com>
2024-02-18 15:24:29 +01:00
Alexander Mikhalitsyn
863c59dc3a
conf: reorganize/split code to idmap_utils.c
Move some idmaps-related functions from lxc/conf.c
to a new idmap_utils.c file.

Signed-off-by: Alexander Mikhalitsyn <aleksandr.mikhalitsyn@canonical.com>
2024-02-18 15:17:25 +01:00
Alexander Mikhalitsyn
b7591ad49d
confile: unhide lxc_config_define*() helpers
Let's unhide lxc_config_define_add, lxc_config_define_load and
lxc_config_define_free helpers. These functions are safe enough
to be used by external tools. Semantic is also clear.

Reason is that we have lxc-start/lxc-execute tools which
use these symbols. Right now it works, because we just
link a whole liblxc statically to each lxc-* tool...

Signed-off-by: Alexander Mikhalitsyn <aleksandr.mikhalitsyn@canonical.com>
2024-02-17 16:58:02 +01:00
Alexander Mikhalitsyn
f14656ebf6
meson: introduce IN_LIBLXC preprocessor macro
The purpose of it is to tell us if we are compiling
liblxc or lxc test/tool/command.

This thing is needed to exclude unnecessary functions
from being compiled-in in the resulting executables
like lxc-start, lxc-attach, etc.

The problem is that lxc tools (lxc-start, lxc-stop, etc)
depend not only on the liblxc as a shared library, but also
require some non-exported symbols or helpers from liblxc
internals. So, we have to link these executables with some liblxc
object files directly which results in the dependency hell,
because linking one .c file from liblxc may end up having to
link with another one (what contains some dependency) and so on.
By using IN_LIBLXC in the liblxc internals we can selectively
omit some functions from being compiled in such cases.

Signed-off-by: Alexander Mikhalitsyn <aleksandr.mikhalitsyn@canonical.com>
2024-02-17 16:47:41 +01:00
Alexander Mikhalitsyn
672b2172de
confile: move lxc_fill_elevated_privileges() to tools/lxc_attach
lxc_fill_elevated_privileges() is used only in lxc-attach tool,
let's move this function in there.

Signed-off-by: Alexander Mikhalitsyn <aleksandr.mikhalitsyn@canonical.com>
2024-02-17 16:43:21 +01:00
Stéphane Graber
16076111da
Merge pull request #4395 from tsnaik/mount-check
oci: resolve cross-filesystem blob caching failure
2024-02-15 23:01:44 -05:00
Christian Brauner
899478b715
Merge pull request #4398 from mihalicyn/usernic_fixes_2
tests: lxc-test-usernic: use iproute tool instead of brctl
2024-02-15 18:50:37 +01:00
Christian Brauner
7c0b2696fe
Merge pull request #4399 from mihalicyn/apparmor_lxc_copy
config: apparmor: add AppArmor profile for lxc-copy
2024-02-15 18:50:19 +01:00
Christian Brauner
8a339b4937
Merge pull request #4400 from mihalicyn/remove_old_cgroup_handling_in_tests
tests: remove old and broken cgroup handling code from tests
2024-02-15 18:50:06 +01:00
Alexander Mikhalitsyn
8f9733d756
tests: remove old and broken cgroup handling code from tests
We have removed the same piece of code in
ec85e5ca49 ("lxc-test-usernic: drop cgroup handling")
let's do the same for two other tests.

This fixes autopkgtests.

Signed-off-by: Alexander Mikhalitsyn <aleksandr.mikhalitsyn@canonical.com>
2024-02-15 18:13:05 +01:00
Alexander Mikhalitsyn
d51ea224e8
config: apparmor: add AppArmor profile for lxc-copy
lxc-copy can start container as lxc-start does in some cases,
so we need to have the same profile for it.

Signed-off-by: Alexander Mikhalitsyn <aleksandr.mikhalitsyn@canonical.com>
2024-02-15 17:59:59 +01:00
Alexander Mikhalitsyn
627bb9460c
tests: lxc-test-usernic: use iproute tool instead of brctl
This is required to fix autopkgtest failures.

Signed-off-by: Alexander Mikhalitsyn <aleksandr.mikhalitsyn@canonical.com>
2024-02-15 17:37:24 +01:00
Tanmay Naik
df0665b6de
oci: resolve cross-filesystem blob caching failure
This commit addresses an issue in the OCI template where lxc-create
fails if OCI-cache directory for blob caching is not on the same mount
as the destination OCI directory. lxc-create bails when skopeo tries to
create a hard-link across the two and fails.

For example, if /var/lib/lxc is a bind mountpoint of a random directory
and skopeo fails to hard-link across /var/cache/lxc and /var/lib/lxc

This commit introduces a check where if both directories are on not the
same mount points, it disables blob caching in skopeo and continues.

Signed-off-by: Tanmay Naik <tnaik96@gmail.com>
2024-02-03 08:22:52 +00:00
Stéphane Graber
09b830d74a
Merge pull request #4394 from hallyn/2024-02-02/test-usernic-fixes
test-usernic fixes
2024-02-02 22:11:14 +01:00
Serge Hallyn
ec85e5ca49 lxc-test-usernic: drop cgroup handling
This stuff is not needed in a modern systemd based system, and in fact
breaks.  It would probably be better to detect such a system so that a
non-systemd box can still run this test.  But I'm not sure what would be
reliable.

Signed-off-by: Serge Hallyn <serge@hallyn.com>
2024-02-02 10:44:20 -06:00
Serge Hallyn
27ec0b0f64 test-usernic: don't use ifconfig
ifconfig is not available on many modern systems.  Use ip instead.

Maybe it would be better to detect what's available, but that
could become brittle.

Signed-off-by: Serge Hallyn <serge@hallyn.com>
2024-02-02 10:43:30 -06:00
Stéphane Graber
3efa1c3037
Merge pull request #4391 from gibmat/fix-x32-container-creation
Add x32 to the list of recognized architectures
2024-01-30 02:37:41 +01:00
Mathias Gibbens
44e845b3ce
Add x32 to the list of recognized architectures
LXC supports x32 containers, but currently creation of those containers is broken:

lxc-create: x32-test: ../src/lxc/confile.c: set_config_personality: 1432 Invalid argument - Unsupported personality "x32"
lxc-create: x32-test: ../src/lxc/parse.c: lxc_file_for_each_line_mmap: 129 Failed to parse config file "/var/lib/lxc/x32-test/config" at line "lxc.arch = x32"
lxc-create: x32-test: ../src/lxc/tools/lxc_create.c: main: 317 Failed to create container x32-test

Signed-off-by: Mathias Gibbens <gibmat@debian.org>
2024-01-30 01:03:06 +00:00
Stéphane Graber
cb5bd70596
Merge pull request #4390 from jacobmcnamee/unpack-tar-xattrs
lxc-download, lxc-local: preserve xattrs on unpack
2024-01-29 00:17:29 +01:00
Jacob McNamee
07e3a516e4 lxc-download, lxc-local: preserve xattrs on unpack
Update tar invocation to preserve all xattrs when unpacking the rootfs,
notably retaining security.capability xattrs (e.g. for ping, newuidmap)

Note: bsdtar already preserves xattrs with -p

Signed-off-by: Jacob McNamee <jacob@jacobmcnamee.com>
2024-01-28 13:22:10 -08:00
Christian Brauner
a1b4ba87d7
Merge pull request #4388 from mihalicyn/plumb_userns_checks
tree-wide: use container_uses_namespace() in more places
2024-01-26 19:35:14 +01:00
Alexander Mikhalitsyn
9ac7c4895e
tree-wide: use container_uses_namespace() in less trivial cases
In our current codebase we have a logical pattern:
list_empty(&handler->conf->id_map)
*IF AND ONLY IF*
container does NOT use user namespace

Which is perfectly correct nowadays, but once we (hopefully)
get an "isolated user namespaces" stuff ready it won't be the case.
It will be perfectly fine to have a user namespace with empty
/proc/*/{u,g}id_map files. Nowadays it's also possible,
but this kind of a configuration close to useless and nobody
actually uses it.

No functional changes intended.

Signed-off-by: Alexander Mikhalitsyn <aleksandr.mikhalitsyn@canonical.com>
2024-01-26 17:20:27 +01:00
Alexander Mikhalitsyn
64341ce7b7
tree-wide: use container_uses_namespace() helper
No functional changes.

Will be useful in future support for an isolated
user namespaces [1]. I have already played with
that locally and found that in the LXC codebase
we have a bunch of different ways to ensure if
a container uses user namespaces or not.

This commit contains a trivial conversion from
an open-coded version of the container_uses_namespace()
helper to an actual use of the helper.

[1] https://lpc.events/event/17/contributions/1569/

Signed-off-by: Alexander Mikhalitsyn <aleksandr.mikhalitsyn@canonical.com>
2024-01-26 17:05:46 +01:00
Stéphane Graber
1fbe1b0813
Merge pull request #4363 from zhaixiaojuan/main
Add loongarch64 support
2024-01-14 22:53:37 +01:00
Stéphane Graber
fedae02984
Merge pull request #4382 from petermichaux/main
Add Verbose Output in Download Template
2024-01-11 21:10:47 +01:00
Peter Michaux
6b40e66c11 Fix error message.
Signed-off-by: Peter Michaux <petermichaux@gmail.com>
2024-01-08 19:56:08 -08:00
Peter Michaux
c8189ee2a3 Add verbose output in download template.
Signed-off-by: Peter Michaux <petermichaux@gmail.com>
2024-01-08 19:56:08 -08:00
Stéphane Graber
42c60557cd
Merge pull request #4381 from petermichaux/patch-1
Align columns in lxc-download.in template
2024-01-06 16:12:24 +01:00
Peter Michaux
84cc3155af
Align columns in lxc-download.in template
Signed-off-by: Peter Michaux <petermichaux@gmail.com>
2024-01-05 22:10:34 -08:00
Adam Stephens
872db54243
build: add more options for customizing install
Signed-off-by: Adam Stephens <adam@valkor.net>
2023-12-27 14:59:05 -05:00
zhaixiaojuan
df17ac417e Add loongarch64 support
Signed-off-by: zhaixiaojuan <zhaixiaojuan@loongson.cn>
2023-12-21 16:19:15 +08:00
Stéphane Graber
a1c2615b59
Merge pull request #4375 from lxc/dependabot/github_actions/actions/upload-artifact-4
build(deps): bump actions/upload-artifact from 3 to 4
2023-12-18 08:56:58 -05:00
dependabot[bot]
112d5615e1
build(deps): bump actions/upload-artifact from 3 to 4
Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 3 to 4.
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](https://github.com/actions/upload-artifact/compare/v3...v4)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-12-18 13:13:10 +00:00
Stéphane Graber
2d0b93ba60
Merge pull request #3236 from xinhua9569/master
config: try to create workdir if not exist
2023-12-13 13:18:29 -05:00
dongxinhua
789457f1ae
config: try to create workdir if not exist
Signed-off-by: dongxinhua <dongxinhua@huawei.com>
2023-12-13 11:25:40 -05:00
Stéphane Graber
959b419210
Merge pull request #4368 from desultory/main
Updated lxc-local template
2023-12-11 17:23:55 -05:00
Zen
86f5c12264
lxc-local: Add --no-dev option to exclude /dev from the fstree
Signed-off-by: Zen <z@pyl.onl>
2023-12-11 17:04:59 -05:00
Zen
f885a3c560
lxc-local: Re-organize code to use more functions
Signed-off-by: Zen <z@pyl.onl>
2023-12-11 17:04:41 -05:00
Zen
7c025072ed
lxc-local: Improve usage info
Signed-off-by: Zen <z@pyl.onl>
2023-12-11 16:59:15 -05:00