]> git.ipfire.org Git - thirdparty/systemd.git/log
thirdparty/systemd.git
4 years agonetwork: radv: refuse invalid router lifetime in conf parser 21143/head
Yu Watanabe [Wed, 27 Oct 2021 04:22:49 +0000 (13:22 +0900)] 
network: radv: refuse invalid router lifetime in conf parser

4 years agosd-radv: update how to calculate interval of sending advertisements
Yu Watanabe [Wed, 27 Oct 2021 07:08:22 +0000 (16:08 +0900)] 
sd-radv: update how to calculate interval of sending advertisements

4 years agosd-radv: router lifetime must be 0 or between 4 seconds and 9000 seconds
Yu Watanabe [Sun, 24 Oct 2021 16:21:22 +0000 (01:21 +0900)] 
sd-radv: router lifetime must be 0 or between 4 seconds and 9000 seconds

See RFC 4861 section 6.2.1.

4 years agosd-radv: introduce RADV_DEFAULT_ROUTER_LIFETIME_USEC
Yu Watanabe [Sun, 24 Oct 2021 16:03:30 +0000 (01:03 +0900)] 
sd-radv: introduce RADV_DEFAULT_ROUTER_LIFETIME_USEC

4 years agosd-radv: add several notes about constants
Yu Watanabe [Sun, 24 Oct 2021 15:48:43 +0000 (00:48 +0900)] 
sd-radv: add several notes about constants

4 years agosd-radv: make several constants not exposed
Yu Watanabe [Sun, 24 Oct 2021 15:37:45 +0000 (00:37 +0900)] 
sd-radv: make several constants not exposed

4 years agosd-radv: drop SD_ prefix for unexposed constants
Yu Watanabe [Wed, 27 Oct 2021 09:54:33 +0000 (18:54 +0900)] 
sd-radv: drop SD_ prefix for unexposed constants

4 years agosd-radv: make sd_radv_set_router_lifetime() take usec_t (uint64_t)
Yu Watanabe [Sun, 24 Oct 2021 15:15:06 +0000 (00:15 +0900)] 
sd-radv: make sd_radv_set_router_lifetime() take usec_t (uint64_t)

4 years agochange indicator used for later versions of VirtualBox (#21127)
Greg Zuro [Wed, 27 Oct 2021 04:02:37 +0000 (21:02 -0700)] 
change indicator used for later versions of VirtualBox (#21127)

Detection of VirtualBox is accomplished in the existing code by *either* `innotek GmbH`
or `Oracle Corporation` existing in any of:

- /sys/class/dmi/id/product_name
- /sys/class/dmi/id/sys_vendor
- /sys/class/dmi/id/board_vendor
- /sys/class/dmi/id/bios_vendor

With Oracle's physical servers, both `/sys/class/dmi/id/sys_vendor` and
`/sys/class/dmi/id/board_vendor` contain `Oracle Corporation`, so those
servers are detected as `oracle` (VirtualBox).

VirtualBox has the following values in the latest versions:

- /sys/class/dmi/id/product_name: `VirtualBox`
- /sys/class/dmi/id/sys_vendor: `innotek GmbH`
- /sys/class/dmi/id/board_vendor: `Oracle Corporation`
- /sys/class/dmi/id/bios_vendor: `innotek GmbH`

Presumably the existing check for `innotek GmbH` is meant to detect
older versions of VirtualBox, while changing the second checked value
from `Oracle Corporation` to `VirtualBox` will reliably detect later and future
versions.

4 years agoMerge pull request #21129 from yuwata/network-dhcp6-pd-vs-ndisc
Yu Watanabe [Wed, 27 Oct 2021 03:15:18 +0000 (12:15 +0900)] 
Merge pull request #21129 from yuwata/network-dhcp6-pd-vs-ndisc

network: several follow-ups for DHCPv6-PD

4 years agojson: do something remotely reasonable when we see NaN/infinity
Lennart Poettering [Tue, 26 Oct 2021 13:45:49 +0000 (15:45 +0200)] 
json: do something remotely reasonable when we see NaN/infinity

JSON doesn't have NaN/infinity/-infinity concepts in the spec.
Implementations vary what they do with it. JSON5 + Python simply
generate special words "NAN" and "Inifinity" from it. Others generate
"null" for it.

At this point we never actually want to output this, so let's be
conservative and generate RFC compliant JSON, i.e. convert to null.

One day should JSON5 actually become a thing we can revisit this, but in
that case we should implement things via a flag, and only optinally
process nan/infinity/-infinity.

This patch is extremely simple: whenever accepting a
nan/infinity/-infinity from outside it converts it to NULL. I.e. we
convert on input, not output.

4 years agotest: add a missing `udevadm settle` to the multipath test case
Frantisek Sumsal [Tue, 26 Oct 2021 12:39:02 +0000 (14:39 +0200)] 
test: add a missing `udevadm settle` to the multipath test case

8a088877ab92d3777d7f487393e3daef6edf43ff uncovered a missing `udevadm
settle` in the multipath test case, causing the test to occasionally
fail with:

```
[   41.718617] testsuite-64.sh[806]: + for i in {0..63}
[   41.727917] systemd-udevd[1120]: sdhf: /usr/lib/udev/rules.d/60-persistent-storage.rules:66 Importing properties from results of 'scsi_id --export --whitelisted -d /dev/sdhf'
[   41.728668] testsuite-64.sh[2341]: ++ printf %.4d 1
[   41.733851] systemd-udevd[1415]: sdhc: Adding watch on '/dev/sdhc'
[   41.734477] testsuite-64.sh[806]: + wwid=deaddeadbeef0001
[   41.734477] testsuite-64.sh[806]: + path=/dev/disk/by-id/wwn-0xdeaddeadbeef0001
[   41.746174] systemd-udevd[1409]: sdhb: 'scsi_id --export --whitelisted -d /dev/sdhb'(out) 'ID_MODEL_ENC=QEMU\x20HARDDISK\x20\x20\x20'
[   41.747058] testsuite-64.sh[2342]: ++ readlink -f /dev/disk/by-id/wwn-0xdeaddeadbeef0001
[   41.755512] testsuite-64.sh[806]: + dmpath=/dev/sdi
[   41.755512] testsuite-64.sh[806]: + lsblk /dev/disk/by-id/wwn-0xdeaddeadbeef0001
[   41.766884] systemd-udevd[1402]: sdhd: 'scsi_id --export --whitelisted -d /dev/sdhd'(out) 'ID_VENDOR=QEMU'
[   41.767532] testsuite-64.sh[2343]: NAME MAJ:MIN RM  SIZE RO TYPE MOUNTPOINTS
[   41.767532] testsuite-64.sh[2343]: sdi    8:128  0  512B  0 disk
[   41.779219] systemd-udevd[1400]: dm-33: 'kpartx_id 254 33 mpath-3deaddeadbeef0051'(out) 'DM_WWN=0xdeaddeadbeef0051'
[   41.779902] testsuite-64.sh[806]: + multipath -C /dev/sdi
[   41.785296] systemd-udevd[1414]: dm-31: Device processed (SEQNUM=4839, ACTION=change)
[   41.785925] testsuite-64.sh[2344]: 37.658168 | /dev/sdi is not a dm device
```

4 years agoman: adjust the explanations related to the DHCPv6 client starting mode 21129/head
Yu Watanabe [Thu, 14 Oct 2021 10:27:08 +0000 (19:27 +0900)] 
man: adjust the explanations related to the DHCPv6 client starting mode

4 years agonetwork: dhcp6: make UplinkInterface=:self imply WithoutRA=solicit
Yu Watanabe [Thu, 14 Oct 2021 10:10:49 +0000 (19:10 +0900)] 
network: dhcp6: make UplinkInterface=:self imply WithoutRA=solicit

4 years agonetwork: do not restart DHCPv6 client when WithoutRA= is set
Yu Watanabe [Thu, 14 Oct 2021 07:35:29 +0000 (16:35 +0900)] 
network: do not restart DHCPv6 client when WithoutRA= is set

Previously, even if WithoutRA= is specified, the DHCPv6 client may be
restarted in undesired mode when a RA is received.

4 years agonetwork: deprecate ForceDHCPv6PDOtherInformation= setting
Yu Watanabe [Thu, 14 Oct 2021 06:42:33 +0000 (15:42 +0900)] 
network: deprecate ForceDHCPv6PDOtherInformation= setting

The setting is completely meaningless, as WithoutRA= and UseDelegatedPrefix=
in [DHCPv6] section, and DHCPv6Client= in [IPv6AcceptRA] section control
the behavior.

4 years agoMerge pull request #21000 from yuwata/network-dhcp6-pd-introduce-uplink
Yu Watanabe [Tue, 26 Oct 2021 15:32:50 +0000 (00:32 +0900)] 
Merge pull request #21000 from yuwata/network-dhcp6-pd-introduce-uplink

network: dhcp6: introduce UplinkInterface= for prefix delegation

4 years agoMerge pull request #21126 from bluca/meta_arch
Zbigniew Jędrzejewski-Szmek [Tue, 26 Oct 2021 14:24:22 +0000 (16:24 +0200)] 
Merge pull request #21126 from bluca/meta_arch

docs/COREDUMP_PACKAGE_METADATA: add architecture field

4 years agoupdate TODO
Lennart Poettering [Tue, 26 Oct 2021 13:40:25 +0000 (15:40 +0200)] 
update TODO

4 years agodocs/COREDUMP_PACKAGE_METADATA: ELF section should be read-only and 4-bytes-aligned 21126/head
Luca Boccassi [Tue, 26 Oct 2021 11:49:39 +0000 (12:49 +0100)] 
docs/COREDUMP_PACKAGE_METADATA: ELF section should be read-only and 4-bytes-aligned

4 years agotest-network: add test cases for DHCPv6 prefix delegation 21000/head
Yu Watanabe [Thu, 14 Oct 2021 17:51:18 +0000 (02:51 +0900)] 
test-network: add test cases for DHCPv6 prefix delegation

4 years agonetwork: dhcp6: introduce UplinkInterface= for DHCP6 prefix delegation
Yu Watanabe [Wed, 13 Oct 2021 09:00:52 +0000 (18:00 +0900)] 
network: dhcp6: introduce UplinkInterface= for DHCP6 prefix delegation

4 years agonetwork: move config_parse_uplink() to networkd-dhcp-common.[ch]
Yu Watanabe [Wed, 13 Oct 2021 08:15:10 +0000 (17:15 +0900)] 
network: move config_parse_uplink() to networkd-dhcp-common.[ch]

4 years agonetwork: dhcp6pd: do not trigger prefix reassignment for all downstreams when a new...
Yu Watanabe [Thu, 21 Oct 2021 08:49:08 +0000 (17:49 +0900)] 
network: dhcp6pd: do not trigger prefix reassignment for all downstreams when a new downstream appears

It is not necessary to reconfigure other interfaces.

4 years agonetwork: dhcp6: do not reconfigure/restart DHCPv6 clients when a new downstream appears
Yu Watanabe [Wed, 13 Oct 2021 07:52:24 +0000 (16:52 +0900)] 
network: dhcp6: do not reconfigure/restart DHCPv6 clients when a new downstream appears

Previously, when a downstream appears which requests delegated prefix to
be assigned, then possibly restart all DHCPv6 clients for another
interfaces.

This makes networkd always honor the UseDelegatedPrefix= setting, and
not restart DHCPv6 clients.

4 years agonetwork: dhcp6: introduce UseDelegatedPrefix= setting and enable by default
Yu Watanabe [Wed, 13 Oct 2021 07:26:09 +0000 (16:26 +0900)] 
network: dhcp6: introduce UseDelegatedPrefix= setting and enable by default

Previously, the prefix delegation is enabled when at least one
downstream interfaces request it. But, when the DHCPv6 client on the
upstream interface is configured, some downstream interfaces may not
exist yet, nor have .network file assigned.

Also, if a system has thousands of interfaces, then the previous logic
introduce O(n^2) search.

This makes the prefix delegation is always enabled, except when it is
explicitly disabled. Hopefully, that should not break anything, as the
DHCPv6 server should ignore the prefix delegation request if the server
do not have any prefix to delegate.

4 years agochange req meson version
gregzuro [Mon, 25 Oct 2021 23:51:40 +0000 (16:51 -0700)] 
change req meson version

since `meson compile` first appears in 0.54.0

4 years agoMerge pull request #21122 from yuwata/network-optimize-reload
Yu Watanabe [Tue, 26 Oct 2021 06:55:01 +0000 (15:55 +0900)] 
Merge pull request #21122 from yuwata/network-optimize-reload

network: slightly optimize "networkctl reload"

4 years agotest-network: reconfigure interface instead of restarting networkd 21122/head
Yu Watanabe [Mon, 25 Oct 2021 17:47:30 +0000 (02:47 +0900)] 
test-network: reconfigure interface instead of restarting networkd

4 years agonetwork: delay dropping addresses or so on reloading .network files
Yu Watanabe [Mon, 25 Oct 2021 17:29:09 +0000 (02:29 +0900)] 
network: delay dropping addresses or so on reloading .network files

When a .network file is updated but its change is not so big, it is not
necessary to first drop all configs and then reassign later again.
This slightly optimize such situation. First foreignize all configs, and
then drop later when it is not requested by the updated .network file.

4 years agohomework: replace homegrown "dir-is-empty" check with dir_is_empty_at()
Lennart Poettering [Thu, 21 Oct 2021 16:07:50 +0000 (18:07 +0200)] 
homework: replace homegrown "dir-is-empty" check with dir_is_empty_at()

4 years agoMerge pull request #21097 from poettering/dir-is-empty-fix
Yu Watanabe [Mon, 25 Oct 2021 23:12:50 +0000 (08:12 +0900)] 
Merge pull request #21097 from poettering/dir-is-empty-fix

dir_is_empty_at() tweaks

4 years agotest: enable debug logging of systemd-udevd
Yu Watanabe [Mon, 25 Oct 2021 20:06:49 +0000 (05:06 +0900)] 
test: enable debug logging of systemd-udevd

Otherwise, it is hard to debug when the test fails.

4 years agonetwork: dhcp6pd: do not assign downstream prefix when RADV is requested but not...
Yu Watanabe [Thu, 21 Oct 2021 14:36:04 +0000 (23:36 +0900)] 
network: dhcp6pd: do not assign downstream prefix when RADV is requested but not configured yet

4 years agonetwork: ndisc: fix behavior when DHCPv6Client=always
Yu Watanabe [Thu, 14 Oct 2021 07:16:07 +0000 (16:16 +0900)] 
network: ndisc: fix behavior when DHCPv6Client=always

The man page says that when 'always' is set, the DHCPv6 client always
starts in managed mode, and that means we need to ignore the RA flags.

4 years agoMerge pull request #21119 from yuwata/network-dhcp6-pd-cleanups
Yu Watanabe [Mon, 25 Oct 2021 23:10:56 +0000 (08:10 +0900)] 
Merge pull request #21119 from yuwata/network-dhcp6-pd-cleanups

network: dhcp6pd: several cleanups

4 years agolibsystemd-network: do not warn when log_dhcp_client() or friends with NULL
Yu Watanabe [Sun, 24 Oct 2021 19:48:39 +0000 (04:48 +0900)] 
libsystemd-network: do not warn when log_dhcp_client() or friends with NULL

4 years agodocs/COREDUMP_PACKAGE_METADATA: add architecture field
Luca Boccassi [Mon, 25 Oct 2021 22:09:43 +0000 (23:09 +0100)] 
docs/COREDUMP_PACKAGE_METADATA: add architecture field

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 agonetwork: rename function
Yu Watanabe [Mon, 25 Oct 2021 17:27:26 +0000 (02:27 +0900)] 
network: rename function

4 years agonetwork: dhcp6: rename variables 21119/head
Yu Watanabe [Wed, 13 Oct 2021 07:12:51 +0000 (16:12 +0900)] 
network: dhcp6: rename variables

4 years agonetwork: dhcp6pd: move logic of acquiring subnet prefix into dhcp6_pd_assign_prefix()
Yu Watanabe [Thu, 21 Oct 2021 07:42:31 +0000 (16:42 +0900)] 
network: dhcp6pd: move logic of acquiring subnet prefix into dhcp6_pd_assign_prefix()

Preparation for later commits.

4 years agonetwork: dhcp6pd: introduce a simplified and unified method to calculate subnet prefix
Yu Watanabe [Wed, 20 Oct 2021 20:16:52 +0000 (05:16 +0900)] 
network: dhcp6pd: introduce a simplified and unified method to calculate subnet prefix

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`.