]> git.ipfire.org Git - thirdparty/systemd.git/log
thirdparty/systemd.git
4 years agowatchdog: add ", ignoring" to log messages about errors we ignore 20751/head
Lennart Poettering [Wed, 15 Sep 2021 13:52:53 +0000 (15:52 +0200)] 
watchdog: add ", ignoring" to log messages about errors we ignore

As per coding style. Also downgrade relevant log messages to
LOG_WARNING.

4 years agowatchdog: pass right error code to log function so that %m works
Lennart Poettering [Wed, 15 Sep 2021 13:43:42 +0000 (15:43 +0200)] 
watchdog: pass right error code to log function so that %m works

4 years agoMerge pull request #20650 from fbuihuu/watchdog-rework
Luca Boccassi [Wed, 15 Sep 2021 13:44:49 +0000 (14:44 +0100)] 
Merge pull request #20650 from fbuihuu/watchdog-rework

Watchdog rework

4 years agojournalctl: never fail at flushing when the flushed flag is set
Franck Bui [Wed, 4 Aug 2021 09:20:07 +0000 (11:20 +0200)] 
journalctl: never fail at flushing when the flushed flag is set

Even if journald was not running, flushing the volatile journal used to work if
the journal was already flushed (ie the flushed flag
/run/systemd/journald/flushed was created).

However since commit 4f413af2a0a, this behavior changed and now '--flush' fails
because it tries to contact journald without checking the presence of the
flushed flag anymore.

This patch restores the previous behavior since there's no reason to fail when
journalctl can figure out that the flush is not necessary.

4 years agotest: document autopkgtest CI infrastructure
Luca Boccassi [Wed, 15 Sep 2021 12:49:04 +0000 (13:49 +0100)] 
test: document autopkgtest CI infrastructure

4 years agoMerge pull request #20729 from yuwata/ethtool-features-set
Yu Watanabe [Wed, 15 Sep 2021 11:28:24 +0000 (20:28 +0900)] 
Merge pull request #20729 from yuwata/ethtool-features-set

ethtool-util: support more offloading feature settings

4 years agoMerge pull request #20728 from yuwata/network-introduce-source-and-state-neighbor...
Yu Watanabe [Wed, 15 Sep 2021 11:26:44 +0000 (20:26 +0900)] 
Merge pull request #20728 from yuwata/network-introduce-source-and-state-neighbor-rule-and-nexthops

network: introduce NetworkConfigSource/State

4 years agoMerge pull request #20742 from pdmorrow/startup_cpus
Yu Watanabe [Wed, 15 Sep 2021 11:26:10 +0000 (20:26 +0900)] 
Merge pull request #20742 from pdmorrow/startup_cpus

add StartupAllowedCPUs= and StartupAllowedMemoryNodes= directives

4 years agowatchdog: use MIN() in update_timeout() 20650/head
Franck Bui [Wed, 15 Sep 2021 09:20:17 +0000 (11:20 +0200)] 
watchdog: use MIN() in update_timeout()

Also the previous expression was probably wrong as "(int) t >= INT_MAX" is
likely to always evaluate to false.

4 years agoshutdown: introduce init_watchdog()
Franck Bui [Wed, 15 Sep 2021 07:13:12 +0000 (09:13 +0200)] 
shutdown: introduce init_watchdog()

No functional change.

4 years agowatchdog: constify watchdog_set_device() parameter
Franck Bui [Wed, 15 Sep 2021 07:14:17 +0000 (09:14 +0200)] 
watchdog: constify watchdog_set_device() parameter

4 years agowatchdog: rename watchdog_set_timeout() into watchdog_setup()
Franck Bui [Tue, 14 Sep 2021 20:36:14 +0000 (22:36 +0200)] 
watchdog: rename watchdog_set_timeout() into watchdog_setup()

"watchdog_set_timeout()" was misleading as the function is not just a setter -
it must be called for activating the watchdog device.

4 years agomeson: add missing include directory when using xkbcommon
Antonio Alvarez Feijoo [Wed, 15 Sep 2021 06:46:40 +0000 (08:46 +0200)] 
meson: add missing include directory when using xkbcommon

Otherwise the build fails:

FAILED: systemd-localed.p/src_locale_localed.c.o
cc -Isystemd-localed.p -I. -I.. -Isrc/basic -I../src/basic -Isrc/fundamental -I../src/fundamental -Isrc/systemd -I../src/systemd -I../src/libsystemd/sd-bus -I../src/libsystemd/sd-device -I../src/libsystemd/sd-event -I../src/libsystemd/sd-hwdb -I../src/libsystemd/sd-id128 -I../src/libsystemd/sd-journal -I../src/libsystemd/sd-netlink -I../src/libsystemd/sd-network -I../src/libsystemd/sd-resolve -Isrc/shared -I../src/shared -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -std=gnu99 -g -Wno-format-signedness -Wno-missing-field-initializers -Wno-unused-parameter -Wdate-time -Wendif-labels -Werror=format=2 -Werror=implicit-function-declaration -Werror=incompatible-pointer-types -Werror=overflow -Werror=return-type -Werror=shift-count-overflow -Werror=shift-overflow=2 -Werror=undef -Werror=unused-function -Wfloat-equal -Wimplicit-fallthrough=5 -Winit-self -Wlogical-op -Wmissing-include-dirs -Wmissing-noreturn -Wnested-externs -Wold-style-definition -Wpointer-arith -Wredundant-decls -Wshadow -Wstrict-aliasing=2 -Wstrict-prototypes -Wsuggest-attribute=noreturn -Wwrite-strings -Wno-unused-result -Werror=missing-declarations -Werror=missing-prototypes -fdiagnostics-show-option -ffast-math -fno-common -fno-strict-aliasing -fstack-protector -fstack-protector-strong -fvisibility=hidden --param=ssp-buffer-size=4 -Werror=shadow -include config.h -MD -MQ systemd-localed.p/src_locale_localed.c.o -MF systemd-localed.p/src_locale_localed.c.o.d -o systemd-localed.p/src_locale_localed.c.o -c ../src/locale/localed.c
../src/locale/localed.c:9:10: fatal error: xkbcommon/xkbcommon.h: No such file or directory
    9 | #include <xkbcommon/xkbcommon.h>
      |          ^~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.

4 years agowatchdog: minor simplification of watchdog_runtime_wait()
Franck Bui [Mon, 6 Sep 2021 12:31:30 +0000 (14:31 +0200)] 
watchdog: minor simplification of watchdog_runtime_wait()

No functional change.

4 years agowatchdog: no need to ping the device twice in watchdog_ping() if the device has just...
Franck Bui [Mon, 6 Sep 2021 10:42:50 +0000 (12:42 +0200)] 
watchdog: no need to ping the device twice in watchdog_ping() if the device has just been opened

4 years agowatchdog: update watchdog_timeout with the closest timeout found by the driver
Franck Bui [Mon, 6 Sep 2021 10:12:45 +0000 (12:12 +0200)] 
watchdog: update watchdog_timeout with the closest timeout found by the driver

Store the actual timeout value found by the driver in watchdog_timeout since
this value is more accurate for calculating the next time for pinging the
device.

4 years agocore: watchdog_set_timeout() doesn't need to return the timeout value used by the HW
Franck Bui [Mon, 6 Sep 2021 10:12:06 +0000 (12:12 +0200)] 
core: watchdog_set_timeout() doesn't need to return the timeout value used by the HW

The manager currently doesn't need it and if it does in the future an helper
should probably be introduced instead.

4 years agocore: call watchdog_ping() unconditionally
Franck Bui [Mon, 6 Sep 2021 06:26:30 +0000 (08:26 +0200)] 
core: call watchdog_ping() unconditionally

This basically reverts commit 61927b9f116bf45bfdbf19dc2981d4a4f527ae5f and
relies on the fact that watchdog_ping() will open and setup the watchdog for us
in case the device appears later on.

Also unlike what is said in comment
https://github.com/systemd/systemd/pull/17460#pullrequestreview-517434377, both
m->watchdog[] and m->overriden_watchdog[] are not supposed to store the actual
timeout used by the watchdog device but stores the value defined by the user.

If the HW timeout value is really needed by the manager then it's probably
better to read it via an helper defined in watchdog.c instead. However the HW
timeout value is currently only needed by the watchdog code itself mainly when
it calculates the time for the next ping.

4 years agowatchdog: make watchdog_ping() a NOP when the watchdog is disabled or closed
Franck Bui [Mon, 6 Sep 2021 06:47:08 +0000 (08:47 +0200)] 
watchdog: make watchdog_ping() a NOP when the watchdog is disabled or closed

This patch allows watchdog_ping() to be used unconditionally regardless of
whether watchdog_set_timeout() or watchdog_close() has been previously called
or not and in both cases watchdog_ping() does nothing.

shutdown.c has been updated to cope with this change.

4 years agofuzz: add StartupAllowedCPUs and StartupAllowedMemoryNodes to directives 20742/head
Peter Morrow [Tue, 14 Sep 2021 18:31:07 +0000 (19:31 +0100)] 
fuzz: add StartupAllowedCPUs and StartupAllowedMemoryNodes to directives

Signed-off-by: Peter Morrow <pemorrow@linux.microsoft.com>
4 years agodocs: update docs with StartupAllowedCPUs and StartupAllowedMemoryNodes details
Peter Morrow [Tue, 14 Sep 2021 16:28:46 +0000 (17:28 +0100)] 
docs: update docs with StartupAllowedCPUs and StartupAllowedMemoryNodes details

Signed-off-by: Peter Morrow <pemorrow@linux.microsoft.com>
4 years agocgroup: add support for StartupAllowedCPUs and StartupAllowedMemoryNodes
Peter Morrow [Tue, 14 Sep 2021 16:14:53 +0000 (17:14 +0100)] 
cgroup: add support for StartupAllowedCPUs and StartupAllowedMemoryNodes

Add new settings which can be used to control cpuset based cpu affinity
during the startup phase only.

Signed-off-by: Peter Morrow <pemorrow@linux.microsoft.com>
4 years agonetwork: use NetworkConfigSource/State to manage nexthops 20728/head
Yu Watanabe [Mon, 6 Sep 2021 00:58:59 +0000 (09:58 +0900)] 
network: use NetworkConfigSource/State to manage nexthops

This also changes the logic when Id= is not specified.
Previously, kernel picks the lowest unused ID, but now networkd picks
the lowest unused ID.

4 years agonetwork: use NetworkConfigSource/State to manage routing policy rules
Yu Watanabe [Tue, 31 Aug 2021 08:24:07 +0000 (17:24 +0900)] 
network: use NetworkConfigSource/State to manage routing policy rules

This also changes the logic when Priority= is not specified.
Previously, we request without FRA_PRIORITY attribute and kernel picks
the highest unused priority for the rule.
This makes networkd picks the highest unused priority and always request
FRA_PRIORITY attribute.

4 years agonetwork: use NetworkConfigSource/State to manage neighbors
Yu Watanabe [Sun, 5 Sep 2021 03:34:41 +0000 (12:34 +0900)] 
network: use NetworkConfigSource/State to manage neighbors

4 years agonetwork: introduce NetworkConfigSource and NetworkConfigState
Yu Watanabe [Wed, 14 Jul 2021 07:50:26 +0000 (16:50 +0900)] 
network: introduce NetworkConfigSource and NetworkConfigState

These will be used in later commits.

4 years agoRespect install_sysconfdir
Kai Wohlfahrt [Mon, 13 Sep 2021 23:32:52 +0000 (00:32 +0100)] 
Respect install_sysconfdir

This was lost e11a25cadbe and c900d89faa0 while adding jinja2
templating. Breaks builds on NixOS.

4 years agosd-journal: Don't compare hashes from different journal files
Daan De Meyer [Tue, 14 Sep 2021 14:08:46 +0000 (15:08 +0100)] 
sd-journal: Don't compare hashes from different journal files

In sd_journal_enumerate_fields(), we check if we've already handled
a field by checking if we can find it in any of the already processed
journal files. We do this by calling
journal_file_find_field_object_with_hash(), which compares the size,
payload and hash of the given field against all fields in a journal file,
trying to find a match. However, since we now use per file hash functions,
hashes for the same fields will differ between different journal files,
meaning we'll never find an actual match.

To fix the issue(), let's use journal_file_find_field_object() when one
or more of the files we're comparing is using per file keyed hashes.
journal_file_find_field_object() only takes the field payload and size
as arguments and calculates the hash itself using the hash function from
the journal file we're searching in.

4 years agoFix error building repart with no libcryptsetup (#20739)
Marcus Harrison [Wed, 15 Sep 2021 01:55:07 +0000 (03:55 +0200)] 
Fix error building repart with no libcryptsetup (#20739)

4 years agocore: watchdog_runtimeout_wait() already returns USEC_INFINITY when the watchdog...
Franck Bui [Mon, 6 Sep 2021 09:06:35 +0000 (11:06 +0200)] 
core: watchdog_runtimeout_wait() already returns USEC_INFINITY when the watchdog is disabled or closed

4 years agomain: use timestamp_is_set() in become_shutdown()
Franck Bui [Mon, 6 Sep 2021 07:28:39 +0000 (09:28 +0200)] 
main: use timestamp_is_set() in become_shutdown()

4 years agopo: Translated using Weblate (Finnish)
Jan Kuparinen [Tue, 14 Sep 2021 19:04:59 +0000 (21:04 +0200)] 
po: Translated using Weblate (Finnish)

Currently translated at 100.0% (189 of 189 strings)

Co-authored-by: Jan Kuparinen <copper_fin@hotmail.com>
Translate-URL: https://translate.fedoraproject.org/projects/systemd/master/fi/
Translation: systemd/main

4 years agoethtool-util: add more network device features 20729/head
Yu Watanabe [Tue, 14 Sep 2021 13:12:42 +0000 (22:12 +0900)] 
ethtool-util: add more network device features

Then, we can easily add new settings to configure features in .link
file.

4 years agoethtool-util: apply tx-checksum-* features at last
Yu Watanabe [Tue, 14 Sep 2021 16:48:59 +0000 (01:48 +0900)] 
ethtool-util: apply tx-checksum-* features at last

NET_DEV_FEAT_TX matches multiple features. In the next commit, all
features whose strings start with "tx-checksum-" will be added.
To make them take precedence over NET_DEV_FEAT_TX, it will be applied
only when each explicit feature is not applied.

4 years agoethtool: do not set unavailable or never_changed bits
Yu Watanabe [Tue, 14 Sep 2021 08:42:52 +0000 (17:42 +0900)] 
ethtool: do not set unavailable or never_changed bits

4 years agoethtool-util: shorten code a bit
Yu Watanabe [Tue, 14 Sep 2021 16:41:15 +0000 (01:41 +0900)] 
ethtool-util: shorten code a bit

Also fixes a error code in debugging log.

4 years agoethtool-util: use sizeof()
Yu Watanabe [Tue, 14 Sep 2021 16:28:29 +0000 (01:28 +0900)] 
ethtool-util: use sizeof()

4 years agoman: extend documentation about TPM2 PCRs
Lennart Poettering [Tue, 14 Sep 2021 13:19:25 +0000 (15:19 +0200)] 
man: extend documentation about TPM2 PCRs

This is an effort to compile a somewhat complete list how PCRs are
actually used on Linux systems these days. It contains data from: the
UEFI PC spec, the shim, the IMA, grub documentation.

I validated these PCRs to some level in the sources.

The grub specific stuff I only added in comments, since I was too lazy
too validate it (also, meh, grub).

It also gives people a hint on which PCR to bind to (and maybe kind of
an explanation of our default choice).

4 years agoMerge pull request #20697 from yuwata/in-addr-prefix
Lennart Poettering [Tue, 14 Sep 2021 13:58:20 +0000 (15:58 +0200)] 
Merge pull request #20697 from yuwata/in-addr-prefix

core: rewrite IPAddressAllow/Deny= parser

4 years agodocs: generic info about adding directives in ARCHITECTURE.md
Luca Boccassi [Mon, 13 Sep 2021 14:57:54 +0000 (15:57 +0100)] 
docs: generic info about adding directives in ARCHITECTURE.md

4 years agonetwork: replace config_parse_address_filter() with config_parse_in_addr_prefixes() 20697/head
Yu Watanabe [Fri, 10 Sep 2021 06:08:54 +0000 (15:08 +0900)] 
network: replace config_parse_address_filter() with config_parse_in_addr_prefixes()

4 years agocore: replace IPAddressAccessItem with struct in_addr_prefix
Yu Watanabe [Fri, 10 Sep 2021 04:58:28 +0000 (13:58 +0900)] 
core: replace IPAddressAccessItem with struct in_addr_prefix

Previously, if a unit file which contains n IPAddressAllow/Deny= lines,
then the computational order of parsing the file was O(n^3), as
ip_address_access_reduce(), whose order is O(n^2), is called for each line.

By replacing in_addr_prefix related functions, now the computational
order is O(n log n).

Fixes #20680.

4 years agocore/cgroup: set bitfield to reduce struct size
Yu Watanabe [Tue, 14 Sep 2021 05:11:08 +0000 (14:11 +0900)] 
core/cgroup: set bitfield to reduce struct size

4 years agotest: add tests for in-addr-prefix-util.c
Yu Watanabe [Tue, 14 Sep 2021 05:55:25 +0000 (14:55 +0900)] 
test: add tests for in-addr-prefix-util.c

4 years agotest: slightly modernize test-in-addr-util.c
Yu Watanabe [Tue, 14 Sep 2021 05:31:59 +0000 (14:31 +0900)] 
test: slightly modernize test-in-addr-util.c

4 years agoin-addr-prefix-util: introduce several utilities for address prefix
Yu Watanabe [Tue, 14 Sep 2021 05:10:33 +0000 (14:10 +0900)] 
in-addr-prefix-util: introduce several utilities for address prefix

4 years agoMerge pull request #20700 from yuwata/network-dhcp-cleanups
Yu Watanabe [Tue, 14 Sep 2021 11:29:27 +0000 (20:29 +0900)] 
Merge pull request #20700 from yuwata/network-dhcp-cleanups

network: several DHCP related cleanups

4 years agonetwork: do not use RouteTable= in [DHCPv4] section for DHCPv6 routes 20700/head
Yu Watanabe [Wed, 8 Sep 2021 00:35:34 +0000 (09:35 +0900)] 
network: do not use RouteTable= in [DHCPv4] section for DHCPv6 routes

We forgot to add RouteTable= in [DHCPv6] section when we split [DHCP]
into two.

4 years agoAdd additional Dell models that require ACCEL_LOCATION=base
Yao Wei (魏銘廷) [Wed, 8 Sep 2021 05:55:49 +0000 (13:55 +0800)] 
Add additional Dell models that require ACCEL_LOCATION=base

This is a related commit to the bug reported in Ubuntu:
  https://bugs.launchpad.net/ubuntu/+source/systemd/+bug/1938259

This adds additional 4 models that without this param, the screen rotates
when the clamshell laptop rotates, which is an unwanted behavior.

This commit also merges entries that needs the same param.

Signed-off-by: Yao Wei (魏銘廷) <yao.wei@canonical.com>
4 years agoMerge pull request #20713 from yuwata/udev-watch-retry
Lennart Poettering [Tue, 14 Sep 2021 07:40:23 +0000 (09:40 +0200)] 
Merge pull request #20713 from yuwata/udev-watch-retry

udev-watch: retry to save watch handle on error

4 years agonetwork: use ltype to distinguish DHCPv4 and DHCPv6
Yu Watanabe [Tue, 7 Sep 2021 23:39:26 +0000 (08:39 +0900)] 
network: use ltype to distinguish DHCPv4 and DHCPv6

4 years agonetwork: dhcp4: use free_and_strdup_warn()
Yu Watanabe [Wed, 8 Sep 2021 04:50:59 +0000 (13:50 +0900)] 
network: dhcp4: use free_and_strdup_warn()

4 years agonetwork: dhcp4: log server address
Yu Watanabe [Wed, 8 Sep 2021 04:49:29 +0000 (13:49 +0900)] 
network: dhcp4: log server address

4 years agonetwork: dhcp4: return earlier on failure
Yu Watanabe [Wed, 8 Sep 2021 04:39:22 +0000 (13:39 +0900)] 
network: dhcp4: return earlier on failure

4 years agonetwork: move common route settings to {dhcp4,ndisc}_request_route()
Yu Watanabe [Wed, 8 Sep 2021 04:02:36 +0000 (13:02 +0900)] 
network: move common route settings to {dhcp4,ndisc}_request_route()

4 years agotest-network: kernel treats the lowest IP address as unicast since 5.14
Yu Watanabe [Mon, 13 Sep 2021 17:50:37 +0000 (02:50 +0900)] 
test-network: kernel treats the lowest IP address as unicast since 5.14

See kernel's 94c821c74bf5fe0c25e09df5334a16f98608db90.

4 years agoescape: improve logging when escaping paths that are slightly non-conforming
Lennart Poettering [Mon, 13 Sep 2021 13:40:00 +0000 (15:40 +0200)] 
escape: improve logging when escaping paths that are slightly non-conforming

Fixes: #20663
4 years agovirt: Improve detection of EC2 metal instances
Benjamin Herrenschmidt [Fri, 3 Sep 2021 01:36:46 +0000 (11:36 +1000)] 
virt: Improve detection of EC2 metal instances

The current detection code relies on /sys/firmware/dmi/entries/0-0/raw
to disambiguate Amazon EC2 virtualized from metal instances.

Unfortunately this file is root only. Thus on a c6g.metal instance
(aarch64), we observe something like this:

$ systemd-detect-virt
amazon
$ sudo systemd-detect-virt
none

Only the latter is correct.

The right long term fix is to extend the kernel to expose the SMBIOS BIOS
Characteristics properly via /sys/class/dmi, but until this happens (and
for backwards compatibility when it does), we need a plan B.

This change implements such a workaround by falling back to using the
instance type from DMI and looking at the ".metal" string present on
metal instances.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
4 years agoMerge pull request #20716 from poettering/tpm2-primary-rsa
Lennart Poettering [Mon, 13 Sep 2021 15:12:20 +0000 (17:12 +0200)] 
Merge pull request #20716 from poettering/tpm2-primary-rsa

tpm2: be smarter when picking primary key algorithm and PCR bank

4 years agoupdate TODO 20716/head
Lennart Poettering [Mon, 13 Sep 2021 12:06:54 +0000 (14:06 +0200)] 
update TODO

4 years agotpm2: log about invalid PCRs on each unsealing
Lennart Poettering [Mon, 13 Sep 2021 10:43:53 +0000 (12:43 +0200)] 
tpm2: log about invalid PCRs on each unsealing

Let's log every time we use uninitialized PCRs when unsealing a secret
via TPM2. This indicates a firmware issue usually, and is something we
shouldn't just show when enrolling but also show every time we unseal,
so that the fact that the selected PCR policy is pretty much pointless
is repeatedly shown.

4 years agotpm2: check if PCR values make sense before using them
Lennart Poettering [Mon, 13 Sep 2021 09:23:41 +0000 (11:23 +0200)] 
tpm2: check if PCR values make sense before using them

Fixes: #20684
4 years agotpm2: support RSA primary keys as fallback if TPM2 devices don't support ECC
Lennart Poettering [Mon, 13 Sep 2021 08:52:43 +0000 (10:52 +0200)] 
tpm2: support RSA primary keys as fallback if TPM2 devices don't support ECC

Previously, we hardcoded use of ECC as primary keys, since they are much
faster (i.e. saving multiple seconds) to do TPM2 operations with. Alas,
not all TPM2 chips appear to support ECC. Bummer.

Let's hence add a fallback logic: if we can't create an ECC primary key,
use an RSA key, and store that fact away.

AFIU the security guarantees should be roughly the same, it's just that
RSA primary keys is so much slower to work with than ECC.

The primary key algorithm is used is stored in the JSON header of LUKS
disks, in a new field. If the field is absent we assume to use ECC, to
provide full compatibility with old systemd versions.

The primary key algorithm is stored in a new field in the credentials
file format (in fact, a previously unused zero space is used), too.

Hopefully, this should ensure that TPM2 support will "just work" on more
systems.

Fixes: #20361
4 years agomemory-util: replace memeqzero() by a more generic memeqbyte()
Lennart Poettering [Mon, 13 Sep 2021 10:33:21 +0000 (12:33 +0200)] 
memory-util: replace memeqzero() by a more generic memeqbyte()

The new helper can check for any byte, no just zeroes. The old name is
then converted into a macro that wraps our new version of the helper.

4 years agoMerge pull request #20701 from yuwata/network-address-cleanups
Luca Boccassi [Mon, 13 Sep 2021 10:12:43 +0000 (11:12 +0100)] 
Merge pull request #20701 from yuwata/network-address-cleanups

network: several address_update() related cleanups

4 years agoudev-watch: retry to save watch handle with random delay 20713/head
Yu Watanabe [Sun, 12 Sep 2021 06:49:22 +0000 (15:49 +0900)] 
udev-watch: retry to save watch handle with random delay

Also, remove the watch handle if we cannot save it.

4 years agosd-device: do not recreate the same symlinks which store watch handle
Yu Watanabe [Sun, 12 Sep 2021 06:47:08 +0000 (15:47 +0900)] 
sd-device: do not recreate the same symlinks which store watch handle

4 years agoMerge pull request #20715 from yuwata/udev-node-follow-ups
Yu Watanabe [Mon, 13 Sep 2021 02:51:55 +0000 (11:51 +0900)] 
Merge pull request #20715 from yuwata/udev-node-follow-ups

udev-node: several follow-ups

4 years agoMerge pull request #20672 from mrc0mmand/more-storage-tests
Yu Watanabe [Mon, 13 Sep 2021 02:50:51 +0000 (11:50 +0900)] 
Merge pull request #20672 from mrc0mmand/more-storage-tests

test: more storage-related tests

4 years agotest: coverage for #19946 20672/head
Frantisek Sumsal [Fri, 10 Sep 2021 15:16:51 +0000 (17:16 +0200)] 
test: coverage for #19946

4 years agotest: make sure all symlinks under /dev/disk/ are valid
Frantisek Sumsal [Fri, 10 Sep 2021 11:04:58 +0000 (13:04 +0200)] 
test: make sure all symlinks under /dev/disk/ are valid

4 years agotest: add a basic multipath test + failover
Frantisek Sumsal [Wed, 8 Sep 2021 16:26:02 +0000 (18:26 +0200)] 
test: add a basic multipath test + failover

4 years agotest: add a multipath helper
Frantisek Sumsal [Wed, 8 Sep 2021 16:17:46 +0000 (18:17 +0200)] 
test: add a multipath helper

4 years agotest: use one call to install necessary modules
Frantisek Sumsal [Wed, 8 Sep 2021 12:57:55 +0000 (14:57 +0200)] 
test: use one call to install necessary modules

4 years agoMerge pull request #20705 from yuwata/test-oomd-util
Luca Boccassi [Sun, 12 Sep 2021 11:56:46 +0000 (12:56 +0100)] 
Merge pull request #20705 from yuwata/test-oomd-util

test: skip oomd test on a unified container on a hybrid host

4 years agotest: tweak parameters for TEST-55-OOMD
Anita Zhang [Sun, 12 Sep 2021 07:02:31 +0000 (00:02 -0700)] 
test: tweak parameters for TEST-55-OOMD

Pressure remains > 1% after a kill for some time and could cause
testchill to get killed. Bumping the limit from 1% to 20% should help
with this.

Fixes #20118

4 years agoudev-node: do not ignore unexpected errors on removing symlink in stack directory 20715/head
Yu Watanabe [Sun, 12 Sep 2021 07:14:27 +0000 (16:14 +0900)] 
udev-node: do not ignore unexpected errors on removing symlink in stack directory

Only acceptable error here is -ENOENT.

4 years agoudev-node: simplify the example of race
Yu Watanabe [Sun, 12 Sep 2021 07:05:51 +0000 (16:05 +0900)] 
udev-node: simplify the example of race

4 years agounit: systemd-oomd.service requires cgroup memory controller 20705/head
Yu Watanabe [Sat, 11 Sep 2021 11:56:15 +0000 (20:56 +0900)] 
unit: systemd-oomd.service requires cgroup memory controller

4 years agotest-oomd-util: skip tests if cgroup memory controller is not available
Yu Watanabe [Sat, 11 Sep 2021 11:37:50 +0000 (20:37 +0900)] 
test-oomd-util: skip tests if cgroup memory controller is not available

Fixes #20593 and #20655.

4 years agooomd: refuse to start if cgroup memory controller is not available
Yu Watanabe [Sat, 11 Sep 2021 11:34:53 +0000 (20:34 +0900)] 
oomd: refuse to start if cgroup memory controller is not available

4 years agosd-boot: Fix assertion fail
Jan Janssen [Sat, 11 Sep 2021 09:14:06 +0000 (11:14 +0200)] 
sd-boot: Fix assertion fail

The UEFI Platform Initialization Specification says that both
parameters may be NULL.

4 years agocgroup-util: use string_hash_ops_free
Yu Watanabe [Sat, 11 Sep 2021 11:29:34 +0000 (20:29 +0900)] 
cgroup-util: use string_hash_ops_free

4 years agocgroup-util: use _cleanup_free_ attribute
Yu Watanabe [Sat, 11 Sep 2021 11:26:58 +0000 (20:26 +0900)] 
cgroup-util: use _cleanup_free_ attribute

4 years agotpm-util: fix TPM parameter handling
Anatol Pomozov [Fri, 10 Sep 2021 18:52:55 +0000 (11:52 -0700)] 
tpm-util: fix TPM parameter handling

cryptenroll allows to specify a custom TPM driver separated from
parameters with colon e.g. `systemd-cryptenroll --tpm2-device=swtpm:`
tells to load swtpm tss driver and use it as a device.

Unfortunately it does not work, swtpm driver init() fails with

```
debug:tcti:src/tss2-tcti/tcti-swtpm.c:570:Tss2_Tcti_Swtpm_Init() Dup'd conf string to: 0x562f91cbc000
debug:tcti:src/util/key-value-parse.c:85:parse_key_value_string() parsing key/value: swtpm:
WARNING:tcti:src/util/key-value-parse.c:50:parse_key_value() key / value string is invalid
Failed to initialize TCTI context: tcti:A parameter has a bad value
```

It turns out that cryptenroll suppose to use the driver name internally
and strip it before passing the rest of parameters to init() function.
Without doing it swtpm receives incorrect key-value property and gets
confused.

Fix it by passing the correct parameter (without driver name) to the
init() function.

Fixes #20708

4 years agonetwork: do not drop IPv6LL address in link_drop_addresses() 20701/head
Yu Watanabe [Wed, 8 Sep 2021 07:18:52 +0000 (16:18 +0900)] 
network: do not drop IPv6LL address in link_drop_addresses()

4 years agonetwork: always call address ready callback if address is ready
Yu Watanabe [Wed, 8 Sep 2021 06:57:55 +0000 (15:57 +0900)] 
network: always call address ready callback if address is ready

The address ready callback is used for cleaning up old addresses or
routes acquired by e.g. DHCP. However, the callback was called only
when the address was previously not ready. So, maybe, unnecessary
addresses or routes may not be cleared.

Also, this makes the callback is called slightly earlier. As it may
remove several addresses or routes, and possibly changes the link state.

4 years agonetwork: define Address earlier
Yu Watanabe [Wed, 8 Sep 2021 07:11:36 +0000 (16:11 +0900)] 
network: define Address earlier

As the type is used in defining address_ready_callback_t.

4 years agonetwork: store IPv6LL address even if link is in failed state
Yu Watanabe [Wed, 8 Sep 2021 06:52:53 +0000 (15:52 +0900)] 
network: store IPv6LL address even if link is in failed state

Otherwise, if IPv6LL is received when the link is in failed state,
we may fail to reconfigure the link.

4 years agonetwork: enable IP masquerade when address is assigned
Yu Watanabe [Wed, 8 Sep 2021 06:39:41 +0000 (15:39 +0900)] 
network: enable IP masquerade when address is assigned

Previously, IP masquerade is enabled when configuring the address. But,
the request of assigning the address may be refused by kernel.

4 years agonetwork: simplify code a bit
Yu Watanabe [Wed, 8 Sep 2021 06:37:48 +0000 (15:37 +0900)] 
network: simplify code a bit

4 years agoMerge pull request #20699 from yuwata/network-drop-foreign
Luca Boccassi [Fri, 10 Sep 2021 20:10:58 +0000 (21:10 +0100)] 
Merge pull request #20699 from yuwata/network-drop-foreign

network: do not drop foreign configs when carrier of unmanaged interface is lost

4 years agoMerge pull request #20702 from yuwata/network-trivial-cleanups
Luca Boccassi [Fri, 10 Sep 2021 20:10:40 +0000 (21:10 +0100)] 
Merge pull request #20702 from yuwata/network-trivial-cleanups

network: several trivial cleanups

4 years agonetwork: fix handling of network interface renaming
Yu Watanabe [Thu, 9 Sep 2021 23:09:56 +0000 (08:09 +0900)] 
network: fix handling of network interface renaming

Fixes #20657.

4 years agoMerge pull request #20703 from poettering/gpt-dissect-tweaks
Lennart Poettering [Fri, 10 Sep 2021 18:48:31 +0000 (20:48 +0200)] 
Merge pull request #20703 from poettering/gpt-dissect-tweaks

dissect: various small tweaks/tougher checks/refactoring of GPT dissection code

4 years agocore: Parse log environment settings again after applying manager environment
Daan De Meyer [Tue, 7 Sep 2021 15:13:56 +0000 (16:13 +0100)] 
core: Parse log environment settings again after applying manager environment

Currently, SYSTEMD_LOG_LEVEL set in the ManagerEnvironment property in system.conf
or user.conf doesn't affect the manager's logging level. Parsing the logging environment
variables again after pushing the manager environment into the process environment
block makes sure any new environment changes also get taken into account for logging.

4 years agodissect-image: replace redundant if check by assert() 20703/head
Lennart Poettering [Thu, 9 Sep 2021 09:41:52 +0000 (11:41 +0200)] 
dissect-image: replace redundant if check by assert()

We know that the designator can only be USR or ROOT (or negative), hence
let's test that with an assert here, instead of doing an if check.

4 years agodissect-image: insist that if a verity partition designator is specified the partitio...
Lennart Poettering [Thu, 9 Sep 2021 09:38:52 +0000 (11:38 +0200)] 
dissect-image: insist that if a verity partition designator is specified the partition exists

Let's tighten our checks further.

4 years agodissect-image: tighten checks on root + /usr/ combinations
Lennart Poettering [Thu, 9 Sep 2021 09:33:03 +0000 (11:33 +0200)] 
dissect-image: tighten checks on root + /usr/ combinations

Our code logic doesn't support images with two verity partitions at the
moment, hence refuse this early (with ENOTUNIQ)

Also, go even further and refuse any combinations of verity enabled root
with verity-less /usr, simplify because that is unsafe and defeats the
point of verity. (i.e. we want to give the guarantee that for
auto-discovered verity magic we guarantee that the data afterwards
available in /usr is safe).

4 years agodissect-image: drop redundant check
Lennart Poettering [Thu, 9 Sep 2021 09:29:19 +0000 (11:29 +0200)] 
dissect-image: drop redundant check

We already check whether we discovered a /usr verity partition without a
/usr partition when initially mangling the partitions, a bunch of lines
further up, no need to repeat this here.