Commit Graph
46910 Commits
Author SHA1 Message Date
Lennart Poettering d4fee8941a confext: make sure we pick up configuration extensions passed to us from the stub
With fixes from Maanya Goenka.
2024-01-03 11:23:27 +01:00
Lennart Poettering 39e0c237f1 stub: pick up confexts from the ESP as well
This does what we do for system extension also for configuration
extension.

This is complicated by the fact that we previously looked for
<uki-binary>.d/*.raw for system extensions. We want to measure sysexts
and confexts to different PCRs (13 vs. 12) hence we must distinguish
them, but *.raw would match both kinds.

This commit solves this via the following mechanism: we'll load confexts
from *.confext.raw and sysexts from *.raw but will then enclude
*.confext.raw from the latter. This preserves compatibility but allows
us to somewhat reasonable distinguish both types of images.

The documentation is updated not going into this detail though, and
instead now claims that sysexts shall be *.sysext.raw and confexts
*.confext.raw even though we actually are more lenient than this. This
is simply to push people towards using the longer, more descriptive
suffixes.

I added an XML comment (<!-- … -->) about this to the docs, so that
whenever somebody notices the difference between code and docs
understands why and leaves it that way.
2024-01-03 10:38:34 +01:00
Yu Watanabe dd8ab4a206 sd-dhcp-server: rename DHCPLease -> sd_dhcp_server_lease
Then, move basic functions for the object to sd-dhcp-server-lease.[ch].

No effective funcional changes.
2024-01-03 15:20:31 +09:00
Yu Watanabe 95c48613f4 sd-dhcp-server: use sd_dhcp_client_id 2024-01-03 15:20:31 +09:00
Rose cb924b9b6a fundamental: prefer byte swap builtins over byte swapping manually
This builtin reduces complexity and GCC/Clang have supported these builtins for a long time.
2024-01-03 15:11:55 +09:00
Yu Watanabe 12fb1fc5dd Merge pull request #30702 from yuwata/sd-dhcp-client-id
dhcp: introduce sd_dhcp_client_id and relevant functions
2024-01-03 15:10:46 +09:00
Yu Watanabe 778823fd52 backlight: supprt ID_LEDS_CLAMP udev property for leds subsystem devices
Closes #30507.
2024-01-03 09:30:41 +09:00
Yu Watanabe e0feaedbd9 udev/dmi-memory-id: update table with latest SMBIOS specification
Closes #30699.
2024-01-03 08:43:17 +09:00
Yu Watanabe 7e08a337b2 Merge pull request #30700 from yuwata/storagetm-fixlets
storagetm: several trivial fixlets
2024-01-03 08:42:58 +09:00
Yu Watanabe cb0a3b8c14 network/route: drop TTL propagate support for MPLS routes
This effectively reverts 9b88f20aba.

We do not support MPLS routes, only IPv4 or IPv6 routes are supported.
2024-01-03 08:41:53 +09:00
Yu Watanabe 6ba147485e network/queue: fix potential double-free on oom
Currently, link_queue_request_safe(), which is a wrapper of
request_new(), is called with a free function at
- link_request_stacked_netdev() at netdev/netdev.c,
- link_request_address() at networkd-address.c,
- link_request_nexthop() at networkd-nexthop.c,
- link_request_neighbor() at networkd-networkd.c.

For the netdev case, the reference counter of the passed object is increased
only when the function returns 1. So, on failure (with -ENOMEM)
previously we unexpectedly dropped the reference of the NetDev object.
Similarly, for Address and friends, the ownership of the object is moved to the
Request object only when the function returns 1. And on failure, previously
the object was freed twice.

Also, netdev_queue_request(), which is another wrapper of request_new()
potentially leaks memory when the same NetDev object is queued twice.
Fortunately, that should not happen as the function is called only once
per object.

This fixes the above issue, and now the ownership or the reference
counter of the object is changed only when it is succeeded with 1.
2024-01-03 08:41:36 +09:00
Yu Watanabe ff49e703ff Merge pull request #30691 from yuwata/resolve-ipv6
resolve: do not listen to IPv6 when disabled by sysctl
2024-01-03 08:41:14 +09:00
Mike Yuan 0e3638380d various: unexport a few internal structs
We don't expose destructors for these internal structs already.
Let's make the struct itself implementation detail too.
2024-01-03 08:40:33 +09:00
Yu Watanabe d59a2b3bf5 sd-dhcp-lease: use sd_dhcp_client_id 2024-01-03 06:06:39 +09:00
Yu Watanabe 1809132064 dhcp: move sd_dhcp_client_id_to_string() to sd-dhcp-client-id.[ch]
Then, this makes it take sd_dhcp_client_id object, and introduce
sd_dhcp_client_id_to_string_from_raw().
2024-01-03 06:06:36 +09:00
Yu Watanabe 6efa51f862 dhcp: introduce sd_dhcp_client_id and relevant functions
This splits out client ID handling from sd-dhcp-client.c to
sd-dhcp-client-id.[ch]. This will be used later in other places.
2024-01-03 06:06:34 +09:00
Mike Gilbert 049f178b80 storagetm: ensure we pass dev_t* to sd_device_get_devnum
On MIPS32 OABI, st_rdev is unsigned long, not dev_t. Use a temporary
variable to avoid an incompatible pointer.

Bug: https://bugs.gentoo.org/920576
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=21278
Fixes: https://github.com/systemd/systemd/issues/30626
2024-01-03 05:37:25 +09:00
Yu Watanabe 69f4a87c8c storagetm: fix use of wrong stat element 2024-01-03 05:19:00 +09:00
Yu Watanabe 30c1cded77 storagetm: always hash stat.st_mode
To make the hash function consistent with the compare function.
2024-01-03 05:07:43 +09:00
Yu Watanabe f22b586a21 network/address: introduce address_remove_and_cancel()
Then, replace address_remove_and_drop() with it.

If an address is requested, and the request is already called,
we may not received its reply and notification from the kernel, and
the corresponding address object may not be remmbered. Even in such
case, we need to remove the address, otherwise the address will come
later after the function called.
2024-01-03 04:43:34 +09:00
Yu Watanabe f1b73dbbc9 network/address: not necessary to remmber address before remove 2024-01-03 04:43:34 +09:00
Yu Watanabe 7f74b00ab0 network/address: make address_remove() take Link object that the address assigned to
No functional change. Preparation for later commits.
2024-01-03 04:43:34 +09:00
Yu Watanabeandsushmbha b16c6076cb udev: wait for an extra time before the manager kills workers
Otherwise, udev workers cannot detect slow programs invoked by
IMPORT{program}=, PROGRAM=, or RUN=, and whole worker process may be
killed.

Fixes #30436.

Co-authored-by: sushmbha <sushmita.bhattacharya@oracle.com>
2024-01-03 04:23:22 +09:00
Yu Watanabe 11706971e8 udev-spawn: skip executing RUN= if exec_delay= is too long
To prevent the worker process killed by the manager.
2024-01-03 04:23:18 +09:00
Yu Watanabe 406c96e329 udev-spawn: refuse to spawn commands if the event already takes too long
Also, calculate the timeout for warning based on the remaining time for
the timeout of the event, rather than the timeout itself.

Currently, udev manager kills the worker if the timeout exceeds. So,
this does not change anything except for the timing of the warning.

Just refactoring and preparation for later commits.
2024-01-03 04:23:12 +09:00
Yu Watanabe ef4e0b7e4f sd-netlink: introduce sd_rtnl_message_route_set_tos()
We already have the getter for the parameter, but forgot to introduce the setter.
2024-01-03 04:21:51 +09:00
Yu Watanabe 8f8b39c86b sd-netlink: move definitions of RTA_TYPE() and RTA_FLAGS() to netlink-util.h 2024-01-03 04:21:28 +09:00
Yu Watanabe a53082f07d resolve: do not listen to IPv6 when disabled by sysctl
Fixes #30669.
2024-01-03 04:03:30 +09:00
Lennart Poettering 03d808c9f6 efi-loader: when detecting if we are booted in UKI measured boot mode, imply a check for TPM2
We simply don't carry any userspace support for TPM1.2 in our tree, and
we shouldn't given it's too weak by today's standards. Hence, if we
check if we are booted in UKI measured boot mode, don't just check if we
are booted in EFI, but also check that we have a TPM2 chip (as opposed
to none or only a TPM1.2 chip).

This is an alternative to #30652 but more comprehensive (and simpler),
since it covers all invocations of efi_measured_uki().

Fixes: #30650
Replaces: #30652
2024-01-02 17:48:53 +01:00
Yu Watanabe 83a0417550 sd-journal: introduce cleanup function and hash ops for Directory
This makes the folloing:
- Each Directory object now has a reference to sd-journal.
- Hence, directory_free(), which is renamed from remove_directory(), can
  be called without sd-journal as an argument.
- Introduces hash ops for Directory, so the finalization becomes
  slightly simpler.
- Allocate hashmaps that store Directory objects when necessary.
- Split out add_directory_impl().

No functional changes, just refactoring.
2024-01-01 19:29:04 +01:00
Luca Boccassi 86b8b66675 Merge pull request #30591 from yuwata/device-util
device-util: introduce device_in_subsystem() and device_is_devtype() helper functions
2024-01-01 19:26:39 +01:00
Luca Boccassi 9d75598bc4 Merge pull request #30593 from yuwata/sd-dhcp-duid
dhcp: introduce sd_dhcp_duid and relevant functions
2024-01-01 19:24:31 +01:00
Luca Boccassi e191de6947 Merge pull request #30614 from yuwata/udev-event-take-worker
udev: make UdevEvent take UdevWorker object
2024-01-01 19:18:07 +01:00
Mike Yuan 22a8f00229 utmp-wtmp: check actual value of bool instead of pointer 2024-01-01 19:13:14 +01:00
Mike Yuan a31222b232 logind: use handle_action_to_string where appropriate
Since 138224fc80, HandleActionData
records the corresponding HandleAction. Let's use it instead of
relying on inhibit_what when mapping to string.
2024-01-01 19:12:44 +01:00
Mike Yuan cbdb8732dd bus-wait-for-units: rearrange function 2024-01-01 18:42:24 +08:00
Mike Yuan 86dea48ddf bus-wait-for-units: correctly report state if disconnected from bus 2024-01-01 18:42:24 +08:00
Mike Yuan 0ffcc7539b bus-wait-for-units: rephrase error message 2024-01-01 18:42:24 +08:00
Mike Yuan a490aa5a2d bus-wait-for-units: use hashmap_remove_value where appropriate 2024-01-01 18:42:23 +08:00
Mike Yuan edba11cbd1 bus-wait-for-jobs: remove unneeded strna and refactor code a bit 2024-01-01 18:42:23 +08:00
Mike Yuan 6aac0ff01c bus-wait-for-jobs: a few modernizations 2024-01-01 18:16:54 +08:00
Mike Yuan e945d395e2 bus-wait-for-jobs: rephrase error message 2024-01-01 15:58:52 +08:00
Mike Yuan a8af9745e5 bus-wait-for-jobs: reorganize functions 2024-01-01 15:57:55 +08:00
Mike Yuan b8f4a205f7 bus-wait-for-jobs: sort includes 2024-01-01 15:45:05 +08:00
Yu Watanabe 73780aa8a3 resolve: DnsTransaction.scope may be NULL when dns_transaction_close_connection() is called
Follow-up for ac1b7b9e19.

Fixes CID#1533020.
2023-12-31 04:51:59 +09:00
Yu Watanabe d05649ca7d resolve: add several comments for DNS type table
Also update compile time checks.

Follow-up for 818bb6f482.
2023-12-31 04:51:42 +09:00
Joakim NohlgårdandYu Watanabe ba340e2a75 udevadm: Propagate return code from verb result
udevadm lock did not propagate the return code from the child process
because all positive values were treated as success.

v2:
Now 'udevadm test-builtin' ignores all positive return values from the
builtin commands. Otherwise, as the hwdb builtin returns an positive value
when a matching entry found, 'udevadm test-builtin hwdb' will fail.

v3:
Initialize partition table before calling 'sfdisk --delete'.

Co-authored-by: Yu Watanabe <watanabe.yu+github@gmail.com>
2023-12-30 05:26:59 +09:00
Mike Yuan 6b9cac874c fd-util: don't eat up errors in fd_cloexec_many
Follow-up for ed18c22c98

Before this commit, a successful fd_cloexec() call would
discard all previously gathered errors.
2023-12-29 14:26:40 +01:00
Yu Watanabe 5b201ffb1e sd-journal: check sd-event state before setting up post change timer
The similar check already exists in schedule_post_change().

The function is currently called at two places.
- journal_file_open() in sd-journal:
  In this case, if the timer is not set up, then journal_file_post_change()
  will be called at the end of journal_file_append_entry(). So, the necessary
  task will be done sequentially when an journal entry is stored to the opened
  journal file. That is desired when the function is called at outside of the
  event loop.
- server_open_journal() in journald:
  This is not called after we exit the event loop.

So, we can safely do nothing in the function if the event loop is being
finished or already finished.

Fixes #30644.
2023-12-29 06:39:06 +09:00
Ronan Pigott 818bb6f482 dns: update record type enum to match iana
Adds some new dns record types. Also, some types were inserted into the
middle of the enum — this corrects an error where the enum constants for
some of the record types previously held an incorrect value.
2023-12-29 04:08:41 +09:00