Commit Graph
100 Commits
Author SHA1 Message Date
Yu Watanabe 18f2d38d5f Journal-remote: modernize source_free() and fix memleak (#36430)
- modernize source_free().
- fix memleak introduced by cfaf78001c. Fixes CID#1591182.
2025-02-19 04:56:15 +09:00
Yu Watanabe a6eb22968c terminal-util: fix possible NULL pointer dereference
Fixes a bug introduced by 94a2b1cd25.
Fixes CID#1591787.
2025-02-18 18:34:39 +01:00
Yu Watanabe 134bb7bfdf nspawn: unconditionally enable FUSE and use FOREACH_ARRAY() (#36407)
- FUSE is unconditionally enabled in the container, as our kernel base
line (v5.4) supports userns-safe FUSE, which is supported since v4.18.
- Create /dev/net/tun only when it is accessible.
- Replaces several loops with FOREACH_ARRAY().
2025-02-19 02:09:58 +09:00
Yu Watanabe 011a83e42b network: fix KeepConfiguration=yes (#36414)
Fixes a regression in dd6d53a8dc (v257).
Fixes #36411.
2025-02-19 02:09:09 +09:00
Yu Watanabe 54258df829 journal-remote: fix memleak
Fixes a bug introduced by cfaf78001c.
Fixes CID#1591182.
2025-02-19 01:00:20 +09:00
Yu Watanabe ca25c8a5e2 journal-remote: modernize source_free()
- make it return NULL,
- suppress log message about reference counter of writer unless trace
  logging is enabled,
- introduce cleanup function for RemoteSource.
2025-02-19 00:58:24 +09:00
Yu Watanabe 114d191a17 nspawn: move the accessibility check for device nodes into copy_devnode_one() 2025-02-18 23:35:13 +09:00
Yu Watanabe c51e472bd4 nspawn: drop unused argument for copy_devnode_one() 2025-02-18 23:24:20 +09:00
Yu Watanabe 9fff6bf59e nspawn: create /dev/net/tun only when it is accessible
Follow-up for 985ea98e7f.

When DevicePolicy= is enabled, but DeviceAllow= for /dev/net/tun is not
specified, bind-mounting the device node from the host system is
meaningless, as it cannot be used in the container anyway.

Let's check the device node is accessible before creating or
bind-mounting.
2025-02-18 23:24:20 +09:00
Yu Watanabe 3cc23a2c23 nspawn: enable FUSE unconditionally
FUSE is userns-safe since kernel v4.18 (da315f6e03988a7127680bbc26e1028991b899b8),
and now our kernel base line is 5.4. Let's drop the logic of checking
the version of FUSE, and unconditionally enable FUSE.
2025-02-18 23:24:20 +09:00
Yu Watanabe 1236f06c42 nspawn: use FOREACH_ARRAY() where applicable 2025-02-18 23:24:20 +09:00
Yu Watanabe 81f637630c network: introduce link_should_mark_config()
This split-out common logic from link_drop_routes() and friends.

This is mostly a refactoring, and not change behavior in most cases.
But slightly change behavior for how foreign nexthops and routing
policy rules are managed.

E.g. when KeepConfiguration=static, previously all foreign nexthops and
routing policy rules were kept, but now only foreign nexthops and rules
with RTPROT_STATIC are kept and others are dropped.

Similary, when KeepConfiguration=dynamic, previously all foreign nexthops
and rules were removed, but now foreign configs with a dynamic protocol
e.g. RTPROT_DHCP are kept, and still configs with RTPROT_STATIC are
dropped.

Currently, we do not set/get/manage protocol for neighbor entries.
Hence, the logic of managing foreign neighbor entries is unchanged.
2025-02-18 23:13:51 +09:00
Yu Watanabe 1cac0676da test-network: add test case for KeepConfiguration=yes with RTPROT_BOOT
For issue #36411.
2025-02-18 23:01:53 +09:00
Yu Watanabe 724faccf45 network/route: do not remove any foreign routes when KeepConfiguration=yes
Without this change, only foreign routes with RTPROT_KERNEL, RTPROT_STATIC,
RTPROT_DHCP, RTPROT_RA, and RTPROT_REDIRECT are kept, and foreign routes with
other protocol e.g. RTPROT_BOOT are removed even if KeepConfiguration=yes.

Fixes a regression in dd6d53a8dc (v257).
Fixes #36411.
2025-02-18 23:01:53 +09:00
Yu Watanabe f9c03297c5 network: update outdated comment
Now, our kernel base line supports ambient capabilities, hence the
comment is outdated.
2025-02-17 06:20:46 +09:00
Yu Watanabe eb381e65f1 network/address: update comment
As commented in the code, the check is now redundant. But let's keep
that to make IPv6LL addresses on other interfaces not removed
accidentally.
2025-02-17 06:20:46 +09:00
Yu Watanabe 29c2d4e158 network/address: IFA_FLAGS is supported since kernel v3.14
Our kernel base line is now v5.4.
2025-02-17 06:20:46 +09:00
Yu Watanabe 7d1a8da719 network/bridge-mdb: drop workaround for MDB entry on bridge
Our kernel base line is now v5.4.
2025-02-17 06:20:46 +09:00
Yu Watanabe 0d73214cae network: mention IFLA_PERM_ADDRESS is since kernel v5.6 2025-02-17 06:20:46 +09:00
Yu Watanabe 49625caaa9 network/routing-policy-rule: assume FRA_PROTOCOL attribute is always set
Since kernel v4.17 (1b71af6053af1bd2f849e9fda4f71c1e3f145dcf), the
attribute is always set in each netlink message for routing policy rule.
Now, our base line is v5.4. Hence, we can drop the workaround.
2025-02-17 06:20:36 +09:00
Yu Watanabe 6698795eda network: add/update comments about required kernel configs 2025-02-17 05:13:06 +09:00
Yu Watanabe 034b69d8b8 network: assume nexthop is supported by the kernel
It is supported since kernel v5.3 (65ee00a9409f751188a8cdc0988167858eb4a536),
but our base line is now v5.4.
2025-02-17 04:54:59 +09:00
Yu Watanabe 7ffa9dc616 TEST-75-RESOLVED: add test cases for resolving service with record type filter 2025-02-16 23:22:50 +09:00
Yu Watanabe d13b5fdc01 TEST-75-RESOLVED: check TXT field 2025-02-16 23:10:16 +09:00
Yu Watanabe 5a07bb2c55 TEST-75-RESOLVED: revert changes done in each test case 2025-02-16 22:55:22 +09:00
Yu Watanabe 6ad252c1a5 TEST-75-RESOLVED: drop unnecessary symlink creation
It is always done in setup().
2025-02-16 22:55:22 +09:00
Yu Watanabe 0592f3f413 resolve: refuse ResolveService method if SRV is filtered
Follow-up for 81ae2237c1.
2025-02-16 22:54:56 +09:00
Yu Watanabe 9ec25fba5a resolve: if both A and AAAA are refused, do not resolve address when resolving service
Similarly, set NO_TXT flag if TXT is filtered.

Follow-up for 81ae2237c1.
Fixes https://github.com/systemd/systemd/pull/36353#issuecomment-2659558382.
2025-02-16 22:54:00 +09:00
Yu Watanabe 3c31cc3981 resolve: allow to specify SD_RESOLVED_NO_SEARCH flag in ResolveRecord
The varlink method io.systemd.Resolve.ResolveRecord already accepts the
flag. Let's also the bus method accept the flag, for consistency.
2025-02-16 22:41:10 +09:00
Yu Watanabe 7cf95470f3 resolve: unify two validate_and_mangle_flags()
The argument `Manager *manager`, is currently unused, but will be used
later.
2025-02-16 22:39:52 +09:00
Yu Watanabe 5f494e8fa6 macro-fundamental: add _nonnull_if_nonzero_ and use it in basic/ (#36395) 2025-02-16 20:21:08 +09:00
Yu Watanabe 56ab3ae170 journal-upload: several follow-ups for Accept-Encoding header handling
This makes,
- When a wildcard value '*' is specified, use the first supported
  compression algorithm,
- disable compression if Accept-Encoding header is unspecified or
  no supported compression algorithm specified in the header,
- ignore all errors in parsing the header.
2025-02-16 20:10:27 +09:00
Yu Watanabe 04b096400b journal-upload: split-out update_content_encoding_header()
No functional change, just refactoring and preparation for later commit.
2025-02-16 20:08:39 +09:00
Yu Watanabe c259c9e253 journal-remote: several follow-ups for Compression= option handling
Follow-ups for cfaf78001c.

- use OrderedHashmap to manage configured compression algorithms, then
  drop CompressionArgs,
- rename CompressionOpts -> CompressionConfig,
- refuse 'none' in Compression= setting, but accept boolean false, which
  disables compression,
- when Compression= option is unspecified, enable all supported compression
  algorithms by default,
- do not set 'none' to the Accept-Encoding header.
2025-02-16 20:08:39 +09:00
Yu Watanabe 8c7e4e0d5e journal-remote: replace extract_first_word() with simple strchr() 2025-02-16 20:08:39 +09:00
Yu Watanabe c272c06b9e journal-remote: assume received data is not compressed when Content-Encoding header is not set
Also, refuse spurious header `Content-Encoding: none`.
2025-02-16 20:08:39 +09:00
Yu Watanabe fc1cf91aa8 journal-remote: copy positional arguments
This also fixes several memory leaks.
2025-02-16 20:08:39 +09:00
Yu Watanabe a8516216d2 journal-remote: trivial coding style fix 2025-02-16 20:08:39 +09:00
Yu Watanabe 5a83fd5a2a resolve: fix use-after-free (#36353)
Fixes a bug introduced by 81ae2237c1.
Fixes #36351.
2025-02-15 00:03:21 +09:00
Yu Watanabe 03d8b9dfab TEST-75-RESOLVED: skip a testcase when running on sanitizer 2025-02-14 11:54:56 +00:00
Yu Watanabe 2c9d6986d8 TEST-75-RESOLVED: keep IPv6 stack enabled
To make the issue #36351 easily reproduced.
2025-02-14 11:54:56 +00:00
Yu Watanabe 39da9b894f TEST-75-RESOLVED: assume knot 3.0 or newer is installed
And make the test failed if knot is installed but older than 3.0.
2025-02-14 11:54:56 +00:00
Yu Watanabe bf4b254d70 mkosi: wrap several more commands when running on sanitizers
They are used in TEST-75-RESOLVED.
2025-02-14 11:54:56 +00:00
Yu Watanabe 225dbd6108 resolve: fix use-after-free
Fixes a bug introduced by 81ae2237c1.
Fixes #36351.
2025-02-14 11:54:56 +00:00
Yu Watanabe dd0d821a33 journal-remote: fix typo
Follow-ups for cfaf78001c.
2025-02-14 13:23:27 +09:00
Yu Watanabe 530ee01c60 TODO: fix typo
Follow-ups for 0eeeb36bd5 and
3fd11dbcd9.
2025-02-14 13:23:11 +09:00
Yu Watanabe d75c74e7bf README: mention fsopen() is since kernel v5.2
It is introduced by the following commit.
https://github.com/torvalds/linux/commit/24dcb3d90a1f67fe08c68a004af37df059d74005
2025-02-14 13:06:33 +09:00
Yu Watanabe 4053af87bb core/mount: rework GracefulOptions= as x-systemd.graceful-option= (#36356)
Prompted by #36337
2025-02-14 13:01:14 +09:00
Yu Watanabe daae625140 core/service: drop unneeded unit_add_to_gc_queue() (#36368) 2025-02-14 12:51:48 +09:00
Yu Watanabe b3b4420620 udev-watch: do not try to remove invalid watch handle
When a new device is processed, there should be no watch handle for
the device, hence udev_watch_clear() provides -1. Let's not try to call
inotify_rm_watch() in that case.

This should not change any behavior. Just for suppressing spurious
debugging log:
=====
(udev-worker)[3626140]: zram1: Removing watch handle -1.
=====
2025-02-12 09:27:24 +09:00
Yu Watanabe a52aad3b4b udev-watch: mention that the failure is ignored 2025-02-12 09:26:51 +09:00
Yu Watanabe 951def0e27 udev-worker: add debugging log about success of flock() for whole block device 2025-02-12 09:20:58 +09:00
Yu Watanabe c0cc24ba42 Follow-ups for xattr-util (#36335) 2025-02-12 07:59:24 +09:00
Yu Watanabe 1e4d0b00e5 string-util: introduce strprepend(), drop effectively unused strnappend() (#36343)
Split out from #36337
2025-02-11 18:09:03 +09:00
Yu Watanabe 5dbd751ccc tmpfiles: 3 trivial cleanups (#36332) 2025-02-10 02:33:33 +09:00
Yu Watanabe 869b0dfe6e core: remove path to transient unit file from unit name maps on stop (#36186)
Fixes #35190.
2025-02-10 00:48:01 +09:00
Yu Watanabe aaa274ed7f xattr-util: try new *xattrat() family syscalls first (#36228)
While killing cgroup v1 I want to turn all cg_* helpers to take
cgroupfs_fd + cg path, which means all relevant path operations must
support openat() semantics. `removexattrat()` is currently missing. I
took the chance to do a bigger refactor for xattr-util.
2025-02-10 00:41:38 +09:00
Yu Watanabe 52e9bc2deb journal-remote,journal-upload: added compression support (#34822) 2025-02-09 13:33:33 +09:00
Yu Watanabe ed8063d143 udevadm-test: show result in json format (#36284)
This adds `--json=MODE` command line option to `udevadm test`.
This may be useful for parsing e.g. network interface name or device
node symlinks.

Closes #23661.
2025-02-08 15:50:04 +09:00
Yu Watanabe 576e98a72c meson: fix suite of alignment check tests
Follow-up for 97318131fd.

By default, suite of each built test is determined by the directory of
the source file. Hence, before the mentioned commit, all tests in
src/boot/efi/ are in the 'efi' suite. The commit changed the directory
tree, but forgot to update the name of the test suite.
2025-02-08 00:13:28 +00:00
Yu Watanabe c26db05640 man/udevadm: add examples to get predictable interface name and persistent device node symlinks
Closes #23661.
2025-02-08 01:39:35 +09:00
Yu Watanabe ac722389a7 udevadm-test: allow to dump result in json format
This adds --json=MODE option for 'udevadm test' command.
When specified, all messages, except for the final result, will be
written to stderr, and the final result is shown in JSON format to
stdout. It may be useful for parsing the test result.
2025-02-08 01:39:35 +09:00
Yu Watanabe 0879fa4bc3 udevadm-test: show guiding messages in stderr
Then, only final results will be shown in stdout.
2025-02-08 01:39:35 +09:00
Yu Watanabe dc27464ab7 udev-rules: always use log_info() to dump current event status 2025-02-08 01:39:35 +09:00
Yu Watanabe fc30b1a0b0 udev-dump: show more information
This also reorders and renames entries.
2025-02-08 01:39:35 +09:00
Yu Watanabe e66d4ea31a udev-dump: fix gid check
Fixes a bug introduced by 03b6879f4d.
2025-02-08 01:39:18 +09:00
Yu Watanabe 0d77185555 udev: sd_device_get_sysnum() provides non-NULL result on success
This drops unnecessary conditions.
2025-02-08 01:38:02 +09:00
Yu Watanabe d083799a2c udev: use device_get_sysnum_unsigned() where applicable 2025-02-08 01:38:02 +09:00
Yu Watanabe 7543ae05e3 sd-device: introduce device_get_sysnum_unsigned() 2025-02-08 01:38:02 +09:00
Yu Watanabe b92a2290c6 kernel-install: addresses post-merge comments for #36218 (#36304) 2025-02-07 21:11:03 +09:00
Yu Watanabe 41f392490e man/kernel-install: update documents for plugins
Addresses the post-merge comments in #36218.
2025-02-07 19:52:36 +09:00
Yu Watanabe be4f4c4343 meson: also skip uid/gid check for nobody user/group when id command not found
Follow-up for 8b413ae406.
2025-02-07 10:49:58 +00:00
Yu Watanabe ab676c768a kernel-install: rename $ADDON_DIR -> $EXTRA_DIR
As the directory contains not only addons, but also credentials and
extensions.

No functional change, just refactoring.

Follow-up for 75ee025c5d.
Addresses the post-merge comment
https://github.com/systemd/systemd/pull/36218#discussion_r1940872236.
2025-02-07 19:46:57 +09:00
Yu Watanabe 9eb348c9c5 core/exec-invoke: drop unnecessary casts
Follow-up for c554acd11d.
2025-02-07 09:18:49 +01:00
Yu Watanabe cdc9be29b1 udev/net: support to configure Energy Efficient Ethernet settings
Closes #36278.
2025-02-07 13:47:41 +09:00
Yu Watanabe 929cb8ba5d udev/net: reorder elements in LinkConfig, and add short comments 2025-02-07 12:37:57 +09:00
Yu Watanabe aedef65e2b firstboot: Populate XKBLAYOUT and friends as well in vconsole.conf (#36275)
Let's derive XKBLAYOUT and friends from the given keymap and populate
these as well in vconsole.conf so that if the user configures a keymap
it's also respected in display managers such as gdm.
2025-02-07 11:20:21 +09:00
Yu WatanabeandRudi Heitbaum 0d879453ac basic/linux: update kernel headers from v6.14-rc1
Co-authored-by: Rudi Heitbaum <rudi@heitbaum.com>
2025-02-06 16:14:14 +00:00
Yu Watanabe 229d91793f boot: several follow-ups for .efifw section support (#36230)
Follow-ups for #35091.
2025-02-06 14:53:12 +09:00
Yu Watanabe 570cd55783 udevadm: several cleanups for command line option parsers (#36241) 2025-02-06 09:39:03 +09:00
Yu Watanabe 2b6890d92f udev-builtin: several trivial cleanups (#36239)
- introduces UDEV_BUILTIN_DESTRUCTOR macro,
- normalize log messages on initialize/finalize,
- explicitly initialize global variable,
- drop using _UDEV_BUILTIN_INVALID.
2025-02-06 09:38:39 +09:00
Yu Watanabe 4e752c9a2f man/udevadm: rebreak and reindent lines 2025-02-05 14:47:14 +09:00
Yu Watanabe d7596ec91c man/udevadm: list --version as a common option
Then, drop --version and --help from each sub commands.
2025-02-05 14:46:57 +09:00
Yu Watanabe 052ab05caf Two test readme improvements (#36265) 2025-02-05 10:08:00 +09:00
Yu Watanabe a10172b035 test-network: add test case for issue #35874 2025-02-05 09:40:31 +09:00
Yu Watanabe bc45d9c959 network/routing-policy-rule: fix compare func
Previously, when comparing an existing and requested routing policy
rules, `all` flag was unset, thus the from and to addresses in the two
rules were not compared. Hence, a new request with from and/or to
addresses might be considered as it already exists even the addresses of
existing one were different from the newly requested one.

All existing rules have valid family, i.e. AF_INET or AF_INET6. And,
all requesting rules with from and/or to addresses also have a valid
family. Hence, even `all` flag is unset, the addresses can be and must
be compared in that case.

Fixes a regression caused by fc58350aa4 (v257).
Fixes #35874.
2025-02-05 09:14:54 +09:00
Yu Watanabe f7ae28fcec test-network: add test case for requesting routing policy rules by multiple interfaces
For issue #36244.
2025-02-04 12:28:59 +09:00
Yu Watanabe 5078e36632 network: allow to configure routing policy rule even if requesting interface is not activated yet
In the kernel, all routing policy rules are not assigned to any interface,
and we can configure them even if the relevant interface is down state.

Fixes a regression caused by 4f8b153d90 (v257).
Fixes #36244.
2025-02-04 12:28:30 +09:00
Yu Watanabe d35f7966ba Merge remote-tracking branch 'weblate/main' into HEAD 2025-02-02 16:21:10 +09:00
Yu Watanabe 295741c0d1 udevadm-verify: document '--resolve-names=late' and accept 'never' as is
When '--resolve-names=late', systemd-udevd resolves user/group names
during each event being processed, and does not verify names on parse.
When '--resolve-names=never', systemd-udevd refuses any user/group names
on parse. Hence, the parser of udev rules behaves diffrently. Let's not
convert 'never' -> 'late' silently, and use the specified option as is.

This also updates man page and shell completion for --resolve-names
option.
2025-02-02 15:55:01 +09:00
Yu Watanabe 8623980980 udevadm: introduce parse_resolve_name_timing() 2025-02-02 15:55:01 +09:00
Yu Watanabe be73f6e35b udevadm: several cleanups around parse_device_action()
- drop unnecessary one line function dump_device_action_table(),
- make parse_device_action() log about invalid action string,
- rename output argument of parse_device_action().
2025-02-02 15:55:01 +09:00
Yu Watanabe 4489fed739 po: sort languages 2025-02-02 15:44:10 +09:00
Yu Watanabe 7db4bdcd40 udev: replace '!= _UDEV_BUILTIN_INVALID' -> '>= 0'
No functional change, just refactoring.
2025-02-02 13:09:18 +09:00
Yu Watanabe 5bb83e3f30 udev-builtin-hwdb: explicitly initialize global variable 2025-02-02 12:44:57 +09:00
Yu Watanabe c791f61949 udev-builtin: normalize load/unload log messages by builtins 2025-02-02 12:43:26 +09:00
Yu Watanabe 1a85468768 udev: introduce UDEV_BUILTIN_DESTRUCTOR macro 2025-02-02 12:36:31 +09:00
Yu Watanabe 546e6cb2e3 userdb: fix typo
Follow-up for 7419291670.
2025-02-01 14:09:06 +09:00
Yu Watanabe 52a0bf1621 boot: rename efifirmware.[ch] -> efi-firmware.[ch]
This also
- renames efifirmware_match_by_fwid() -> efi_firmware_match_by_fwid(),
- drops unnecessary wrapper efifw_get_fwid(),
- drops unnecessary inclusion of header <endian.h>,
- sort files in meson.build.

No functional change, just refactoring and follow-ups for
83bf58f39d.
2025-02-01 13:54:01 +09:00
Yu Watanabe 8963df6c81 man: update tags in systemd-stub(7)
- use <literal> for section name,
- use <command> for systemd-stub,
- drop '=' suffix from EFI variable name.
2025-02-01 13:37:51 +09:00