Commit graph

66886 commits

Author SHA1 Message Date
Jan Janssen 1e73a64a7a meson: Convert more options to meson features
The semantics for libidn2 and pwquality have changed slightly: We will
pick a preferred one if both are enabled instead of making it an error.
2023-08-23 14:45:02 +02:00
Jan Janssen 847e5585b6 meson: Convert bpf-framework to meson feature 2023-08-23 14:45:02 +02:00
Jan Janssen 40e9c4e45d meson: Convert options to meson features (require)
These options use requre() to conveniently express their dependency
requirements.
2023-08-23 14:45:02 +02:00
Jan Janssen 101b59433b meson: Convert dbus to meson feature
Also, there is no need to conditionalize the get_variable() calls
because not-found dependencies will just return the passed default value
if provided.
2023-08-23 14:45:02 +02:00
Jan Janssen a0c9ac9ae4 meson: Convert options to meson features (find_library fallback)
This uses a two-step approach to make sure we can fall back to
find_library(), while also skipping the detection if the features are
explicitly disabled.
2023-08-23 14:45:02 +02:00
Jan Janssen 9ee80846f8 meson: Convert fidsk to meson feature
By making this a disabler dependency, we can slightly simplify the code
and it als fixes the build for -Dfdisk=disabled as we failed to create a
fallback empty libshared_fdisk variable.
2023-08-23 14:45:02 +02:00
Jan Janssen 43abc59a27 meson: Use feature options
By using meson features we can replace the handcrafted dependency
auto-detection by just passing the value from get_option directly to the
required arg for dependency, find_library etc.
'auto' features make the dependency optional, 'enabled' requires it
while 'disabled' features will skip detection entirely.

Any skipped or not found dependency will just be a no-op when passed to
build steps and therefore we can also skip the creation of empty vars.

The use of skip_deps for these is dropped here as meson provides a way
to disable all optional features in one go by passing
'-Dauto_features=disabled'.
2023-08-23 14:45:02 +02:00
Susant Sahani b26c345279 network: radv - Allow to send hop limit 2023-08-23 14:06:14 +09:00
Yu Watanabe 244f518f1d
Merge pull request #28764 from yuwata/core-namespace
core/namespace: cleanups
2023-08-23 12:43:29 +09:00
Nandakumar Raghavan a2fc6f2d59 networkd: Add T1 and T2 DHCPv6 options to expose in dbus API
Include T1 and T2 DHCPv6 options to expose in dbus API.
Introduced new field DHCPv6lease where these options are
added. This will be added to the JSON output when we query
org.freedesktop.network1.Manager object.
2023-08-23 12:43:09 +09:00
Yu Watanabe 856532ef01
Merge pull request #28926 from yuwata/bsod-cleanups
bsod: several cleanups
2023-08-23 12:41:53 +09:00
Susant Sahani fdc4c67c2a
network/radv: allow to configure the time between retransmitted Neighbor Solicitation (#28888) 2023-08-23 12:37:44 +09:00
Yu Watanabe 14c5c43985
Merge pull request #28496 from ssahani/ndisc-28426
network: ndisc - Also fill router preference
2023-08-23 12:36:45 +09:00
Susant Sahani 4ccd48cb26 network: ndisc - drop routes of lifetime 0
A Lifetime of 0 indicates that the router is not a default router anymore
and associated default route should be discarded from host's routing table.

https://datatracker.ietf.org/doc/html/rfc4861
```
Router Lifetime
     16-bit unsigned integer.  The lifetime associated
     with the default router in units of seconds.  The
     field can contain values up to 65535 and receivers
     should handle any value, while the sending rules in
     Section 6 limit the lifetime to 9000 seconds.  A
     Lifetime of 0 indicates that the router is not a
     default router and SHOULD NOT appear on the default
     router list.  The Router Lifetime applies only to
     the router's usefulness as a default router; it
     does not apply to information contained in other
     message fields or options.  Options that need time
     limits for their information include their own
     lifetime fields.

```
2023-08-22 21:28:11 +05:30
Yu Watanabe 51bf9b1ac3 core/namespace: do not return 1 unnecessarily
The caller of this function apply_mounts() -> apply_one_mount() only
checks if the return value is negative or not.
2023-08-22 23:22:34 +09:00
Yu Watanabe cc45ff17a4 core/namespace: add missing string table entries 2023-08-22 23:22:32 +09:00
Yu Watanabe 2b60ce545c mount-util: drop unused remount_and_move_sub_mounts() 2023-08-22 23:21:43 +09:00
Yu Watanabe 553e366086 core/namespace: reimplement mount_private_sysfs() in the same logic to mount private procfs
Previously, mount_private_sysfs() was implemented by using open_tree()
and move_mount() to keep submounts. But these syscalls are slightly new
and supported since kernel version 5.2.

We already do the same thing for /proc/, but without the new syscalls.
Let's use the same logic to mount private procfs. Then, we can mount
new instance of sysfs with older kernels.
2023-08-22 23:21:43 +09:00
Yu Watanabe cc7e2dff7e core/namespace: use ERRNO_IS_NEG_PRIVILEGE()
Also, this makes mount_procfs() always return the last failure in mount(),
and slightly reduces indentation by returning earlier.
2023-08-22 23:21:43 +09:00
Zbigniew Jędrzejewski-Szmek 88328d997a
Merge pull request #28787 from yuwata/credential-next
core: do not leak mount for credentials directory if possible
2023-08-22 16:21:00 +02:00
Yu Watanabe c3c885a771 bsod: several cleanups
- add reference to the service unit in the man page,
- fix several indentation and typos,
- replace '(uint64_t) -1' with 'UINT64_MAX',
- drop unnecessary 'continue'.
2023-08-22 23:20:14 +09:00
Yu Watanabe cf5d2df986 man/rules: update man rules for systemd-tmpfiles-setup-dev-early.service
Follow-up for bb7f485f4b.
2023-08-22 22:58:40 +09:00
Susant Sahani f44eebd1ba network: ndisc - Also fill router preference 2023-08-22 18:41:09 +05:30
Frantisek Sumsal 465ba1236c sysext: fix a memory leak
Introduced by 41712cd1c0.

=================================================================
==2194==ERROR: LeakSanitizer: detected memory leaks
Indirect leak of 359856 byte(s) in 459 object(s) allocated from:
    #0 0x7ffff7511df4  (/usr/lib64/clang/16/lib/linux/libclang_rt.asan-powerpc64le.so+0x191df4) (BuildId: 47e1dd371a2b8525b6cb737760a4dc535f30ea10)
    #1 0x7ffff6bb5fb0 in message_from_header /systemd-meson-build/../root/systemd/src/libsystemd/sd-bus/bus-message.c:372:13
    #2 0x7ffff6bb5fb0 in bus_message_from_malloc /systemd-meson-build/../root/systemd/src/libsystemd/sd-bus/bus-message.c:421:13
    #3 0x7ffff6c23f54 in bus_socket_make_message /systemd-meson-build/../root/systemd/src/libsystemd/sd-bus/bus-socket.c:1222:13
    #4 0x7ffff6c22d10 in bus_socket_read_message /systemd-meson-build/../root/systemd/src/libsystemd/sd-bus/bus-socket.c
    #5 0x7ffff6c4d414 in bus_read_message /systemd-meson-build/../root/systemd/src/libsystemd/sd-bus/sd-bus.c:2082:16
    #6 0x7ffff6c4d414 in sd_bus_call /systemd-meson-build/../root/systemd/src/libsystemd/sd-bus/sd-bus.c:2480:21
    #7 0x7ffff6682904 in bus_service_manager_reload /systemd-meson-build/../root/systemd/src/shared/bus-unit-util.c:2823:13
    #8 0x1000d570 in daemon_reload /systemd-meson-build/../root/systemd/src/sysext/sysext.c:233:16
    #9 0x100090f8 in merge /systemd-meson-build/../root/systemd/src/sysext/sysext.c:895:21
    #10 0x10006ff4 in verb_merge /systemd-meson-build/../root/systemd/src/sysext/sysext.c:964:16
    #11 0x7ffff69ae894 in dispatch_verb /systemd-meson-build/../root/systemd/src/shared/verbs.c:103:24
    #12 0x10004570 in sysext_main /systemd-meson-build/../root/systemd/src/sysext/sysext.c:1194:16
    #13 0x10004570 in run /systemd-meson-build/../root/systemd/src/sysext/sysext.c:1214:16
    #14 0x10004570 in main /systemd-meson-build/../root/systemd/src/sysext/sysext.c:1217:1
    #15 0x7ffff5f5a968 in generic_start_main.isra.0 (/lib64/libc.so.6+0x2a968) (BuildId: c218e04818632a05c23f6fdcca16f93e95ea7de2)
    #16 0x7ffff5f5ab00 in __libc_start_main (/lib64/libc.so.6+0x2ab00) (BuildId: c218e04818632a05c23f6fdcca16f93e95ea7de2)
Indirect leak of 124984 byte(s) in 459 object(s) allocated from:
...
    #11 0x7ffff5f5a968 in generic_start_main.isra.0 (/lib64/libc.so.6+0x2a968) (BuildId: c218e04818632a05c23f6fdcca16f93e95ea7de2)
    #12 0x7ffff5f5ab00 in __libc_start_main (/lib64/libc.so.6+0x2ab00) (BuildId: c218e04818632a05c23f6fdcca16f93e95ea7de2)
SUMMARY: AddressSanitizer: 493766 byte(s) leaked in 1383 allocation(s).
2023-08-22 15:04:49 +02:00
Yu Watanabe 9475e23c90 network: several follow-ups for TCP-RTO setting
- rename TCPRetransmissionTimeOutSec= -> TCPRetransmissionTimeoutSec,
- refuse infinity,
- fix the input value verifier (USEC_PER_SEC -> USEC_PER_MSEC),
- use DIV_ROUND_UP() when assigning the value.

Follow-ups for 1412d4a4fe.
Closes #28898.
2023-08-22 15:02:59 +02:00
Zbigniew Jędrzejewski-Szmek b0edf3a303
Merge pull request #28914 from poettering/boot-poweroff
sd-boot: add quick hotkeys for poweroff/reboot
2023-08-22 14:55:24 +02:00
Lennart Poettering 41beeb3e30 core: simplify get_process_umask() invocation 2023-08-22 12:33:17 +02:00
Yu Watanabe 08801318e8 network: fix log message and man page for HopLimit=
Follow-up for 88c0642358.
Closes #28899.
2023-08-22 12:10:39 +02:00
Lennart Poettering 321261c7d9 update TODO 2023-08-22 11:29:36 +02:00
Lennart Poettering 1b9af63f55 boot: add control-less alias for Ctrl-l hotkey
I couldn't get ctrl work properly over serial line/qemu. Hence, let's
add an alias for Ctrl-l: a simple Shift-l (i.e. uppercase L)

(Note that lowercase L will result in selection of the first Linux
entry, hence we stay away from that)
2023-08-22 11:29:36 +02:00
Lennart Poettering f6531b11d2 boot: add hotkeys for rebooting/powering off the system from the boot menu
In a an environment with a serial console it's just too useful to
directly reboot/power off the machine without any further tooling.
2023-08-22 11:29:36 +02:00
Lennart Poettering 90dab2b01e boot: modernize mangle_stub_cmdline() a bit + drop leading whitespace
Let's modernize the function a bit, and make it return the string passed
in, as we usually do.

Most importanly though: also drop leading whitespace, not just trailing
whitespace.
2023-08-22 10:53:25 +02:00
Lennart Poettering c4d281fa1a boot: explain why we refuse to edit kernel cmdline when we do so 2023-08-22 10:46:34 +02:00
Lennart Poettering b91497f8cf
Merge pull request #28903 from poettering/verbs-levenshtein
verbs: give helpful hint when people mistype command verbs on the cmdline of our tools
2023-08-22 10:15:00 +02:00
Yu Watanabe 9ae3624889 test-execute: add tests for credentials directory with mount namespace
This also adds cases that open_tree() and move_mount() are filtered, to
emulate old kernel behavior.
2023-08-22 11:50:20 +09:00
Yu Watanabe 94fe4cf255 core: do not leak mount for credentials directory if mount namespace is enabled
Since kernel v5.2, open_tree() and move_mount() are added. If a service
loads or sets credentials, then let's try to clone the mount that contains
credentials with open_tree(), then mount it after a (private) mount
namespace is initialized for the service. Then, we can setup a mount for
credentials directory without leaking it to the main shared mount
namespace.

With this change, the credentials for services that request their own
private mount namespace become much much safer. And, the number of mount
events triggered by setting up credential directories can be decreased.

Unfortunately, this does not 'fix' the original issue #25527, as the
reported service does not requests private mount namespace, but the
situation should be better now.
2023-08-22 11:50:16 +09:00
Yu Watanabe 7241b9cd72 core/credential: make setup_credentials() return path to credentials directory
Then, we can reuse the path when building environment variables and setting up
mount namespace.
No functional change, just refactoring.
2023-08-22 11:41:52 +09:00
Yu Watanabe fbaf3b23ae core: set $CREDENTIALS_DIRECTORY only when we set up credentials
It is not necessary to set the environment variable on an execution step
we do not support credentials.
2023-08-22 11:39:08 +09:00
Yu Watanabe 7d202fb35d core/credential: split out unit_add_default_credential_dependencies()
No functional change, just refactoring.
2023-08-22 11:39:08 +09:00
Yu Watanabe 602c74cf78 core: split out functions and definitions from execute.[ch] to credential.[ch]
The functions and definitions related to credential consume about 1000
lines in execute.c. Let's split out them to dedicated files.
2023-08-22 11:39:08 +09:00
Lennart Poettering ea803614fc verbs: make a helpful suggestion when user types unrecognized verb
I have been mistyping commands too often myself, and I think the tools
could simply be more helpful, by suggesting to me what I probably wanted
to write. Copy/Paste FTW, after all!
2023-08-21 23:19:49 +02:00
Lennart Poettering 7ef5b0a4d8 string-util: add a function to determine levenshtein distance of two strings 2023-08-21 23:19:49 +02:00
Lennart Poettering b022ea0476 efi: add comment clarifying we should not use EV_IPL anymore 2023-08-21 23:18:28 +02:00
Lennart Poettering 1126841553 man: mention two more things logind does
Prompted by: #28902
2023-08-21 23:15:57 +02:00
Lennart Poettering afa303254d
Merge pull request #28907 from poettering/have-seccomp-tweaks
reduce HAVE_SECCOMP ifdeffery
2023-08-21 23:15:39 +02:00
Lennart Poettering cf1ab844a9 tree-wide: drop "static inline" use in .c files
"static inline" makes sense in .h files. But in .c files it's useless
decoration, the compiler should just make its own decisions there, and
it can do that.

hence, replace all remaining uses of "static line" by a simple" static"
in all .c files (but keep them in .h files, where they make sense)
2023-08-21 23:15:12 +02:00
Frantisek Sumsal 252adedaaf
Merge pull request #28911 from weblate/weblate-systemd-master
Translations update from Fedora Weblate
2023-08-21 17:57:40 +00:00
Jan Kuparinen e86ecf931d po: Translated using Weblate (Finnish)
Currently translated at 100.0% (227 of 227 strings)

Co-authored-by: Jan Kuparinen <copper_fin@hotmail.com>
Translate-URL: https://translate.fedoraproject.org/projects/systemd/master/fi/
Translation: systemd/main
2023-08-21 19:21:12 +02:00
Maarten 74fb028878 po: Translated using Weblate (Dutch)
Currently translated at 100.0% (227 of 227 strings)

Co-authored-by: Maarten <maarten@posteo.de>
Translate-URL: https://translate.fedoraproject.org/projects/systemd/master/nl/
Translation: systemd/main
2023-08-21 19:21:12 +02:00
Lennart Poettering e2fc0a7222 tree-wide: don't ifdef seccomp-util.h, drop seccomp.h inclusion everywhere
seccomp-util.h doesn't need ifdeffing, hence don't. It has worked since
quite a while with HAVE_SECCOMP is off, hence use it everywhere.

Also drop explicit seccomp.h inclusion everywhere (which needs
HAVE_SECCOMP ifdeffery everywhere). seccomp-util.h includes it anyway,
automatically, which we can just rely on, and it deals with HAVE_SECCOMP
at one central place.
2023-08-21 18:50:29 +02:00