]> git.ipfire.org Git - thirdparty/systemd.git/log
thirdparty/systemd.git
14 months agomain: make sure the ambient caps set is valid in case we fail to read it 34092/head
Lennart Poettering [Thu, 22 Aug 2024 16:36:23 +0000 (18:36 +0200)] 
main: make sure the ambient caps set is valid in case we fail to read it

We ignore failures when reading this after all. Hence we better leave
the memory properly initialized.

14 months agomain: generate warning when we cannot reset caps
Lennart Poettering [Thu, 22 Aug 2024 16:20:38 +0000 (18:20 +0200)] 
main: generate warning when we cannot reset caps

Follow-up for: #32937

14 months agocore: rename original_ambient_set → saved_ambient_set
Lennart Poettering [Thu, 22 Aug 2024 16:18:41 +0000 (18:18 +0200)] 
core: rename original_ambient_set → saved_ambient_set

We call similar other fields in main.c (notably: rlimit stuff, env vars) "saved",
rather than "original". Hence stick to that kind of naming here too.

Follow-up for: #32937

14 months agoman: document .membership files that nss-systemd processes
Lennart Poettering [Wed, 21 Aug 2024 08:10:34 +0000 (10:10 +0200)] 
man: document .membership files that nss-systemd processes

This has been a glaring omission the docs: when people create
.user/.group/.user-privileged/.group-privileged drop-in files, they
should also create matching .membership files.

14 months agoMerge pull request #34051 from rpigott/resolved-demote-fallback
Yu Watanabe [Thu, 22 Aug 2024 11:21:33 +0000 (20:21 +0900)] 
Merge pull request #34051 from rpigott/resolved-demote-fallback

resolved: demote only the fallback servers in the global scope

14 months agoMerge pull request #34033 from DaanDeMeyer/mkosi-cage
Daan De Meyer [Thu, 22 Aug 2024 10:57:07 +0000 (12:57 +0200)] 
Merge pull request #34033 from DaanDeMeyer/mkosi-cage

 mkosi: Update to latest

14 months agomkosi: Update to latest 34033/head
Daan De Meyer [Mon, 19 Aug 2024 09:27:26 +0000 (11:27 +0200)] 
mkosi: Update to latest

14 months agoMerge pull request #34076 from yuwata/polkit-message
Lennart Poettering [Thu, 22 Aug 2024 08:56:53 +0000 (10:56 +0200)] 
Merge pull request #34076 from yuwata/polkit-message

polkit: add missing period in polkit messages

14 months agomkosi: Improve formatting
Daan De Meyer [Mon, 19 Aug 2024 09:27:11 +0000 (11:27 +0200)] 
mkosi: Improve formatting

14 months agoMerge pull request #34079 from AdrianVovk/sysupdate-fixups
Yu Watanabe [Thu, 22 Aug 2024 04:59:55 +0000 (13:59 +0900)] 
Merge pull request #34079 from AdrianVovk/sysupdate-fixups

systemd-sysupdated follow-ups

14 months agosysupdate: man: Cleanup sections about flags 34079/head
Adrian Vovk [Thu, 22 Aug 2024 02:10:49 +0000 (22:10 -0400)] 
sysupdate: man: Cleanup sections about flags

14 months agosysupdate: Simplify sysupdate_run_simple callsite
Adrian Vovk [Thu, 22 Aug 2024 01:44:53 +0000 (21:44 -0400)] 
sysupdate: Simplify sysupdate_run_simple callsite

Allows the caller to optionally pass in a target, instead of making
everyone call target_get_argument at the call site.

14 months agosysupdated: Verify inputs more rigorously
Adrian Vovk [Thu, 22 Aug 2024 01:36:25 +0000 (21:36 -0400)] 
sysupdated: Verify inputs more rigorously

Also return better errors

14 months agosysupdated: Fixup redundant constant name
Adrian Vovk [Thu, 22 Aug 2024 01:35:25 +0000 (21:35 -0400)] 
sysupdated: Fixup redundant constant name

SD_ stands for systemd, so SD_SYSTEMD_* is SYSTEMD_SYSTEMD_*

14 months agosysupdated: Fixup minor formatting issues
Adrian Vovk [Wed, 21 Aug 2024 20:15:24 +0000 (16:15 -0400)] 
sysupdated: Fixup minor formatting issues

14 months agolabeler: add more rules
Yu Watanabe [Wed, 21 Aug 2024 21:43:32 +0000 (06:43 +0900)] 
labeler: add more rules

14 months agoMerge pull request #34072 from yuwata/networkd-routing-policy-rule-follow-up
Yu Watanabe [Wed, 21 Aug 2024 22:17:10 +0000 (07:17 +0900)] 
Merge pull request #34072 from yuwata/networkd-routing-policy-rule-follow-up

network/routing-policy-rule: follow up for recent change

14 months agopo: update Japanese translations 34076/head
Yu Watanabe [Wed, 21 Aug 2024 22:10:47 +0000 (07:10 +0900)] 
po: update Japanese translations

14 months agopolkit: add missing period in messages
Yu Watanabe [Wed, 21 Aug 2024 22:08:05 +0000 (07:08 +0900)] 
polkit: add missing period in messages

14 months agopo: update Japanese translations
Yu Watanabe [Wed, 21 Aug 2024 20:02:56 +0000 (05:02 +0900)] 
po: update Japanese translations

14 months agoMerge pull request #32363 from CodethinkLabs/sysupdate-dbus
Adrian Vovk [Wed, 21 Aug 2024 19:35:34 +0000 (15:35 -0400)] 
Merge pull request #32363 from CodethinkLabs/sysupdate-dbus

sysupdate: Implement dbus service

14 months agoMerge pull request #34053 from YHNdnzj/follow-ups
Yu Watanabe [Wed, 21 Aug 2024 19:34:11 +0000 (04:34 +0900)] 
Merge pull request #34053 from YHNdnzj/follow-ups

Two follow-ups for recent PRs

14 months agobootctl: don't load etc/machine-info from cwd
Alyssa Ross [Wed, 21 Aug 2024 12:21:47 +0000 (14:21 +0200)] 
bootctl: don't load etc/machine-info from cwd

arg_root defaults to null, so if --root isn't given, this would try reading
etc/machine-info from the current working directory, which is likely to fail.

Fixes: 77db9ef2ab ("boot: Make sure we take --root into account everywhere.")
14 months agoman: Ensure notify example includes <string.h>
A. Wilcox [Wed, 21 Aug 2024 14:35:58 +0000 (09:35 -0500)] 
man: Ensure notify example includes <string.h>

This ensures that memcpy and strerror are defined.  This is especially
important with GCC 14 as implicit function declarations are now an error.

14 months agohwdb: rename hwdb_bin_paths -> HWDB_BIN_PATHS
Yu Watanabe [Wed, 21 Aug 2024 17:08:20 +0000 (02:08 +0900)] 
hwdb: rename hwdb_bin_paths -> HWDB_BIN_PATHS

We usually use upper letters for constant definitions.

14 months agocore/exec-invoke: document calling setpriority() after sched_setattr()
Ivan Shapovalov [Wed, 21 Aug 2024 17:36:08 +0000 (19:36 +0200)] 
core/exec-invoke: document calling setpriority() after sched_setattr()

Fixes: 711a157738b ("core/exec-invoke: call setpriority() after sched_setattr()")
14 months agotest-network: also test routing policy rules are configured as expected after reconfi... 34072/head
Yu Watanabe [Wed, 21 Aug 2024 19:20:51 +0000 (04:20 +0900)] 
test-network: also test routing policy rules are configured as expected after reconfiguration

For issue #34068.

14 months agotest-network: find routing policy rule by priority
Yu Watanabe [Wed, 21 Aug 2024 19:16:09 +0000 (04:16 +0900)] 
test-network: find routing policy rule by priority

We usually configure a test rule with a unique priority. Hence, finding
rule by priority reduces the lines of output, and we can debug easily.

Also print short comments on check. That's helpful when the check is
called several times.

14 months agonetwork/routing-policy-rule: use address family of existing rule when judging if...
Yu Watanabe [Wed, 21 Aug 2024 19:11:52 +0000 (04:11 +0900)] 
network/routing-policy-rule: use address family of existing rule when judging if existing rule can be updated

Otherwise, the other RoutingPolicyRule object may not have a valid
address family yet, and the existing rule may be wrongly handled as
that it is not requested by any interface, and it may be removed.

Follow-up for 727235006a7e8904f8493d32376cffa6969c5fa9.
Fixes #34068.

14 months agoresolved: demote the fallback dns servers 34051/head
Ronan Pigott [Wed, 21 Aug 2024 14:49:59 +0000 (07:49 -0700)] 
resolved: demote the fallback dns servers

This softens the behavior originally introduced in eded61e410df to apply
only to the fallback dns servers.

The intent is that the global FallbackDNS (instead of DNS) can now be
used in conjunction with the per-link dns, providing a fallback behavior
without introducing a scope overlap.

References: eded61e410df (resolved: demote the global unicast scope, 2024-08-19)

14 months agoresolved: use the fallback servers when no default dns is configured
Ronan Pigott [Tue, 20 Aug 2024 17:25:28 +0000 (10:25 -0700)] 
resolved: use the fallback servers when no default dns is configured

This expands the role of fallback servers so they are applied not only
when there are no dns servers configured, but when all the configured
dns servers are configured only for non-default-route links.

14 months agoresolved: introduce link_set_default_route
Ronan Pigott [Wed, 21 Aug 2024 16:41:35 +0000 (09:41 -0700)] 
resolved: introduce link_set_default_route

14 months agoresolved: introduce dns_server_is_fallback
Ronan Pigott [Wed, 21 Aug 2024 16:36:13 +0000 (09:36 -0700)] 
resolved: introduce dns_server_is_fallback

14 months agoMerge pull request #34055 from whot/wip/eviocrevoke-warnings
Yu Watanabe [Wed, 21 Aug 2024 16:34:35 +0000 (01:34 +0900)] 
Merge pull request #34055 from whot/wip/eviocrevoke-warnings

Update warnings for failed EVIOCREVOKE invocations

14 months agoMerge pull request #34054 from yuwata/network-failed-state
Yu Watanabe [Wed, 21 Aug 2024 16:22:29 +0000 (01:22 +0900)] 
Merge pull request #34054 from yuwata/network-failed-state

network: several fixlets for reconfiguration after entered failed state

14 months agonetworkctl: split networkctl.c into small pieces
Yu Watanabe [Wed, 21 Aug 2024 06:31:57 +0000 (15:31 +0900)] 
networkctl: split networkctl.c into small pieces

No functional change, just refactoring.

14 months agoMerge pull request #33498 from DaanDeMeyer/btrfs
Daan De Meyer [Wed, 21 Aug 2024 15:19:09 +0000 (17:19 +0200)] 
Merge pull request #33498 from DaanDeMeyer/btrfs

repart: Allow Subvolumes= when running offline

14 months agoRevert "resolved: demote the global unicast scope"
Ronan Pigott [Wed, 21 Aug 2024 13:59:22 +0000 (06:59 -0700)] 
Revert "resolved: demote the global unicast scope"

This commit may have been a breaking change for sd-resolved foreign
resolv.conf mode, where a legacy network management daemon directly
modifies resolv.conf and sd-resolved consumes that.

This reverts commit eded61e410dfa6c16ae68cb624c58122fb18fd0e.

14 months agoprocess-util: always retry with pidfd_spawn() w/o cgroup first 34053/head
Mike Yuan [Tue, 20 Aug 2024 18:04:46 +0000 (20:04 +0200)] 
process-util: always retry with pidfd_spawn() w/o cgroup first

Follow-up for 7ac58157ca67ab001307f1fd72e0cc7c0c4e846a

With the mentioned commit, iff E2BIG we'd retry pidfd_spawn()
with POSIX_SPAWN_SETCGROUP disabled. However, the same strategy
should actually apply to EOPNOTSUPP/ENOSYS/EPERM too -
they can mean two things here: no clone3() or no CLONE_PIDFD.
Therefore, let's first try clone() + CLONE_PIDFD, and fall further back
to plain clone() (posix_spawn()) only as last resort. Plus, record
the fact so that we don't unnecessarily retry every single time
if CLONE_PIDFD is the one that's unavailable.

14 months agoprocess-util: check the flag instead of 'cgroup' param
Mike Yuan [Tue, 20 Aug 2024 20:01:09 +0000 (22:01 +0200)] 
process-util: check the flag instead of 'cgroup' param

We might skip CLONE_INTO_CGROUP wholly if not supported.

14 months agoman: use standard-options for --no-ask-password everywhere
Mike Yuan [Tue, 20 Aug 2024 10:32:57 +0000 (12:32 +0200)] 
man: use standard-options for --no-ask-password everywhere

14 months agoRevert "cgroup-util: Don't try to open pidfd for kernel threads"
Daan De Meyer [Wed, 21 Aug 2024 09:25:46 +0000 (11:25 +0200)] 
Revert "cgroup-util: Don't try to open pidfd for kernel threads"

The kernel patch was reverted so let's try again to open pidfds
for kernel threads.

This reverts commit ead48ec35c863650944352a3455f26ce3b393058.

14 months agoMerge pull request #34049 from yuwata/network-routing-policy-rule
Luca Boccassi [Wed, 21 Aug 2024 10:46:37 +0000 (12:46 +0200)] 
Merge pull request #34049 from yuwata/network-routing-policy-rule

network: further rework for routing policy rule

14 months agorepart: Allow Subvolumes= and DefaultSubvolume= when running offline 33498/head
Daan De Meyer [Wed, 26 Jun 2024 18:33:06 +0000 (20:33 +0200)] 
repart: Allow Subvolumes= and DefaultSubvolume= when running offline

mkfs.btrfs has recently learned new options --subvol and --default-subvol
so let's stop failing when Subvolumes= and DefaultSubvolume= are used offline
and use the new --subvol and --default-subvol options instead to create subvolumes
in the generated root filesystem without root privileges or loop devices.

14 months agorepart: Don't add same dir to MakeDirectories= or Subvolumes= twice
Daan De Meyer [Wed, 14 Aug 2024 15:31:30 +0000 (17:31 +0200)] 
repart: Don't add same dir to MakeDirectories= or Subvolumes= twice

14 months agorepart: Constify partition_needs_populate()
Daan De Meyer [Thu, 8 Aug 2024 18:16:55 +0000 (20:16 +0200)] 
repart: Constify partition_needs_populate()

14 months agorepart: Use loop_device_error_is_fatal() in one more place
Daan De Meyer [Wed, 26 Jun 2024 18:32:13 +0000 (20:32 +0200)] 
repart: Use loop_device_error_is_fatal() in one more place

14 months agosysupdate: Add integration test for updatectl updates 32363/head
Tom Coldrick [Thu, 20 Jun 2024 09:26:24 +0000 (10:26 +0100)] 
sysupdate: Add integration test for updatectl updates

14 months agosysupdate: Implement updatectl
Adrian Vovk [Fri, 14 Jul 2023 00:23:12 +0000 (20:23 -0400)] 
sysupdate: Implement updatectl

This is the command-line tool to manage systemd-sysudpated

Co-authored-by: Tom Coldrick <thomas.coldrick@codethink.co.uk>
Co-authored-by: Abderrahim Kitouni <abderrahim.kitouni@codethink.co.uk>
14 months agosysupdate: Implement systemd-sysupdated dbus service
Adrian Vovk [Fri, 30 Jun 2023 02:58:41 +0000 (22:58 -0400)] 
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>
14 months agologind: warn about EVIOCREVOKE errors other than EINVAL too 34055/head
Peter Hutterer [Mon, 12 Aug 2024 04:05:13 +0000 (14:05 +1000)] 
logind: warn about EVIOCREVOKE errors other than EINVAL too

EINVAL means the kernel doesn't support it, ENODEV means it's
already revoked or the device is no longer there which has the same
effect anyway. All others - let's print an error to the logs.

14 months agonetwork/ipv4acd: adjust comment and logging 34054/head
Yu Watanabe [Wed, 21 Aug 2024 01:47:09 +0000 (10:47 +0900)] 
network/ipv4acd: adjust comment and logging

14 months agosd-dhcp-client: actually restart daemon after sending DECLINE message
Yu Watanabe [Wed, 21 Aug 2024 01:31:34 +0000 (10:31 +0900)] 
sd-dhcp-client: actually restart daemon after sending DECLINE message

client_stop() sets DHCP_STATE_STOPPED to client->state, thus the server
never restarted.

14 months agosd-dhcp-client: stop client without calling notification after sending RELEASE
Yu Watanabe [Wed, 21 Aug 2024 01:24:44 +0000 (10:24 +0900)] 
sd-dhcp-client: stop client without calling notification after sending RELEASE

Otherwise, even the acquired lease is released, the client may be in
e.g. BOUND state or so, and may send renew or rebind after timeout
later.

14 months agosd-dhcp-client: refuse to send RELEASE or friends gracefully when the daemon is stopp...
Yu Watanabe [Wed, 21 Aug 2024 01:23:06 +0000 (10:23 +0900)] 
sd-dhcp-client: refuse to send RELEASE or friends gracefully when the daemon is stopped or so

We can easily hit the assertions without checking the internal states of
the DHCP client before calling these functions. That's annoying.
Let's do more gracefully.

14 months agosd-dhcp-client: do not call callback with SD_DHCP_CLIENT_EVENT_STOP if already stopped
Yu Watanabe [Wed, 21 Aug 2024 02:24:14 +0000 (11:24 +0900)] 
sd-dhcp-client: do not call callback with SD_DHCP_CLIENT_EVENT_STOP if already stopped

When an interface enters the failed state, even if the DHCP client is
stopped, the acquired DHCP lease is not unreferenced, as the callback
dhcp4_handler() do nothing in that case. When the failed interface is
being reconfigured after that, the DHCP client is stopped again
(though it is already stopped), and SD_DHCP_CLIENT_EVENT_STOP event is
triggered and sd_dhcp_client_send_release() is called, and the
assertion in the function is triggered.

E.g.
===
systemd-networkd[98588]: wlp59s0: DHCPv4 address 192.168.86.250/24, gateway 192.168.86.1 acquired from 192.168.86.1
systemd-networkd[98588]: wlp59s0: Could not set DHCPv4 route: Nexthop has invalid gateway. Network is unreachable
systemd-networkd[98588]: wlp59s0: Failed
systemd-networkd[98588]: wlp59s0: State changed: configuring -> failed
systemd-networkd[98588]: wlp59s0: The interface entered the failed state frequently, refusing to reconfigure it automatically.
systemd-networkd[98588]: wlp59s0: DHCPv4 client: STOPPED
systemd-networkd[98588]: wlp59s0: DHCPv4 client: State changed: bound -> stopped
systemd-networkd[98588]: Got message type=method_call sender=:1.449 destination=org.freedesktop.network1 path=/org/freedesktop/network1 interface=org.freedesktop.network1.Manager member=ReconfigureLink ...
systemd-networkd[98588]: wlp59s0: State changed: failed -> initialized
systemd-networkd[98588]: wlp59s0: found matching network '/etc/systemd/network/50-wifi.network'.
systemd-networkd[98588]: wlp59s0: Configuring with /etc/systemd/network/50-wifi.network.
systemd-networkd[98588]: wlp59s0: DHCPv4 client: STOPPED
systemd-networkd[98588]: Assertion 'sd_dhcp_client_is_running(client)' failed at src/libsystemd-network/sd-dhcp-client.c:2197, function sd_dhcp_client_send_release(). Aborting.
===

14 months agonetwork: log and enter failed state in link_reconfigure()
Yu Watanabe [Tue, 20 Aug 2024 22:07:05 +0000 (07:07 +0900)] 
network: log and enter failed state in link_reconfigure()

No functional change, just refactoring.

14 months agonetwork: enter initialized state when the interface will be reconfigured
Yu Watanabe [Tue, 20 Aug 2024 22:01:47 +0000 (07:01 +0900)] 
network: enter initialized state when the interface will be reconfigured

When the interface is in the failed state, link_getlink_handler_internal()
will do nothing and return zero, thus the interface will not be
reconfigured, especially when the reconfiguration is triggered in
link_enter_failed().

Follow-up for c2eb7753dd47ec04ae0d66400e70bc87fbf1adcc.

14 months agonetwork: introduce reconfigure_data_free() and _freep()
Yu Watanabe [Tue, 20 Aug 2024 22:17:19 +0000 (07:17 +0900)] 
network: introduce reconfigure_data_free() and _freep()

No functional change, just refactoring.

14 months agoMerge pull request #34018 from yuwata/network-address-label
Yu Watanabe [Tue, 20 Aug 2024 17:05:22 +0000 (02:05 +0900)] 
Merge pull request #34018 from yuwata/network-address-label

network: allow to configure IPv6 address label in networkd.conf

14 months agoprocess-util: handle pidfd_spawn() returning E2BIG
Kornilios Kourtis [Thu, 15 Aug 2024 15:22:35 +0000 (17:22 +0200)] 
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>
14 months agotests: Don't override QemuKvm= value if TEST_NO_KVM=0
Daan De Meyer [Tue, 20 Aug 2024 12:39:45 +0000 (14:39 +0200)] 
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.

14 months agotest-network: add test for ManageForeignRoutingPolicyRules= 34049/head
Yu Watanabe [Tue, 20 Aug 2024 01:33:42 +0000 (10:33 +0900)] 
test-network: add test for ManageForeignRoutingPolicyRules=

14 months agotest-network: add tests for Type=table, goto, and nop
Yu Watanabe [Tue, 20 Aug 2024 01:07:10 +0000 (10:07 +0900)] 
test-network: add tests for Type=table, goto, and nop

14 months agotest-network: do not pass '[detached]' to 'ip rule del'
Yu Watanabe [Tue, 20 Aug 2024 11:56:35 +0000 (20:56 +0900)] 
test-network: do not pass '[detached]' to 'ip rule del'

That indicates the interface name in 'iif' or 'oif' cannot be resolved
when 'ip rule' command is invoked. That's natural when networkd fail to
remove rule but the corresponding interface is already removed.
To make not the residual rules interfere subsequent test cases, let's
ignore the flag and actually remove unwanted rules.

14 months agonetwork/routing-policy-rule: support all known type of rule
Yu Watanabe [Mon, 19 Aug 2024 20:16:53 +0000 (05:16 +0900)] 
network/routing-policy-rule: support all known type of rule

This also adds GoTo= to specify the target priority of goto rule.

Note, table was the default but could not be specified in Type=.

14 months agonetwork/routing-policy-rule: also manage remaining attributes
Yu Watanabe [Mon, 19 Aug 2024 22:00:44 +0000 (07:00 +0900)] 
network/routing-policy-rule: also manage remaining attributes

Currently, these attributes are not configured by us, but there may be a
existing rule created by user manually with one of these attribute.
To correctly manage such foreign rules, let's read these attributes.

14 months agosd-netlink: introduce sd_netlink_message_read_u64()
Yu Watanabe [Mon, 19 Aug 2024 21:56:53 +0000 (06:56 +0900)] 
sd-netlink: introduce sd_netlink_message_read_u64()

14 months agonetwork/routing-policy-rule: remove rules that have conflicting flags
Yu Watanabe [Mon, 19 Aug 2024 21:19:46 +0000 (06:19 +0900)] 
network/routing-policy-rule: remove rules that have conflicting flags

The kernel does not distinguish rules with different flags in
rule_exists(), but the flags of an existing rule cannot be updated.
Let's remove rules that have conflicting flags, and configure new rules
later with requested flags.

14 months agonetwork/routing-policy-rule: anyway detach rule even when we fail to remove it
Yu Watanabe [Mon, 19 Aug 2024 19:11:19 +0000 (04:11 +0900)] 
network/routing-policy-rule: anyway detach rule even when we fail to remove it

When we fail to remove a rule, that mostly means the rule does not exist
in the kernel anymore, e.g. already removed manually and we have not
received notification about that yet.
Let's detach the rule in that case.

14 months agonetwork/routing-policy-rule: do not save rule to Manager before it is configured
Yu Watanabe [Mon, 19 Aug 2024 19:02:46 +0000 (04:02 +0900)] 
network/routing-policy-rule: do not save rule to Manager before it is configured

Otherwise, if we fail to configure the rule, then the manager will keep
nonexistent rule forever. So, let's first copy the rule and put it on
Request, then on success generate a new copy based on the netlink
notification and store it to Manager.

This is the same as 0a0c2672dbd22dc85d660e5baa7e1bef701beb88, but for
routing policy rule.

14 months agonetwork/routing-policy-rule: skip requesting when rule is already requested
Yu Watanabe [Mon, 19 Aug 2024 18:56:33 +0000 (03:56 +0900)] 
network/routing-policy-rule: skip requesting when rule is already requested

If it is already requested, the new request will be anyway silently refused by
link_queue_request_safe(), which returns 0 in such case. Let's return earlier.

There should be no functional change, just refactoring.

14 months agonetwork/address-label: allow to configure IPv6 address label in networkd.conf 34018/head
Yu Watanabe [Sat, 17 Aug 2024 04:33:35 +0000 (13:33 +0900)] 
network/address-label: allow to configure IPv6 address label in networkd.conf

Closes #23159.

14 months agonetwork/queue: introduce manager_queue_request_full()
Yu Watanabe [Sat, 17 Aug 2024 04:04:03 +0000 (13:04 +0900)] 
network/queue: introduce manager_queue_request_full()

Currently it is not used, but will be used later.

14 months agonetwork/address-label: split out address_label_fill_message()
Yu Watanabe [Sat, 17 Aug 2024 04:02:06 +0000 (13:02 +0900)] 
network/address-label: split out address_label_fill_message()

No functional change, just refactoring and preparation for later
commits.

14 months agonetwork/address-label: several cleanups for conf parsers
Yu Watanabe [Sat, 17 Aug 2024 03:38:44 +0000 (12:38 +0900)] 
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.

14 months agonetwork/address-label: introduce custom hash_ops
Yu Watanabe [Sat, 17 Aug 2024 03:36:18 +0000 (12:36 +0900)] 
network/address-label: introduce custom hash_ops

No functional change, just refactoring.

14 months agonetwork/routing-policy-rule: add trailing period to the log message
Yu Watanabe [Mon, 19 Aug 2024 18:52:47 +0000 (03:52 +0900)] 
network/routing-policy-rule: add trailing period to the log message

14 months agonetwork/routing-policy-rule: do not modify RountingPolicyRule objects managed by...
Yu Watanabe [Mon, 19 Aug 2024 18:36:40 +0000 (03:36 +0900)] 
network/routing-policy-rule: do not modify RountingPolicyRule objects managed by Manager or Network

They are stored in Manager.rules set or Network.rules_by_section hashmap.
For safety, let's not edit them even temporarily.

No functional change, just refactoring.

14 months agoshared: invoke agents only when we have a controlling TTY
Lennart Poettering [Tue, 20 Aug 2024 08:52:20 +0000 (10:52 +0200)] 
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

14 months agoMerge pull request #34044 from poettering/isatty-fixes
Yu Watanabe [Tue, 20 Aug 2024 11:36:07 +0000 (20:36 +0900)] 
Merge pull request #34044 from poettering/isatty-fixes

fixes around isatty() handling

14 months agoman: fix ID_NET_LABEL_ONBOARD= documentation
Lennart Poettering [Tue, 20 Aug 2024 08:28:53 +0000 (10:28 +0200)] 
man: fix ID_NET_LABEL_ONBOARD= documentation

We do not prefix the field with anything, since
8c053c83ae3c18342c4faaa0043d787884056614.

14 months agoMerge pull request #34009 from yuwata/network-resolve-polkit
Luca Boccassi [Tue, 20 Aug 2024 10:14:03 +0000 (12:14 +0200)] 
Merge pull request #34009 from yuwata/network-resolve-polkit

network,resolve: support interactive authentication

14 months agoMerge pull request #34014 from yuwata/network-ip-masquerade
Luca Boccassi [Tue, 20 Aug 2024 09:59:30 +0000 (11:59 +0200)] 
Merge pull request #34014 from yuwata/network-ip-masquerade

network: make IPMasquerade= imply global IP forwarding settings again

14 months agoMerge pull request #34021 from yuwata/network-routing-policy-rule
Luca Boccassi [Tue, 20 Aug 2024 09:49:02 +0000 (11:49 +0200)] 
Merge pull request #34021 from yuwata/network-routing-policy-rule

network/routing-policy-rule: several cleanups

14 months agoresolved: demote the global unicast scope
Ronan Pigott [Mon, 19 Aug 2024 20:18:10 +0000 (13:18 -0700)] 
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.

14 months agotree-wide: use isatty_safe() more 34044/head
Lennart Poettering [Tue, 20 Aug 2024 08:33:52 +0000 (10:33 +0200)] 
tree-wide: use isatty_safe() more

14 months agoterminal-util: don't assume errno is correctly set when using isatty_safe()
Lennart Poettering [Tue, 20 Aug 2024 08:32:14 +0000 (10:32 +0200)] 
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
14 months agoterminal-util: fix isatty_safe() on hung-up TTYs
Lennart Poettering [Tue, 20 Aug 2024 08:30:19 +0000 (10:30 +0200)] 
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

14 months agotest-network: make kernel send NA with router flag
Yu Watanabe [Tue, 20 Aug 2024 04:08:59 +0000 (13:08 +0900)] 
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
===

14 months agonamespace: Fix extension release memory leak
maia x. [Mon, 19 Aug 2024 19:47:21 +0000 (12:47 -0700)] 
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 55ea4ef096543d2bceea9315868d5aca945d7a57.

14 months agonetwork/routing-policy-rule: drop unused argument 34021/head
Yu Watanabe [Mon, 19 Aug 2024 03:36:17 +0000 (12:36 +0900)] 
network/routing-policy-rule: drop unused argument

14 months agonetwork/routing-policy-rule: introduce ref and unref functions for RoutingPolicyRule
Yu Watanabe [Sat, 17 Aug 2024 07:14:31 +0000 (16:14 +0900)] 
network/routing-policy-rule: introduce ref and unref functions for RoutingPolicyRule

No functional change, just refactoring and preparation for later change.

14 months agonetwork/routing-policy-rule: manage all flags
Yu Watanabe [Sat, 17 Aug 2024 11:24:07 +0000 (20:24 +0900)] 
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.

14 months agonetwork/routing-policy-rule: use int32_t for suppress_prefixlen
Yu Watanabe [Sat, 17 Aug 2024 11:13:12 +0000 (20:13 +0900)] 
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.

14 months agonetwork/routing-policy-rule: reorder elements of RoutingPolicyRule and add comments
Yu Watanabe [Sat, 17 Aug 2024 06:25:04 +0000 (15:25 +0900)] 
network/routing-policy-rule: reorder elements of RoutingPolicyRule and add comments

No functional change, just refactoring.

14 months agonetwork/routing-policy-rule: update hash and compare function for fib rule
Yu Watanabe [Sat, 17 Aug 2024 05:55:41 +0000 (14:55 +0900)] 
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.

14 months agotest-dhcp-server: Gracefully handle the network being down
Daan De Meyer [Sun, 18 Aug 2024 22:13:47 +0000 (00:13 +0200)] 
test-dhcp-server: Gracefully handle the network being down

14 months agorun: also enable interactive authentication on opening pty 34009/head
Yu Watanabe [Fri, 16 Aug 2024 11:00:25 +0000 (20:00 +0900)] 
run: also enable interactive authentication on opening pty

14 months agorun: use sd_bus_set_allow_interactive_authorization()
Yu Watanabe [Fri, 16 Aug 2024 10:59:30 +0000 (19:59 +0900)] 
run: use sd_bus_set_allow_interactive_authorization()