Commit Graph

75699 Commits

Author SHA1 Message Date
Adrian Vovk
bf2c741fd7 sysupdate: Implement systemd-sysupdated dbus service
Co-authored-by: Tom Coldrick <thomas.coldrick@codethink.co.uk>
Co-authored-by: Abderrahim Kitouni <abderrahim.kitouni@codethink.co.uk>
2024-08-21 09:31:41 +01:00
Yu Watanabe
2656f44c3c Merge pull request #34018 from yuwata/network-address-label
network: allow to configure IPv6 address label in networkd.conf
2024-08-21 02:05:22 +09:00
Kornilios Kourtis
7ac58157ca process-util: handle pidfd_spawn() returning E2BIG
In some kernels (specifically, 5.4) even though the clone3 syscall is
supported, setting CLONE_INTO_CGROUP is not. The error message returned
in this case is E2BIG.

If posix_spawn_wrapper encounters this error, it does not retry, and
cannot spawn any programs in said kernels.

This commit adds a check for the E2BIG error and retries pidfd_spawn()
without the POSIX_SPAWN_SETCGROUP flag.

If we encounter an E2BIG error, and the pidfd_spawn() succeeds after
removing the POSIX_SPAWN_SETCGROUP flag, then we cache the result so
that we do not retry every time.

Originally, this issue was reported in https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1077204.

Signed-off-by: Kornilios Kourtis <kornilios@gmail.com>
2024-08-21 02:04:57 +09:00
Daan De Meyer
c8e7cfeddc tests: Don't override QemuKvm= value if TEST_NO_KVM=0
Let's disable KVM if TEST_NO_KVM=1 is set but let's not specify anything
if it's not set so the QemuKvm= setting from mkosi.conf is used.
2024-08-21 01:52:09 +09:00
Yu Watanabe
489671d225 network/address-label: allow to configure IPv6 address label in networkd.conf
Closes #23159.
2024-08-20 20:50:56 +09:00
Yu Watanabe
477defd774 network/queue: introduce manager_queue_request_full()
Currently it is not used, but will be used later.
2024-08-20 20:49:32 +09:00
Yu Watanabe
7b2e07ca4c network/address-label: split out address_label_fill_message()
No functional change, just refactoring and preparation for later
commits.
2024-08-20 20:49:28 +09:00
Yu Watanabe
4dfbecd2ff network/address-label: several cleanups for conf parsers
- Check userdata, instead of data, though they point to the same
  position.
- Support an empty string.
- Use UINT32_MAX, as the label is uint32_t.
2024-08-20 20:48:48 +09:00
Yu Watanabe
c95fa6acb5 network/address-label: introduce custom hash_ops
No functional change, just refactoring.
2024-08-20 20:48:48 +09:00
Lennart Poettering
61242b1f0f shared: invoke agents only when we have a controlling TTY
being connected to a TTY is not really enough to determine
interactivity in many cases. Let's also check if we have a controlling
TTY.

Inspired by #34016
2024-08-20 20:37:50 +09:00
Yu Watanabe
41f5e66cf2 Merge pull request #34044 from poettering/isatty-fixes
fixes around isatty() handling
2024-08-20 20:36:07 +09:00
Lennart Poettering
8915e4aef5 man: fix ID_NET_LABEL_ONBOARD= documentation
We do not prefix the field with anything, since
8c053c83ae.
2024-08-20 20:30:39 +09:00
Luca Boccassi
a8d1f9da55 Merge pull request #34009 from yuwata/network-resolve-polkit
network,resolve: support interactive authentication
2024-08-20 12:14:03 +02:00
Luca Boccassi
a16079fccc Merge pull request #34014 from yuwata/network-ip-masquerade
network: make IPMasquerade= imply global IP forwarding settings again
2024-08-20 11:59:30 +02:00
Luca Boccassi
2bc7cae70b Merge pull request #34021 from yuwata/network-routing-policy-rule
network/routing-policy-rule: several cleanups
2024-08-20 11:49:02 +02:00
Ronan Pigott
eded61e410 resolved: demote the global unicast scope
This will greatly reduce the number of cases where the global unicast
scope overlaps with link scopes configured as default-route, making it
feasible to use the global DNS setting in conjunction with per-link dns
servers configured by the network.

This change is preferred over demoting links to default-route=no where
the user prefers to use the network provided DNS servers, and I expect
it is non-disruptive in that it should not degrade the efficacy of any
existing configuration.
2024-08-20 11:45:22 +02:00
Lennart Poettering
300b7e7620 tree-wide: use isatty_safe() more 2024-08-20 11:11:53 +02:00
Lennart Poettering
aae47bf7a3 terminal-util: don't assume errno is correctly set when using isatty_safe()
let's instead generate ENOTTY on our own. This is more correct with out
coding style (since we generally do not propagate errors via errno), and
also addresses #34039 as side effect. (#34039 really needs to be fixed
in musl though, too, this is just a work-around as side-effect).

Fixes: #34039
2024-08-20 10:59:47 +02:00
Lennart Poettering
1b24357c41 terminal-util: fix isatty_safe() on hung-up TTYs
glibc returs EIO on ttys that are hung up. That's not really correct,
POSIX seems to disagree.

Work around this in our code, and turn this into a clean "1", since a
hung up tty doesn't stop being a tty just because it is hung up.

Background: https://github.com/systemd/systemd/pull/34039
2024-08-20 10:57:49 +02:00
Yu Watanabe
0197fb599a test-network: make kernel send NA with router flag
If the router interface send NA without router flag, client interface will drop
SLAAC addresses. To make the router interface send NA with router flag,
IPv6 forwarding needs to be enabled.
===
client: NDISC: Received Neighbor Advertisement from fe80::1034:56ff:fe78:9a99: Router=no, Solicited=yes, Override=no
client: NDISC: Invoking callback for 'neighbor' event.
client: Removing NDisc route (configured): dst: 2002:da8:1:99::/64, src: n/a, gw: n/a, prefsrc: n/a, table: main(254), priority: 1024, proto: ra, scope: global, type: unicast, flags: n/a
client: Removing NDisc route (configured): dst: n/a, src: n/a, gw: fe80::1034:56ff:fe78:9a99, prefsrc: n/a, table: main(254), priority: 1024, proto: ra, scope: global, type: unicast, flags: n/a
client: Removing NDisc address (configured): 2002:da8:1:99:1034:56ff:fe78:9a00/64 (valid for 23h 59min 58s, preferred for 3h 59min 58s), flags: manage-temporary-address,no-prefixroute, scope: global
===
2024-08-20 09:01:08 +02:00
maia x.
010ea061fc namespace: Fix extension release memory leak
In apply_one_mount(), in the MOUNT_EXTENSION_DIRECTORY case,
char **extension_release was used as a return pointer twice but only
cleaned up once in the end. Fix it by removing duplicate code that
was causing this issue.

Fixes issue introduced in 55ea4ef096.
2024-08-20 09:40:52 +09:00
Yu Watanabe
93f91df671 network/routing-policy-rule: drop unused argument 2024-08-20 02:21:21 +09:00
Yu Watanabe
6c72e80a3c network/routing-policy-rule: introduce ref and unref functions for RoutingPolicyRule
No functional change, just refactoring and preparation for later change.
2024-08-20 02:21:21 +09:00
Yu Watanabe
957d94c5bd network/routing-policy-rule: manage all flags
Currently, only FIB_RULE_INVERT flag can be configurable, but for
simplicity and future extension, let's manage all flags.

No functional change, just refactoring.
2024-08-20 02:21:21 +09:00
Yu Watanabe
933448defe network/routing-policy-rule: use int32_t for suppress_prefixlen
The kernel parses FRA_SUPPRESS_PREFIXLEN as uint32_t, but internally
handled as signed integer and negative values as unset. Let's explicitly
specify the size of the variable.

No functional change, just refactoring.
2024-08-20 02:21:21 +09:00
Yu Watanabe
0a3a3a2a1e network/routing-policy-rule: reorder elements of RoutingPolicyRule and add comments
No functional change, just refactoring.
2024-08-20 02:21:21 +09:00
Yu Watanabe
82ddfaa591 network/routing-policy-rule: update hash and compare function for fib rule
Let's manage fib rules with the logic used by the kernel.

Should not change any behavior.
2024-08-20 02:21:16 +09:00
Daan De Meyer
4cf7a676af test-dhcp-server: Gracefully handle the network being down 2024-08-19 11:38:55 +09:00
Yu Watanabe
cc3e48b3c1 run: also enable interactive authentication on opening pty 2024-08-19 11:36:32 +09:00
Yu Watanabe
1b8a74678c run: use sd_bus_set_allow_interactive_authorization() 2024-08-19 11:36:32 +09:00
Yu Watanabe
04834552ed mount: use sd_bus_set_allow_interactive_authorization() 2024-08-19 11:36:32 +09:00
Yu Watanabe
335608593c timedatectl: drop unnecessary temporal variables
Also drop unnecessary spaces.
2024-08-19 11:36:32 +09:00
Yu Watanabe
f3cf6167ef tree-wide: voidify polkit_agent_open_if_enabled() 2024-08-19 11:36:32 +09:00
Yu Watanabe
69e7d2efdf timedatectl: enable interactive authentication for DBus methods 2024-08-19 11:36:32 +09:00
Yu Watanabe
470cea62da resolve: inherit server userdata
No functional change, just refactoring.
2024-08-19 11:36:32 +09:00
Yu Watanabe
cf01bbb7a4 resolve: support polkit authentication for io.systemd.Resolve.Monitor
Then, non-privilege user can call e.g. 'resolvectl monitor' with
authentication.
2024-08-19 11:36:32 +09:00
Yu Watanabe
302cc03cc8 sd-varlink: allow to dispatch method again on pending-method-more state
Otherwise, polkit authentication does not work for methods that require
the MORE flag.
2024-08-19 11:36:32 +09:00
Yu Watanabe
614a6770f9 resolvectl: acquire DBus connection only when necessary
When e.g. `resolvectl monitor` is called, it is not necessary to acquire
DBus connection.
2024-08-19 11:36:32 +09:00
Yu Watanabe
f75ecb9f8b resolvectl: several coding style cleanups
Use RET_GATHER(), FOREACH_ARRAY(), and strv_skip().
2024-08-19 11:36:32 +09:00
Yu Watanabe
5703301ada resolvectl: introduce --no-ask-password option 2024-08-19 11:36:22 +09:00
Yu Watanabe
1d7fa67789 resolvectl: enable interactive authentication for dbus method call
Even the server side supports polkit authentication, previously
the client side did not support polkit authentication.
2024-08-19 11:29:40 +09:00
Yu Watanabe
21f31f23cc networkctl: introduce --no-ask-password option 2024-08-19 11:28:22 +09:00
Yu Watanabe
67899e3e6b networkctl: enable interactive authentication for dbus method call
Previously, e.g. 'networkctl reload' did not ask password through
polkit.
2024-08-19 11:27:53 +09:00
Daan De Meyer
c4e809b6ad Merge pull request #34026 from DaanDeMeyer/tests
Handle unprivileged user namespaces gracefully in tests
2024-08-18 23:31:10 +02:00
Daan De Meyer
ef31767ed7 test: Gracefully handle running within user namespace with single user
Unprivileged users often make themselves root by unsharing a user namespace
and then mapping their current user to root which does not require privileges.
Let's make sure our tests don't fail in such an environment by adding checks
where required to see if we're not running in a user namespace with only a
single user.
2024-08-18 21:53:52 +02:00
Yu Watanabe
dff27ce65a Merge pull request #34025 from YHNdnzj/edit-util-wrong-place
edit-util: catch and warn about edits outside of markers
2024-08-19 04:33:56 +09:00
Yu Watanabe
dc64f66756 Merge pull request #34022 from YHNdnzj/unit-is-filtered
core/unit: two trivial cleanups
2024-08-19 04:29:54 +09:00
Yu Watanabe
871b0ee995 Merge pull request #34020 from YHNdnzj/cred-no-mountover
core/dbus-service: refuse bind mounting over /run/credentials/
2024-08-19 04:29:42 +09:00
Yu Watanabe
6e4918a944 analyze: introduce --instance= option to control instance name for template units
Note, `systemd-analyze foo@.service --instance=hoge` is equivalent to
`systemd-analyze foo@hoge.service`. But, the option may be useful when
e.g. passing multiple template units that have restriction on their
instance name:
```
$ ls
template_aaa@.service   template_bbb@.service   template_ccc@.service
$ systemd-analyze ./template_* --instance=hoge
```
Without the option, we need to embed an instance name into each unit
name, so cannot use globs.

Prompted by #33681.
2024-08-19 04:29:23 +09:00
Mike Yuan
e65b07293c edit-util: catch and warn about edits outside of markers
The users still periodically come back to #24208.
Let's add a detection for this hence.
2024-08-18 16:42:29 +02:00