Commit Graph
68173 Commits
Author SHA1 Message Date
Luca Boccassi e5cd8bc060 Merge pull request #29601 from yuwata/mmap-check-overflow
mmap: check offset and size more carefully
2023-10-24 12:20:04 +01:00
Luca Boccassi 50dbadc9d1 Merge pull request #29685 from poettering/cryptenroll-reduce-scope
cryptenroll: two minor simplifications
2023-10-24 10:49:37 +01:00
Mike Yuan cf6416612c Merge pull request #29681 from YHNdnzj/sleep-round-three
sleep-config: cleanup round three
2023-10-24 17:03:54 +08:00
Yu Watanabe 8875639a7c Merge pull request #29679 from keszybz/drop-iovec-null
Drop IOVEC_NULL
2023-10-24 17:05:45 +09:00
Zbigniew Jędrzejewski-Szmek 1dd33bf3e4 basic/iovec-util: use FOREACH_ARRAY in one more place 2023-10-23 22:30:37 +02:00
Zbigniew Jędrzejewski-Szmek 3c9783c7f4 basic/iovec-util: drop TAKE_IOVEC
As suggested in
https://github.com/systemd/systemd/pull/29679#discussion_r1368678932.
2023-10-23 22:23:13 +02:00
Lennart Poettering 475c473d32 cryptenroll: merge two if checks with same condition
This removes a duplicate condition check by adding a common surrounding
if block.

This also change a confusing if check: "(X && Y) && Z" to simply "X && Y && Z"
2023-10-23 22:19:40 +02:00
Lennart Poettering 91a1632a4c cryptenroll: reduce scope of two global variables
No change in behaviour
2023-10-23 22:19:29 +02:00
Luca Boccassi d334c1211f systemctl: fallback if logind doesn't support new flag
Follow-up for 665a3d6d15
2023-10-23 19:43:15 +01:00
Luca Boccassi 28d2c32f0b Merge pull request #29633 from yuwata/dhcp-ipv6-only-mode-follow-ups
dhcp: several follow-ups for IPv6 only mode
2023-10-23 18:39:10 +01:00
Mike Yuan fefddffa53 sleep-config: check sleep mode only when hibernation
With the previous change, this should only be used when
doing hibernation.
2023-10-23 23:12:27 +08:00
Mike Yuan 1f82c21dce sleep-config: remove HibernateState= & HybridSleepState=, restrict
SuspendState= not to include "disk"

I don't know why these existed in the first place, but as I
justified in the comments, it's simply not sensible to allow
HibernateState= or HybridSleepState= to take values other than
'disk'. So let's just remove those options. Also, SuspendState=
should not contain 'disk'.
2023-10-23 23:12:27 +08:00
Mike Yuan 080105d77a hibernate-util: add missing assertion 2023-10-23 23:12:27 +08:00
Mike Yuan a3f7047f00 hibernate-resume: add missing static for arg_info 2023-10-23 23:12:27 +08:00
Antonio Alvarez Feijoo 2c87b71b00 timedatectl: add missing commands to the help output
Follow up to 159a855b34
2023-10-23 15:48:58 +01:00
Zbigniew Jędrzejewski-Szmek 7dc951ef91 basic/iovec-util: drop IOVEC_NULL
The macro isn't very useful, we can just use the direct setting to increase
readability.
2023-10-23 15:04:08 +02:00
Zbigniew Jędrzejewski-Szmek 1ca0b482b6 basic/iovec-util: always call the iovec "iovec"
We were using "i", "iov", and "iovec" in variuos places. Let's be
consistent.
2023-10-23 15:04:08 +02:00
Luca Boccassi f04333210b Merge pull request #29674 from poettering/unexport-marshal-blob
tpm2-util: make tpm2_marshal_blob()/tpm2_unmarshal_blob() static
2023-10-23 11:43:15 +01:00
Lennart Poettering 24aeaf4e7f glyph-util: add 'full block' glyph 2023-10-23 11:24:35 +01:00
Lennart Poettering 4cdef9f08c pcrextend: split out word to measure code into shared helper file
Let's split out the logic that actually generates the word to measure to
PCRs into a new helper file pcrextend-util.[ch].

This we can later reuse to calculate PCR measurement predictions ahead
of time.
2023-10-23 11:24:18 +01:00
Lennart Poettering 10cb55eef1 efi-api: export UUID converter calls
(while exporting, do some minor simplifications)
2023-10-23 11:23:56 +01:00
Lennart Poettering add8091c97 tpm2-util: make tpm2_read_public() static, as we use it only internally in tpm2-util.c 2023-10-23 10:36:22 +02:00
Lennart Poettering 9122edf907 tpm2-util: make tpm2_marshal_blob()/tpm2_unmarshal_blob() static
These are not used outside of tpm2-util.[ch], and the way they merge
public/private key pair into one blob is kinda specific to our
implementation, hence better should be hidden away, and not used for new
code anyway.
2023-10-23 10:36:22 +02:00
Julien Malka f64b9a1897 creds-utils: fix read_full_file_full call in read_credential_with_decryption
data was passed as a null pointer when an address was expected.
As a result, the assert was always tripped.
2023-10-23 09:36:04 +02:00
NAHO e6e5a272ed docs: correct parenthesis placement in 'man/tmpfiles.d.xml'
Correct the parenthesis placement in 'man/tmpfiles.d.xml' to prevent the
following formatting:

> lock ( shared or exclusive) is
2023-10-22 18:12:58 +01:00
Lennart Poettering b98c4f1d48 tpm2-util: rename tpm2_calculate_name() → tpm2_calculate_pubkey_name()
We'll soon have a function for determining the name of an NV index,
hence let's rename the existing function for the same of a public key to
make clear it's about public keys only.
2023-10-21 19:34:55 +01:00
Luca Boccassi 242b4bebcd Merge pull request #29382 from YHNdnzj/sleep-round-two
shared/sleep-config,hibernate-util: cleanup round two
2023-10-21 11:51:09 +01:00
Martin Wilck bf25cf6c49 units: modprobe@.service: don't unescape instance name
modprobe treats "-" and "_" interchangeably, thereby avoiding frequent
errors because some module names contain dashes and others underscores.

Because modprobe@.service unescapes the instance name, an attempt to
start "modprobe@dm-crypt.service" will run "modprobe -abq dm/crypt",
which is doomed to fail. "modprobe@dm_crypt.service" will work as
expected. Thus unescaping the instance name has surprising side effects.
Use "%i" instead.
2023-10-21 11:41:22 +01:00
Franck Bui a1af99df8e test: install af_packet kernel module on openSUSE
Currently needed by test-dhcp-server unit test, af_packet is not built-in on
openSUSE distributions.
2023-10-21 11:39:10 +01:00
Luca Boccassi ed5c97029c Merge pull request #29652 from yuwata/dhcp-cleanup-headers
dhcp: cleanup headers
2023-10-21 11:38:23 +01:00
Luca Boccassi 04144b9169 Merge pull request #29650 from YHNdnzj/more-followup
Some more follow-ups for recent PRs
2023-10-21 11:37:38 +01:00
Mike Yuan 0f095d0b8f shared/mount-util: log correct errno
Follow-up for 5f48198af8
2023-10-21 06:25:36 +08:00
Mike Yuan 5d4072d0ed man,docs: suffix directories with / 2023-10-21 06:25:35 +08:00
Mike Yuan fc932ed48f core/execute: use FOREACH_ARRAY and free_many more 2023-10-21 06:25:35 +08:00
Yu Watanabe 0bc30a2038 network,dhcp: restart client with 'networkctl renew' when delayed by IPv6 only mode
This is convenient when the server supports IPv6 only mode.
Otherwise, we cannot request a new address during the client is waiting an
IPv6 connectivity. Note, the minimal timespan is 5min, and a server may
send a quite large value.
2023-10-21 01:54:08 +09:00
Yu Watanabe 8664ded716 dhcp: split dhcp-internal.h into two 2023-10-21 01:54:08 +09:00
Yu Watanabe 95bd6816d7 sd-dhcp-client: always use sd_dhcp_client.timeout_ipv6_only_mode for delaying subsequent task
Otherwise, sd_dhcp_client_set_ipv6_connectivity() may not work, as it
checks if the timer event source is enabled or not.
2023-10-21 01:54:08 +09:00
Yu Watanabe 40e4be7e8e dhcp: move DHCP client specific definitions to dhcp-client-internal.h 2023-10-21 01:54:08 +09:00
Yu Watanabe 74c102d7e9 sd-dhcp-client: add a short comment about IPv6 only mode 2023-10-21 01:54:08 +09:00
Yu Watanabe dab96fed0c sd-dhcp-client: only send RENEW message when the client is in bound state
Fixes an issue reported at
https://github.com/systemd/systemd/pull/29544#issuecomment-1762742561.
2023-10-21 01:54:08 +09:00
Yu Watanabe a43f922526 sd-dhcp-client: simplify the condition in sd_dhcp_client_get_lease()
The condition was outdated, e.g. SELECTING state does not have a lease.
See client_handle_offer() and client_enter_requesting().

The condition based on the state may become much complex in the future.
Let's use simpler condition.
2023-10-21 01:54:08 +09:00
Yu Watanabe 9bcbb61458 dhcp: split out dhcp-network.h from dhcp-internal.h 2023-10-21 01:54:07 +09:00
Yu Watanabe 8320db407c dhcp: move DHCPState to dhcp-client-internal.h
All other definitions in dhcp-protocol.h are common for client and
server. Let's move DHCP client specific definitions.
2023-10-21 01:54:07 +09:00
Yu Watanabe f3d84e20c9 fuzz: include library headers first 2023-10-21 01:54:07 +09:00
Mike Yuan 805deec039 hibernate-util: introduce hibernation_is_safe
After 7470b80763, we refuse
to hibernate if we fail to write HibernateLocation EFI
variable and resume= is not set. Let's teach sleep_supported
to follow the practice too.
2023-10-20 23:22:54 +08:00
Mike Yuan 596873c10c hibernate-util: rework find_hibernate_location
* "HibernateLocation" struct is renamed to HibernationDevice
  to avoid ambiguity with the EFI variable. Also, it no longer
  takes the reference to a SwapEntry object, since it's really
  unnecessary (only SwapEntry.path is used), but increases complexity.
* SwapEntry is no longer used externally.
* find_hibernate_location is split into read_swap_entries and
  find_suitable_hibernation_device. The former reads all swap entries
  into SwapEntries object for later use.
* Make use of btrfs_get_file_physical_offset_fd

Closes #25130
2023-10-20 23:22:54 +08:00
Mike Yuan 2abc3c6d48 hibernate-util: read_fiemap: add missing asserts 2023-10-20 23:22:28 +08:00
Mike Yuan a0f6d74ec8 sleep-config: introduce sleep_supported_full that returns a reason
Preparation for later commits.

Also some other cleanups:
* Add assertions
* Use FOREACH_ARRAY
2023-10-20 23:22:28 +08:00
Mike Yuan 23577f4462 sleep-config: minor cleanup for can_sleep_{state,disk}
* Rename to sleep_{state,mode}_supported
* Treat unreadable/unwriable sysfs files as error
2023-10-20 23:22:28 +08:00
Mike Yuan d12babb574 test-btrfs-physical-offset: log correct errno 2023-10-20 23:22:28 +08:00