Commit graph

70998 commits

Author SHA1 Message Date
Yu Watanabe 972f1d17ab network/ndisc: remove conflicting routes on configuring routes based on newly received RA
The linux kernel does not update several parameters, e.g. RTA_PREF.
Hence, when we configure routes based on a RA, we need to remove
existing conflicting routes.

Fixes #28426 and #28439.
2024-02-15 00:43:12 +09:00
Yu Watanabe 7027cdbd79 network/route: remove existing route if some property conflict with requested ones
Fixes #28853.
2024-02-15 00:43:12 +09:00
Yu Watanabe e09b758876 network: rename link_drop_managed_xyz() -> link_drop_static_xyz()
As networkd does not configure nexthops, neighbors, or routing policy rules
dynamically, this only changes link_drop_managed_addresses(). Previously
it also removed dynamic addresses, but with this commit, now it only
removes static addresses. Note, link_drop_managed_routes() has removed
only static routes, so this commit only changes its name.

Note. as commented in the code, the dynamic addresses will be removed
on lease expiration or stopping client, and link_drop_managed_xyz() are
called on reconfiguration or so, and at that time, all dynamic
addressing clients are stopped or restarted, so this should not
effective behavior change.
2024-02-15 00:43:12 +09:00
Yu Watanabe a86763c70b network/ndisc: also drop SLAAC addresses and routes on reconfiguring
Especially, this is important for routes, as link_drop_managed_routes()
removes only static routes, rather than non-foreign routes.
2024-02-15 00:43:12 +09:00
Yu Watanabe 95e1fbbac4 test-network: allow to specify multiple interfaces to wait_online() without square bracket 2024-02-15 00:42:43 +09:00
Luca Boccassi 37c6c2035e
Merge pull request #28761 from esposem/cmdline_manager
bootctl: handle UKI cmdline addons
2024-02-14 13:56:31 +00:00
Luca Boccassi 25d80c2203
Merge pull request #31283 from CodethinkLabs/vmspawn/start_from_template
vmspawn: Support being invoked from a template unit
2024-02-14 13:55:04 +00:00
Lennart Poettering 63091fa38c
Merge pull request #31319 from poettering/journal-tighten-memfd-flags
journald: tighten checks on incoming memfds a bit
2024-02-14 14:40:46 +01:00
Yu Watanabe 489326e25b
Merge pull request #31314 from yuwata/network-ndisc-check-conflicting-address
network/ndisc: check conflicting address
2024-02-14 22:19:05 +09:00
Luca Boccassi 311efaae25 meson: do not attempt to install tests when they are disabled
If -Dtests=false but -Dinstall-tests=true the build will fail, as some tests will
be pulled in the build but not their prerequisites. It doesn't make sense to ask
for tests to be installed if they are disabled.

FAILED: test-acd
cc  -o test-acd test-acd.p/src_libsystemd-network_test-acd.c.o -flto -Wl,--as-needed -Wl,--no-undefined -pie -fstack-protector -Wl,-z,relro -specs=/usr/share/debhelper/dh_package_notes/debian-package-notes.specs -g -O2 -ffile-prefix-map=/tmp/s=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -ffat-lto-objects -Wdate-time -D_FORTIFY_SOURCE=2 '-Wl,-rpath,$ORIGIN/src/shared:XXXXXXXXXXXXXXX' -Wl,-rpath-link,/tmp/s/obj-x86_64-linux-gnu/src/shared -Wl,--start-group src/shared/libsystemd-shared-255.so src/libsystemd-network/libsystemd-network.a -Wl,--end-group -Wl,--fatal-warnings -Wl,-z,now -Wl,-z,relro -Wl,--warn-common -Wl,--gc-sections -Wl,--fatal-warnings -Wl,-z,now -Wl,-z,relro -Wl,--warn-common -Wl,--gc-sections
/usr/bin/ld: /tmp/cc0oYwFZ.ltrans0.ltrans.o: in function `main':
./obj-x86_64-linux-gnu/./obj-x86_64-linux-gnu/<artificial>:85:(.text.startup+0x33): undefined reference to `test_setup_logging'
collect2: error: ld returned 1 exit status
2024-02-14 12:41:09 +01:00
Lennart Poettering 296de3867c journald: rebreak some comments 2024-02-14 11:00:18 +01:00
Lennart Poettering 1f47e27a29 journald: when getting journal data via memfd, check flags are valid
Add some extra safety checks: refuse weird open flags.

And while we are at it, also use stat_verify_regular()
2024-02-14 11:00:08 +01:00
Emanuele Giuseppe Esposito 01fd84111f bootctl: discover and pring global UKI PE addons
An UKI final command line is not just made of the content of .cmdline,
but also from the addons that are inserted in
/boot/efi/EFI/Linux/<UKI_NAME>.efi.extra.d (local addons) and /boot/efi/loader/addons
(global addons).

Therefore bootclt "status" and "list" should also include these addons
when printing the UKI command line.

Support for /boot/efi/EFI/Linux/<UKI_NAME>.efi.extra.d is already present,
so now cover addons present in /boot/efi/loader/addons (global addons).

Example (assume UKI_NAME=devel):
$ bootctl
ukiCmdline: console=tty0 console=ttyS0
  globalAddon: loader/addons/global.addon.efi
      cmdline: └─quiet
   localAddon: devel.efi.extra.d/rpm_addon.addon.efi
      cmdline: └─this is a normal addon
 finalCmdline: console=tty0 console=ttyS0 quiet this is a normal addon
2024-02-14 04:58:28 -05:00
Emanuele Giuseppe Esposito 122650b4a0 bootctl: discover local UKI PE addons
An UKI final command line is not just made of the content of .cmdline,
but also from the addons that are inserted in
/boot/efi/EFI/Linux/<UKI_NAME>.efi.extra.d (local addons) and
/boot/efi/loader/addons (global addons).

Therefore bootclt "status" and "list" should also include these addons
when printing the UKI command line.

Right now, discover addons present in
/boot/efi/EFI/Linux/<UKI_NAME>.efi.extra.d.

Example output (assume UKI_NAME=devel):
$ bootctl
ukiCmdline: console=tty0 console=ttyS0
   localAddon: devel.efi.extra.d/rpm_addon.addon.efi
      cmdline: └─this is a normal addon
 finalCmdline: console=tty0 console=ttyS0 this is a normal addon
2024-02-14 04:58:20 -05:00
Emanuele Giuseppe Esposito ebd1a30093 bootspec: refactor find_sections
Prepare for the incoming changes that introduce PE addons support.
Addons will contain a .cmdline section, but not .osrel.
2024-02-14 04:56:42 -05:00
Lennart Poettering a050dc507c update TODO 2024-02-14 10:56:35 +01:00
Adrian Vovk c425c8854f hashmap: Add helper to dump sorted keys
Currently, hashmap_dump_sorted sorts by key and then returns the values
in order sorted by key. This commit adds another helper that does the
same but returns the sorted keys instead
2024-02-14 09:35:36 +01:00
Yu Watanabe d1cde7f051 sd-journal: drop unused function prototype
Follow-up for 8b4fbbb0a1.

The function was renamed and moved by
035b0f8fe8.
Maybe the prototype is mistakenly re-introduced on rebase.
2024-02-14 09:31:13 +01:00
Mike Yuan 872ffc8a82 core/load-fragment: modernize config_parse_socket_listen
Prompted by #31304
2024-02-14 09:23:07 +01:00
Lennart Poettering 64e18af731
Merge pull request #31206 from AdrianVovk/user-record-fields
Added some more user record fields
2024-02-14 09:22:23 +01:00
Adrian Vovk 83b4576195 env-util: Add helper to store current log level
This is useful after a fork but before an exec into a binary that uses
systemd's logging utilities. For example, this should be used in dbus
services that fork off worker processes: currently, the log level set by
the LogControl dbus API will be lost because of the exec, and the worker
process will not have the correct log level set.
2024-02-14 09:21:45 +01:00
Lennart Poettering 2fe27f966f
Merge pull request #31297 from AdrianVovk/sha256-util-lib
basic: Add some sha256 helper functions
2024-02-14 09:19:56 +01:00
Yu Watanabe 8bd473ff25 core: allow to specify /dev/rfkill for ListenSpecial=
Follow-up for 8049bce619.

Fixes #31294.
2024-02-14 09:14:59 +01:00
Adrian Vovk 80d07162e7 format-utils: Expose FORMAT_UID and FORMAT_GID
This pulls this generally useful helper out of sysusers and into the
util lib, and updates the places throughout the codebase where it makes
sense to use it.
2024-02-14 09:14:13 +01:00
Adrian Vovk e2a40cc7b9 homed: Add some missing asserts
These functions expect secrets to be passed in (some even dereference
the variables), but fail to assert that they're non-null. So this commit
adds some assertions
2024-02-14 09:13:46 +01:00
Yu Watanabe e720ad88f3 network/ndisc: check if there exists a conflicting address
Follow-up for 0a0c2672db.

Before the commit, if a conflicting address exists or already requested,
then the configuration of newly requested address (especially, prefix
length) is mostly ignored silently.

However, after the commit, even if there exists a conflicting address,
networkd anyway tries to configure the newly requested address, and
enter failed state. Such situation can be triggered, e.g. when the DHCPv6
client is started earlier than NDisc, by WithoutRA=solicit.

Fixes #31263.
2024-02-14 13:59:04 +09:00
Yu Watanabe 9e79ef9120 network/ndisc: drop unnecessary ownership transfer
Follow-up for e217da1380.
2024-02-14 13:59:04 +09:00
Yu Watanabe 77de62f96c network/dhcp6: use address_can_update() at one more place
In address_can_update(), only prefix length is checked for IPv6
addresses. So, this should not change any behavior.
2024-02-14 13:59:04 +09:00
Yu Watanabe a45e1c35e3 network/address: drop requirement of Address.link and .network in address_can_update()
This also rename arguments.
No functional change, just refactoring.
2024-02-14 13:59:04 +09:00
Adrian Vovk 49e55abb7f
user-record: Add languages field
This field is like preferredLanguage, but takes a priority list of
languages instead. If an app isn't translated into a user's primary
language, it can fall back to one of the other languages in the list
thus making the app more accessible to the user.

For instance: in my experience, many Ukrainians are fluent in Russian,
often significantly better than English (especially if they are of a
generation that grew up during the USSR). Such a person might set this
new variable to ["uk_UA.UTF-8", "ru_UA.UTF-8"] so that software that
lacks Ukrainian translations will first try Russian translations before
defaulting to English.

Fixes #31290
2024-02-13 17:39:14 -05:00
Adrian Vovk fa485e8fc5
locale-util: Restrict valid locales
This further restricts the charset of locales to better reflect what
locales actually look like.

This allows us to safely join locale names using the `:` character, for
instance, which cannot appear in a locale name and is used by the
`$LANGUAGE` env var
2024-02-13 17:31:36 -05:00
Adrian Vovk 592ca6f0ef
pam_systemd: Let user record override env vars
The user record should be the source of truth for the user's environment
variables, and the user should be able to override them in much the same
way that they can if they simply append the variable to their ~/.profile

For example, before $LANG would never get set to the user's preferred
language, because the service manager always ensures that $LANG is set
to something (either the localed config, or a compiled-in default). Thus
the user's preferredLanguage setting was always ignored
2024-02-13 17:31:35 -05:00
Luca Boccassi e1390da025 varlink: fix dead code
'e' is already checked in the previous branch, no need to check it again,
it cannot be NULL.

CID#1534465

Follow-up for 9bca989183
2024-02-13 21:43:59 +00:00
Yu Watanabe 604b200108 test: fix typo
Follow-up for d02018afdb.
2024-02-14 04:04:12 +09:00
Yu Watanabe 964756923b test: fix typo
Follow-up for 3456c89ac2.
2024-02-14 04:03:09 +09:00
Yu Watanabe a14d3b48f7 cryptsetup: fix typo
Follow-up for c5daf14c88.
2024-02-14 04:01:52 +09:00
Adrian Vovk 0bac442251
basic: Add some sha256 helper functions
Adds a util function to sha256 an open fd (moved from dissect). Also
adds functions to check if a string contains a valid sha256 hash, and
parse it into a sha256 array.
2024-02-13 13:59:27 -05:00
Yu Watanabe dcd484e545 tools: fix typo
Follow-up for 6d55e3a364.
2024-02-14 03:58:35 +09:00
Frantisek Sumsal 5b1aa0e19a core: escape spaces when serializing as well
Otherwise they might get stripped when reading the serialized data back.

Resolves: #31214
2024-02-14 02:22:58 +08:00
Adrian Vovk a7a67dfd9d
fundamental: Add overflow-safe math helpers
ADD_SAFE/SUB_SAFE/MUL_SAFE do addition/subtraction/multiplication
respectively with an overflow check. If an overflow occurs these return
false, otherwise true. Example: (c = a + b) would become ADD_SAFE(&c, a,
b)

INC_SAFE/DEC_SAFE/MUL_ASSIGN_SAFE are like above but they also reassign
the first argument. Example: (a += b) would become INC_SAFE(&a, b)
2024-02-13 13:08:20 -05:00
Daan De Meyer 6d55e3a364 Use tilde for rc tag versioning
tilde sorts lower in the version comparison spec:
https://uapi-group.org/specifications/specs/version_format_specification/

➜  systemd git:(strip) systemd-analyze compare-versions 249\~rc1 249
249\~rc1 < 249
➜  systemd git:(strip) systemd-analyze compare-versions 249-rc1 249
249-rc1 > 249

Also update tools/meson-vcs-tag.sh to use carets instead of hyphens
for the git part of the version as carets are allowed to be part of
a version by pacman while hyphens are not and both sort higher than
a version without the git part.
2024-02-13 18:14:36 +01:00
Sam Leonard 38624568d8
vmspawn: add template unit to start systemd-vmspawn -M 2024-02-13 12:31:03 +00:00
Sam Leonard b064cc563a
vmspawn: search for machines when only passed -M/--machine= 2024-02-13 12:31:03 +00:00
Sam Leonard 6af6d44230
vmspawn: discover bootloader for directory type images 2024-02-13 12:31:03 +00:00
Sam Leonard 811ad9e6b2
vmspawn: support multiple initrds via merging 2024-02-13 12:26:33 +00:00
김인수 ccc5673cc9 po: Translated using Weblate (Korean)
Currently translated at 100.0% (227 of 227 strings)

Co-authored-by: 김인수 <simmon@nplob.com>
Translate-URL: https://translate.fedoraproject.org/projects/systemd/master/ko/
Translation: systemd/main
2024-02-13 10:49:37 +01:00
Lennart Poettering c9cdbaed17
Merge pull request #30380 from keszybz/tmpfiles-dry-run
Make tmpfiles/sysusers nicer with local files and implement tmpfiles --dry-run
2024-02-13 09:45:50 +01:00
Ondrej Kozina c5daf14c88 cryptsetup: Add optional support for linking volume key in keyring.
cryptsetup 2.7.0 adds feature to link effective volume key in custom
kernel keyring during device activation. It can be used later to pass
linked volume key to other services.

For example: kdump enabled systems installed on LUKS2 device.
This feature allows it to store volume key linked in a kernel keyring
to the kdump reserved memory and reuse it to reactivate LUKS2 device
in case of kernel crash.
2024-02-13 09:45:08 +01:00
Lennart Poettering 10048b2e20 update TODO 2024-02-13 09:17:43 +01:00
Frantisek Sumsal 16343f52ba
Merge pull request #31271 from fbuihuu/test-69-debugging-improvements
Test 69 debugging improvements
2024-02-12 21:14:43 +01:00