]> git.ipfire.org Git - thirdparty/systemd.git/log
thirdparty/systemd.git
4 years agotree-wide: explicitly unpoison getdents64() memory 21097/head
Lennart Poettering [Mon, 25 Oct 2021 08:59:56 +0000 (10:59 +0200)] 
tree-wide: explicitly unpoison getdents64() memory

Apparently memory sanitizer doesn't grok getdents64() properly. Let's
address that by explicitly marken memory initialized by getdents64() as
unpoisoned.

4 years agotest: add test for dir_is_empty_at()
Lennart Poettering [Fri, 22 Oct 2021 22:32:59 +0000 (00:32 +0200)] 
test: add test for dir_is_empty_at()

4 years agostat-util: make sure dir_is_empty_at() does something useful in all cases
Lennart Poettering [Fri, 22 Oct 2021 22:31:33 +0000 (00:31 +0200)] 
stat-util: make sure dir_is_empty_at() does something useful in all cases

4 years agostat-util: optimize dir_is_empty_at() a bit, by using getdents64()
Lennart Poettering [Fri, 22 Oct 2021 22:30:14 +0000 (00:30 +0200)] 
stat-util: optimize dir_is_empty_at() a bit, by using getdents64()

That way we have a single syscall only for it, instead of the multiple
readdir() and friends do. And we can operate entirely on the stack, no
malloc() implicit.

4 years agodirent-util: add FOREACH macro for iterating through getdents64() buffers
Lennart Poettering [Fri, 22 Oct 2021 22:28:24 +0000 (00:28 +0200)] 
dirent-util: add FOREACH macro for iterating through getdents64() buffers

We already have a similar loop twice, let's make it easier to read via
an iteration macro.

(The new macro is a bit more careful even, as it verifies the full
dirent fits into the remaining buffer when returning it)

4 years agodirent-util: move getdents64() related definitions to common header
Lennart Poettering [Fri, 22 Oct 2021 22:21:20 +0000 (00:21 +0200)] 
dirent-util: move getdents64() related definitions to common header

We want to reuse getdents64() wherever necessary, let's hence move
definitions useful for that into public code.

4 years agostat-util: specify O_DIRECTORY when reopening dir in dir_is_empty_at()
Lennart Poettering [Thu, 21 Oct 2021 16:07:06 +0000 (18:07 +0200)] 
stat-util: specify O_DIRECTORY when reopening dir in dir_is_empty_at()

That way we can fail earlier if the specified fd is not actually a
directory.

(Also, it's not exactly according to standards to open things without
either O_RDONLY/O_RDWR...)

4 years agoudev: do not try to rename interface if it is already up
Yu Watanabe [Sun, 24 Oct 2021 11:43:34 +0000 (20:43 +0900)] 
udev: do not try to rename interface if it is already up

See dev_change_name() in kernel's net/core/dev.c.

Fixes #21105.

4 years agoMerge pull request #21116 from poettering/test-cleaner
Yu Watanabe [Mon, 25 Oct 2021 14:16:14 +0000 (23:16 +0900)] 
Merge pull request #21116 from poettering/test-cleaner

make tests a bit cleaner in regards to oomd handling

4 years agoMerge pull request #21117 from mrc0mmand/last-coverage-related-tweaks
Yu Watanabe [Mon, 25 Oct 2021 14:15:47 +0000 (23:15 +0900)] 
Merge pull request #21117 from mrc0mmand/last-coverage-related-tweaks

Last batch of coverage-related tweaks

4 years agoMerge pull request #21077 from poettering/mount-setattr
Yu Watanabe [Mon, 25 Oct 2021 14:15:10 +0000 (23:15 +0900)] 
Merge pull request #21077 from poettering/mount-setattr

optimize remounting with mount_setattr() syscall

4 years agonspawn: fix build when SECCOMP is disabled
Yu Watanabe [Mon, 25 Oct 2021 07:42:19 +0000 (16:42 +0900)] 
nspawn: fix build when SECCOMP is disabled

Follow-up for 20e458ae3c3b386e2b720bbd3c37d95781e69ae7.

4 years agotest: merge coverage reports from previous test runs 21117/head
Frantisek Sumsal [Mon, 25 Oct 2021 09:35:47 +0000 (11:35 +0200)] 
test: merge coverage reports from previous test runs

Relevant mainly for tests which utilize both QEMU and nspawn.

4 years agotest: tweak TriggerLimitIntervalSec= when built with coverage
Frantisek Sumsal [Mon, 25 Oct 2021 09:02:22 +0000 (11:02 +0200)] 
test: tweak TriggerLimitIntervalSec= when built with coverage

Collecting coverage causes a significant slowdown in general, but since
this test requires certain timing, we need to tweak the defaults to make
it reliably pass.

4 years agovarlink: don't try to talk to oomd from unit tests 21116/head
Lennart Poettering [Mon, 25 Oct 2021 08:39:32 +0000 (10:39 +0200)] 
varlink: don't try to talk to oomd from unit tests

Talking to external daemons we ourselves maintain is a job for the
integration tests, not the unit tests. This communication is likely to
fail hence don#t even bother.

This makes our tests a bit cleaner.

4 years agocgroup: handle gracefully if we can't read oom_kill cgroup attribute
Lennart Poettering [Mon, 25 Oct 2021 08:39:12 +0000 (10:39 +0200)] 
cgroup: handle gracefully if we can't read oom_kill cgroup attribute

4 years agomount-util: move opening of /proc/self/mountinfo into bind_remount_one_with_mountinfo() 21077/head
Lennart Poettering [Wed, 20 Oct 2021 21:27:04 +0000 (23:27 +0200)] 
mount-util: move opening of /proc/self/mountinfo into bind_remount_one_with_mountinfo()

Let's move things around a bit, and open /proc/self/mountinfo if needed
inside of bind_remount_one_with_mountinfo(). That way bind_remount_one()
can become a superthin inline wrapper around
bind_remount_one_with_mountinfo(). Main benefit is that we don't even
have to open /p/s/mi in case mount_setattr() actually worked for us.

4 years agomount-util: port over bind_remount_recursive_with_mountinfo() to mount_setattr()
Lennart Poettering [Wed, 20 Oct 2021 21:12:53 +0000 (23:12 +0200)] 
mount-util: port over bind_remount_recursive_with_mountinfo() to mount_setattr()

4 years agomount-util: use modern mount_setattr() syscall for bind_remount_one_with_mountinfo()
Lennart Poettering [Wed, 20 Oct 2021 20:57:22 +0000 (22:57 +0200)] 
mount-util: use modern mount_setattr() syscall for bind_remount_one_with_mountinfo()

New kernels have a nice syscall for changing bind mount flags. Let's use
it. This makes the complex libmount based iteration logic unnecessary.

4 years agoTODO: add note about chase_symlink flag
Luca Boccassi [Sun, 24 Oct 2021 16:00:49 +0000 (17:00 +0100)] 
TODO: add note about chase_symlink flag

4 years agoMerge pull request #21108 from mrc0mmand/here-comes-the-coverage
Yu Watanabe [Sun, 24 Oct 2021 13:54:23 +0000 (22:54 +0900)] 
Merge pull request #21108 from mrc0mmand/here-comes-the-coverage

A couple more coverage-related tweaks

4 years agotest: rename the global service override file for coverage runs 21108/head
Frantisek Sumsal [Sat, 23 Oct 2021 20:10:24 +0000 (22:10 +0200)] 
test: rename the global service override file for coverage runs

Otherwise we break TEST-15-DROPIN, since it uses
/usr/lib/systemd/system/service.d/override.conf in some of its
sub-tests.

4 years agoREADME: fix CentOS CI badge
Frantisek Sumsal [Sat, 23 Oct 2021 19:46:53 +0000 (21:46 +0200)] 
README: fix CentOS CI badge

4 years agotest: disable ProtectHome= when collecting coverage as well
Frantisek Sumsal [Sat, 23 Oct 2021 19:20:37 +0000 (21:20 +0200)] 
test: disable ProtectHome= when collecting coverage as well

Depending on the location of the original build dir, either ProtectHome=
or ProtectSystem= may get in the way when creating the gcov metadata
files.

Follow-up to:
    * 02d7e73013a92c5580023e4e548d19adbc254dbe
    * 6c9efba67715cd1ced170ac46c04d47934ad276a

4 years agoMerge pull request #21082 from yuwata/network-dhcp6-pd-trivial-cleanups
Yu Watanabe [Sat, 23 Oct 2021 14:58:22 +0000 (23:58 +0900)] 
Merge pull request #21082 from yuwata/network-dhcp6-pd-trivial-cleanups

network: DHCPv6 PD: several trivial cleanups

4 years agoefivars: skip writing if variable is already in wanted state
Anssi Hannula [Mon, 18 Oct 2021 13:31:30 +0000 (16:31 +0300)] 
efivars: skip writing if variable is already in wanted state

In order to minimize EFI variable NVRAM wear, do not rewrite variables
if they are already in the wanted state (i.e. same data and attributes).

This allows e.g. performing repeat calls of "bootctl install" (which
always rewrites the EFI boot entry) without consuming EFI NVRAM write
cycles.

4 years agohomed: don't drop caches on activation
Lennart Poettering [Fri, 22 Oct 2021 22:42:54 +0000 (00:42 +0200)] 
homed: don't drop caches on activation

We should drop caches if we are configured to do so in all cases where
we are done with home dir operations: except if that operation is
activation, because in that case we are not destroying anything, but
leaving it on.

Hence, turn off the flag that reminds us that we should drop caches
before exiting, once activation completed fully,

Follow-up for 86019efa4416d7b548cab321c15bc22a65463786

4 years agonspawn: ignore --suppress-sync=yes when seccomp is disabled
Yu Watanabe [Fri, 22 Oct 2021 13:32:45 +0000 (22:32 +0900)] 
nspawn: ignore --suppress-sync=yes when seccomp is disabled

Follow-up for 4a4654e0241fbeabecb8587fd3520b6b39264b9c.

Fixes #21090.

4 years agonspawn: bump RLIMIT_NOFILE for nspawn payload similar to how host PID 1 does it for...
Lennart Poettering [Fri, 22 Oct 2021 15:34:46 +0000 (17:34 +0200)] 
nspawn: bump RLIMIT_NOFILE for nspawn payload similar to how host PID 1 does it for its payload

We try to pass containers roughly the same rlimits as the host gets from
the kernel. However, this means we'd set the RLIMIT_NOFILE to 4K. Which
is quite limiting though, and is something we actually departed from in
PID1: since 52d620757817bc0fa7de3ddbe43024544ced7ea0 we raise the limit
substantially for all userspace.

Given that nspawn is quite often invoked without proper PID1, let's raise the
limits for container payloads the same way as we do from the real PID1
to its service payloads.

4 years agoupdate TODO
Lennart Poettering [Fri, 22 Oct 2021 17:19:56 +0000 (19:19 +0200)] 
update TODO

4 years agosd-boot: Add keys to reboot into firmware interface
Jan Janssen [Wed, 20 Oct 2021 10:15:03 +0000 (12:15 +0200)] 
sd-boot: Add keys to reboot into firmware interface

This is useful if the auto-firmware setting has been disabled. The
keys used here are based on what the majority of firmware employ in
the wild.
This also ensures there's a chance for the user to discover this in
case they were too slow during POST or simply used the wrong ones.

4 years agoMerge pull request #21094 from poettering/userns-split
Lennart Poettering [Fri, 22 Oct 2021 17:12:21 +0000 (19:12 +0200)] 
Merge pull request #21094 from poettering/userns-split

util-lib: split out userns allocation into new helper function

4 years agoMerge pull request #21093 from poettering/homework-trivial-tweaks
Lennart Poettering [Fri, 22 Oct 2021 17:12:01 +0000 (19:12 +0200)] 
Merge pull request #21093 from poettering/homework-trivial-tweaks

homed trivial refactoring

4 years agoupdate TODO
Lennart Poettering [Fri, 22 Oct 2021 15:57:13 +0000 (17:57 +0200)] 
update TODO

4 years agoMerge pull request #21079 from poettering/fd-reopen-directory-tweak
Lennart Poettering [Fri, 22 Oct 2021 15:41:17 +0000 (17:41 +0200)] 
Merge pull request #21079 from poettering/fd-reopen-directory-tweak

fd-util: when re-opening a directory with fd_reopen() go via openat(……

4 years agoprocess-util: move sync() out of freeze() 21094/head
Lennart Poettering [Fri, 22 Oct 2021 14:37:10 +0000 (16:37 +0200)] 
process-util: move sync() out of freeze()

We are using this for creating userns namespaces, and we really
shouldn't try to sync there. Moreover the use of free() in shutdown code
doesn't need it anyway, since it just sync()ed right before anyway. Only
the third user of freeze() we have actually needs the syc(), hence do it
there and nowhere else.

4 years agonamespace-util: introduce userns_acquire() as helper for allocating new unbound userns
Lennart Poettering [Wed, 20 Oct 2021 11:15:27 +0000 (13:15 +0200)] 
namespace-util: introduce userns_acquire() as helper for allocating new unbound userns

This returns a namespace fd, and takes a uidmap/gidmap as string. This
is split out out mount-util.c's remount_idmap() logic, so that we can
allocate a userns independently.

4 years agobasic: move freeze() from shared/exec-util.h to basic/process-util.h
Lennart Poettering [Wed, 20 Oct 2021 11:14:11 +0000 (13:14 +0200)] 
basic: move freeze() from shared/exec-util.h to basic/process-util.h

That way we can use it in other code from basic/. It fits into both
headers equally well or badly, hence let's just move this one function.

4 years agohomework: split home_unshare_and_mount() in two 21093/head
Lennart Poettering [Fri, 22 Oct 2021 14:08:26 +0000 (16:08 +0200)] 
homework: split home_unshare_and_mount() in two

Previously the call did two things, and the second thing was optional
(depending on first arg being NULL). Let's simplify this and just make
it two distinct functions, where one calls the other.

This should make things a bit more readable, given that we called a
function called "…and_mount()" which didn't actually mount...

No actual code changes, just some refactoring.

4 years agohomework: use bit fields where we deal with lots of separate boolean flags
Lennart Poettering [Fri, 22 Oct 2021 13:51:49 +0000 (15:51 +0200)] 
homework: use bit fields where we deal with lots of separate boolean flags

No actual code changes, just making a structure a bit shorter.

4 years agohomework: add macro for "/run/systemd/user-home-mount"
Lennart Poettering [Fri, 22 Oct 2021 14:01:42 +0000 (16:01 +0200)] 
homework: add macro for "/run/systemd/user-home-mount"

We use this work dir a various places, and it's easy to mistype, hence
let the compiler detect this for us, and introduce a macro for it.

No code changes, just some search/replace.

4 years agonetwork: dhcp6pd: fix the default value of subnet ID
Yu Watanabe [Fri, 22 Oct 2021 06:49:26 +0000 (15:49 +0900)] 
network: dhcp6pd: fix the default value of subnet ID

The type of dhcp6_pd_subnet_id is int64_t.

4 years agovarlink: disconnect varlink link in one more case
Lennart Poettering [Thu, 21 Oct 2021 15:29:48 +0000 (17:29 +0200)] 
varlink: disconnect varlink link in one more case

Previously we'd possibly see POLLHUP on a varlink link, and continue to
run epoll on it even though we have nothing to read nor write anymore.

Let's fix that, and once we know that there's nothing to write anymore
(or we saw a write error already) we'll disconnect after POLLHUP.

Fixes: #20062
4 years agotest-fd-util: add test case for fd_reopen() 21079/head
Lennart Poettering [Fri, 22 Oct 2021 12:04:28 +0000 (14:04 +0200)] 
test-fd-util: add test case for fd_reopen()

4 years agofd-util: tweak error handling in fd_reopen()
Lennart Poettering [Fri, 22 Oct 2021 12:03:46 +0000 (14:03 +0200)] 
fd-util: tweak error handling in fd_reopen()

If we know that /proc/ works, then ENOENT when reopening an fd means the
fd didn't exist. Let's return the correct error code for that, i.e.
EBADF.

4 years agofd-util: when re-opening a directory with fd_reopen() go via openat(…, ".", …)
Lennart Poettering [Thu, 21 Oct 2021 08:21:03 +0000 (10:21 +0200)] 
fd-util: when re-opening a directory with fd_reopen() go via openat(…, ".", …)

This adds a tiny shortcut to fd_reopen(): if we are about to reopen the
fd via O_DIRECTORY then we know it#s a directory and we might as well
reopen it via opening "." using the fd as "at fd" in openat().

This has the benefit that we don't need /proc/self/fd/ around for this
special case: fewer sources of errors.

4 years agotest-networkd-address: fix clock type
Lennart Poettering [Fri, 22 Oct 2021 07:39:55 +0000 (09:39 +0200)] 
test-networkd-address: fix clock type

The clock to use internally is clock_boottime_or_monotonic(), but the
test used CLOCK_MONOTONIC. After one system suspend the test thus likely
starts to fail.

4 years agosd-boot: Be more precise about secure boot modes
Jan Janssen [Wed, 20 Oct 2021 08:11:45 +0000 (10:11 +0200)] 
sd-boot: Be more precise about secure boot modes

Fixes: #11559
4 years agonetwork: dhcp6pd: check link state earlier before assigning prefixes to downstream 21082/head
Yu Watanabe [Thu, 21 Oct 2021 07:09:44 +0000 (16:09 +0900)] 
network: dhcp6pd: check link state earlier before assigning prefixes to downstream

Also, narrow the acceptable range of the states.

4 years agonetwork: dhcp6pd: also call dhcp6_pd_prepare() and dhcp6_pd_finalize() for upstream...
Yu Watanabe [Thu, 21 Oct 2021 08:54:06 +0000 (17:54 +0900)] 
network: dhcp6pd: also call dhcp6_pd_prepare() and dhcp6_pd_finalize() for upstream interface

As now the subnet prefix may be assigned to the upstream interface.

4 years agoMerge pull request #21081 from mrc0mmand/even-more-coverage-tweaks
Yu Watanabe [Thu, 21 Oct 2021 19:48:40 +0000 (04:48 +0900)] 
Merge pull request #21081 from mrc0mmand/even-more-coverage-tweaks

test: collect even more coverage

4 years agohwdb: Allow USB autosuspend for MS Surface Pro (2017) Type Cover
Jonas Dreßler [Thu, 21 Oct 2021 12:47:35 +0000 (14:47 +0200)] 
hwdb: Allow USB autosuspend for MS Surface Pro (2017) Type Cover

The Surface Type Covers are known to support USB autosuspend just fine
(and it's also enabled by default on Windows), so enable it in hwdb.

4 years agonetwork: dhcp6pd: not necessary to drop routes when Assign=yes
Yu Watanabe [Wed, 20 Oct 2021 20:47:16 +0000 (05:47 +0900)] 
network: dhcp6pd: not necessary to drop routes when Assign=yes

4 years agoMerge pull request #21072 from yuwata/network-address-lifetime
Yu Watanabe [Thu, 21 Oct 2021 16:46:55 +0000 (01:46 +0900)] 
Merge pull request #21072 from yuwata/network-address-lifetime

network: address: use usec_t for handling lifetime

4 years agoMerge pull request #21050 from yuwata/network-bpf-cleanups
Yu Watanabe [Thu, 21 Oct 2021 16:46:15 +0000 (01:46 +0900)] 
Merge pull request #21050 from yuwata/network-bpf-cleanups

libsystemd-network: cleanup BPF code

4 years agotest: make the coverage check safer for non-compiled builds 21081/head
Frantisek Sumsal [Thu, 21 Oct 2021 16:34:21 +0000 (18:34 +0200)] 
test: make the coverage check safer for non-compiled builds

4 years agotest: collect the coverage _before_ unmounting the rootfs
Frantisek Sumsal [Thu, 21 Oct 2021 16:12:06 +0000 (18:12 +0200)] 
test: collect the coverage _before_ unmounting the rootfs

d'oh!

4 years agotest: loosen sandbox restrictions for integration tests as well
Frantisek Sumsal [Thu, 21 Oct 2021 16:06:36 +0000 (18:06 +0200)] 
test: loosen sandbox restrictions for integration tests as well

Otherwise we miss quite a lot of coverage (mainly from logind,
hostnamed, networkd, and possibly others), since they can't write their
reports with `ProtectSystem=strict`.

4 years agotest: loosen certain sandbox restrictions when collecting coverage
Frantisek Sumsal [Thu, 21 Oct 2021 15:34:43 +0000 (17:34 +0200)] 
test: loosen certain sandbox restrictions when collecting coverage

With `ProtectSystem=strict` gcov is unable to write the *.gcda files
with collected coverage. Let's add a yet another switch to make such
restriction less strict to make gcov happy.

This addresses following errors:
```
...
systemd-networkd[272469]: profiling:/systemd-meson-build/src/shared/libsystemd-shared-249.a.p/binfmt-util.c.gcda:Cannot open
systemd-networkd[272469]: profiling:/systemd-meson-build/src/shared/libsystemd-shared-249.a.p/base-filesystem.c.gcda:Cannot open
systemd-networkd[272469]: profiling:/systemd-meson-build/src/shared/libsystemd-shared-249.a.p/barrier.c.gcda:Cannot open
systemd-networkd[272469]: profiling:/systemd-meson-build/src/shared/libsystemd-shared-249.a.p/ask-password-api.c.gcda:Cannot open
systemd-networkd[272469]: profiling:/systemd-meson-build/src/shared/libsystemd-shared-249.a.p/apparmor-util.c.gcda:Cannot open
systemd-networkd[272469]: profiling:/systemd-meson-build/src/shared/libsystemd-shared-249.a.p/acpi-fpdt.c.gcda:Cannot open
...
```

4 years agotest: wait a bit for the given PID to die if it's still alive
Frantisek Sumsal [Thu, 21 Oct 2021 13:59:57 +0000 (15:59 +0200)] 
test: wait a bit for the given PID to die if it's still alive

When playing around with the coverage-enabled build I kept hitting
an issue where dnsmasq failed to start because the previous instance was
still shutting down. This should, hopefully, help to mitigate that.

4 years agoicmp6: shorten code a bit 21050/head
Yu Watanabe [Tue, 19 Oct 2021 11:32:40 +0000 (20:32 +0900)] 
icmp6: shorten code a bit

4 years agodhcp: shorten BPF code a bit
Yu Watanabe [Tue, 19 Oct 2021 11:28:57 +0000 (20:28 +0900)] 
dhcp: shorten BPF code a bit

- replace `A = k` and `X = A` with `X = k`,
- replace `A ^= X` and `A == 0` with `A == X`.
- use UINT32_MAX when accept a packet

4 years agodhcp: rebreak function arguments
Yu Watanabe [Tue, 19 Oct 2021 11:24:09 +0000 (20:24 +0900)] 
dhcp: rebreak function arguments

4 years agodhcp: fix assertions
Yu Watanabe [Tue, 19 Oct 2021 11:23:47 +0000 (20:23 +0900)] 
dhcp: fix assertions

4 years agodhcp: shorten code a bit
Yu Watanabe [Tue, 19 Oct 2021 11:22:56 +0000 (20:22 +0900)] 
dhcp: shorten code a bit

4 years agolldp: shorten code a bit
Yu Watanabe [Tue, 19 Oct 2021 11:16:34 +0000 (20:16 +0900)] 
lldp: shorten code a bit

4 years agoarp-util: shorten BPF code a bit
Yu Watanabe [Tue, 19 Oct 2021 11:05:11 +0000 (20:05 +0900)] 
arp-util: shorten BPF code a bit

- replace `A = k` and `X = A` with `X = k`,
- replace `A ^= X` and `A == 0` with `A == X`.
- use UINT32_MAX when accept a packet

4 years agonetwork: address: use usec_t for handling lifetime 21072/head
Yu Watanabe [Wed, 20 Oct 2021 17:21:59 +0000 (02:21 +0900)] 
network: address: use usec_t for handling lifetime

This drops stuct ifa_cacheinfo from Address, and store lifetime with
usec_t.

Why? Now, all requests of address configurations are once stored in
the request queue, and will be processed when it is ready. So, the
timestamp value passed to the kernel must be evaluated on configure.

This also fixes the following two issues.
- Time values in struct ifa_cacheinfo are stored in uint32_t.
  So, the validity check of the address configured by NDisc may fail on
  long running systems.
- If a system uses DHCPv6PD, when an interface may appear or be
  reconfigured later, then the lifetime value may be inappropriate.
  We need to adjust the lifetime with the current time and the timestamp
  of the lease.

4 years agonetwork: ndisc: rename valid_until -> lifetime_usec
Yu Watanabe [Thu, 21 Oct 2021 11:50:12 +0000 (20:50 +0900)] 
network: ndisc: rename valid_until -> lifetime_usec

4 years agonetwork: ndisc: add missing lifetime check
Yu Watanabe [Thu, 21 Oct 2021 11:43:57 +0000 (20:43 +0900)] 
network: ndisc: add missing lifetime check

4 years agonetwork: route: rename lifetime -> lifetime_usec
Yu Watanabe [Wed, 20 Oct 2021 15:22:49 +0000 (00:22 +0900)] 
network: route: rename lifetime -> lifetime_usec

4 years agoMerge pull request #21065 from keszybz/efi-warnings
Zbigniew Jędrzejewski-Szmek [Thu, 21 Oct 2021 06:33:08 +0000 (08:33 +0200)] 
Merge pull request #21065 from keszybz/efi-warnings

Clean up unused variables in efi code

4 years agonetwork: drop unnecessary header inclusion
Yu Watanabe [Wed, 20 Oct 2021 19:26:56 +0000 (04:26 +0900)] 
network: drop unnecessary header inclusion

4 years agoCI: disable code coverage in GH Action
Luca Boccassi [Wed, 20 Oct 2021 21:10:56 +0000 (22:10 +0100)] 
CI: disable code coverage in GH Action

It is now ran on the nightly CentOS build, so that it can cover
integration tests too, and not just unit tests. It's nightly as
it considerably increases the integration test runtime, so it's
not appropriate for all PRs.

4 years agotest: don't install test-network-generator-conversion.sh w/o networkd
Frantisek Sumsal [Wed, 20 Oct 2021 17:43:34 +0000 (19:43 +0200)] 
test: don't install test-network-generator-conversion.sh w/o networkd

otherwise TEST-02 will fail:

```
=== Failed test log ===
--- test-network-generator-conversion.sh begin ---
+ [[ -n '' ]]
+ [[ -x /usr/lib/systemd/systemd-network-generator ]]
+ [[ -x /lib/systemd/systemd-network-generator ]]
+ exit 1
--- test-network-generator-conversion.sh end ---
```

Before:
```
$ meson build -Dnetworkd=false -Dinstall-tests=true
$ ninja -C build
$ DESTDIR=$PWD/test-install ninja -C build install
$ find test-install/ -name test-network-generator-conversion.sh
test-install/usr/lib/systemd/tests/test-network-generator-conversion.sh
```

After:
```
$ find test-install/ -name test-network-generator-conversion.sh
<no output>
```

4 years agotest: collect coverage in a couple more codepaths
Frantisek Sumsal [Wed, 20 Oct 2021 11:00:37 +0000 (13:00 +0200)] 
test: collect coverage in a couple more codepaths

Otherwise we'd miss coverage from TEST-{02,24,61}, since they don't go
through the "standard" `check_result_common` hook.

Follow-up to 7bf20e48bd7d641a39a14a7feb749b7e8b0fc0f6.

4 years agozsh-completion: nspawn: add --suppress-sync option
Yu Watanabe [Wed, 20 Oct 2021 13:44:35 +0000 (22:44 +0900)] 
zsh-completion: nspawn: add --suppress-sync option

Follow-up for 4a4654e0241fbeabecb8587fd3520b6b39264b9c.

4 years agoMerge pull request #21051 from poettering/nspawn-no-sync
Yu Watanabe [Wed, 20 Oct 2021 13:42:43 +0000 (22:42 +0900)] 
Merge pull request #21051 from poettering/nspawn-no-sync

nspawn: add --suppress-sync=yes mode for turning sync() and friends i…

4 years agoMerge pull request #21055 from yuwata/network-dhcp6-pd-route-lifetime-metric
Luca Boccassi [Wed, 20 Oct 2021 13:38:03 +0000 (14:38 +0100)] 
Merge pull request #21055 from yuwata/network-dhcp6-pd-route-lifetime-metric

network: dhcp6pd: set lifetime and route metric

4 years agoMerge pull request #21061 from poettering/direct-io-loopback-tweaks
Yu Watanabe [Wed, 20 Oct 2021 13:21:30 +0000 (22:21 +0900)] 
Merge pull request #21061 from poettering/direct-io-loopback-tweaks

tweaks to O_DIRECT loop work

4 years agoTypos found by codespell
Dimitri Papadopoulos [Wed, 20 Oct 2021 07:38:57 +0000 (09:38 +0200)] 
Typos found by codespell

4 years agoefi: check input parameter 21065/head
Zbigniew Jędrzejewski-Szmek [Wed, 20 Oct 2021 11:57:38 +0000 (13:57 +0200)] 
efi: check input parameter

clang complained about an unused variable. We cast the buffer to
struct boot_params, so let's check that it's at least this long.

4 years agoefi: drop two unused variables
Zbigniew Jędrzejewski-Szmek [Wed, 20 Oct 2021 11:53:27 +0000 (13:53 +0200)] 
efi: drop two unused variables

It seems the code was added in 2553a5482c77980429565d14662f309e385bd472 and
those two were never used for anything.

4 years agonspawn: add --suppress-sync=yes mode for turning sync() and friends into NOPs via... 21051/head
Lennart Poettering [Tue, 19 Oct 2021 12:56:49 +0000 (14:56 +0200)] 
nspawn: add --suppress-sync=yes mode for turning sync() and friends into NOPs via seccomp

This is supposed to be used by package/image builders such as mkosi to
speed up building, since it allows us to suppress sync() inside a
container.

This does what Debian's eatmydata tool does, but for a container, and
via seccomp (instead of LD_PRELOAD).

4 years agoloop-util: call loop_device_make_internal() at the right place 21061/head
Lennart Poettering [Wed, 20 Oct 2021 07:57:16 +0000 (09:57 +0200)] 
loop-util: call loop_device_make_internal() at the right place

The whole reason loop_device_make_internal() exists (as opposed to just
loop_device_make()) is to avoid mangling the loop flags value/call
getenv twice. Hence let's actually call it when we already mangled the
flags value.

4 years agoloop-util: add debug logging about O_RDWR vs. O_RDONLY + O_DIRECT mode
Lennart Poettering [Wed, 20 Oct 2021 07:56:20 +0000 (09:56 +0200)] 
loop-util: add debug logging about O_RDWR vs. O_RDONLY + O_DIRECT mode

Once we managed to open the file let's log what we wanted and what we
got.

4 years agoloop-util: minor coding style updates
Lennart Poettering [Wed, 20 Oct 2021 07:55:33 +0000 (09:55 +0200)] 
loop-util: minor coding style updates

As suggested here: https://github.com/systemd/systemd/pull/21044#pullrequestreview-783530343

4 years agoMerge pull request #21041 from yuwata/network-bpf-neighbor
Yu Watanabe [Wed, 20 Oct 2021 04:30:32 +0000 (13:30 +0900)] 
Merge pull request #21041 from yuwata/network-bpf-neighbor

network: introduce BPF to reject netlink messages about non-static neighbor

4 years agoMerge pull request #21056 from yuwata/test-network-cleanups
Yu Watanabe [Wed, 20 Oct 2021 04:29:45 +0000 (13:29 +0900)] 
Merge pull request #21056 from yuwata/test-network-cleanups

test-network: several cleanups related to dnsmasq

4 years agotest-network: cleanup dnsmasq related file on setup 21056/head
Yu Watanabe [Thu, 14 Oct 2021 17:00:27 +0000 (02:00 +0900)] 
test-network: cleanup dnsmasq related file on setup

Just for safety.

4 years agotest-network: drop pid_file argument from stop_dnsmasq()
Yu Watanabe [Thu, 14 Oct 2021 16:54:11 +0000 (01:54 +0900)] 
test-network: drop pid_file argument from stop_dnsmasq()

4 years agotest-network: use constant variables in dnsmasq command
Yu Watanabe [Thu, 14 Oct 2021 16:36:08 +0000 (01:36 +0900)] 
test-network: use constant variables in dnsmasq command

4 years agonetwork: dhcp6pd: set default metric 256 for delegated prefix 21055/head
Yu Watanabe [Thu, 14 Oct 2021 20:57:30 +0000 (05:57 +0900)] 
network: dhcp6pd: set default metric 256 for delegated prefix

When Assign= in [DHCPv6PrefixDelegation] is enabled, then the kernel
will create the prefix route for the assigned address with metric 256.
When Assign= is disabled, then the kernel will create the route with
metric 1024.

For the default value, we should choose a smaller value (higher priority)
than 1024, as the unreachable routes for delegated prefix will be
configured with 1024.

4 years agonetwork: dhcp6: explicitly specify metric for unreachable route
Yu Watanabe [Thu, 14 Oct 2021 21:00:22 +0000 (06:00 +0900)] 
network: dhcp6: explicitly specify metric for unreachable route

For static IPv6 routes without metric is specified, then we use 1024.
But such an adjustment is not performed to dynamic routes. So, let's
specify the metric explicitly.
Otherwise, configured routes will be handled as foreign.

4 years agonetwork: dhcp6pd: set lifetime to routes for assigned prefixes
Yu Watanabe [Thu, 14 Oct 2021 19:21:21 +0000 (04:21 +0900)] 
network: dhcp6pd: set lifetime to routes for assigned prefixes

Note that the kernel (at least 5.14.11) seems not to support lifetime
for IPv6 unreachable routes. The lifetime for routes of the type will be
handled by sd-event's timer event source.
So, we cannot confirm the lifetime with 'ip route' command.

4 years agosd-dhcp6-client: introduce sd_dhcp6_lease_get_timestamp()
Yu Watanabe [Thu, 14 Oct 2021 19:19:59 +0000 (04:19 +0900)] 
sd-dhcp6-client: introduce sd_dhcp6_lease_get_timestamp()

4 years agoMerge pull request #21035 from yuwata/network-route-fix-lifetime
Yu Watanabe [Tue, 19 Oct 2021 16:48:44 +0000 (01:48 +0900)] 
Merge pull request #21035 from yuwata/network-route-fix-lifetime

network: route: drop kernel version check

4 years agoMerge pull request #21044 from poettering/loopback-direct-io
Lennart Poettering [Tue, 19 Oct 2021 16:42:25 +0000 (18:42 +0200)] 
Merge pull request #21044 from poettering/loopback-direct-io

loop-util: enable LO_FLAGS_DIRECT_IO by default on loopback devices

4 years agoCI: disable opensuse mkosi CI
Daan De Meyer [Tue, 19 Oct 2021 13:54:07 +0000 (14:54 +0100)] 
CI: disable opensuse mkosi CI

Until https://github.com/systemd/systemd/issues/21019 is fixed,
there's no point in running the opensuse CI job so let's disable
it for now.

4 years agoloop-util: work around cache invalidation bug in older kernels 21044/head
Lennart Poettering [Mon, 18 Oct 2021 20:34:54 +0000 (22:34 +0200)] 
loop-util: work around cache invalidation bug in older kernels

Inspired by the discussions in #21003.

Inspired in particular by what Android apexd does:

https://android.googlesource.com/platform/system/apex/+/refs/heads/master/apexd/apexd_loop.cpp