1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2025-01-06 13:17:44 +03:00
Commit Graph

59168 Commits

Author SHA1 Message Date
Yu Watanabe
3b75435db6 dhcp: make dhcp_identifier_set_iaid() take struct hw_addr_data 2022-08-06 04:53:36 +09:00
Yu Watanabe
e0ead13088 sd-dhcp6-client: use hw_addr_set() 2022-08-06 04:53:36 +09:00
Yu Watanabe
7e5c25b244 sd-dhcp-client: use struct hw_addr_data to store MAC and broadcast address 2022-08-06 04:53:36 +09:00
Yu Watanabe
069f5df051 ether-addr-util: introduce hw_addr_set() helper function 2022-08-06 04:53:36 +09:00
Yu Watanabe
7fddb9704f dhcp4: stop client before updating MAC address 2022-08-06 04:53:36 +09:00
Yu Watanabe
ebf404a4d0 sd-netlink: rename NLType and friends
In sd-netlink, we use 'type' for naming many variables with different type,
and worst of all, function like `type_get_type()` exists. That makes the
code hard to understood.

Let's rename
- NLType -> NLAPolicy
- NLTypeSystem -> NLAPolicySet
- NLTypeSystemUnion -> NLAPolicySetUnion
- type_get_type() -> policy_get_type()
- type_get_type_system() -> policy_get_policy_set(), and so on.

This also changes the type of attribute taken by e.g.
`sd_netlink_message_append_string()` from `unsigned short` -> `uint16_t`
to make the variable size clearer.
2022-08-06 03:53:51 +09:00
Yu Watanabe
96788d2aa4 udev-util: assume system is running on AC power when no battery found
Fixes #24214.
2022-08-06 03:42:32 +09:00
Yu Watanabe
1c6e17e5d1 udev-util: align string table 2022-08-06 03:35:04 +09:00
Yu Watanabe
1ab7e2b587
Merge pull request #23340 from yuwata/network-check-sr-iov-pf-state
network: check SR-IOV PF state
2022-08-06 03:18:30 +09:00
Yu Watanabe
c75efa3f7e
Merge pull request #23508 from yuwata/core-device
core/device: fix devlink handling
2022-08-06 03:18:14 +09:00
Richard Phibel
b6d1e2b441
mkosi: Add package libfdisk to Ubuntu dependencies (#24211)
* mkosi: Add package libfdisk to Ubuntu dependencies

The libfdisk package is needed by systemd-repart.
2022-08-05 18:40:17 +01:00
David Rheinsberg
347f48246f bus: use inline trace argument for ANONYMOUS auth
Rather than using a separate DATA round to transmit the trace-string of
the ANONYMOUS authentication scheme, transmit it inline as argument.
This requires a refactor of the client-side SASL parser, as we now have
a different set of replies depending on the mode used.

This fixes an issue where libdbus-1 does not query for trace-strings if
not transmit inline as AUTH-ANONYMOUS argument. It is unclear from the
wording of the spec whether this is a violation by libdbus-1. However,
we can work around it by simply changing our mode of transmittal.
2022-08-05 16:39:55 +01:00
Luca Boccassi
ecb991621a
Merge pull request #24216 from poettering/ispowerof2
add ISPOWEROF2() macro and use it
2022-08-05 16:38:58 +01:00
Lennart Poettering
7496235134 man,journalctl: introduce man/--help sections
So far the --help text and the man page of journactl were mostly a large
pile of options shown next to each other. Let's add some basic
structure, and group switches by sections such as "Filtering Options",
"Output Options" and so on.

Do this the same way in the --help text and in the man page.

Since this moves everything around anyway, I also opted to rebreak all
paragraphs in the man page. This makes the patch larger than necessary,
but given that this whole patch doesn't really change contents besides
section titles I figured this would be OK.
2022-08-05 16:13:07 +01:00
David Tardon
141332ab55 man: update dbus docs 2022-08-05 15:56:23 +02:00
David Tardon
9e69bd4801 man: document DefaultDeviceTimeoutSec= 2022-08-05 15:55:44 +02:00
Yu Watanabe
1f6d268b4b core/device: add comments for boolean arguments 2022-08-05 22:16:58 +09:00
Yu Watanabe
4a1a1caf21 core/device: always accept syspath change
When multiple devices have the same devlink, then
adding/updating/removing one of the device may cause syspath change.

Fixes the following issue in
https://github.com/systemd/systemd/issues/23208#issue-1217909746
> the above shows an inconsistency between udev's and systemd's handling
> of the two different devices having the same alias. While udev replaces
> the by-uuid symlink which now points to sdh1 rather than sdd1, systemd
> keeps the previous mapping to sdd1 and emits a warning. This is not the
> problem cause but worth mentioning.
2022-08-05 22:15:02 +09:00
Yu Watanabe
dce2d35ce5 core/device: move several functions
No functional change. A preparation for later commits.
2022-08-05 22:13:47 +09:00
Yu Watanabe
367a2597c3 core/device: store the original path
The unit name may be hashed. Hence, we cannot obtain the original path
from the unit name.

The path will be used in the later commits.
2022-08-05 22:13:47 +09:00
Franck Bui
7870de03c5 core: replace m->honor_device_enumeration with MANAGER_IS_SWITCHING_ROOT() 2022-08-05 22:13:47 +09:00
Franck Bui
d35fe8c0af core: introduce MANAGER_IS_SWITCHING_ROOT() helper function
Will be used by the following commit.
2022-08-05 22:13:43 +09:00
Yu Watanabe
e33232d405 network: also check SR-IOV PF port and other VF ports before configuring
When a PF port becomes down (this can happens e.g. the PF port is joining
a bond interface), some drivers make its VF ports also become down, and
may cause failures in configuring VF ports.

Similary, when a VF port become down, some drivers make its PF port and
other VF ports down.

Let's configure SR-IOV ports (both PF and VFs) after all link-layer
settings of all ports being applied.

Fixes #23315.
2022-08-05 21:49:27 +09:00
Yu Watanabe
b0ff6dea38 network: manage SR-IOV PF and VF ports 2022-08-05 21:49:27 +09:00
Yu Watanabe
00117f8811 network: split out link_is_ready_to_create_stacked_netdev()
Preparation for later commits.
2022-08-05 21:49:27 +09:00
Yu Watanabe
4b482e8bf4 network: check link state with link_is_ready_to_configure() before configuring DHCP client or friends
Otherwise, DHCP client or friends may started before link-layer properties,
e.g. MAC address, being configured or the link being activated.
2022-08-05 21:49:27 +09:00
Yu Watanabe
2fd3908b5c network: drop carrier check for unmanaged interface from link_is_ready_to_configure()
Preparation for later commits. No functional change.
2022-08-05 21:49:27 +09:00
Yu Watanabe
d8d4db58ca network: refuse to configure anything on pending or initialized state 2022-08-05 21:49:27 +09:00
Yu Watanabe
53c2e3b9ba network: unset master ifindex only when necessary 2022-08-05 21:49:27 +09:00
Yu Watanabe
4d79af57ca network: wiphy: use ERRNO_IS_DEVICE_ABSENT() 2022-08-05 21:49:27 +09:00
Yu Watanabe
59611eb9b8 udev: ignore empty SR-IOV VF suffix
It should not happen. Just for safety.
2022-08-05 21:49:27 +09:00
Yu Watanabe
68a52f5973 sd-device: introduce sd_device_new_child() 2022-08-05 21:49:23 +09:00
Frantisek Sumsal
578355684d ci: set a timeout for each mkosi stage
Work around #24202 so we don't wait ~6 hours for a stuck QEMU job.
2022-08-05 12:12:13 +00:00
Lennart Poettering
983ce0b517 macro: use ISPOWEROF2() at various places 2022-08-05 13:37:29 +02:00
Lennart Poettering
c51e4c796d macro: add macro for checking if integer is power of 2 2022-08-05 13:34:11 +02:00
David Tardon
a0fe19f9f7 core: allow to set default timeout for devices
Fixes: #19879
2022-08-05 13:20:00 +02:00
Jonas Witschel
559a1d35d5 cryptsetup: test unlocking using a TPM2 LUKS2 token plugin with a PIN
Test the functionality implemented in the previous commit ("cryptsetup: ask for
PIN when trying to activate using a LUKS2 token plugin"): when "tpm2-device" is
not specified, systemd-cryptsetup calls crypt_activate_by_token_pin() to try to
unlock using a LUKS2 token plugin, test whether this is able to obtain the
provided PIN.
2022-08-05 12:22:27 +02:00
Jonas Witschel
ee6c66acc5 cryptsetup: ask for PIN when trying to activate using a LUKS2 token plugin
crypt_activate_by_token() fails with ENOANO if the token is protected with a
PIN, in this case we need to call crypt_activate_by_token_pin() with a PIN.
This logic is already implemented in
crypt_activate_by_token_pin_ask_password().

This code path is relevant when using systemd-gpt-auto-generator because there
is no a priory information about the type of the used security device, so
systemd-cryptsetup tries to unlock the volume using the corresponding
cryptsetup plugin.
2022-08-05 12:22:27 +02:00
Jonas Witschel
89db47550d cryptsetup-token-systemd-fido2: use crypt_normalize_pin
Use the helper function introduced in the previous commit ("cryptsetup:
implement cryptsetup_token_open_pin for systemd-tpm2 LUKS2 token") for
cryptsetup-token-systemd-tpm2.
2022-08-05 12:22:27 +02:00
Jonas Witschel
35ba2b4f01 cryptsetup: implement cryptsetup_token_open_pin for systemd-tpm2 LUKS2 token
This finishes the implementation started in commit
1f895adac2 ("cryptsetup: add libcryptsetup TPM2
PIN support").

Note that the previous implementation took a shortcut by returning EOPNOTSUPP
instead of the correct ENOANO as per the cryptsetup documentation. This meant
that systemd-cryptsetup fell back to the non-plugin implementation in order to
ask for the PIN. Since this does not happen any more when returning ENOANO, we
need to ask for the PIN in attach_luks2_by_tpm2_via_plugin() instead like
attach_luks2_by_fido2_via_plugin() does.
2022-08-05 12:19:57 +02:00
Jonas Witschel
d141149957 cryptsetup: refactor asking for a PIN into a more generic function
This functionality will be useful for other LUKS2 token types as well in the
future.
2022-08-05 11:28:44 +02:00
Yu Watanabe
14e7bc2e77
Merge pull request #23367 from yuwata/core-mount
core/mount: fix dependency issues
2022-08-05 13:48:23 +09:00
Yu Watanabe
49ad287292 test-network: support the case that l2tp module is not supported
Hopefully fixes the issue reported at
https://github.com/systemd/systemd-centos-ci/pull/517#issuecomment-1205399798.
2022-08-04 18:39:04 +00:00
Yu Watanabe
413f20b4ac test: add test case for mount unit dependencies 2022-08-05 01:35:38 +09:00
Yu Watanabe
49267b1b14 core/mount: make device deps from /proc/self/mountinfo and .mount unit file exclusive
Before this commit, when a .mount unit file is loaded, the device
dependencies from the unit file are automatically added. If a device
that is different from which specified in .mount unit file is mounted
on the path, then the device dependencies about the device are also added.
Hence, the unit has device dependencies about two (or more) different
devices. Hence, if one of the devices are unplugged, even if another one
is mounted on the path, then the path is unmounted.

This commit makes device dependencies from two different sources
exclusive, and always regenerate the dependencies when one of the
information is updated.

Fixes #19983 and #23552.
2022-08-05 01:35:38 +09:00
Yu Watanabe
0fe06168b3 core/mount: also remove default deps from /proc/self/mountinfo when it is updated
The dependencies tagged with UNIT_DEPENDENCY_MOUNTINFO_DEFAULT depend
on both /proc/self/mountinfo and corresponding .mount unit file.
Hence, if some information from mountinfo is updated, e.g. device mounted
on the path, we need to update the dependencies.
2022-08-05 01:35:38 +09:00
Yu Watanabe
b9e6d23dfc core/mount: set Mount.from_proc_self_mountinfo flag before adding default dependencies
When the function mount_setup_new_unit() is called, the corresponding
.mount unit file is not loaded. Hence, Mount.from_fragment is false.
To add default dependencies to e.g. .device units, it is necessary that
the Mount.from_proc_self_mountinfo flag is set. However, the flag was
not set even the unit has information from /proc/self/mountinfo.

Partially fixes #19983.
2022-08-05 01:35:38 +09:00
Yu Watanabe
03e52e8cc3 core: unit_name_from_path() does not return -ENAMETOOLONG anymore
Follow-ups for a7fb1f2eae and
1d0727e76f.
2022-08-05 01:34:55 +09:00
Yu Watanabe
6688b72d32 core/mount: use set_put_strdup_full() 2022-08-05 01:32:28 +09:00
Lennart Poettering
f17061ef95
Merge pull request #24189 from medhefgo/boot-secure
boot: Follow-up fixes for #20255
2022-08-04 17:27:20 +02:00