]> git.ipfire.org Git - thirdparty/systemd.git/log
thirdparty/systemd.git
8 months agolocal-addresses: ignore tentative addresses
Yu Watanabe [Fri, 19 Jan 2024 10:44:49 +0000 (19:44 +0900)] 
local-addresses: ignore tentative addresses

As tentative addresses may be dropped soon if DAD failed.

8 months agolocal-addresses: check family more
Yu Watanabe [Fri, 19 Jan 2024 10:43:26 +0000 (19:43 +0900)] 
local-addresses: check family more

Just for safety. No functional change, unless the kernel sends broken
messages.

8 months agolocal-addresses: rename metric -> priority
Yu Watanabe [Fri, 19 Jan 2024 10:24:45 +0000 (19:24 +0900)] 
local-addresses: rename metric -> priority

To make it consistent with the netlink attribute RTA_PRIORITY.

8 months agotest-local-addresses: several modernization
Yu Watanabe [Fri, 19 Jan 2024 10:35:57 +0000 (19:35 +0900)] 
test-local-addresses: several modernization

- use size_t for number of addresses,
- use FOREACH_ARRAY() macro,
- use IN_ADDR_TO_STRING() macro, etc.

8 months agoptyfwd: when leaving a session with tinted background, clear to end of screen
Lennart Poettering [Fri, 19 Jan 2024 22:39:13 +0000 (23:39 +0100)] 
ptyfwd: when leaving a session with tinted background, clear to end of screen

So if we tint the background of a ptyfwd session with a color and the
session ends, then so far we reset the bg color and clear till the end
of line.

Let's instead clear till the end of the screen. This is nicer since it
means that any follow-up output will not be affected by the changed
background color anymore.

8 months agorun: the --background= switch expects an argument
Lennart Poettering [Fri, 19 Jan 2024 22:41:24 +0000 (23:41 +0100)] 
run: the --background= switch expects an argument

We got this right when running as "uid0", but wrong when invoked under
"systemd-run". Let's fix that.

8 months agoMerge pull request #31016 from poettering/pid1-priority-rework
Lennart Poettering [Fri, 19 Jan 2024 23:13:39 +0000 (00:13 +0100)] 
Merge pull request #31016 from poettering/pid1-priority-rework

pid1 event source priorities rework

8 months agologinctl: add --json= and -j to help text
Mike Yuan [Fri, 19 Jan 2024 15:01:42 +0000 (23:01 +0800)] 
loginctl: add --json= and -j to help text

Follow-up for ea54517476521a35fd10790664f2525a03c582b6

8 months agocgtop: fix sscanf return code checks
Luca Boccassi [Fri, 19 Jan 2024 15:12:49 +0000 (15:12 +0000)] 
cgtop: fix sscanf return code checks

sscanf can return EOF on error, so check that we get a result instead.

CodeQL#2386 and CodeQL#2387

8 months agoMerge pull request #31022 from aafeijoo-suse/bash-completion-cryptenroll-2
Luca Boccassi [Fri, 19 Jan 2024 18:00:10 +0000 (18:00 +0000)] 
Merge pull request #31022 from aafeijoo-suse/bash-completion-cryptenroll-2

fix typo and add some missing options to bash-completion

8 months agoportable: log structured message when attach/detach succeeds
Luca Boccassi [Thu, 18 Jan 2024 19:32:47 +0000 (19:32 +0000)] 
portable: log structured message when attach/detach succeeds

Currently portabled is completely silent (when not using debug level). But
when the system state is changed (ie: a portable is attached or detached)
there are no traces left in the journal. Log at info level when either of
those operations succeed, as they are effectively changing the state of
the system.

Create new MESSAGE_IDs for these logs, and also append PORTABLE_ROOT=
(and PORTABLE_EXTENSION= if any), like the units themselves are
configured to do via LogExtraFields=, so that the same metadata can
be found in the attach/detach messages and in logs from the units
themselves.

8 months agoman: clarify description of Attach/Detach flags
Luca Boccassi [Fri, 19 Jan 2024 14:46:25 +0000 (14:46 +0000)] 
man: clarify description of Attach/Detach flags

8 months agotest: add integration test for Type=exec robustness 31016/head
Lennart Poettering [Fri, 19 Jan 2024 13:36:13 +0000 (14:36 +0100)] 
test: add integration test for Type=exec robustness

This tests for #30799, so that it does not return.

8 months agomanager: order idle jobs
Lennart Poettering [Fri, 19 Jan 2024 13:09:42 +0000 (14:09 +0100)] 
manager: order idle jobs

Let's put the run queue really the last spot, as we should only start
doing more work if we really have nothing else to do anymore.

Let's move the service watchdog after the rewatch PID logic for similar
logic: it will possibly result in new jobs being enqueued to stop
things, and we should really have done all other work first.

8 months agomanager: renumber priorities
Lennart Poettering [Fri, 19 Jan 2024 13:08:38 +0000 (14:08 +0100)] 
manager: renumber priorities

no actual change, let's just make sure the priorities are densely
defined without "holes". Just to make this prettier and less surprising.

8 months agomanager: process exec_fd (i.e. Type=exec) events before SIGCHLD events
Lennart Poettering [Fri, 19 Jan 2024 13:03:55 +0000 (14:03 +0100)] 
manager: process exec_fd (i.e. Type=exec) events before SIGCHLD events

We want to make sure we don't confuse the case "process started
successfully but then failed quickly" from the case "process failed to
start". Hence we need to make sure we take notice of Type=exec before we
bother with SIGCHLD.

Hence move EVENT_PRIORITY_EXEC_FD to the front. In fact, let's move it
even further up than SIGCHLD, i.e. before sd_notify() handling, so that
we don't end up processing service state change notifications before we
even considered that the service is properly started.

This also gives the cgroup OOM handling and the exec_fd handling
different priorities, to improve robustness of the system, we should act
quickly on OOM, and it doesn't matter if a service started succcessfully
if we have to act on OOM anyway.

This is based on Andrew Onyshchuk <andryk.rv@gmail.com> work here:

See: #30799
Fixes: #28304
8 months agocore: maintain a single table with event source priorities
Lennart Poettering [Fri, 19 Jan 2024 12:50:17 +0000 (13:50 +0100)] 
core: maintain a single table with event source priorities

It's hard to oversee the assigned processing priorities of the various
event sources we have. Let's unify them in a table (an enum), where we
can have a single consisten look at them, and then reference the table
entries by expressive symbols.

This doesn#t change behaviour in any way, it just gives each priority a
nice label, but doesn't change any of the priorities.

Prompted by: #30799

8 months agodissect: fix typo 31022/head
Antonio Alvarez Feijoo [Fri, 19 Jan 2024 15:01:13 +0000 (16:01 +0100)] 
dissect: fix typo

8 months agobash-completion: add missing options to systemd-dissect
Antonio Alvarez Feijoo [Fri, 19 Jan 2024 14:50:15 +0000 (15:50 +0100)] 
bash-completion: add missing options to systemd-dissect

8 months agobash-completion: add missing options to systemd-cryptenroll
Antonio Alvarez Feijoo [Fri, 19 Jan 2024 14:49:52 +0000 (15:49 +0100)] 
bash-completion: add missing options to systemd-cryptenroll

8 months agonetwork: fix typo
Yu Watanabe [Fri, 19 Jan 2024 14:27:31 +0000 (23:27 +0900)] 
network: fix typo

Follow-up for 406fde1a4d87eb43cbec0b86213bf78b02595c6b.

8 months agoMerge pull request #31012 from YHNdnzj/pam-systemd-session-busy
Lennart Poettering [Fri, 19 Jan 2024 14:08:37 +0000 (15:08 +0100)] 
Merge pull request #31012 from YHNdnzj/pam-systemd-session-busy

pam_systemd: always check if session is busy

8 months agoMerge pull request #31013 from YHNdnzj/logind-modernization-split
Lennart Poettering [Fri, 19 Jan 2024 14:06:17 +0000 (15:06 +0100)] 
Merge pull request #31013 from YHNdnzj/logind-modernization-split

logind: minor modernizations

8 months agoMerge pull request #31009 from yuwata/network-route-convert-before-requesting
Luca Boccassi [Fri, 19 Jan 2024 13:20:32 +0000 (13:20 +0000)] 
Merge pull request #31009 from yuwata/network-route-convert-before-requesting

network/route: convert routes before requesting

8 months agologind-dbus: use SESSION_IS_{SELF,AUTO} instead of SEAT_* for sessions 31013/head
Mike Yuan [Thu, 18 Jan 2024 15:22:39 +0000 (23:22 +0800)] 
logind-dbus: use SESSION_IS_{SELF,AUTO} instead of SEAT_* for sessions

8 months agologind-user: use RET_GATHER more
Mike Yuan [Fri, 19 Jan 2024 12:12:14 +0000 (20:12 +0800)] 
logind-user: use RET_GATHER more

8 months agopam_systemd: always check if session is busy 31012/head
Mike Yuan [Fri, 19 Jan 2024 12:00:31 +0000 (20:00 +0800)] 
pam_systemd: always check if session is busy

We need to check for BUS_ERROR_SESSION_BUSY no matter
whether pidfd is used, i.e. after we retry with
CreateSession().

8 months agopam_systemd: close pidfd after use
Mike Yuan [Fri, 19 Jan 2024 11:57:31 +0000 (19:57 +0800)] 
pam_systemd: close pidfd after use

8 months agoboot: don't print error if device tree fixup protocol isn't supported
Clayton Craft [Fri, 19 Jan 2024 00:20:55 +0000 (16:20 -0800)] 
boot: don't print error if device tree fixup protocol isn't supported

This isn't a failure we care about, and it's somewhat alarming to see a
red error message flash up on the display when booting, so this just
simply returns EFI_SUCCESS and skips printing the "error" altogether.

8 months agoMerge pull request #30956 from yuwata/nspawn-network-pass-wifi
Luca Boccassi [Fri, 19 Jan 2024 11:41:58 +0000 (11:41 +0000)] 
Merge pull request #30956 from yuwata/nspawn-network-pass-wifi

nspawn: support passing wireless interface to container

8 months agojournalctl: consider shut down namespaced sd-journald instance synced
Frantisek Sumsal [Thu, 18 Jan 2024 16:20:52 +0000 (17:20 +0100)] 
journalctl: consider shut down namespaced sd-journald instance synced

If the namespaced systemd-journald instance was shut down due to
inactivity, we can consider it synchronized, so avoid throwing an error
in such case.

This should help with the random TEST-44-LOG-NAMESPACE fails where we
might try to sync the namespace just after it was shut down:

[    7.682941] H testsuite-44.sh[381]: + systemd-run --wait -p LogNamespace=foobaz echo 'hello world'
[    7.693916] H systemd-journald[389]: Failed to open /dev/kmsg, ignoring: Operation not permitted
[    7.693983] H systemd-journald[389]: Collecting audit messages is disabled.
[    7.725511] H systemd[1]: Started systemd-journald@foobar.service.
[    7.726496] H systemd[1]: Listening on systemd-journald-varlink@foobaz.socket.
[    7.726808] H systemd[1]: Listening on systemd-journald@foobaz.socket.
[    7.750774] H systemd[1]: Started run-u3.service.
[    7.795122] H systemd[1]: run-u3.service: Deactivated successfully.
[    7.842042] H testsuite-44.sh[390]: Running as unit: run-u3.service; invocation ID: 56380adeb36940a8a170d9ffd2e1e433
[    7.842561] H systemd[1]: systemd-journald-varlink@foobaz.socket: Deactivated successfully.
[    7.842762] H systemd[1]: Closed systemd-journald-varlink@foobaz.socket.
[    7.846394] H systemd[1]: systemd-journald@foobaz.socket: Deactivated successfully.
[    7.846566] H systemd[1]: Closed systemd-journald@foobaz.socket.
[    7.852983] H testsuite-44.sh[390]: Finished with result: success
[    7.852983] H testsuite-44.sh[390]: Main processes terminated with: code=exited/status=0
[    7.852983] H testsuite-44.sh[390]: Service runtime: 44ms
[    7.852983] H testsuite-44.sh[390]: CPU time consumed: 8ms
[    7.852983] H testsuite-44.sh[390]: Memory peak: 880.0K
[    7.852983] H testsuite-44.sh[390]: Memory swap peak: 0B
[    7.853785] H testsuite-44.sh[381]: + journalctl --namespace=foobar --sync
[    7.860095] H systemd-journald[389]: Received client request to sync journal.
[    7.862119] H testsuite-44.sh[381]: + journalctl --namespace=foobaz --sync
[    7.868381] H journalctl[396]: Failed to connect to /run/systemd/journal.foobaz/io.systemd.journal: Connection refused
[    7.871498] H systemd[1]: testsuite-44.service: Main process exited, code=exited, status=1/FAILURE
[    7.871642] H systemd[1]: testsuite-44.service: Failed with result 'exit-code'.
[    7.930772] H systemd[1]: Failed to start testsuite-44.service.

8 months agonetwork/route-nexthop: configure as a simple gateway when MultipathRoute= is specifie... 31009/head
Yu Watanabe [Sat, 13 Jan 2024 04:32:27 +0000 (13:32 +0900)] 
network/route-nexthop: configure as a simple gateway when MultipathRoute= is specified only once

The kernel handles such configuration completely equivalent to the case
that Gateway= is specified.

8 months agonetwork/route: drop unnecessary ownership transfer
Yu Watanabe [Sat, 13 Jan 2024 11:18:24 +0000 (20:18 +0900)] 
network/route: drop unnecessary ownership transfer

Let's free Route objects on the caller side.

8 months agonetwork/route-nexthop: drop unnecessary link arguments
Yu Watanabe [Sat, 13 Jan 2024 07:02:44 +0000 (16:02 +0900)] 
network/route-nexthop: drop unnecessary link arguments

These arguments are unused now.

8 months agonetwork/route: convert route before requesting
Yu Watanabe [Tue, 16 Jan 2024 13:36:29 +0000 (22:36 +0900)] 
network/route: convert route before requesting

Previously,
1. use the passed Route object as is when a route is requested,
2. when the route becomes ready to configure, convert the Route object
   if necessary, to resolve outgoing interface name, and split multipath
   routes, and save them to the associated interfaces,
3. configure the route with the passed Route object.

However, there are several inconsistencies with what kernel does:
- The kernel does not merge nor split IPv4 multipath routes. However, we
  unconditionally split multipath routes to manage.
- The kernel does not set gateway or so to a route if it has nexthop ID.

Fortunately, I do not find any issues caused by the inconsistencies. But
for safety, let's manage routes in a consistent way with the kernel.

This makes,
1. when a route is requested, split IPv6 multipath routes, but keep IPv4
   multipath routes as is, and queue (possibly multiple) requests for
   the route.
2. when the route becomes ready to configure, resolve nexthop and interface
   name, and requeue request if necessary.
3. configure the (possibly split) route.

By using the logic,
- Now we manage routes in a mostly consistent way with the kernel.
- We can drop ConvertedRoutes object.
- Hopefully the code becomes much simpler.

8 months agonetwork/route-nexthop: fix route_nexthop_copy()
Yu Watanabe [Fri, 19 Jan 2024 10:19:01 +0000 (19:19 +0900)] 
network/route-nexthop: fix route_nexthop_copy()

Follow-up for 413ea20ab3d86b5bccf775da21a945327b3880c9.

8 months agotest-13-NSPAWN: add more test case for passing network interfaces 30956/head
Yu Watanabe [Wed, 17 Jan 2024 01:55:35 +0000 (10:55 +0900)] 
test-13-NSPAWN: add more test case for passing network interfaces

- test interface renaming that conflicts with the current alternative
  network interface name,
- test passing wlan interfaces.

8 months agonspawn-network: support passing wireless interface to container
Yu Watanabe [Wed, 17 Jan 2024 01:36:28 +0000 (10:36 +0900)] 
nspawn-network: support passing wireless interface to container

Closes #7873.

8 months agonspawn-network: also check alternative names
Yu Watanabe [Wed, 17 Jan 2024 01:07:19 +0000 (10:07 +0900)] 
nspawn-network: also check alternative names

If the requested new name for a network interface is already assigned as a
alternative name, then it is not necessary to and cannot rename the
interface.

8 months agonspawn-network: split out move_network_interface_one()
Yu Watanabe [Wed, 17 Jan 2024 00:48:12 +0000 (09:48 +0900)] 
nspawn-network: split out move_network_interface_one()

This also changes to use sd_device to get some attributes.
So, on moving interfaces back to the parent, we need to populate sysfs
associated to the client netns.
That may look redundant and complicated, but it makes later change
easier, and hopefully faster.

8 months agonspawn-network: split out move_back_network_interfaces()
Yu Watanabe [Wed, 17 Jan 2024 00:28:31 +0000 (09:28 +0900)] 
nspawn-network: split out move_back_network_interfaces()

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

8 months agosd-netlink: add policy for NL80211_ATTR_NETNS_FD
Yu Watanabe [Wed, 17 Jan 2024 01:32:10 +0000 (10:32 +0900)] 
sd-netlink: add policy for NL80211_ATTR_NETNS_FD

8 months agosd-netlink: introduce rtnl_rename_link()
Yu Watanabe [Fri, 19 Jan 2024 03:35:25 +0000 (12:35 +0900)] 
sd-netlink: introduce rtnl_rename_link()

8 months agosd-device: introduce device_get_sysattr_u32()
Yu Watanabe [Tue, 16 Jan 2024 07:07:58 +0000 (16:07 +0900)] 
sd-device: introduce device_get_sysattr_u32()

8 months agoudev-util: introduce reset_cached_udev_availability()
Yu Watanabe [Wed, 17 Jan 2024 05:09:05 +0000 (14:09 +0900)] 
udev-util: introduce reset_cached_udev_availability()

8 months agonamespace-util: introduce netns_acquire()
Yu Watanabe [Fri, 19 Jan 2024 02:34:17 +0000 (11:34 +0900)] 
namespace-util: introduce netns_acquire()

Similar to userns_acquire(), but for network namespace.

8 months agoprocess-util: introduce FORK_NEW_NETNS for safe_fork()
Yu Watanabe [Fri, 19 Jan 2024 02:32:10 +0000 (11:32 +0900)] 
process-util: introduce FORK_NEW_NETNS for safe_fork()

Similar to FORK_NEW_MOUNTNS or FORK_NEW_USERNS.

8 months agonamespace-util: downgrade log level in userns_acquire()
Yu Watanabe [Fri, 19 Jan 2024 02:30:16 +0000 (11:30 +0900)] 
namespace-util: downgrade log level in userns_acquire()

On failure, the caller logs the error in LOG_ERR.

8 months agotree-wide: add short comments for namespace_open() and namespace_enter()
Yu Watanabe [Fri, 19 Jan 2024 01:46:20 +0000 (10:46 +0900)] 
tree-wide: add short comments for namespace_open() and namespace_enter()

Also use -EBADF when unspecified.

8 months agonamespace-util: rename arguments to prefix 'ret_'
Yu Watanabe [Tue, 16 Jan 2024 19:20:06 +0000 (04:20 +0900)] 
namespace-util: rename arguments to prefix 'ret_'

Also reorder opening namespace fd to make it match with the order of the
arguments.

8 months agoRevert "man: add missing <cmdsynopsis> wrapper"
Antonio Alvarez Feijoo [Thu, 18 Jan 2024 13:45:24 +0000 (14:45 +0100)] 
Revert "man: add missing <cmdsynopsis> wrapper"

This reverts commit 35fc10756bc5302d2dff1c235f864fa23a6d8771.

Although DocBook 4.5 states that `cmdsynopsis` can be used within `term` [1],
and `term` within `varlistentry`, `man` does not display the list of commands
after this change. FWIW, `cmdsynopsis` is used tree-wide within `refsynopsisdiv`
only.

[1] https://tdg.docbook.org/tdg/4.5/term

8 months agonetwork: use strdup_or_null() where appropriate
Yu Watanabe [Fri, 19 Jan 2024 01:27:14 +0000 (10:27 +0900)] 
network: use strdup_or_null() where appropriate

8 months agovirt: support detection of Apple Virtualization guests with cpuid
Black-Hole1 [Fri, 19 Jan 2024 03:38:49 +0000 (11:38 +0800)] 
virt: support detection of Apple Virtualization guests with cpuid

This is a supplement to #24419. On macOS Intel machines, detection needs to be done through cpuid.
In macOS, `dmi_vendors` detection is only applicable to M series.

Signed-off-by: Black-Hole1 <bh@bugs.cc>
8 months agoMerge pull request #30975 from yuwata/network-route-several-helper-functions
Yu Watanabe [Fri, 19 Jan 2024 05:42:40 +0000 (14:42 +0900)] 
Merge pull request #30975 from yuwata/network-route-several-helper-functions

network/route: introduce several helper functions

8 months agonetwork/route: introduce route_get_request() 30975/head
Yu Watanabe [Tue, 16 Jan 2024 05:19:01 +0000 (14:19 +0900)] 
network/route: introduce route_get_request()

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

8 months agonetwork: adjust nexthops of dynamic routes before requesting
Yu Watanabe [Tue, 16 Jan 2024 04:01:27 +0000 (13:01 +0900)] 
network: adjust nexthops of dynamic routes before requesting

No effective functionality is changed. Preparation for later commits.

8 months agonetwork/route-nexthop: introduce route_adjust_nexthops() and route_nexthops_needs_adj...
Yu Watanabe [Sun, 14 Jan 2024 05:50:19 +0000 (14:50 +0900)] 
network/route-nexthop: introduce route_adjust_nexthops() and route_nexthops_needs_adjust()

These are not used in this commit, but will be used later.
Preparation for later commits.

8 months agonetwork/route-nexthop: introduce route_nexthops_copy()
Yu Watanabe [Sun, 14 Jan 2024 04:49:30 +0000 (13:49 +0900)] 
network/route-nexthop: introduce route_nexthops_copy()

This also introduce an extra argument for route_dup(), but it is
currently unused, will be used later.

No functional change, just preparation for later commits.

8 months agonetwork/route-nexthop: use RTA_MULTIPATH when weight is not zero
Yu Watanabe [Sat, 13 Jan 2024 04:49:24 +0000 (13:49 +0900)] 
network/route-nexthop: use RTA_MULTIPATH when weight is not zero

As we have no way to specify the weight of gateway without using
RTA_MULTIPATH.

8 months agoMeasure empty PK and KEK EFI vars
Alberto Planas [Thu, 18 Jan 2024 14:38:30 +0000 (15:38 +0100)] 
Measure empty PK and KEK EFI vars

The OVMF UEFI firmware is measuring PK and KEK when secure boot is
disabled, and those variables are absent.  This can be checked via the
event log to see that there are extensions for PCR 7 associated with PK
and KEK events of type EV_EFI_VARIABLE_DRIVER_CONFIG.

When running the "lock-secureboot-policy" verb, pcrlock complains that
those variables are not found and refuse to generate the
240-secureboot-policy.pcrlock.d/generated.pcrlock file.

The "TCG PC Client Platform Firmware Profile Specification Version 1.05
Revision 23"[1] from May 7, 2021, in section "3.3.4.8 PCR[7] - Secure
Boot Policy Measurements", point 10.b:

If reading a UEFI variable returns UEFI_NOT_FOUND, platform firmware
SHALL measure the absence of the variable. The
UEFI_VARIABLE_DATA.VariableDataLength field MUST be set to zero and
UEFI_VARIABLE_DATA.VariableData field will have a size of zero.

This patch mark those variables to be marked as "synthesize empty",
generating the correct hash for those variables.

Signed-off-by: Alberto Planas <aplanas@suse.com>
8 months agonetwork: Add L3MasterDevice= into routing policy
Nick Cao [Wed, 17 Jan 2024 21:28:15 +0000 (16:28 -0500)] 
network: Add L3MasterDevice= into routing policy

8 months agoMerge pull request #30988 from bluca/dbus_docs
Luca Boccassi [Thu, 18 Jan 2024 22:45:24 +0000 (22:45 +0000)] 
Merge pull request #30988 from bluca/dbus_docs

A couple of clarification for D-Bus methods

8 months agoman: explicitly say that portable1's Attach/Detach are synchronous 30988/head
Luca Boccassi [Wed, 17 Jan 2024 17:00:35 +0000 (17:00 +0000)] 
man: explicitly say that portable1's Attach/Detach are synchronous

8 months agoman: add more suggestions on how to use StartUnit and JobRemoved
Luca Boccassi [Wed, 17 Jan 2024 16:59:26 +0000 (16:59 +0000)] 
man: add more suggestions on how to use StartUnit and JobRemoved

This is not immediately clear for users, so spell out the preferred pattern
clearly in the D-Bus documentation.

8 months agonetworkd: Adding DHCPv4 private options to D-BUS
Nandakumar Raghavan [Mon, 15 Jan 2024 14:39:35 +0000 (14:39 +0000)] 
networkd: Adding DHCPv4 private options to D-BUS

Currently DHCPv4 private options are not exposed in D-BUS.
This change is to include those private options into D-BUS

8 months agoMerge pull request #30973 from mrc0mmand/gcc14
Lennart Poettering [Thu, 18 Jan 2024 08:16:40 +0000 (09:16 +0100)] 
Merge pull request #30973 from mrc0mmand/gcc14

Reorder arguments for calloc()-like functions, part #2

8 months agodissect-image: introduce new get_common_dissect_directory() helper
Lennart Poettering [Mon, 4 Dec 2023 17:15:41 +0000 (18:15 +0100)] 
dissect-image: introduce new get_common_dissect_directory() helper

So far, if some component mounts a DDI in some local mount namespace we
created a temporary mountpoint in /tmp/ for that. Let's instead use the
same directory inode in /run/ instead. This is safe, since if everything
runs in a local mount namespace (with propagation on /run/ off) then
they shouldn't fight for the inode. And it relieves us from having to
clean up the directory after use. Morever, it allows us to run without
/tmp/ mounted.

This only moves dissect-image.c and the dissec tool over. More stuff is
moved over later.

8 months agoMerge pull request #30990 from poettering/more-mime
Luca Boccassi [Thu, 18 Jan 2024 00:01:09 +0000 (00:01 +0000)] 
Merge pull request #30990 from poettering/more-mime

register mime types for some of our data files according to the shared mime spec

8 months agoman: don't suggest using pam_unix.so's use_authtok switch
Lennart Poettering [Wed, 17 Jan 2024 22:41:14 +0000 (23:41 +0100)] 
man: don't suggest using pam_unix.so's use_authtok switch

Our dumbed down example PAM stacks do not contain cracklib/pwq modules,
hence using use_authtok on the pam_unix.so password change stack won't
work, because it has the effect that pam_unix.so never asks for a
password on its own, expecting the cracklib/pwq modules to have
queried/validated them beforehand.

I noticed this issue because of #30969: Debian's PAM setup suffers by
the same issue – even though they don't actually use our suggested PAM
fragments at all.

See: #30969

8 months agomime: also add magic-based mime type rules for our other binary files 30990/head
Lennart Poettering [Mon, 15 Jan 2024 14:01:24 +0000 (15:01 +0100)] 
mime: also add magic-based mime type rules for our other binary files

No immediate usecase, it's just nice that if you browser these files
with a graphical file manager you see them recognized as what they are.

8 months agomime: expose a mime type for encrypted credentials
Lennart Poettering [Mon, 15 Jan 2024 12:44:39 +0000 (13:44 +0100)] 
mime: expose a mime type for encrypted credentials

Let's make things nice for desktops, and provide a mime type for
credential files.

This uses the 128bit header identifier that our credential files start
with. However, the files are always base64 encoded, hence we have to
match the base64 string, hence add a small test case that generates them
properly for us, and truncates them at the right place (since 128 is not
evently divisable by 6).

8 months agovmspawn: include qemu cmdline in debug output
Lennart Poettering [Wed, 17 Jan 2024 15:31:16 +0000 (16:31 +0100)] 
vmspawn: include qemu cmdline in debug output

It's just so useful for debugging to know what is going to be executed.

8 months agoMerge pull request #30980 from poettering/varlink-call-full
Lennart Poettering [Wed, 17 Jan 2024 18:08:12 +0000 (19:08 +0100)] 
Merge pull request #30980 from poettering/varlink-call-full

varlink: some tweaks and fixes

8 months agoMerge pull request #30661 from rpigott/resolved-https-record
Luca Boccassi [Wed, 17 Jan 2024 16:20:35 +0000 (16:20 +0000)] 
Merge pull request #30661 from rpigott/resolved-https-record

resolved: support RFC 9460 SVCB and HTTPS records

8 months agoRestart the DHCPv4 client when max REQUEST attempts is reached
Andres Beltran [Tue, 21 Nov 2023 22:29:14 +0000 (22:29 +0000)] 
Restart the DHCPv4 client when max REQUEST attempts is reached

8 months agouser-util: remove dead code
Luca Boccassi [Wed, 17 Jan 2024 14:55:05 +0000 (14:55 +0000)] 
user-util: remove dead code

The branch explicitly checks that all of these ret_ variables are NULL,
so they will never be used.

Follow-up for 83e9b584dba1352493d8d2337bfe20d923d5163b

CID#1533239
CID#1533240
CID#1533241

8 months agorun: strjoina is used, not sprintf
Mike Yuan [Wed, 17 Jan 2024 13:35:47 +0000 (21:35 +0800)] 
run: strjoina is used, not sprintf

Follow-up for 43ead5e3d611e7d3a2e723f5a3cdbf1f8686cea0

8 months agohibernate-util: log that we actually read /sys/power/resume* rather than cmdline
Mike Yuan [Wed, 17 Jan 2024 11:52:40 +0000 (19:52 +0800)] 
hibernate-util: log that we actually read /sys/power/resume* rather than cmdline

/sys/power/resume is always populated by the initrd, while
/sys/power/resume_offset might have been populated by
the kernel itself. Therefore, if the user is using an initrd
that doesn't include resume hook, the hibernation would fail,
which is expected. However, it was hard to track down the real
problem, since the previous log message suggested that resume=
is not set through kernel cmdline.

8 months agovarlink: introduce varlink_call_and_log() which calls and then logs an error 30980/head
Lennart Poettering [Wed, 17 Jan 2024 10:09:05 +0000 (11:09 +0100)] 
varlink: introduce varlink_call_and_log() which calls and then logs an error

As it turns out we do this in a similar way at various times (and
sometimes incorrectly), hence add a common implementation to share the
code and fix the incorrect behaviour.

8 months agovarlink: drop "ret_flags" parameter from varlink_call()
Lennart Poettering [Wed, 17 Jan 2024 09:25:17 +0000 (10:25 +0100)] 
varlink: drop "ret_flags" parameter from varlink_call()

The parameter returns the flags field of the reply message. This is only
relevant in very few cases, hence drop it from the call, but keep it in
a more generic varlink_call_full() call for those who need it.

Do something similar for varlink_callb().

8 months agovarlink: if varlink_call() is called with ret_error_id=NULL propagate error via retur...
Lennart Poettering [Wed, 17 Jan 2024 09:57:56 +0000 (10:57 +0100)] 
varlink: if varlink_call() is called with ret_error_id=NULL propagate error via return value

It's OK if callers don't want to know the varlink error string. But in
that case return the fact the call failed via the return value, as a
negative errno as usual, to make sure it's not accidentally ignored.

Similar for varlink_observe()

8 months agovarlink: in varlink_observe() correctly collect error parameters
Lennart Poettering [Wed, 17 Jan 2024 09:56:25 +0000 (10:56 +0100)] 
varlink: in varlink_observe() correctly collect error parameters

In varlink errors can have parameters (and they regularly do, for
example the io.systemd.System error we generate carries the errno in its
parameter), hence it's essential that varlink_oberserve collects that
properly and returns it too.

8 months agovarlink: add helper that turns varlink errors back to errnos, client-side
Lennart Poettering [Tue, 19 Dec 2023 14:01:36 +0000 (15:01 +0100)] 
varlink: add helper that turns varlink errors back to errnos, client-side

8 months agologind-action: also check .target unit state when selecting sleep action
Mike Yuan [Wed, 17 Jan 2024 04:09:11 +0000 (12:09 +0800)] 
logind-action: also check .target unit state when selecting sleep action

8 months agoMerge pull request #30971 from ddstreet/tpm2_key_conversion
Lennart Poettering [Wed, 17 Jan 2024 12:36:47 +0000 (13:36 +0100)] 
Merge pull request #30971 from ddstreet/tpm2_key_conversion

Fix tpm unsealing when using RSA public key signatures

8 months agomacro: terminate the temporary VA_ARGS_FOREACH() array with a sentinel 30973/head
Frantisek Sumsal [Wed, 17 Jan 2024 12:11:14 +0000 (13:11 +0100)] 
macro: terminate the temporary VA_ARGS_FOREACH() array with a sentinel

So gcc-14 doesn't complain we're out of bounds on the last iteration:

[2092/2414] Compiling C object test-macro.p/src_test_test-macro.c.o
In file included from ../src/basic/list.h:209,
                 from ../src/basic/log.h:10,
                 from ../src/test/test-macro.c:5:
../src/test/test-macro.c: In function ‘test_FOREACH_VA_ARGS’:
../src/basic/macro.h:395:90: warning: array subscript 1 is outside array bounds of ‘uint8_t[1]’ {aka ‘unsigned char[1]’} [-Warray-bounds=]
  395 |              ((long)(_current_ - _entries_) < (long)ELEMENTSOF(_entries_)) && ({ entry = *_current_; true; }); \
../src/basic/macro.h:392:9: note: in expansion of macro ‘_VA_ARGS_FOREACH’
  392 |         _VA_ARGS_FOREACH(entry, UNIQ_T(_entries_, UNIQ), UNIQ_T(_current_, UNIQ), ##__VA_ARGS__)
      |         ^~~~~~~~~~~~~~~~
../src/test/test-macro.c:322:9: note: in expansion of macro ‘VA_ARGS_FOREACH’
  322 |         VA_ARGS_FOREACH(u8, 0) {
      |         ^~~~~~~~~~~~~~~
../src/fundamental/macro-fundamental.h:163:37: note: at offset 1 into object ‘__unique_prefix__entries_181’ of size 1
  163 | #define UNIQ_T(x, uniq) CONCATENATE(__unique_prefix_, CONCATENATE(x, uniq))
      |                                     ^~~~~~~~~~~~~~~~
../src/basic/macro.h:394:28: note: in definition of macro ‘_VA_ARGS_FOREACH’
  394 |         for (typeof(entry) _entries_[] = { __VA_ARGS__ }, *_current_ = _entries_; \
      |                            ^~~~~~~~~
../src/fundamental/macro-fundamental.h:109:27: note: in expansion of macro ‘XCONCATENATE’
  109 | #define CONCATENATE(x, y) XCONCATENATE(x, y)
      |                           ^~~~~~~~~~~~
../src/fundamental/macro-fundamental.h:163:25: note: in expansion of macro ‘CONCATENATE’
  163 | #define UNIQ_T(x, uniq) CONCATENATE(__unique_prefix_, CONCATENATE(x, uniq))
      |                         ^~~~~~~~~~~
../src/basic/macro.h:392:33: note: in expansion of macro ‘UNIQ_T’
  392 |         _VA_ARGS_FOREACH(entry, UNIQ_T(_entries_, UNIQ), UNIQ_T(_current_, UNIQ), ##__VA_ARGS__)
      |                                 ^~~~~~
../src/test/test-macro.c:322:9: note: in expansion of macro ‘VA_ARGS_FOREACH’
  322 |         VA_ARGS_FOREACH(u8, 0) {
      |         ^~~~~~~~~~~~~~~

8 months agoMerge pull request #30974 from poettering/strv-extend-many
Lennart Poettering [Wed, 17 Jan 2024 12:13:30 +0000 (13:13 +0100)] 
Merge pull request #30974 from poettering/strv-extend-many

strv: add new strv_extend_many() helper

8 months agossh-generator: correct log level of one function
Lennart Poettering [Wed, 17 Jan 2024 08:49:17 +0000 (09:49 +0100)] 
ssh-generator: correct log level of one function

add_export_unix_socket() generally logs about errors, but we forgot one
case.

8 months agocore/unit: check for correct function in vtable
Mike Yuan [Wed, 17 Jan 2024 09:20:29 +0000 (17:20 +0800)] 
core/unit: check for correct function in vtable

Prompted by https://github.com/systemd/systemd/pull/30974/commits/61e44e01325eca50e88fc9cd400ee340081e9134

8 months agoMerge pull request #30972 from mrc0mmand/ci-unit-tests-ukify
Luca Boccassi [Wed, 17 Jan 2024 11:46:45 +0000 (11:46 +0000)] 
Merge pull request #30972 from mrc0mmand/ci-unit-tests-ukify

ci: install python3-pytest for ukify tests

8 months agomeson: disable -Wnonnull-compare
Frantisek Sumsal [Tue, 16 Jan 2024 21:25:04 +0000 (22:25 +0100)] 
meson: disable -Wnonnull-compare

This gets enabled by default in gcc-14 and complains everywhere where we
use assert() on an expression that is always true (i.e. using
`int x[static 2]` in function declaration, etc.):

[153/2414] Compiling C object src/basic/libbasic.a.p/fs-util.c.o
In file included from ../src/basic/macro.h:13,
                 from ../src/basic/alloc-util.h:10,
                 from ../src/basic/fs-util.c:11:
../src/basic/fd-util.h: In function ‘format_proc_fd_path’:
../src/fundamental/macro-fundamental.h:74:41: warning: ‘nonnull’ argument ‘buf’ compared to NULL [-Wnonnull-compare]
   74 | #define _unlikely_(x) (__builtin_expect(!!(x), 0))
      |                                         ^~~~~
../src/basic/macro.h:150:21: note: in expansion of macro ‘_unlikely_’
  150 |                 if (_unlikely_(!(expr)))                                \
      |                     ^~~~~~~~~~
../src/basic/macro.h:167:22: note: in expansion of macro ‘assert_message_se’
  167 | #define assert(expr) assert_message_se(expr, #expr)
      |                      ^~~~~~~~~~~~~~~~~
../src/basic/fd-util.h:129:9: note: in expansion of macro ‘assert’
  129 |         assert(buf);
      |         ^~~~~~

Disabling this selectively only for asserts is a bit painful, since the
option is not available in all compilers, and it'd need to be handled in
the EFI stuff as well.

8 months agosd-netlink: fix rtnl_resolve_link_alternative_name()
Yu Watanabe [Wed, 17 Jan 2024 02:57:21 +0000 (11:57 +0900)] 
sd-netlink: fix rtnl_resolve_link_alternative_name()

Fixes a bug introduced by afdf6c3b6040ef43b05428b834f0f302c8ce9a1b.

8 months agoexec-credential: strv_extend() handles NULL strings gracefully 30974/head
Lennart Poettering [Tue, 16 Jan 2024 22:24:04 +0000 (23:24 +0100)] 
exec-credential: strv_extend() handles NULL strings gracefully

8 months agotree-wide: propagate the error we got from strv_extend_xyz() to the caller
Lennart Poettering [Tue, 16 Jan 2024 22:22:43 +0000 (23:22 +0100)] 
tree-wide: propagate the error we got from strv_extend_xyz() to the caller

It's a bit sloppy to return -ENOMEM rather than the actual error we
already returned in the first place (even though it's always going to be
ENOMEM)

8 months agodbus-unit: don't eat up error codes needlessly
Lennart Poettering [Tue, 16 Jan 2024 22:16:40 +0000 (23:16 +0100)] 
dbus-unit: don't eat up error codes needlessly

8 months agotree-wide: port over various pieces of code to strv_extend_many()
Lennart Poettering [Tue, 16 Jan 2024 22:15:37 +0000 (23:15 +0100)] 
tree-wide: port over various pieces of code to strv_extend_many()

8 months agostrv: add strv_extend_many() helper
Lennart Poettering [Tue, 16 Jan 2024 21:38:31 +0000 (22:38 +0100)] 
strv: add strv_extend_many() helper

This is supposed to be a nicer, faster replacement for the often seen
pattern strv_extend_strv(l, STRV_MAKE(…), false)

8 months agostrv: remove strv_extend_front()
Lennart Poettering [Tue, 16 Jan 2024 18:17:12 +0000 (19:17 +0100)] 
strv: remove strv_extend_front()

It's entirely identical to strv_push_prepend() hence drop the duplicate
definition.

8 months agostrv: modernize strv_insert()
Lennart Poettering [Tue, 16 Jan 2024 18:15:34 +0000 (19:15 +0100)] 
strv: modernize strv_insert()

Let's use memmove() to move the string contents, rather than manual
loops.

Fix the overflow extension.

Prefer reallocarray() over malloc()

8 months agoReorder arguments for calloc()-like functions, part #2
Frantisek Sumsal [Tue, 16 Jan 2024 21:42:39 +0000 (22:42 +0100)] 
Reorder arguments for calloc()-like functions, part #2

To appease gcc-14's -Wcalloc-transposed-args check.

Follow-up for 2a9ab0974bb290bc66dc84d909c33d23361b0752.