Lennart Poettering [Wed, 16 Feb 2022 10:50:48 +0000 (11:50 +0100)]
tree-wide: some coccinelle fixes
Lennart Poettering [Wed, 16 Feb 2022 09:52:51 +0000 (10:52 +0100)]
coccinelle: automatically switch some uses of memcpy() → mempcpy()
Inspired by #22520, let's add a coccinelle script that converts this
automatically.
Yu Watanabe [Wed, 16 Feb 2022 14:14:39 +0000 (23:14 +0900)]
timesync: add missing setting in template
Follow-up for
e81a44bf5faa80ec6ca2ef835d559a65c7e27c35.
Lennart Poettering [Wed, 16 Feb 2022 15:36:25 +0000 (16:36 +0100)]
Merge pull request #22526 from poettering/homed-container-uid-range
homed: map container UID range for homed home directories
Yu Watanabe [Wed, 16 Feb 2022 14:03:52 +0000 (23:03 +0900)]
Merge pull request #22502 from yuwata/udev-net-virtual-wlan-interface
network: add virtual wlan interface support
Yu Watanabe [Wed, 16 Feb 2022 14:02:51 +0000 (23:02 +0900)]
Merge pull request #22520 from yuwata/sd-dhcp6-client-cosmetic-follow-ups
sd-dhcp6-client: several cosmetic follow-ups
Yu Watanabe [Wed, 16 Feb 2022 14:02:21 +0000 (23:02 +0900)]
Merge pull request #22271 from keszybz/manager-reexec-freeze
Freeze manager if reexec fails
Lennart Poettering [Tue, 15 Feb 2022 21:40:34 +0000 (22:40 +0100)]
NEWS: update excerpt on container UID/GID mappings
Lennart Poettering [Tue, 15 Feb 2022 21:40:29 +0000 (22:40 +0100)]
docs: document homed's use of the container UID mapping
Lennart Poettering [Tue, 15 Feb 2022 17:22:37 +0000 (18:22 +0100)]
homed: when using id mapping on the home dirs, also do an identity mapping for the container UID ranges
Apparently people really want to put high UIDs in their homedirs. Let's
add some minimal support for that.
Further discussion: https://github.com/systemd/systemd/pull/22239#issuecomment-
1040421552
Inspired by, based on, and replacing #22239 by Christian Brauner.
Lennart Poettering [Wed, 16 Feb 2022 09:53:54 +0000 (10:53 +0100)]
TODO
Lennart Poettering [Wed, 16 Feb 2022 09:14:59 +0000 (10:14 +0100)]
man: fix virtualization table
The count of VM types got out of sync, let's fix that.
Follow-up for
b6eca3731dd92b009b182f188936e1c2544574da which forgot to
increase the count by one.
Yu Watanabe [Tue, 15 Feb 2022 14:51:28 +0000 (23:51 +0900)]
sd-dhcp6-client: use mempcpy() or mempcpy_safe()
Yu Watanabe [Tue, 15 Feb 2022 14:50:14 +0000 (23:50 +0900)]
memory-util: introdyce mempcpy_safe()
Yu Watanabe [Tue, 15 Feb 2022 14:43:15 +0000 (23:43 +0900)]
dhcp-identifier: use offsetof()
Also use appropriate place to store UUID.
Zbigniew Jędrzejewski-Szmek [Wed, 16 Feb 2022 07:07:02 +0000 (08:07 +0100)]
manager: add {} around cpu sets, use range formatting
We would print "Setting NUMA policy to bind, with nodes .".
This is not very clear, change it to "… with nodes {}.".
Also use range formatting for masks to make output shorter.
Zbigniew Jędrzejewski-Szmek [Tue, 15 Feb 2022 15:23:04 +0000 (16:23 +0100)]
manager: add few ", ignoring" and adjust level in one message
Yu Watanabe [Wed, 16 Feb 2022 07:04:14 +0000 (16:04 +0900)]
Merge pull request #22523 from DaanDeMeyer/systemd-networkd-tests-fixes
mkosi: Support running systemd-networkd-tests.py in QEMU
Evgeny Vereshchagin [Tue, 15 Feb 2022 01:13:10 +0000 (01:13 +0000)]
tests: allow running all the services with SYSTEMD_LOG_LEVEL
It should make it easier to figure out what exactly services do there.
For example, with SYSTEMD_LOG_LEVEL=debug userdbd (v249) prints
```
varlink-5: New incoming message: {"method":"io.systemd.UserDatabase.GetUserRecord","parameters":{}}
```
before it crashes and systemd-resolved prints
```
varlink-21: New incoming message: {"method":"io.systemd.Resolve.ResolveAddress","parameters":{"address":[127,0,0,1],"flags":0,"ifindex":
1000000,"family":0}}
```
and those messages are helpful (especially when scripts causing them
aren't clever enough to keep track of random stuff they send to systemd
:-))
Daan De Meyer [Tue, 15 Feb 2022 17:58:15 +0000 (17:58 +0000)]
test: Prefix all network/netdev config files used by systemd-networkd-tests.py
Let's make sure these take preference over any generic network config files shipped
by the OS (in this case specifically, mkosi).
Daan De Meyer [Tue, 15 Feb 2022 21:56:10 +0000 (21:56 +0000)]
test: Skip test_macsec() until kernel panic is fixed
Daan De Meyer [Tue, 15 Feb 2022 18:02:36 +0000 (18:02 +0000)]
mkosi: Support running systemd-networkd-tests.py in QEMU
This commit adds the necessary packages for Fedora and Arch.
Max Gautier [Sun, 13 Feb 2022 14:16:05 +0000 (15:16 +0100)]
docs: Correct WantedBy= regarding template units
Yu Watanabe [Tue, 15 Feb 2022 14:36:45 +0000 (23:36 +0900)]
sd-dhcp6-client: add comment about ia_na and ia_pd
Daan De Meyer [Tue, 15 Feb 2022 11:50:31 +0000 (11:50 +0000)]
test: Stop using TextTestRunner in systemd-networkd-tests.py
If we assign our own test runner, passing arguments stops working
as unittest won't instantiate its own test runner after it parses
the arguments from sys.argv.
Consequence is that the tests will write to stderr now instead of
stdout since it doesn't seem possible to configure the stream that
unittest.main() will instantiate its test runner with so it'll
default to sys.stderr.
Yu Watanabe [Mon, 14 Feb 2022 17:09:21 +0000 (02:09 +0900)]
network: add support to create wlan virtual interface
Closes #18977.
Lennart Poettering [Tue, 15 Feb 2022 14:20:16 +0000 (15:20 +0100)]
Merge pull request #22516 from keszybz/bit-and-pieces
Post-review fixups and other tiny improvements
Ludwig Nussel [Tue, 15 Feb 2022 10:49:26 +0000 (11:49 +0100)]
Revert "man: fix description of --force in halt(8) (#7392)"
This reverts commit
5d9adb5b60b815b477ba9e6b19ef0fd7e1854a38.
Lennart Poettering [Tue, 15 Feb 2022 13:18:55 +0000 (14:18 +0100)]
Merge pull request #22412 from yuwata/sd-dhcp6-client-cleanups
sd-dhcp6-client: several fixes and cleanups
Zbigniew Jędrzejewski-Szmek [Thu, 27 Jan 2022 14:03:27 +0000 (15:03 +0100)]
manager: if we are reexecuting, do not invoke any fallbacks
For https://bugzilla.redhat.com/show_bug.cgi?id=
1986176:
if we are trying to reexecute, and this fails for any reason, we shouldn't
try to execute /sbin/init or /bin/sh. It is better to just freeze.
If we freeze it is easier to diagnose what happened, but if we execute
one of the fallbacks, we don't really know what will happen. In particular
the new init might just return, causing the machine to shut down. Or we
may successfully spawn /bin/sh, which could leave the machine open.
Zbigniew Jędrzejewski-Szmek [Thu, 27 Jan 2022 13:14:24 +0000 (14:14 +0100)]
manager: do not ignore the return value from the main loop
If manager_loop() fails, we would print an error message, but then actually
ignore the error in main(), and potentially execute the shutdown binary.
I'm not sure how likely this is to happen in practice, but it seems sloppy.
So let's do the cleanup, but actually freeze() if manager_loop() returned
an error.
invoke_main_loop() is refactored to return the manager objective. This way
we don't need to pass a separate parameter to specify whether we are
reexecuting. Subsequent patch will make further use of the returned objective.
Zbigniew Jędrzejewski-Szmek [Tue, 15 Feb 2022 09:50:43 +0000 (10:50 +0100)]
homework: avoid runtime formatting of a fixed string
Follow-up for
fe9bd5ad3670f6a34f9ea9b4e2c16bec6000ce11.
I checked that the formatted string has the same dashes as
before
fe9bd5ad3670f6a34f9ea9b4e2c16bec6000ce11.
Zbigniew Jędrzejewski-Szmek [Tue, 15 Feb 2022 09:46:35 +0000 (10:46 +0100)]
share/gpt: add stringified defines for GPT partition types
Zbigniew Jędrzejewski-Szmek [Tue, 15 Feb 2022 09:30:35 +0000 (10:30 +0100)]
NEWS: minor grammar adjustment
Follow-up for
e41dcb822167116c8924e56b39640536df894bbd.
Zbigniew Jędrzejewski-Szmek [Sun, 13 Feb 2022 11:11:52 +0000 (12:11 +0100)]
systemctl: expand error message
Zbigniew Jędrzejewski-Szmek [Fri, 21 Jan 2022 12:26:56 +0000 (13:26 +0100)]
docs: more internal links
Yu Watanabe [Sun, 13 Feb 2022 18:19:29 +0000 (03:19 +0900)]
wifi-util: introduce nl80211_iftype_from_string()
Yu Watanabe [Mon, 14 Feb 2022 17:06:29 +0000 (02:06 +0900)]
network: manage WLAN phy
Yu Watanabe [Mon, 14 Feb 2022 19:24:44 +0000 (04:24 +0900)]
network: netdev: add flag to skip kind check
It will be used in later commit.
Yu Watanabe [Mon, 14 Feb 2022 18:28:18 +0000 (03:28 +0900)]
network: netdev: use request queue to create independent netdevs
Yu Watanabe [Mon, 14 Feb 2022 18:26:16 +0000 (03:26 +0900)]
network: netdev: increment reference counter on request
Otherwise, it may be freed on reload.
Yu Watanabe [Mon, 14 Feb 2022 18:24:27 +0000 (03:24 +0900)]
network: netdev: make netdev_is_ready_to_create() return negative errno on fatal error
Yu Watanabe [Mon, 14 Feb 2022 17:20:36 +0000 (02:20 +0900)]
network: rename REQUEST_TYPE_STACKED_NETDEV -> REQUEST_TYPE_NETDEV_STACKED
Yu Watanabe [Mon, 14 Feb 2022 17:05:06 +0000 (02:05 +0900)]
meson: sort listed files
Frantisek Sumsal [Mon, 14 Feb 2022 19:19:51 +0000 (20:19 +0100)]
test: set `ReadWritePaths=$BUILD_DIR` when running w/ coverage
otherwise units using `DynamicUser=yes` won't be able to write the
coverage stats (currently affecting TEST-20-MAINPIDGAMES).
`DynamicUser=yes` implies `ProtectSystem=strict` and
`ProtectHome=read-only` and can't be overridden hence we need to
utilize `ReadWritePaths=` to work around that.
Yu Watanabe [Mon, 14 Feb 2022 19:45:59 +0000 (04:45 +0900)]
Merge pull request #22487 from poettering/bootspec-source-flags
bootctl: show all discovered entries, but show state + type in details
Yu Watanabe [Mon, 14 Feb 2022 19:45:31 +0000 (04:45 +0900)]
Merge pull request #22508 from poettering/stat-ino-compare
stat-util: add new stat_inode_same() helper
Yu Watanabe [Mon, 14 Feb 2022 19:40:53 +0000 (04:40 +0900)]
Merge pull request #22507 from poettering/id128-compare-tweaks
sd-id128: comparison tweaks
Lennart Poettering [Mon, 14 Feb 2022 17:05:31 +0000 (18:05 +0100)]
docs: make clear that if you use threaded cgroups you need to do that two levels down from your delegated cgroup
Prompted by: #22486
Lennart Poettering [Mon, 14 Feb 2022 16:23:35 +0000 (17:23 +0100)]
sd-daemon: use path_join() instead of manual path concat
Lennart Poettering [Mon, 14 Feb 2022 16:22:27 +0000 (17:22 +0100)]
coredump: fix inode check
When checking if we look at the root directory we actually need to
compare both st_dev *and* st_ino. The existing check only checked the
latter. Fix that.
Lennart Poettering [Mon, 14 Feb 2022 16:22:18 +0000 (17:22 +0100)]
fd-util: use ERRNO_IS_XYZ() macros where appropriate
Lennart Poettering [Mon, 14 Feb 2022 16:21:41 +0000 (17:21 +0100)]
tree-wide: port various places over to new stat_inode_same() helper
Lennart Poettering [Mon, 14 Feb 2022 16:18:32 +0000 (17:18 +0100)]
stat-util: add helper stat_inode_same() for comparing stat's st_dev/st_ino in one
We do this all over the place, hence let's add a simple helper that does
this and particularly carefully and thoroughly.
Luca Boccassi [Mon, 14 Feb 2022 16:17:04 +0000 (16:17 +0000)]
Merge pull request #22506 from poettering/devnum-zero-btrfs-block-dev
gpt-auto: some (primarily cosmetic) fixes to backing block device detection in gpt-auto-generator/sd-device
Luca Boccassi [Mon, 14 Feb 2022 16:16:39 +0000 (16:16 +0000)]
Merge pull request #22445 from lnussel/logind
logind: post review fixes
Lennart Poettering [Fri, 11 Feb 2022 21:36:00 +0000 (22:36 +0100)]
bootspec: avoid zero size VLA
apparently some checkers don't like that. Let's be entirely safe here,
and use malloc() based allocation, given that the entries are user
controlled.
Lennart Poettering [Fri, 11 Feb 2022 21:23:37 +0000 (22:23 +0100)]
boot: suppress XBOOTLDR if same device as ESP when enumerating entries
On my local system I linked up the ESP and XBOOTLDR partitions, and
ended up with duplicate entries being listed. Try hard to detect that
and only enumerate entries in the ESP if it turns out that both dirs
have the same dev_t.
This should detect both bind mounted and symlinked cases and should make
our list output less confusing.
Lennart Poettering [Fri, 11 Feb 2022 21:19:35 +0000 (22:19 +0100)]
bootspec: make sure all return values are initialized on return of find_esp_and_warn()
THis makes sure that find_esp_and_warn() + find_xbootldr_and_warn()
follow our usual coding style that on success all return values are
initialized. We got that right in most successful codepaths out of these
functions, but missed the one where the paths are manually overwritten
via env vars.
Lennart Poettering [Fri, 11 Feb 2022 20:15:22 +0000 (21:15 +0100)]
bootctl: show more information about boot entry state in list
Let's improve display of boot entries and show what type they have (i.e.
boot loader spec type 1, or type 2, or auto-discovered or reported by
boot loader), and in particular mark entries the boot loader discovered
but we can't find (i.e. that likely vanished, or possibly couldn't be
found due to a misconfiguration) and that the boot loader didn't find
but we see (which are new, or possibly also the result of
misconfiguraiton).
This is supposed to be a replacement for #22161, but instead of hiding
vanished entries, highlights them, which I think is more appropriate for
a low-level tool such bootctl.
Replaces: #22161 #22398
Lennart Poettering [Fri, 11 Feb 2022 13:41:00 +0000 (14:41 +0100)]
bootspec: also collect/mark the "selected" boot entry (i.e. the one currently booted)
it's helpful and easy, so let's do it
Lennart Poettering [Fri, 11 Feb 2022 13:18:18 +0000 (14:18 +0100)]
bootspec: also parse new 'beep' loader.conf variable
Lennart Poettering [Fri, 11 Feb 2022 13:12:09 +0000 (14:12 +0100)]
bootspec: parse/show devicetree-overlay field too
It has been defined in the boot loader spec, and is the only field we
currently don't parse, hence fix that.
Lennart Poettering [Fri, 11 Feb 2022 13:05:15 +0000 (14:05 +0100)]
update TODO
Lennart Poettering [Fri, 11 Feb 2022 13:05:01 +0000 (14:05 +0100)]
bootspec: port one more use of basename() to path_extract_filename()
Lennart Poettering [Thu, 3 Feb 2022 15:27:33 +0000 (16:27 +0100)]
Revert "bootctl: Ignore boot entries (continue #22041)"
Lennart Poettering [Mon, 14 Feb 2022 13:59:03 +0000 (14:59 +0100)]
veritysetup: whitespace fix
Lennart Poettering [Mon, 14 Feb 2022 13:56:52 +0000 (14:56 +0100)]
homed: use SD_ID128_TO_UUID_STRING() at one more place
Lennart Poettering [Mon, 14 Feb 2022 13:56:37 +0000 (14:56 +0100)]
tree-wide: use id128_equal_string() at various places
Lennart Poettering [Mon, 14 Feb 2022 13:54:24 +0000 (14:54 +0100)]
id128-util: add new helper id128_equal_string()
Quite often we compare uuids/id128 formatted as strings with specific
values. So far we usually used streq() for that. let's add a new
explicit helper for this in id128_equal_string() that compares a string
with an sd_id128_t and is more robust than a simple string comparison.
Moreover, we can mroe easily reuse the various defines we have for
specific UUIDs, for example those from gpt.h.
Lennart Poettering [Mon, 14 Feb 2022 13:52:02 +0000 (14:52 +0100)]
sd128: export sd_id128_to_uuid_string()
We expose various other forms of UUID helpers already, i.e.
SD_ID128_UUID_FORMAT_STR and SD_ID128_MAKE_UUID_STR(), and we parse
UUIDs, hence add a high-level helper for formatting UUIDs too.
This doesn't add any new code, it just moves some helpers
id128-util.[ch] → sd-id128.[ch], to make them public.
Frantisek Sumsal [Mon, 14 Feb 2022 13:51:08 +0000 (13:51 +0000)]
Merge pull request #22505 from mrc0mmand/more-coverage-tweaks
A couple of coverage-related tweaks
Yu Watanabe [Wed, 19 Jan 2022 21:31:39 +0000 (06:31 +0900)]
test: check if running in container earlier
Luca Boccassi [Mon, 14 Feb 2022 13:17:23 +0000 (13:17 +0000)]
Merge pull request #22496 from yuwata/network-cleanups-keep-configuration
network: cleanups for KeepConfiguration= setting
Lennart Poettering [Mon, 14 Feb 2022 12:35:27 +0000 (13:35 +0100)]
gpt-auto: properly handle case where we can't determine devno of /usr/ fs
get_block_device_harder() returns == 0 if the fs is valid, but it is not
backed by a single devno. (As opposed to returning > 0 if the devno is
valid). Let's catch this case and log a clear message, and don't bother
open the device in that case.
This is mostly cosmetical, as either way, systemd-gpt-auto-generator
doesn't work in scenarios like that.
Prompted-by: #22504
Lennart Poettering [Mon, 14 Feb 2022 12:33:43 +0000 (13:33 +0100)]
sd-device: refuse opening device mit major/minor of zero early
device nodes with 0 dev_t are not real (and for that reason such inodes
are used as whiteouts in overlayfs, for example), hence refuse them
early. It seems wrong going to sysfs for something we know can't exist
anyway.
Frantisek Sumsal [Mon, 14 Feb 2022 11:20:02 +0000 (12:20 +0100)]
test: check for (possibly) missing test coverage
If the test logs contain lines like:
```
...systemd-resolved[735885]: profiling:/systemd-meson-build/src/shared/libsystemd-shared-250.a.p/base-filesystem.c.gcda:Cannot open
```
it means we're possibly missing some coverage since gcov can't write the stats,
usually due to the sandbox being too restrictive (e.g. ProtectSystem=yes,
ProtectHome=yes) or the $BUILD_DIR being inaccessible to non-root users.
Frantisek Sumsal [Mon, 14 Feb 2022 10:58:54 +0000 (11:58 +0100)]
test: set ACLs for the build dir when built with coverage
Otherwise unprivileged processes (like systemd-resolved) can't write
coverage data.
Matija Skala [Sat, 12 Feb 2022 05:05:54 +0000 (06:05 +0100)]
do not call __register_atfork directly
this way it is cleaner and more portable and systemd links against libpthread anyway
Ludwig Nussel [Wed, 9 Feb 2022 09:39:16 +0000 (10:39 +0100)]
systemctl: fix halt -f
Commit
adefc8789b always asks logind for shutdown first. So I broke halt
-f which is supposed to issue a direct syscall in that case.
Ludwig Nussel [Mon, 7 Feb 2022 17:03:22 +0000 (18:03 +0100)]
logind: more verbose struct initialization
Ludwig Nussel [Mon, 7 Feb 2022 10:50:12 +0000 (11:50 +0100)]
logind: increase max wall message length to 4096
Ludwig Nussel [Mon, 7 Feb 2022 09:56:19 +0000 (10:56 +0100)]
logind: style fixes
Ludwig Nussel [Thu, 3 Feb 2022 16:08:28 +0000 (17:08 +0100)]
logind: add handle enum to struct
Avoid pointer arithmetic at the expense of repeating the enum value
in the struct.
Yu Watanabe [Mon, 14 Feb 2022 06:08:20 +0000 (15:08 +0900)]
test-dhcp6-client: add test for rapid commit
Yu Watanabe [Thu, 10 Feb 2022 07:14:21 +0000 (16:14 +0900)]
test-dhcp6-client: cleanups
This does many cleanups. Most prominently,
- check the sents packet more strictly,
- make the packets used in the test more readable,
- unify callbacks.
Yu Watanabe [Mon, 7 Feb 2022 16:19:50 +0000 (01:19 +0900)]
fuzz-dhcp6-client: add prefix hint and vendor option to sent message
Yu Watanabe [Mon, 7 Feb 2022 16:19:27 +0000 (01:19 +0900)]
fuzz-dhcp6-client: merge with fuzz-dhcp6-client-send
Yu Watanabe [Mon, 7 Feb 2022 15:30:56 +0000 (00:30 +0900)]
fuzz-dhcp6-client: test multiple states
Then, now all three paths client_process_information(),
client_process_reply(), and client_process_advertise_or_rapid_commit_reply()
in client_receive_message() are fuzzed.
Yu Watanabe [Thu, 10 Feb 2022 12:44:28 +0000 (21:44 +0900)]
sd-dhcp6-client: append extra options before elapsed time option
The value of elapsed time option is determined in runtime and not
deterministic. It is hard to test the sent packets if it is located
in the intermidiate of the packet.
Yu Watanabe [Thu, 10 Feb 2022 12:11:32 +0000 (21:11 +0900)]
sd-dhcp6-client: logs invalid NTP option
Returning negative errno triggers to produce debugging log in
dhcp6_lease_parse_message().
Yu Watanabe [Mon, 7 Feb 2022 19:05:00 +0000 (04:05 +0900)]
sd-dhcp6-client: split dhcp6-internal.h into two
Also, this moves string tables to dhcp6-protocol.c.
Yu Watanabe [Mon, 7 Feb 2022 14:36:49 +0000 (23:36 +0900)]
network: do not restart DHCPv6 client when it is already running in managed mode
Otherwise, if a network has two router and one provides M flag and the
other provides O flag, then the DHCPv6 client switches the running mode
repeatedly. That makes the IPv6 network configuration of the host
unstable.
Yu Watanabe [Mon, 7 Feb 2022 14:23:05 +0000 (23:23 +0900)]
sd-dhcp6-client: reset Information Refresh Time on stop
Yu Watanabe [Mon, 7 Feb 2022 12:04:50 +0000 (21:04 +0900)]
sd-dhcp6-client: add log about Information Refresh Time
And store IRT only when the client is running in information
requesting mode.
Yu Watanabe [Mon, 7 Feb 2022 12:09:53 +0000 (21:09 +0900)]
sd-dhcp6-client: use memcmp_nn() at one more place
Yu Watanabe [Mon, 7 Feb 2022 06:31:33 +0000 (15:31 +0900)]
dhcp-identifier: generate static and constant DUID-EN when the client is running in test mode
Follow-up for
9216fddc5a8ac2742e6cfa7660f95c20ca4f2193.
Yu Watanabe [Mon, 7 Feb 2022 06:10:25 +0000 (15:10 +0900)]
dhcp-identifier: introduce dhcp_identifier_set_duid()
Yu Watanabe [Mon, 7 Feb 2022 06:08:27 +0000 (15:08 +0900)]
dhcp-identifier: introduce duid_type_to_string()
Yu Watanabe [Mon, 7 Feb 2022 04:56:36 +0000 (13:56 +0900)]
sd-dhcp6-client: do not expose set_transaction_id()
This is mostly for tests or fuzzers. Hence, this makes the function
requires that the client is running in the test mode.
Also, now the function mask the value for message type.