summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md3
-rw-r--r--docs/DESKTOP_ENVIRONMENTS.md102
-rw-r--r--fuzzbuzz.yaml33
-rw-r--r--hwdb.d/60-evdev.hwdb18
-rw-r--r--hwdb.d/60-keyboard.hwdb1
-rw-r--r--hwdb.d/60-sensor.hwdb8
-rw-r--r--man/custom-entities.ent.in8
-rwxr-xr-xman/html.in3
-rw-r--r--man/loader.conf.xml2
-rwxr-xr-xman/man.in3
-rw-r--r--man/path-documents.c9
-rw-r--r--man/rules/meson.build17
-rw-r--r--man/sd-bus.xml11
-rw-r--r--man/sd_bus_call.xml6
-rw-r--r--man/sd_bus_close.xml15
-rw-r--r--man/sd_bus_default.xml19
-rw-r--r--man/sd_bus_message_append.xml109
-rw-r--r--man/sd_bus_message_seal.xml106
-rw-r--r--man/sd_bus_new.xml10
-rw-r--r--man/sd_bus_reply_method_error.xml26
-rw-r--r--man/sd_bus_reply_method_return.xml113
-rw-r--r--man/sd_bus_send.xml136
-rw-r--r--man/sd_bus_set_address.xml176
-rw-r--r--man/sd_bus_set_description.xml26
-rw-r--r--man/sd_bus_set_method_call_timeout.xml3
-rw-r--r--man/sd_bus_slot_get_bus.xml88
-rw-r--r--man/sd_bus_slot_ref.xml14
-rw-r--r--man/sd_bus_start.xml124
-rw-r--r--man/sd_path_lookup.xml215
-rw-r--r--man/sysctl.d.xml2
-rw-r--r--man/systemd.network.xml41
-rw-r--r--man/systemd.service.xml3
-rw-r--r--meson.build29
-rw-r--r--meson_options.txt6
-rw-r--r--po/uk.po91
-rw-r--r--shell-completion/zsh/_machinectl1
-rw-r--r--src/basic/capability-util.c4
-rw-r--r--src/basic/cgroup-util.c45
-rw-r--r--src/basic/cgroup-util.h3
-rw-r--r--src/basic/limits-util.c9
-rw-r--r--src/basic/log.h2
-rw-r--r--src/basic/meson.build2
-rw-r--r--src/basic/mountpoint-util.c3
-rw-r--r--src/basic/path-lookup.c (renamed from src/shared/path-lookup.c)85
-rw-r--r--src/basic/path-lookup.h (renamed from src/shared/path-lookup.h)9
-rw-r--r--src/basic/selinux-util.c17
-rw-r--r--src/basic/strv.h10
-rw-r--r--src/basic/user-util.c20
-rw-r--r--src/core/cgroup.c57
-rw-r--r--src/core/device.c5
-rw-r--r--src/core/generator-setup.c58
-rw-r--r--src/core/generator-setup.h8
-rw-r--r--src/core/manager.c3
-rw-r--r--src/core/meson.build2
-rw-r--r--src/core/selinux-access.c9
-rw-r--r--src/core/swap.c2
-rw-r--r--src/core/systemd.pc.in115
-rw-r--r--src/core/unit.c33
-rw-r--r--src/environment-d-generator/environment-d-generator.c2
-rw-r--r--src/fuzz/fuzz.h3
-rw-r--r--src/fuzz/fuzzer-entry-point.c5
-rw-r--r--src/journal/sd-journal.c7
-rw-r--r--src/libsystemd-network/dhcp-lease-internal.h3
-rw-r--r--src/libsystemd-network/dhcp-server-internal.h7
-rw-r--r--src/libsystemd-network/network-internal.h3
-rw-r--r--src/libsystemd-network/sd-dhcp-client.c42
-rw-r--r--src/libsystemd-network/sd-dhcp-lease.c30
-rw-r--r--src/libsystemd-network/sd-dhcp-server.c73
-rw-r--r--src/libsystemd/libsystemd.sym6
-rw-r--r--src/libsystemd/sd-bus/bus-convenience.c11
-rw-r--r--src/libsystemd/sd-bus/bus-message.c7
-rw-r--r--src/libsystemd/sd-bus/sd-bus.c82
-rw-r--r--src/libsystemd/sd-network/sd-network.c8
-rw-r--r--src/libsystemd/sd-path/sd-path.c207
-rw-r--r--src/login/logind-dbus.c8
-rw-r--r--src/login/org.freedesktop.login1.policy2
-rw-r--r--src/network/netdev/netdev.c1
-rw-r--r--src/network/networkctl.c120
-rw-r--r--src/network/networkd-dhcp-server.c125
-rw-r--r--src/network/networkd-dhcp-server.h1
-rw-r--r--src/network/networkd-dhcp4.c12
-rw-r--r--src/network/networkd-link.c23
-rw-r--r--src/network/networkd-manager.c29
-rw-r--r--src/network/networkd-network-gperf.gperf3
-rw-r--r--src/network/networkd-network.c3
-rw-r--r--src/network/networkd-network.h6
-rw-r--r--src/path/path.c118
-rw-r--r--src/shared/bridge-util.c13
-rw-r--r--src/shared/bridge-util.h20
-rw-r--r--src/shared/bus-util.c32
-rw-r--r--src/shared/geneve-util.c12
-rw-r--r--src/shared/geneve-util.h17
-rw-r--r--src/shared/meson.build6
-rw-r--r--src/shutdown/shutdown.c3
-rw-r--r--src/systemctl/systemctl.c3
-rw-r--r--src/systemd/meson.build2
-rw-r--r--src/systemd/sd-bus.h46
-rw-r--r--src/systemd/sd-dhcp-client.h4
-rw-r--r--src/systemd/sd-dhcp-lease.h1
-rw-r--r--src/systemd/sd-dhcp-server.h2
-rw-r--r--src/systemd/sd-network.h7
-rw-r--r--src/systemd/sd-path.h31
-rw-r--r--src/test/meson.build9
-rw-r--r--src/test/test-install-root.c102
-rw-r--r--src/test/test-sd-path.c69
-rw-r--r--src/test/test-user-util.c4
-rw-r--r--src/tmpfiles/tmpfiles.c2
-rw-r--r--src/udev/net/link-config.c1
-rw-r--r--src/udev/udev.pc.in3
-rw-r--r--test/fuzz/fuzz-network-parser/directives.network3
-rwxr-xr-xtools/meson-check-api-docs.sh2
-rwxr-xr-xtravis-ci/managers/fuzzbuzz.sh5
-rwxr-xr-xtravis-ci/managers/fuzzit.sh4
-rw-r--r--units/sys-kernel-tracing.mount1
-rw-r--r--units/systemd-network-generator.service.in3
115 files changed, 2687 insertions, 745 deletions
diff --git a/README.md b/README.md
index 0274715e8c..4acc899cbc 100644
--- a/README.md
+++ b/README.md
@@ -12,7 +12,8 @@ System and Service Manager
[![Travis CI Build Status](https://travis-ci.org/systemd/systemd.svg?branch=master)](https://travis-ci.org/systemd/systemd)<br/>
[![Language Grade: C/C++](https://img.shields.io/lgtm/grade/cpp/g/systemd/systemd.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/systemd/systemd/context:cpp)<br/>
[![CentOS CI Build Status](https://ci.centos.org/buildStatus/icon?job=systemd-pr-build)](https://ci.centos.org/job/systemd-pr-build/)<br/>
-[![Build Status](https://dev.azure.com/evvers/systemd-systemd/_apis/build/status/systemd.systemd?branchName=master)](https://dev.azure.com/evvers/systemd-systemd/_build/latest?definitionId=1&branchName=master)
+[![Build Status](https://dev.azure.com/evvers/systemd-systemd/_apis/build/status/systemd.systemd?branchName=master)](https://dev.azure.com/evvers/systemd-systemd/_build/latest?definitionId=1&branchName=master)<br/>
+[![Packaging status](https://repology.org/badge/tiny-repos/systemd.svg)](https://repology.org/project/systemd/versions)
## Details
diff --git a/docs/DESKTOP_ENVIRONMENTS.md b/docs/DESKTOP_ENVIRONMENTS.md
new file mode 100644
index 0000000000..1c8c7aec6e
--- /dev/null
+++ b/docs/DESKTOP_ENVIRONMENTS.md
@@ -0,0 +1,102 @@
+---
+title: Desktop Environment Integration
+category: Concepts
+layout: default
+---
+
+# Desktop Environments
+
+NOTE: This document is a work-in-progress.
+
+## Single Graphical Session
+
+systemd only supports running one graphical session per user at a time.
+While this might not have always been the case historically, having multiple
+sessions for one user running at the same time is problematic.
+The DBus session bus is shared between all the logins, and services that are
+started must be implicitly assigned to the user's current graphical session.
+
+In principle it is possible to run a single graphical session across multiple
+logind seats, and this could be a way to use more than one display per user.
+When a user logs in to a second seat, the seat resources could be assigned
+to the existing session, allowing the graphical environment to present it
+is a single seat.
+Currently nothing like this is supported or even planned.
+
+## Pre-defined systemd units
+
+[`systemd.special(7)`](https://www.freedesktop.org/software/systemd/man/systemd.special.html)
+defines the `graphical-session.target` and `graphical-session-pre.target` to
+allow cross-desktop integration. Furthermore, systemd defines the three base
+slices `background`, `apps` and `session`.
+All units should be placed into one of these slices depending on their purposes:
+
+ * `session.slice`: Contains only processes essential to run the user's graphical session
+ * `apps.slice`: Contains all normal applications that the user is running
+ * `background.slice`: Useful for low-priority background tasks
+
+The purpose of this grouping is to assign different priorities to the
+applications.
+This could e.g. mean reserving memory to session processes,
+preferentially killing background tasks in out-of-memory situations
+or assinging different memory/CPU/IO priorities to ensure that the session
+runs smoothly under load.
+
+TODO: Will there be a default to place units into e.g. `apps.slice` by default
+rather than the root slice?
+
+## XDG standardization for applications
+
+To ensure cross-desktop compatibility and encourage sharing of good practices,
+desktop environments should adhere to the following conventions:
+
+ * Application units should follow the scheme `apps-<launcher>-<ApplicationID>-<RANDOM>.service`,
+ e.g. `apps-gnome-org.gnome.Evince-12345.service`,
+ `apps-flatpak-org.telegram.desktop-12345.service` or `apps-KDE-org.kde.okular-12345.service`.
+ * Using `.service` units instead of `.scope` units, i.e. allowing systemd to
+ start the process on behalf of the caller,
+ instead of the caller starting the process and letting systemd know about it,
+ is encouraged.
+ * If no application ID is available, the launcher should generate a reasonable
+ name when possible (e.g. using `basename(argv[0])`). This name must not
+ contain a `-` character.
+
+This has the following advantages:
+ * Using the `apps-<launcher>-` prefix means that the unit defaults can be
+ adjusted using desktop environment specific drop-in files.
+ * The application ID can be retrieved by stripping the prefix and postfix.
+ This in turn should map to the corresponding `.desktop` file when available
+
+TODO: Define the name of slices that should be used.
+This could be `apps-<launcher>-<ApplicationID>-<RANDOM>.slice`.
+
+TODO: Does it really make sense to insert the `<launcher>`? In GNOME I am
+currently using a drop-in to configure `BindTo=graphical-session.target`,
+`CollectMode=inactive-or-failed` and `TimeoutSec=5s`. I feel that such a
+policy makes sense, but it may make much more sense to just define a
+global default for all (graphical) applications.
+
+ * Should application lifetime be bound to the session?
+ * May the user have applications that do not belong to the graphical session (e.g. launched from SSH)?
+ * Could we maybe add a default `apps-.service.d` drop-in configuration?
+
+## XDG autostart integration
+
+To allow XDG autostart integration, systemd will ship a cross-desktop generator
+to create appropriate units for the autostart directory.
+Desktop Environments will be able to make use of this simply by starting the
+appropriate XDG related targets (representing e.g. content of the
+`$XDG_CURRENT_DESKTOP` environment variable to handle `OnlyShowIn/NotShowIn`).
+The names and ordering rules for these targets are to be defined.
+
+This generator will likely never support certain desktop specific extensions.
+One such example is the GNOME specific feature to bind a service to a settings
+variable.
+
+## Startup and shutdown best practices
+
+Question here are:
+
+ * Are there strong opinions on how the session-leader process should watch the user's session units?
+ * Should systemd/logind/… provide an integrated way to define a session in terms of a running *user* unit?
+ * Is having `gnome-session-shutdown.target` that is run with `replace-irreversibly` considered a good practice?
diff --git a/fuzzbuzz.yaml b/fuzzbuzz.yaml
deleted file mode 100644
index 2cd1763a6d..0000000000
--- a/fuzzbuzz.yaml
+++ /dev/null
@@ -1,33 +0,0 @@
-base: ubuntu:16.04
-language: c
-setup:
-- sudo bash -c "echo 'deb-src http://archive.ubuntu.com/ubuntu/ xenial main restricted universe multiverse' >>/etc/apt/sources.list"
-- sudo apt-get update -y
-- sudo apt-get build-dep -y systemd
-- sudo apt-get install -y python3-pip
-- sudo apt-get install -y libfdisk-dev libp11-kit-dev libssl-dev libpwquality-dev
-- pip3 install meson ninja
-- export PATH="$HOME/.local/bin/:$PATH"
-- CC=$FUZZ_CC CXX=$FUZZ_CXX meson -Dfuzzbuzz=true -Dfuzzbuzz-engine-dir=$(dirname "$FUZZ_ENGINE") -Dfuzzbuzz-engine=$(cut -d. -f1 <(basename "$FUZZ_ENGINE")) -Db_lundef=false ./build
-- ninja -v -C ./build fuzzers
-environment:
-targets:
-- name: fuzz-compress
- harness:
- binary: ./build/fuzz-compress
-- name: fuzz-unit-file
- harness:
- binary: ./build/fuzz-unit-file
- corpus: ./test/fuzz/fuzz-unit-file
-- name: fuzz-journald-syslog
- harness:
- binary: ./build/fuzz-journald-syslog
- corpus: ./test/fuzz/fuzz-journald-syslog
-- name: fuzz-netdev-parser
- harness:
- binary: ./build/fuzz-netdev-parser
- corpus: ./test/fuzz/fuzz-netdev-parser
-- name: fuzz-network-parser
- harness:
- binary: ./build/fuzz-network-parser
- corpus: ./test/fuzz/fuzz-network-parser
diff --git a/hwdb.d/60-evdev.hwdb b/hwdb.d/60-evdev.hwdb
index 5d4ff8bc93..1ab0f01584 100644
--- a/hwdb.d/60-evdev.hwdb
+++ b/hwdb.d/60-evdev.hwdb
@@ -572,6 +572,24 @@ evdev:name:ETPS/2 Elantech Touchpad:dmi:*svnSAMSUNGELECTRONICSCO.,LTD.:pn870Z5E/
EVDEV_ABS_36=::29
#########################################
+# Star Labs
+#########################################
+
+# Star LabTop Mk III
+evdev:name:ALPS0001:00 0911:5288 Touchpad:dmi:*svnStarLabs:pnLabTop*
+ EVDEV_ABS_00=0:2627:25
+ EVDEV_ABS_01=0:1331:20
+ EVDEV_ABS_35=0:2627:25
+ EVDEV_ABS_36=0:1331:20
+
+# Star Lite Mk II
+evdev:name:ALPS0001:00 0911:5288 Touchpad:dmi:*svnStarLabs:pnLite:*
+ EVDEV_ABS_00=55:1750:16
+ EVDEV_ABS_01=51:950:15
+ EVDEV_ABS_35=55:1750:16
+ EVDEV_ABS_36=51:950:15
+
+#########################################
# System76
#########################################
diff --git a/hwdb.d/60-keyboard.hwdb b/hwdb.d/60-keyboard.hwdb
index 766ca74054..176ec3836a 100644
--- a/hwdb.d/60-keyboard.hwdb
+++ b/hwdb.d/60-keyboard.hwdb
@@ -1121,6 +1121,7 @@ evdev:atkbd:dmi:bvn*:bvr*:bd*:svnMAXDATA:pnPro*7000*:pvr*
# Akoya
evdev:atkbd:dmi:bvn*:bvr*:svnMEDION*:pnS3409*:pvr*
evdev:atkbd:dmi:bvn*:bvr*:svnMedion*:pnAkoya*:pvr*
+evdev:atkbd:dmi:bvn*:bvr*:svnMedion*:pnP6669*:pvr*
KEYBOARD_KEY_a0=!mute
KEYBOARD_KEY_ae=!volumedown
KEYBOARD_KEY_b0=!volumeup
diff --git a/hwdb.d/60-sensor.hwdb b/hwdb.d/60-sensor.hwdb
index abedbaca81..4c66b7c4f8 100644
--- a/hwdb.d/60-sensor.hwdb
+++ b/hwdb.d/60-sensor.hwdb
@@ -249,6 +249,10 @@ sensor:modalias:acpi:*KIOX000A*:dmi:*svn*CytrixTechnology:*pn*Complex11t*
sensor:modalias:platform:HID-SENSOR-200073:dmi:*svnDell*:pnVostro5581:*
ACCEL_LOCATION=base
+# Dell Venue 8 Pro 3845
+sensor:modalias:acpi:INVN6500*:dmi:*svnDellInc.*:pnVenue8Pro3845*
+ ACCEL_MOUNT_MATRIX=0, -1, 0; -1, 0, 0; 0, 0, 1
+
# Dell Venue 10 Pro 5055
sensor:modalias:acpi:INVN6500*:dmi:*svnDell*:pnVenue10Pro5055*
ACCEL_MOUNT_MATRIX=0, -1, 0; 1, 0, 0; 0, 0, 1
@@ -407,6 +411,10 @@ sensor:modalias:acpi:SMO8500*:dmi:bvnLENOVO:*:pvrLenovoMIIX3-830:*
sensor:modalias:acpi:BOSC0200*:dmi:*:svnLENOVO:pn81H3:*
ACCEL_MOUNT_MATRIX=0, 1, 0; -1, 0, 0; 0, 0, 1
+# IdeaPad Miix 300
+sensor:modalias:acpi:SMO8500*:dmi:bvnLENOVO:*:pvrMIIX300-*
+ ACCEL_MOUNT_MATRIX=0, -1, 0; -1, 0, 0; 0, 0, 1
+
# IdeaPad Miix 310 note this only is for BIOS version (bvr) 1HCN4?WW and 1HCN2?WW, which has
# a portrait LCD panel, versions with bvr 1HCN3?WW have a landscape panel
sensor:modalias:acpi:KIOX000A*:dmi:bvnLENOVO:bvr1HCN4?WW:*:svnLENOVO:pn80SG:*
diff --git a/man/custom-entities.ent.in b/man/custom-entities.ent.in
index 85805777a0..84a29f5de4 100644
--- a/man/custom-entities.ent.in
+++ b/man/custom-entities.ent.in
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="utf-8" ?>
<!ENTITY MOUNT_PATH @MOUNT_PATH@>
<!ENTITY UMOUNT_PATH @UMOUNT_PATH@>
-<!ENTITY systemgeneratordir @SYSTEM_GENERATOR_PATH@>
-<!ENTITY usergeneratordir @USER_GENERATOR_PATH@>
-<!ENTITY systemenvgeneratordir @SYSTEM_ENV_GENERATOR_PATH@>
-<!ENTITY userenvgeneratordir @USER_ENV_GENERATOR_PATH@>
+<!ENTITY systemgeneratordir @SYSTEM_GENERATOR_DIR@>
+<!ENTITY usergeneratordir @USER_GENERATOR_DIR@>
+<!ENTITY systemenvgeneratordir @SYSTEM_ENV_GENERATOR_DIR@>
+<!ENTITY userenvgeneratordir @USER_ENV_GENERATOR_DIR@>
<!ENTITY CERTIFICATE_ROOT @CERTIFICATE_ROOT@>
<!ENTITY MEMORY_ACCOUNTING_DEFAULT @MEMORY_ACCOUNTING_DEFAULT_YES_NO@>
<!ENTITY KILL_USER_PROCESSES @KILL_USER_PROCESSES_YES_NO@>
diff --git a/man/html.in b/man/html.in
index bc9a668c23..c09d300d6f 100755
--- a/man/html.in
+++ b/man/html.in
@@ -6,6 +6,9 @@ if [ -z "$1" ]; then
exit 1
fi
+# make sure the rules have been regenrated (in case man/update-man-rules was just run)
+ninja -C "@BUILD_ROOT@" version.h
+
target="man/$1.html"
ninja -C "@BUILD_ROOT@" "$target"
set -x
diff --git a/man/loader.conf.xml b/man/loader.conf.xml
index 14f84c13ee..4b01a93bd0 100644
--- a/man/loader.conf.xml
+++ b/man/loader.conf.xml
@@ -165,7 +165,7 @@
variable is set, and then derive the random seed to pass to the OS from the combination. If
<literal>always</literal> the boot loader will do so even if <varname>LoaderSystemToken</varname> is
not set. This mode is useful in environments where protection against OS image reuse is not a
- concern, and the random seed shall be used even with no further setup in place. User <command>bootctl
+ concern, and the random seed shall be used even with no further setup in place. Use <command>bootctl
random-seed</command> to initialize both the random seed file in the ESP and the system token EFI
variable.</para>
diff --git a/man/man.in b/man/man.in
index 75680b860c..812c6767fc 100755
--- a/man/man.in
+++ b/man/man.in
@@ -6,6 +6,9 @@ if [ -z "$1" ]; then
exit 1
fi
+# make sure the rules have been regenrated (in case man/update-man-rules was just run)
+ninja -C "@BUILD_ROOT@" version.h
+
page="$(echo "$1" | sed 's/\./\\./')"
target=$(ninja -C "@BUILD_ROOT@" -t query man/man | grep -E -m1 "man/$page\.[0-9]$" | awk '{print $2}')
if [ -z "$target" ]; then
diff --git a/man/path-documents.c b/man/path-documents.c
new file mode 100644
index 0000000000..a6c1f9371a
--- /dev/null
+++ b/man/path-documents.c
@@ -0,0 +1,9 @@
+#include <stdio.h>
+#include <sd-path.h>
+
+int main(void) {
+ char *t;
+
+ sd_path_lookup(SD_PATH_USER_DOCUMENTS, NULL, &t);
+ printf("~/Documents: %s\n", t);
+}
diff --git a/man/rules/meson.build b/man/rules/meson.build
index 6d10df1ab1..db90073f36 100644
--- a/man/rules/meson.build
+++ b/man/rules/meson.build
@@ -139,7 +139,7 @@ manpages = [
['sd_bus_attach_event', '3', ['sd_bus_detach_event', 'sd_bus_get_event'], ''],
['sd_bus_call', '3', ['sd_bus_call_async'], ''],
['sd_bus_call_method', '3', ['sd_bus_call_method_async'], ''],
- ['sd_bus_close', '3', ['sd_bus_flush'], ''],
+ ['sd_bus_close', '3', ['sd_bus_default_flush_close', 'sd_bus_flush'], ''],
['sd_bus_creds_get_pid',
'3',
['sd_bus_creds_get_audit_login_uid',
@@ -281,6 +281,7 @@ manpages = [
['sd_bus_message_read_array', '3', [], ''],
['sd_bus_message_read_basic', '3', [], ''],
['sd_bus_message_rewind', '3', [], ''],
+ ['sd_bus_message_seal', '3', [], ''],
['sd_bus_message_sensitive', '3', [], ''],
['sd_bus_message_set_destination',
'3',
@@ -324,18 +325,23 @@ manpages = [
'sd_bus_reply_method_errnof',
'sd_bus_reply_method_errorf'],
''],
+ ['sd_bus_reply_method_return', '3', [], ''],
['sd_bus_request_name',
'3',
['sd_bus_release_name',
'sd_bus_release_name_async',
'sd_bus_request_name_async'],
''],
+ ['sd_bus_send', '3', [], ''],
+ ['sd_bus_set_address', '3', ['sd_bus_get_address'], ''],
['sd_bus_set_close_on_exit', '3', ['sd_bus_get_close_on_exit'], ''],
['sd_bus_set_connected_signal', '3', ['sd_bus_get_connected_signal'], ''],
['sd_bus_set_description',
'3',
['sd_bus_get_allow_interactive_authorization',
'sd_bus_get_description',
+ 'sd_bus_is_anonymous',
+ 'sd_bus_is_trusted',
'sd_bus_set_allow_interactive_authorization',
'sd_bus_set_anonymous',
'sd_bus_set_trusted'],
@@ -346,10 +352,13 @@ manpages = [
''],
['sd_bus_set_sender', '3', ['sd_bus_get_sender'], ''],
['sd_bus_set_watch_bind', '3', ['sd_bus_get_watch_bind'], ''],
- ['sd_bus_slot_ref',
+ ['sd_bus_slot_get_bus',
'3',
- ['sd_bus_slot_get_bus', 'sd_bus_slot_unref', 'sd_bus_slot_unrefp'],
+ ['sd_bus_slot_get_current_handler',
+ 'sd_bus_slot_get_current_message',
+ 'sd_bus_slot_get_current_userdata'],
''],
+ ['sd_bus_slot_ref', '3', ['sd_bus_slot_unref', 'sd_bus_slot_unrefp'], ''],
['sd_bus_slot_set_description', '3', ['sd_bus_slot_get_description'], ''],
['sd_bus_slot_set_destroy_callback',
'3',
@@ -360,6 +369,7 @@ manpages = [
''],
['sd_bus_slot_set_floating', '3', ['sd_bus_slot_get_floating'], ''],
['sd_bus_slot_set_userdata', '3', ['sd_bus_slot_get_userdata'], ''],
+ ['sd_bus_start', '3', [], ''],
['sd_bus_track_add_name',
'3',
['sd_bus_track_add_sender',
@@ -616,6 +626,7 @@ manpages = [
'3',
['sd_notifyf', 'sd_pid_notify', 'sd_pid_notify_with_fds', 'sd_pid_notifyf'],
''],
+ ['sd_path_lookup', '3', ['sd_path_lookup_strv'], ''],
['sd_pid_get_owner_uid',
'3',
['sd_peer_get_cgroup',
diff --git a/man/sd-bus.xml b/man/sd-bus.xml
index 9bd6dbcc66..48f4a2a84f 100644
--- a/man/sd-bus.xml
+++ b/man/sd-bus.xml
@@ -54,6 +54,7 @@
<citerefentry><refentrytitle>sd-bus-errors</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
<citerefentry><refentrytitle>sd_bus_error</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
<citerefentry><refentrytitle>sd_bus_error_add_map</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
+<citerefentry><refentrytitle>sd_bus_get_address</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
<citerefentry><refentrytitle>sd_bus_get_fd</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
<citerefentry><refentrytitle>sd_bus_get_method_call_timeout</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
<citerefentry><refentrytitle>sd_bus_get_n_queued_read</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
@@ -76,6 +77,7 @@
<citerefentry><refentrytitle>sd_bus_message_read_array</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
<citerefentry><refentrytitle>sd_bus_message_read_basic</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
<citerefentry><refentrytitle>sd_bus_message_rewind</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
+<citerefentry><refentrytitle>sd_bus_message_seal</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
<citerefentry><refentrytitle>sd_bus_message_set_destination</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
<citerefentry><refentrytitle>sd_bus_message_set_expect_reply</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
<citerefentry><refentrytitle>sd_bus_message_skip</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
@@ -84,18 +86,25 @@
<citerefentry><refentrytitle>sd_bus_new</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
<citerefentry><refentrytitle>sd_bus_path_encode</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
<citerefentry><refentrytitle>sd_bus_process</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
+<citerefentry><refentrytitle>sd_bus_reply_method_return</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
<citerefentry><refentrytitle>sd_bus_reply_method_error</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
<citerefentry><refentrytitle>sd_bus_request_name</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
+<citerefentry><refentrytitle>sd_bus_send</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
+<citerefentry><refentrytitle>sd_bus_set_address</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
<citerefentry><refentrytitle>sd_bus_set_connected_signal</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
<citerefentry><refentrytitle>sd_bus_set_description</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
<citerefentry><refentrytitle>sd_bus_set_method_call_timeout</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
<citerefentry><refentrytitle>sd_bus_set_sender</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
<citerefentry><refentrytitle>sd_bus_set_watch_bind</refentrytitle><manvolnum>3</manvolnum></citerefentry>
-<citerefentry><refentrytitle>sd_bus_set_close_on_exit</refentrytitle><manvolnum>3</manvolnum></citerefentry>
+<citerefentry><refentrytitle>sd_bus_set_close_on_exit</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
+<citerefentry><refentrytitle>sd_bus_slot_get_current_handler</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
+<citerefentry><refentrytitle>sd_bus_slot_get_current_message</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
+<citerefentry><refentrytitle>sd_bus_slot_get_current_userdata</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
<citerefentry><refentrytitle>sd_bus_slot_set_description</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
<citerefentry><refentrytitle>sd_bus_slot_set_destroy_callback</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
<citerefentry><refentrytitle>sd_bus_slot_set_floating</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
<citerefentry><refentrytitle>sd_bus_slot_set_userdata</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
+<citerefentry><refentrytitle>sd_bus_start</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
<citerefentry><refentrytitle>sd_bus_track_add_name</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
<citerefentry><refentrytitle>sd_bus_track_new</refentrytitle><manvolnum>3</manvolnum></citerefentry>
</literallayout>
diff --git a/man/sd_bus_call.xml b/man/sd_bus_call.xml
index 6555563793..f2d725a29f 100644
--- a/man/sd_bus_call.xml
+++ b/man/sd_bus_call.xml
@@ -128,14 +128,14 @@
<varlistentry>
<term><constant>-ENOTCONN</constant></term>
- <listitem><para>The bus parameter <parameter>bus</parameter> is <constant>NULL</constant>
- or the bus is not connected.</para></listitem>
+ <listitem><para>The input parameter <parameter>bus</parameter> is
+ <constant>NULL</constant> or the bus is not connected.</para></listitem>
</varlistentry>
<varlistentry>
<term><constant>-ECONNRESET</constant></term>
- <listitem><para>The client was disconnected while waiting for the response.
+ <listitem><para>The bus connection was closed while waiting for the response.
</para></listitem>
</varlistentry>
diff --git a/man/sd_bus_close.xml b/man/sd_bus_close.xml
index d81c593878..953f16ac34 100644
--- a/man/sd_bus_close.xml
+++ b/man/sd_bus_close.xml
@@ -19,6 +19,7 @@
<refnamediv>
<refname>sd_bus_close</refname>
<refname>sd_bus_flush</refname>
+ <refname>sd_bus_default_flush_close</refname>
<refpurpose>Close and flush a bus connection</refpurpose>
</refnamediv>
@@ -36,6 +37,11 @@
<funcdef>int <function>sd_bus_flush</function></funcdef>
<paramdef>sd_bus *<parameter>bus</parameter></paramdef>
</funcprototype>
+
+ <funcprototype>
+ <funcdef>void <function>sd_bus_default_flush_close</function></funcdef>
+ <paramdef>void</paramdef>
+ </funcprototype>
</funcsynopsis>
</refsynopsisdiv>
@@ -59,6 +65,15 @@
bus object so that it may be freed. Since these three operations are frequently done together a helper call
<citerefentry><refentrytitle>sd_bus_flush_close_unref</refentrytitle><manvolnum>3</manvolnum></citerefentry> is
provided that combines them into one.</para>
+
+ <para><function>sd_bus_default_flush_close()</function> is similar to
+ <function>sd_bus_flush_close_unref</function>, but does not take a bus pointer argument and instead
+ iterates over any of the "default" busses opened by
+ <citerefentry><refentrytitle>sd_bus_default</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
+ <citerefentry><refentrytitle>sd_bus_default_user</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
+ <citerefentry><refentrytitle>sd_bus_default_system</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
+ and similar calls. <function>sd_bus_default_flush_close()</function> is particularly useful to clean up
+ any busses opened using those calls before the program exits.</para>
</refsect1>
<refsect1>
diff --git a/man/sd_bus_default.xml b/man/sd_bus_default.xml
index 51c27f04ff..8532c2bf46 100644
--- a/man/sd_bus_default.xml
+++ b/man/sd_bus_default.xml
@@ -186,14 +186,14 @@
<para>Note that entering a container is a privileged operation, and will likely only
work for the root user on the remote machine.</para>
- <para><function>sd_bus_open_system_machine()</function> connects
- to the system bus in the specified <parameter>machine</parameter>,
- where <parameter>machine</parameter> is the name of a local
- container. See
- <citerefentry><refentrytitle>machinectl</refentrytitle><manvolnum>1</manvolnum></citerefentry>
- for more information about the "machine" concept. Note that
- connections into local containers are only available to privileged
- processes at this time.</para>
+ <para><function>sd_bus_open_system_machine()</function> connects to the system bus in the specified
+ <parameter>machine</parameter>, where <parameter>machine</parameter> is the name of a local
+ container. See
+ <citerefentry><refentrytitle>sd_bus_set_address</refentrytitle><manvolnum>3</manvolnum></citerefentry>
+ for a description of the address syntax, and
+ <citerefentry><refentrytitle>machinectl</refentrytitle><manvolnum>1</manvolnum></citerefentry> for more
+ information about the "machine" concept. Note that connections into local containers are only available
+ to privileged processes at this time.</para>
<para>These calls allocate a bus connection object and initiate
the connection to a well-known bus of some form. An alternative to
@@ -297,7 +297,7 @@
</varlistentry>
</variablelist>
- <para>In addition, any further connection-related errors may be by returned. See
+ <para>In addition, other connection-related errors may be returned. See
<citerefentry><refentrytitle>sd_bus_send</refentrytitle><manvolnum>3</manvolnum></citerefentry>.</para>
</refsect2>
</refsect1>
@@ -313,6 +313,7 @@
<citerefentry><refentrytitle>sd_bus_new</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
<citerefentry><refentrytitle>sd_bus_ref</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
<citerefentry><refentrytitle>sd_bus_unref</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
+ <citerefentry><refentrytitle>sd_bus_close</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
<citerefentry project='die-net'><refentrytitle>ssh</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
<citerefentry><refentrytitle>systemd-machined.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
<citerefentry><refentrytitle>machinectl</refentrytitle><manvolnum>1</manvolnum></citerefentry>
diff --git a/man/sd_bus_message_append.xml b/man/sd_bus_message_append.xml
index b87468e373..a67819e0d7 100644
--- a/man/sd_bus_message_append.xml
+++ b/man/sd_bus_message_append.xml
@@ -20,8 +20,7 @@
<refname>sd_bus_message_append</refname>
<refname>sd_bus_message_appendv</refname>
- <refpurpose>Attach fields to a D-Bus message based on a type
- string</refpurpose>
+ <refpurpose>Attach fields to a D-Bus message based on a type string</refpurpose>
</refnamediv>
<refsynopsisdiv>
@@ -36,10 +35,10 @@
</funcprototype>
<funcprototype>
- <funcdef>int sd_bus_message_appendv</funcdef>
- <paramdef>sd_bus_message *<parameter>m</parameter></paramdef>
- <paramdef>const char *<parameter>types</parameter></paramdef>
- <paramdef>va_list <parameter>ap</parameter></paramdef>
+ <funcdef>int sd_bus_message_appendv</funcdef>
+ <paramdef>sd_bus_message *<parameter>m</parameter></paramdef>
+ <paramdef>const char *<parameter>types</parameter></paramdef>
+ <paramdef>va_list <parameter>ap</parameter></paramdef>
</funcprototype>
</funcsynopsis>
@@ -48,60 +47,49 @@
<refsect1>
<title>Description</title>
- <para>The <function>sd_bus_message_append()</function> function
- appends a sequence of fields to the D-Bus message object
- <parameter>m</parameter>. The type string
- <parameter>types</parameter> describes the types of the field
- arguments that follow. For each type specified in the type string,
- one or more arguments need to be specified, in the same order as
- declared in the type string.</para>
-
- <para>The type string is composed of the elements shown in the
- table below. It contains zero or more single "complete types".
- Each complete type may be one of the basic types or a fully
- described container type. A container type may be a structure with
- the contained types, a variant, an array with its element type, or
- a dictionary entry with the contained types. The type string is
- <constant>NUL</constant>-terminated.</para>
-
- <para>In case of a basic type, one argument of the corresponding
- type is expected.</para>
-
- <para>A structure is denoted by a sequence of complete types
- between <literal>(</literal> and <literal>)</literal>. This
- sequence cannot be empty — it must contain at least one type.
- Arguments corresponding to this nested sequence follow the same
- rules as if they were not nested.</para>
-
- <para>A variant is denoted by <literal>v</literal>. Corresponding
- arguments must begin with a type string denoting a complete type,
- and following that, arguments corresponding to the specified type.
- </para>
+ <para>The <function>sd_bus_message_append()</function> function appends a sequence of fields to
+ the D-Bus message object <parameter>m</parameter>. The type string <parameter>types</parameter>
+ describes the types of the field arguments that follow. For each type specified in the type
+ string, one or more arguments need to be specified, in the same order as declared in the type
+ string.</para>
- <para>An array is denoted by <literal>a</literal> followed by a
- complete type. Corresponding arguments must begin with the number of
- entries in the array, followed by the entries themselves,
- matching the element type of the array.</para>
+ <para>The type string is composed of the elements shown in the table below. It contains zero or
+ more single "complete types". Each complete type may be one of the basic types or a fully
+ described container type. A container type may be a structure with the contained types, a
+ variant, an array with its element type, or a dictionary entry with the contained types. The
+ type string is <constant>NUL</constant>-terminated.</para>
- <para>A dictionary is an array of dictionary entries, denoted by
- <literal>a</literal> followed by a pair of complete types between
- <literal>{</literal> and <literal>}</literal>. The first of those
- types must be a basic type. Corresponding arguments must begin
- with the number of dictionary entries, followed by a pair of
- values for each entry matching the element type of
- the dictionary entries.</para>
+ <para>In case of a basic type, one argument of the corresponding type is expected.</para>
- <para>The <function>sd_bus_message_appendv()</function> is equivalent to the
- <function>sd_bus_message_append()</function>, except that it is called with
- a <literal>va_list</literal> instead of a variable number of arguments. This
- function does not call the <function>va_end()</function> macro. Because it
- invokes the <function>va_arg()</function> macro, the value of
- <parameter>ap</parameter> is undefined after the call.</para>
+ <para>A structure is denoted by a sequence of complete types between <literal>(</literal> and
+ <literal>)</literal>. This sequence cannot be empty — it must contain at least one type.
+ Arguments corresponding to this nested sequence follow the same rules as if they were not
+ nested.</para>
+
+ <para>A variant is denoted by <literal>v</literal>. Corresponding arguments must begin with a
+ type string denoting a complete type, and following that, arguments corresponding to the
+ specified type.</para>
+
+ <para>An array is denoted by <literal>a</literal> followed by a complete type. Corresponding
+ arguments must begin with the number of entries in the array, followed by the entries
+ themselves, matching the element type of the array.</para>
- <para>For further details on the D-Bus type system, please consult
- the <ulink
- url="http://dbus.freedesktop.org/doc/dbus-specification.html#type-system">D-Bus
- Specification</ulink>.</para>
+ <para>A dictionary is an array of dictionary entries, denoted by <literal>a</literal> followed
+ by a pair of complete types between <literal>{</literal> and <literal>}</literal>. The first of
+ those types must be a basic type. Corresponding arguments must begin with the number of
+ dictionary entries, followed by a pair of values for each entry matching the element type of the
+ dictionary entries.</para>
+
+ <para>The <function>sd_bus_message_appendv()</function> is equivalent to the
+ <function>sd_bus_message_append()</function>, except that it is called with a
+ <literal>va_list</literal> instead of a variable number of arguments. This function does not
+ call the <function>va_end()</function> macro. Because it invokes the
+ <function>va_arg()</function> macro, the value of <parameter>ap</parameter> is undefined after
+ the call.</para>
+
+ <para>For further details on the D-Bus type system, please consult the
+ <ulink url="http://dbus.freedesktop.org/doc/dbus-specification.html#type-system">D-Bus Specification</ulink>.
+ </para>
<table>
<title>Item type specifiers</title>
@@ -162,7 +150,6 @@
<constant>NULL</constant>, which is equivalent to an empty string. See
<citerefentry><refentrytitle>sd_bus_message_append_basic</refentrytitle><manvolnum>3</manvolnum></citerefentry>
for the precise interpretation of those and other types.</para>
-
</refsect1>
<refsect1>
@@ -205,12 +192,12 @@ sd_bus_message_append(m, "ynqiuxtd", y, n, q, i, u, x, t, d);</programlisting>
<para>Append a structure composed of a string and a D-Bus path:</para>
<programlisting>sd_bus_message_append(m, "(so)", "a string", "/a/path");
-</programlisting>
+ </programlisting>
<para>Append an array of UNIX file descriptors:</para>
<programlisting>sd_bus_message_append(m, "ah", 3, STDIN_FILENO, STDOUT_FILENO, STDERR_FILENO);
-</programlisting>
+ </programlisting>
<para>Append a variant, with the real type "g" (signature),
and value "sdbusisgood":</para>
@@ -227,8 +214,8 @@ sd_bus_message_append(m, "ynqiuxtd", y, n, q, i, u, x, t, d);</programlisting>
<refsect1>
<title>Return Value</title>
- <para>On success, these functions return 0 or a positive integer. On failure, they return a negative
- errno-style error code.</para>
+ <para>On success, these functions return a non-negative integer. On failure, they return a
+ negative errno-style error code.</para>
<xi:include href="sd_bus_message_append_basic.xml" xpointer="errors" />
</refsect1>
diff --git a/man/sd_bus_message_seal.xml b/man/sd_bus_message_seal.xml
new file mode 100644
index 0000000000..03783d9279
--- /dev/null
+++ b/man/sd_bus_message_seal.xml
@@ -0,0 +1,106 @@
+<?xml version='1.0'?>
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+ "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
+<!-- SPDX-License-Identifier: LGPL-2.1+ -->
+
+<refentry id="sd_bus_message_seal"
+ xmlns:xi="http://www.w3.org/2001/XInclude">
+
+ <refentryinfo>
+ <title>sd_bus_message_seal</title>
+ <productname>systemd</productname>
+ </refentryinfo>
+
+ <refmeta>
+ <refentrytitle>sd_bus_message_seal</refentrytitle>
+ <manvolnum>3</manvolnum>
+ </refmeta>
+
+ <refnamediv>
+ <refname>sd_bus_message_seal</refname>
+
+ <refpurpose>Prepare a D-Bus message for transmission</refpurpose>
+ </refnamediv>
+
+ <refsynopsisdiv>
+ <funcsynopsis>
+ <funcsynopsisinfo>#include &lt;systemd/sd-bus.h&gt;</funcsynopsisinfo>
+
+ <funcprototype>
+ <funcdef>int <function>sd_bus_message_seal</function></funcdef>
+ <paramdef>sd_bus_message *<parameter>m</parameter></paramdef>
+ <paramdef>uint64_t <parameter>cookie</parameter></paramdef>
+ <paramdef>uint64_t <parameter>timeout_usec</parameter></paramdef>
+ </funcprototype>
+ </funcsynopsis>
+ </refsynopsisdiv>
+
+ <refsect1>
+ <title>Description</title>
+
+ <para><function>sd_bus_message_seal()</function> finishes the message <parameter>m</parameter>
+ and prepares it for transmission using
+ <citerefentry><refentrytitle>sd_bus_send</refentrytitle><manvolnum>3</manvolnum></citerefentry>.
+ <parameter>cookie</parameter> specifies the identifier used to match the message reply to its
+ corresponding request. <parameter>timeout_usec</parameter> specifies the maximum time in
+ microseconds to wait for a reply to arrive.</para>
+
+ <para>Note that in most scenarios, it's not necessary to call this function directly.
+ <citerefentry><refentrytitle>sd_bus_call</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
+ <citerefentry><refentrytitle>sd_bus_call_async</refentrytitle><manvolnum>3</manvolnum></citerefentry> and
+ <citerefentry><refentrytitle>sd_bus_send</refentrytitle><manvolnum>3</manvolnum></citerefentry>
+ will seal any given messages if they have not been sealed yet.</para>
+ </refsect1>
+
+ <refsect1>
+ <title>Return Value</title>
+
+ <para>On success, this function returns a non-negative integer. On failure, it returns a
+ negative errno-style error code.</para>
+
+ <refsect2>
+ <title>Errors</title>
+
+ <para>Returned errors may indicate the following problems:</para>
+
+ <variablelist>
+ <varlistentry>
+ <term><constant>-EINVAL</constant></term>
+
+ <listitem><para>The <parameter>m</parameter> parameter is <constant>NULL</constant>.
+ </para></listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><constant>-EBADMSG</constant></term>
+
+ <listitem><para>The D-Bus message <parameter>m</parameter> has open containers.
+ </para></listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><constant>-ENOMSG</constant></term>
+
+ <listitem><para>The D-Bus message <parameter>m</parameter> is a reply but its type
+ signature does not match the return type signature of its corresponding member in the
+ object vtable.</para></listitem>
+ </varlistentry>
+ </variablelist>
+ </refsect2>
+ </refsect1>
+
+ <xi:include href="libsystemd-pkgconfig.xml" />
+
+ <refsect1>
+ <title>See Also</title>
+
+ <para>
+ <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
+ <citerefentry><refentrytitle>sd-bus</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
+ <citerefentry><refentrytitle>sd_bus_call</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
+ <citerefentry><refentrytitle>sd_bus_call_async</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
+ <citerefentry><refentrytitle>sd_bus_send</refentrytitle><manvolnum>3</manvolnum></citerefentry>
+ </para>
+ </refsect1>
+
+</refentry>
diff --git a/man/sd_bus_new.xml b/man/sd_bus_new.xml
index 7771a78d8b..ceca3350fc 100644
--- a/man/sd_bus_new.xml
+++ b/man/sd_bus_new.xml
@@ -87,14 +87,12 @@
or a related call, and then start the connection with
<citerefentry><refentrytitle>sd_bus_start</refentrytitle><manvolnum>3</manvolnum></citerefentry>.</para>
- <para>In most cases, it is a better idea to invoke
+ <para>In most cases, it is better to use
<citerefentry><refentrytitle>sd_bus_default_user</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
<citerefentry><refentrytitle>sd_bus_default_system</refentrytitle><manvolnum>3</manvolnum></citerefentry>
- or related calls instead of the more low-level
- <function>sd_bus_new()</function> and
- <function>sd_bus_start()</function>. The higher-level calls not
- only allocate a bus object but also start the connection to a
- well-known bus in a single function invocation.</para>
+ or related calls instead of the more low-level <function>sd_bus_new()</function> and
+ <function>sd_bus_start()</function>. The higher-level functions not only allocate a bus object but also
+ start the connection to a well-known bus in a single function call.</para>
<para><function>sd_bus_ref()</function> increases the reference
counter of <parameter>bus</parameter> by one.</para>
diff --git a/man/sd_bus_reply_method_error.xml b/man/sd_bus_reply_method_error.xml
index 5a6cef6bad..a1062ce2a9 100644
--- a/man/sd_bus_reply_method_error.xml
+++ b/man/sd_bus_reply_method_error.xml
@@ -22,7 +22,7 @@
<refname>sd_bus_reply_method_errno</refname>
<refname>sd_bus_reply_method_errnof</refname>
- <refpurpose>Reply with an error to a method call</refpurpose>
+ <refpurpose>Reply with an error to a D-Bus method call</refpurpose>
</refnamediv>
<refsynopsisdiv>
@@ -63,12 +63,12 @@
<refsect1>
<title>Description</title>
- <para>The <function>sd_bus_reply_method_error()</function> function sends an
- error reply to the <parameter>call</parameter> message. The error structure
- <parameter>e</parameter> specifies the error to send, and is used as described in
+ <para>The <function>sd_bus_reply_method_error()</function> function sends an error reply to the
+ <parameter>call</parameter> message. The error structure <parameter>e</parameter> specifies the
+ error to send, and is used as described in
<citerefentry><refentrytitle>sd_bus_message_new_error</refentrytitle><manvolnum>3</manvolnum></citerefentry>.
- If no reply is expected to <parameter>call</parameter>, this function returns
- success without sending reply.</para>
+ If no reply is expected to <parameter>call</parameter>, this function succeeds without sending a
+ reply.</para>
<para>The <function>sd_bus_reply_method_errorf()</function> is to
<function>sd_bus_reply_method_error()</function> what
@@ -89,8 +89,9 @@
<refsect1>
<title>Return Value</title>
- <para>These functions return 0 if the error reply was successfully sent or if
- none was expected, and a negative errno-style error code otherwise.</para>
+ <para>This function returns a non-negative integer if the error reply was successfully sent or
+ if <parameter>call</parameter> does not expect a reply. On failure, it returns a negative
+ errno-style error code.</para>
<refsect2>
<title>Errors</title>
@@ -101,15 +102,14 @@
<varlistentry>
<term><constant>-EINVAL</constant></term>
- <listitem><para>The call message <parameter>call</parameter> is
+ <listitem><para>The input parameter <parameter>call</parameter> is
<constant>NULL</constant>.</para>
- <para>Message <parameter>call</parameter> is not a method call message.
- </para>
+ <para>Message <parameter>call</parameter> is not a method call message.</para>
<para>Message <parameter>call</parameter> is not attached to a bus.</para>
- <para>The error <parameter>error</parameter> parameter to
+ <para>The error parameter <parameter>error</parameter> to
<function>sd_bus_reply_method_error</function> is not set, see
<citerefentry><refentrytitle>sd_bus_error_is_set</refentrytitle><manvolnum>3</manvolnum></citerefentry>.
</para>
@@ -137,7 +137,7 @@
</varlistentry>
</variablelist>
- <para>In addition, any error message returned by
+ <para>In addition, any error returned by
<citerefentry><refentrytitle>sd_bus_send</refentrytitle><manvolnum>1</manvolnum></citerefentry>
may be returned.</para>
</refsect2>
diff --git a/man/sd_bus_reply_method_return.xml b/man/sd_bus_reply_method_return.xml
new file mode 100644
index 0000000000..8669730d0f
--- /dev/null
+++ b/man/sd_bus_reply_method_return.xml
@@ -0,0 +1,113 @@
+<?xml version='1.0'?>
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+ "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
+<!-- SPDX-License-Identifier: LGPL-2.1+ -->
+
+<refentry id="sd_bus_reply_method_return"
+ xmlns:xi="http://www.w3.org/2001/XInclude">
+
+ <refentryinfo>
+ <title>sd_bus_reply_method_return</title>
+ <productname>systemd</productname>
+ </refentryinfo>
+
+ <refmeta>
+ <refentrytitle>sd_bus_reply_method_return</refentrytitle>
+ <manvolnum>3</manvolnum>
+ </refmeta>
+
+ <refnamediv>
+ <refname>sd_bus_reply_method_return</refname>
+
+ <refpurpose>Reply to a D-Bus method call</refpurpose>
+ </refnamediv>
+
+ <refsynopsisdiv>
+ <funcsynopsis>
+ <funcsynopsisinfo>#include &lt;systemd/sd-bus.h&gt;</funcsynopsisinfo>
+
+ <funcprototype>
+ <funcdef>int sd_bus_reply_method_return</funcdef>
+ <paramdef>sd_bus_message *<parameter>call</parameter></paramdef>
+ <paramdef>const char *<parameter>types</parameter></paramdef>
+ <paramdef>...</paramdef>
+ </funcprototype>
+ </funcsynopsis>
+ </refsynopsisdiv>
+
+ <refsect1>
+ <title>Description</title>
+
+ <para><function>sd_bus_reply_method_return()</function> sends a reply to the
+ <parameter>call</parameter> message. The type string <parameter>types</parameter> and the
+ arguments that follow it must adhere to the format described in
+ <citerefentry><refentrytitle>sd_bus_message_append</refentrytitle><manvolnum>3</manvolnum></citerefentry>.
+ If no reply is expected to <parameter>call</parameter>, this function succeeds without sending a
+ reply.</para>
+ </refsect1>
+
+ <refsect1>
+ <title>Return Value</title>
+
+ <para>On success, this function returns a non-negative integer. On failure, it returns a
+ negative errno-style error code.</para>
+
+ <refsect2>
+ <title>Errors</title>
+
+ <para>Returned errors may indicate the following problems:</para>
+
+ <variablelist>
+ <varlistentry>
+ <term><constant>-EINVAL</constant></term>
+
+ <listitem><para>The input parameter <parameter>call</parameter> is
+ <constant>NULL</constant>.</para>
+
+ <para>Message <parameter>call</parameter> is not a method call message.
+ </para>
+
+ <para>Message <parameter>call</parameter> is not attached to a bus.</para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><constant>-EPERM</constant></term>
+
+ <listitem><para>Message <parameter>call</parameter> has been sealed.
+ </para></listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><constant>-ENOTCONN</constant></term>
+
+ <listitem><para>The bus to which message <parameter>call</parameter> is attached is not
+ connected.</para></listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><constant>-ENOMEM</constant></term>
+
+ <listitem><para>Memory allocation failed.</para></listitem>
+ </varlistentry>
+ </variablelist>
+
+ <para>In addition, any error returned by
+ <citerefentry><refentrytitle>sd_bus_send</refentrytitle><manvolnum>1</manvolnum></citerefentry>
+ may be returned.</para>
+ </refsect2>
+ </refsect1>
+
+ <xi:include href="libsystemd-pkgconfig.xml" />
+
+ <refsect1>
+ <title>See Also</title>
+
+ <para>
+ <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
+ <citerefentry><refentrytitle>sd-bus</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
+ <citerefentry><refentrytitle>sd_bus_message_new_method_return</refentrytitle><manvolnum>3</manvolnum></citerefentry>
+ </para>
+ </refsect1>
+
+</refentry>
diff --git a/man/sd_bus_send.xml b/man/sd_bus_send.xml
new file mode 100644
index 0000000000..659fa2a86c
--- /dev/null
+++ b/man/sd_bus_send.xml
@@ -0,0 +1,136 @@
+<?xml version='1.0'?>
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+ "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
+<!-- SPDX-License-Identifier: LGPL-2.1+ -->
+
+<refentry id="sd_bus_send"
+ xmlns:xi="http://www.w3.org/2001/XInclude">
+
+ <refentryinfo>
+ <title>sd_bus_send</title>
+ <productname>systemd</productname>
+ </refentryinfo>
+
+ <refmeta>
+ <refentrytitle>sd_bus_send</refentrytitle>
+ <manvolnum>3</manvolnum>
+ </refmeta>
+
+ <refnamediv>
+ <refname>sd_bus_send</refname>
+
+ <refpurpose>Queue a D-Bus message for transfer</refpurpose>
+ </refnamediv>
+
+ <refsynopsisdiv>
+ <funcsynopsis>
+ <funcsynopsisinfo>#include &lt;systemd/sd-bus.h&gt;</funcsynopsisinfo>
+
+ <funcprototype>
+ <funcdef>int <function>sd_bus_send</function></funcdef>
+ <paramdef>sd_bus *<parameter>bus</parameter></paramdef>
+ <paramdef>sd_bus_message *<parameter>m</parameter></paramdef>
+ <paramdef>uint64_t *<parameter>cookie</parameter></paramdef>
+ </funcprototype>
+ </funcsynopsis>
+ </refsynopsisdiv>
+
+ <refsect1>
+ <title>Description</title>
+
+ <para><function>sd_bus_send()</function> queues the bus message object <parameter>m</parameter>
+ for transfer. If <parameter>bus</parameter> is <constant>NULL</constant>, the bus that
+ <parameter>m</parameter> is attached to is used. <parameter>bus</parameter> only needs to be set
+ when the message is sent to a different bus than the one it's attached to, for example when
+ forwarding messages. If the output parameter <parameter>cookie</parameter> is not
+ <constant>NULL</constant>, it is set to the message identifier. This value can later be used to
+ match incoming replies to their corresponding messages. If <parameter>cookie</parameter> is set
+ to <constant>NULL</constant> and the message is not sealed, <function>sd_bus_send()</function>
+ assumes the message <parameter>m</parameter> doesn't expect a reply and adds the necessary
+ headers to indicate this.</para>
+
+ <para>Note that in most scenarios, <function>sd_bus_send()</function> should not be called
+ directly. Instead, use higher level functions such as
+ <citerefentry><refentrytitle>sd_bus_call_method</refentrytitle><manvolnum>3</manvolnum></citerefentry> and
+ <citerefentry><refentrytitle>sd_bus_reply_method_return</refentrytitle><manvolnum>3</manvolnum></citerefentry>
+ which call <function>sd_bus_send()</function> internally.</para>
+ </refsect1>
+
+ <refsect1>
+ <title>Return Value</title>
+
+ <para>On success, this function returns a non-negative integer. On failure, it returns a
+ negative errno-style error code.</para>
+
+ <refsect2 id='errors'>
+ <title>Errors</title>
+
+ <para>Returned errors may indicate the following problems:</para>
+
+ <variablelist>
+ <varlistentry>
+ <term><constant>-EINVAL</constant></term>
+
+ <listitem><para>The input parameter <parameter>m</parameter> is <constant>NULL</constant>.
+ </para></listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><constant>-EOPNOTSUPP</constant></term>
+
+ <listitem><para>The bus connection does not support sending file descriptors.
+ </para></listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><constant>-ECHILD</constant></term>
+
+ <listitem><para>The bus connection was allocated in a parent process and is being reused
+ in a child process after <function>fork()</function>.</para></listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><constant>-ENOBUFS</constant></term>
+
+ <listitem><para>The bus connection's write queue is full.</para></listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><constant>-ENOTCONN</constant></term>
+
+ <listitem><para>The input parameter <parameter>bus</parameter> is
+ <constant>NULL</constant> or the bus is not connected.</para></listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><constant>-ECONNRESET</constant></term>
+
+ <listitem><para>The bus connection was closed while waiting for the response.
+ </para></listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><constant>-ENOMEM</constant></term>
+
+ <listitem><para>Memory allocation failed.</para></listitem>
+ </varlistentry>
+ </variablelist>
+ </refsect2>
+ </refsect1>
+
+ <xi:include href="libsystemd-pkgconfig.xml" />
+
+ <refsect1>
+ <title>See Also</title>
+
+ <para>
+ <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
+ <citerefentry><refentrytitle>sd-bus</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
+ <citerefentry><refentrytitle>sd_bus_call_method</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
+ <citerefentry><refentrytitle>sd_bus_message_set_destination</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
+ <citerefentry><refentrytitle>sd_bus_reply_method_return</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
+ <citerefentry><refentrytitle>sd_bus_send_to</refentrytitle><manvolnum>3</manvolnum></citerefentry>
+ </para>
+ </refsect1>
+
+</refentry>
diff --git a/man/sd_bus_set_address.xml b/man/sd_bus_set_address.xml
new file mode 100644
index 0000000000..b022741ff4
--- /dev/null
+++ b/man/sd_bus_set_address.xml
@@ -0,0 +1,176 @@
+<?xml version='1.0'?>
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+ "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
+<!-- SPDX-License-Identifier: LGPL-2.1+ -->
+
+<refentry id="sd_bus_set_address"
+ xmlns:xi="http://www.w3.org/2001/XInclude">
+
+ <refentryinfo>
+ <title>sd_bus_set_address</title>
+ <productname>systemd</productname>
+ </refentryinfo>
+
+ <refmeta>
+ <refentrytitle>sd_bus_set_address</refentrytitle>
+ <manvolnum>3</manvolnum>
+ </refmeta>
+
+ <refnamediv>
+ <refname>sd_bus_set_address</refname>
+ <refname>sd_bus_get_address</refname>
+
+ <refpurpose>Set or query the address of the bus connection</refpurpose>
+ </refnamediv>
+
+ <refsynopsisdiv>
+ <funcsynopsis>
+ <funcsynopsisinfo>#include &lt;systemd/sd-bus.h&gt;</funcsynopsisinfo>
+
+ <funcprototype>
+ <funcdef>int <function>sd_bus_set_address</function></funcdef>
+ <paramdef>sd_bus *<parameter>bus</parameter></paramdef>
+ <paramdef>const char* <parameter>address</parameter></paramdef>
+ </funcprototype>
+
+ <funcprototype>
+ <funcdef>int <function>sd_bus_get_address</function></funcdef>
+ <paramdef>sd_bus *<parameter>bus</parameter></paramdef>
+ <paramdef>const char** <parameter>address</parameter></paramdef>
+ </funcprototype>
+
+ </funcsynopsis>
+ </refsynopsisdiv>
+
+ <refsect1>
+ <title>Description</title>
+
+ <para><function>sd_bus_set_address()</function> configures a list of addresses of bus brokers to try to
+ connect to from a subsequent
+ <citerefentry><refentrytitle>sd_bus_start</refentrytitle><manvolnum>3</manvolnum></citerefentry> call.
+ The argument is a <literal>;</literal>-separated list of addresses to try. Each item must be one of the
+ following:
+ </para>
+
+ <itemizedlist>
+ <listitem>
+ <para>A unix socket address specified as
+ <literal>unix:guid=<replaceable>guid</replaceable>,path=<replaceable>path</replaceable></literal> or
+ <literal>unix:guid=<replaceable>guid</replaceable>,abstract=<replaceable>path</replaceable></literal>.
+ Exactly one of the <varname>path=</varname> and <varname>abstract=</varname> keys must be present,
+ while <varname>guid=</varname> is optional.</para>
+ </listitem>
+
+ <listitem>
+ <para>A TCP socket address specified as
+ <literal>tcp:[guid=<replaceable>guid</replaceable>,][host=<replaceable>host</replaceable>][,port=<replaceable>port</replaceable>][,family=<replaceable>family</replaceable>]</literal>.
+ One or both of the <varname>host=</varname> and <varname>port=</varname> keys must be present, while
+ the rest is optional. <replaceable>family</replaceable> may be either <option>ipv4</option> or
+ <option>ipv6</option>.</para>
+ </listitem>
+
+ <listitem>
+ <para>An executable to spawn specified as
+ <literal>unixexec:guid=<replaceable>guid</replaceable>,path=<replaceable>path</replaceable>,argv1=<replaceable>argument</replaceable>,argv2=<replaceable>argument</replaceable>,...</literal>.
+ The <varname>path=</varname> key must be present, while <varname>guid=</varname> is optional.</para>
+ </listitem>
+
+ <listitem>
+ <para>A machine (container) to connect to specified as
+ <literal>x-machine-unix:guid=<replaceable>guid</replaceable>,machine=<replaceable>machine</replaceable>,pid=<replaceable>pid</replaceable></literal>.
+ Exactly one of the <varname>machine=</varname> and <varname>pid=</varname> keys must be present,
+ while <varname>guid=</varname> is optional. <parameter>machine</parameter> is the name of a local
+ container. See
+ <citerefentry><refentrytitle>machinectl</refentrytitle><manvolnum>1</manvolnum></citerefentry> for
+ more information about the "machine" concept. <literal>machine=.host</literal> may be used to specify
+ the host machine. A connection to the standard system bus socket inside of the specified machine will
+ be created.</para>
+ </listitem>
+ </itemizedlist>
+
+ <para>In all cases, parameter <parameter>guid</parameter> is an identifier of the remote peer, in the
+ syntax accepted by
+ <citerefentry><refentrytitle>sd_id128_from_string</refentrytitle><manvolnum>3</manvolnum></citerefentry>.
+ If specified, the identifier returned by the peer after the connection is established will be checked and
+ the connection will be rejected in case of a mismatch.</para>
+
+ <para>Note that the addresses passed to <function>sd_bus_set_address()</function> may not be verified
+ immediately. If they are invalid, an error may be returned e.g. from a subsequent call to
+ <citerefentry><refentrytitle>sd_bus_start</refentrytitle><manvolnum>3</manvolnum></citerefentry>.
+ </para>
+
+ <para><function>sd_bus_get_address()</function> returns any previously set addresses. In addition to
+ being explicitly set by <function>sd_bus_set_address()</function>, the address will also be set
+ automatically by
+ <citerefentry><refentrytitle>sd_bus_open</refentrytitle><manvolnum>3</manvolnum></citerefentry> and
+ similar calls, based on environment variables or built-in defaults.</para>
+ </refsect1>
+
+ <refsect1>
+ <title>Return Value</title>
+
+ <para>On success, these functions return a non-negative integer. On failure, they return a negative
+ errno-style error code.</para>
+
+ <refsect2>
+ <title>Errors</title>
+
+ <para>Returned errors may indicate the following problems:</para>
+
+ <variablelist>
+ <varlistentry>
+ <term><constant>-EINVAL</constant></term>
+
+ <listitem><para>The input parameters <parameter>bus</parameter> or <parameter>address</parameter> are <constant>NULL</constant>.
+ </para></listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><constant>-ENOPKG</constant></term>
+
+ <listitem><para>The bus object <parameter>bus</parameter> could not be resolved.</para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><constant>-EPERM</constant></term>
+
+ <listitem><para>The input parameter <parameter>bus</parameter> is in a wrong state
+ (<function>sd_bus_set_address()</function> may only be called once on a newly-created bus object).</para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><constant>-ECHILD</constant></term>
+
+ <listitem><para>The bus object <parameter>bus</parameter> was created in a different
+ process.</para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><constant>-ENODATA</constant></term>
+
+ <listitem><para>The bus object <parameter>bus</parameter> has no address configured.</para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ </refsect2>
+ </refsect1>
+
+ <xi:include href="libsystemd-pkgconfig.xml" />
+
+ <refsect1>
+ <title>See Also</title>
+
+ <para>
+ <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
+ <citerefentry><refentrytitle>sd-bus</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
+ <citerefentry><refentrytitle>sd_bus_new</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
+ <citerefentry><refentrytitle>sd_bus_start</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
+ <citerefentry><refentrytitle>systemd-machined.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
+ <citerefentry><refentrytitle>machinectl</refentrytitle><manvolnum>1</manvolnum></citerefentry>
+ </para>
+ </refsect1>
+
+</refentry>
diff --git a/man/sd_bus_set_description.xml b/man/sd_bus_set_description.xml
index bee63cb74e..b855008eb8 100644
--- a/man/sd_bus_set_description.xml
+++ b/man/sd_bus_set_description.xml
@@ -19,7 +19,9 @@
<refname>sd_bus_set_description</refname>
<refname>sd_bus_get_description</refname>
<refname>sd_bus_set_anonymous</refname>
+ <refname>sd_bus_is_anonymous</refname>
<refname>sd_bus_set_trusted</refname>
+ <refname>sd_bus_is_trusted</refname>
<refname>sd_bus_set_allow_interactive_authorization</refname>
<refname>sd_bus_get_allow_interactive_authorization</refname>
@@ -49,12 +51,22 @@
</funcprototype>
<funcprototype>
+ <funcdef>int <function>sd_bus_is_anonymous</function></funcdef>
+ <paramdef>sd_bus *<parameter>bus</parameter></paramdef>
+ </funcprototype>
+
+ <funcprototype>
<funcdef>int <function>sd_bus_set_trusted</function></funcdef>
<paramdef>sd_bus *<parameter>bus</parameter></paramdef>
<paramdef>int <parameter>b</parameter></paramdef>
</funcprototype>
<funcprototype>
+ <funcdef>int <function>sd_bus_is_trusted</function></funcdef>
+ <paramdef>sd_bus *<parameter>bus</parameter></paramdef>
+ </funcprototype>
+
+ <funcprototype>
<funcdef>int <function>sd_bus_set_allow_interactive_authorization</function></funcdef>
<paramdef>sd_bus *<parameter>bus</parameter></paramdef>
<paramdef>int <parameter>b</parameter></paramdef>
@@ -75,7 +87,7 @@
and freed when the bus object is deallocated. The
<parameter>description</parameter> argument may be <constant>NULL</constant>, in
which case the description is unset. This function must be called before the bus
- has been started.</para>
+ is started.</para>
<para><function>sd_bus_get_description()</function> returns a description string
in <parameter>description</parameter>. This string may have been previously set
@@ -87,14 +99,20 @@
<para><function>sd_bus_set_anonymous()</function> enables or disables "anonymous
authentication", i.e. lack of authentication, of the bus peer. This function must
- be called before the bus has been started. See the <ulink
+ be called before the bus is started. See the <ulink
url="view-source:https://dbus.freedesktop.org/doc/dbus-specification.html#auth-mechanisms">Authentication
Mechanisms</ulink> section of the D-Bus specification for details.</para>
+ <para><function>sd_bus_is_anonymous()</function> returns true if the bus connection allows anonymous
+ authentication (in the sense described in previous paragraph).</para>
+
<para><function>sd_bus_set_trusted()</function> sets the "trusted" state on the
<parameter>bus</parameter> object. If true, all connections on the bus are
- trusted and access to all privileged and unprivileged methods is granted. This
- function must be called before the bus has been started.</para>
+ trusted and access to all privileged and unprivileged methods is granted. This
+ function must be called before the bus is started.</para>
+
+ <para><function>sd_bus_is_trusted()</function> returns true if the bus connection is trusted (in the
+ sense described in previous paragraph).</para>
<para><function>sd_bus_set_allow_interactive_authorization()</function>
enables or disables interactive authorization for method calls. If true,
diff --git a/man/sd_bus_set_method_call_timeout.xml b/man/sd_bus_set_method_call_timeout.xml
index 01857fdf20..006020aae7 100644
--- a/man/sd_bus_set_method_call_timeout.xml
+++ b/man/sd_bus_set_method_call_timeout.xml
@@ -96,8 +96,7 @@
<para>
<citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
<citerefentry><refentrytitle>sd-bus</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
- <citerefentry><refentrytitle>sd_bus_call</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
- <citerefentry><refentrytitle>sd_bus_message_seal</refentrytitle><manvolnum>3</manvolnum></citerefentry>
+ <citerefentry><refentrytitle>sd_bus_call</refentrytitle><manvolnum>3</manvolnum></citerefentry>
</para>
</refsect1>
diff --git a/man/sd_bus_slot_get_bus.xml b/man/sd_bus_slot_get_bus.xml
new file mode 100644
index 0000000000..ed3e55b057
--- /dev/null
+++ b/man/sd_bus_slot_get_bus.xml
@@ -0,0 +1,88 @@
+<?xml version='1.0'?>
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+ "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
+<!-- SPDX-License-Identifier: LGPL-2.1+ -->
+
+<refentry id="sd_bus_slot_get_bus" xmlns:xi="http://www.w3.org/2001/XInclude">
+ <refentryinfo>
+ <title>sd_bus_slot_get_bus</title>
+ <productname>systemd</productname>
+ </refentryinfo>
+
+ <refmeta>
+ <refentrytitle>sd_bus_slot_get_bus</refentrytitle>
+ <manvolnum>3</manvolnum>
+ </refmeta>
+
+ <refnamediv>
+ <refname>sd_bus_slot_get_bus</refname>
+ <refname>sd_bus_slot_get_current_handler</refname>
+ <refname>sd_bus_slot_get_current_message</refname>
+ <refname>sd_bus_slot_get_current_userdata</refname>
+
+ <refpurpose>Query information attached to a bus slot object</refpurpose>
+ </refnamediv>
+
+ <refsynopsisdiv>
+ <funcsynopsis>
+ <funcsynopsisinfo>#include &lt;systemd/sd-bus.h&gt;</funcsynopsisinfo>
+
+ <funcprototype>
+ <funcdef>sd_bus *<function>sd_bus_slot_get_bus</function></funcdef>
+ <paramdef>sd_bus_slot *<parameter>slot</parameter></paramdef>
+ </funcprototype>
+
+ <funcprototype>
+ <funcdef>sd_bus_message_handler_t <function>sd_bus_slot_get_current_handler</function>
+ </funcdef>
+ <paramdef>sd_bus_slot *<parameter>slot</parameter></paramdef>
+ </funcprototype>
+
+ <funcprototype>
+ <funcdef>sd_bus_message *<function>sd_bus_slot_get_current_message</function></funcdef>
+ <paramdef>sd_bus_slot *<parameter>slot</parameter></paramdef>
+ </funcprototype>
+
+ <funcprototype>
+ <funcdef>void *<function>sd_bus_slot_get_current_userdata</function></funcdef>
+ <paramdef>sd_bus_slot *<parameter>slot</parameter></paramdef>
+ </funcprototype>
+ </funcsynopsis>
+ </refsynopsisdiv>
+
+ <refsect1>
+ <title>Description</title>
+
+ <para><function>sd_bus_slot_get_bus()</function> returns the bus object that message
+ <parameter>slot</parameter> is attached to.</para>
+
+ <para><function>sd_bus_slot_get_current_handler()</function>,
+ <function>sd_bus_slot_get_current_message()</function> and
+ <function>sd_bus_slot_get_current_userdata()</function> return the current handler, message and
+ userdata respectively of the bus <parameter>slot</parameter> is attached to if we're currently
+ executing the callback associated with <parameter>slot</parameter>.</para>
+ </refsect1>
+
+ <refsect1>
+ <title>Return Value</title>
+
+ <para><function>sd_bus_slot_get_bus()</function> always returns the bus object.</para>
+
+ <para>On success, <function>sd_bus_slot_get_current_handler()</function>,
+ <function>sd_bus_slot_get_current_message()</function> and
+ <function>sd_bus_slot_get_current_userdata()</function> return the requested object. On failure,
+ they return <constant>NULL</constant>.</para>
+ </refsect1>
+
+ <xi:include href="libsystemd-pkgconfig.xml" />
+
+ <refsect1>
+ <title>See Also</title>
+
+ <para>
+ <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
+ <citerefentry><refentrytitle>sd-bus</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
+ </para>
+ </refsect1>
+
+</refentry>
diff --git a/man/sd_bus_slot_ref.xml b/man/sd_bus_slot_ref.xml
index 22b288bfcc..ef144ece6d 100644
--- a/man/sd_bus_slot_ref.xml
+++ b/man/sd_bus_slot_ref.xml
@@ -18,7 +18,6 @@
<refname>sd_bus_slot_ref</refname>
<refname>sd_bus_slot_unref</refname>
<refname>sd_bus_slot_unrefp</refname>
- <refname>sd_bus_slot_get_bus</refname>
<refpurpose>Create and destroy references to a bus slot object</refpurpose>
</refnamediv>
@@ -41,11 +40,6 @@
<funcdef>void <function>sd_bus_slot_unrefp</function></funcdef>
<paramdef>sd_bus_slot **<parameter>slotp</parameter></paramdef>
</funcprototype>
-
- <funcprototype>
- <funcdef>sd_bus *<function>sd_bus_slot_get_bus</function></funcdef>
- <paramdef>sd_bus_slot *<parameter>m</parameter></paramdef>
- </funcprototype>
</funcsynopsis>
</refsynopsisdiv>
@@ -72,11 +66,7 @@
execute no operation if the passed in bus object address is
<constant>NULL</constant>. <function>sd_bus_slot_unrefp()</function> will first dereference
its argument, which must not be <constant>NULL</constant>, and will execute no operation if
- <emphasis>that</emphasis> is <constant>NULL</constant>.
- </para>
-
- <para><function>sd_bus_slot_get_bus()</function> returns the bus object that message
- <parameter>slot</parameter> is attached to.</para>
+ <emphasis>that</emphasis> is <constant>NULL</constant>.</para>
</refsect1>
<refsect1>
@@ -85,8 +75,6 @@
<para><function>sd_bus_slot_ref()</function> always returns the argument.</para>
<para><function>sd_bus_slot_unref()</function> always returns <constant>NULL</constant>.</para>
-
- <para><function>sd_bus_slot_get_bus()</function> always returns the bus object.</para>
</refsect1>
<xi:include href="libsystemd-pkgconfig.xml" />
diff --git a/man/sd_bus_start.xml b/man/sd_bus_start.xml
new file mode 100644
index 0000000000..0be07f4777
--- /dev/null
+++ b/man/sd_bus_start.xml
@@ -0,0 +1,124 @@
+<?xml version='1.0'?>
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+ "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
+<!-- SPDX-License-Identifier: LGPL-2.1+ -->
+
+<refentry id="sd_bus_start"
+ xmlns:xi="http://www.w3.org/2001/XInclude">
+
+ <refentryinfo>
+ <title>sd_bus_start</title>
+ <productname>systemd</productname>
+ </refentryinfo>
+
+ <refmeta>
+ <refentrytitle>sd_bus_start</refentrytitle>
+ <manvolnum>3</manvolnum>
+ </refmeta>
+
+ <refnamediv>
+ <refname>sd_bus_start</refname>
+
+ <refpurpose>Initiate a bus connection to the D-bus broker daemon
+ </refpurpose>
+ </refnamediv>
+
+ <refsynopsisdiv>
+ <funcsynopsis>
+ <funcsynopsisinfo>#include &lt;systemd/sd-bus.h&gt;</funcsynopsisinfo>
+
+ <funcprototype>
+ <funcdef>int <function>sd_bus_start</function></funcdef>
+ <paramdef>sd_bus *<parameter>bus</parameter></paramdef>
+ </funcprototype>
+ </funcsynopsis>
+ </refsynopsisdiv>
+
+ <refsect1>
+ <title>Description</title>
+
+ <para><function>sd_bus_start()</function> connects an existing bus connection object to the D-Bus
+ broker daemon, usually
+ <citerefentry project='die-net'><refentrytitle>dbus-daemon</refentrytitle><manvolnum>1</manvolnum></citerefentry>
+ or
+ <citerefentry project='mankier'><refentrytitle>dbus-broker</refentrytitle><manvolnum>1</manvolnum></citerefentry>.
+ The mechanism to use for the connection must be configured before the call to
+ <function>sd_bus_start()</function>, using one of
+ <citerefentry><refentrytitle>sd_bus_set_address</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
+ <citerefentry><refentrytitle>sd_bus_set_fd</refentrytitle><manvolnum>3</manvolnum></citerefentry>, or
+ <citerefentry><refentrytitle>sd_bus_set_exec</refentrytitle><manvolnum>3</manvolnum></citerefentry>.
+ <function>sd_bus_start()</function> will open the connection socket or spawn the executable as
+ needed, and asynchronously start a <function>org.freedesktop.DBus.Hello()</function> call. The
+ answer to the Hello call will be processed later from
+ <citerefentry><refentrytitle>sd_bus_process</refentrytitle><manvolnum>3</manvolnum></citerefentry>. If
+ opening of the connection or queuing of the asynchronous call fail, the connection will be closed with
+ <citerefentry><refentrytitle>sd_bus_close</refentrytitle><manvolnum>3</manvolnum></citerefentry>.</para>
+
+ <para>In most cases, it is better to use
+ <citerefentry><refentrytitle>sd_bus_default_user</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
+ <citerefentry><refentrytitle>sd_bus_default_system</refentrytitle><manvolnum>3</manvolnum></citerefentry>
+ or related calls instead of the more low-level <function>sd_bus_new()</function> and
+ <function>sd_bus_start()</function>. The higher-level functions not only allocate a bus object but also
+ start the connection to a well-known bus in a single function call.</para>
+ </refsect1>
+
+ <refsect1>
+ <title>Return Value</title>
+
+ <para>On success, this function returns a non-negative integer. On failure, it returns a negative
+ errno-style error code.</para>
+
+ <refsect2 id='errors'>
+ <title>Errors</title>
+
+ <variablelist>
+ <varlistentry>
+ <term><constant>-EINVAL</constant></term>
+
+ <listitem><para>The input parameter <parameter>bus</parameter> is <constant>NULL</constant>.
+ </para></listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><constant>-ENOPKG</constant></term>
+
+ <listitem><para>Bus object <parameter>bus</parameter> could not be resolved.</para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><constant>-EPERM</constant></term>
+
+ <listitem><para>The input parameter <parameter>bus</parameter> is in a wrong state
+ (<function>sd_bus_start()</function> may only be called once on a newly-created bus object).</para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><constant>-ECHILD</constant></term>
+
+ <listitem><para>The bus object <parameter>bus</parameter> was created in a different
+ process.</para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+
+ <para>In addition, other connection-related errors may be returned. See
+ <citerefentry><refentrytitle>sd_bus_send</refentrytitle><manvolnum>3</manvolnum></citerefentry>.</para>
+ </refsect2>
+ </refsect1>
+
+ <xi:include href="libsystemd-pkgconfig.xml" />
+
+ <refsect1>
+ <title>See Also</title>
+
+ <para>
+ <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
+ <citerefentry><refentrytitle>sd-bus</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
+ <citerefentry><refentrytitle>sd_bus_default</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
+ <citerefentry><refentrytitle>sd_bus_call_async</refentrytitle><manvolnum>3</manvolnum></citerefentry>
+ </para>
+ </refsect1>
+
+</refentry>
diff --git a/man/sd_path_lookup.xml b/man/sd_path_lookup.xml
new file mode 100644
index 0000000000..68c6812ab1
--- /dev/null
+++ b/man/sd_path_lookup.xml
@@ -0,0 +1,215 @@
+<?xml version='1.0'?>
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+ "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
+<!-- SPDX-License-Identifier: LGPL-2.1+ -->
+
+<refentry id="sd_path_lookup" xmlns:xi="http://www.w3.org/2001/XInclude">
+
+ <refentryinfo>
+ <title>sd_path_lookup</title>
+ <productname>systemd</productname>
+ </refentryinfo>
+
+ <refmeta>
+ <refentrytitle>sd_path_lookup</refentrytitle>
+ <manvolnum>3</manvolnum>
+ </refmeta>
+
+ <refnamediv>
+ <refname>sd_path_lookup</refname>
+ <refname>sd_path_lookup_strv</refname>
+
+ <refpurpose>Query well-known file system paths</refpurpose>
+ </refnamediv>
+
+ <refsynopsisdiv>
+ <funcsynopsis>
+ <funcsynopsisinfo>#include &lt;systemd/sd-path.h&gt;</funcsynopsisinfo>
+
+ <!-- note: individual constants are not added as <refname>s, there's just too many -->
+
+ <funcsynopsisinfo><token>enum</token> {
+ <constant>SD_PATH_TEMPORARY</constant>,
+ <constant>SD_PATH_TEMPORARY_LARGE</constant>,
+
+ <constant>SD_PATH_SYSTEM_BINARIES</constant>,
+ <constant>SD_PATH_SYSTEM_INCLUDE</constant>,
+ <constant>SD_PATH_SYSTEM_LIBRARY_PRIVATE</constant>,
+ <constant>SD_PATH_SYSTEM_LIBRARY_ARCH</constant>,
+ <constant>SD_PATH_SYSTEM_SHARED</constant>,
+ <constant>SD_PATH_SYSTEM_CONFIGURATION_FACTORY</constant>,
+ <constant>SD_PATH_SYSTEM_STATE_FACTORY</constant>,
+
+ <constant>SD_PATH_SYSTEM_CONFIGURATION</constant>,
+ <constant>SD_PATH_SYSTEM_RUNTIME</constant>,
+ <constant>SD_PATH_SYSTEM_RUNTIME_LOGS</constant>,
+ <constant>SD_PATH_SYSTEM_STATE_PRIVATE</constant>,
+ <constant>SD_PATH_SYSTEM_STATE_LOGS</constant>,
+ <constant>SD_PATH_SYSTEM_STATE_CACHE</constant>,
+ <constant>SD_PATH_SYSTEM_STATE_SPOOL</constant>,
+
+ <constant>SD_PATH_USER_BINARIES</constant>,
+ <constant>SD_PATH_USER_LIBRARY_PRIVATE</constant>,
+ <constant>SD_PATH_USER_LIBRARY_ARCH</constant>,
+ <constant>SD_PATH_USER_SHARED</constant>,
+
+ <constant>SD_PATH_USER_CONFIGURATION</constant>,
+ <constant>SD_PATH_USER_RUNTIME</constant>,
+ <constant>SD_PATH_USER_STATE_CACHE</constant>,
+
+ <constant>SD_PATH_USER</constant>,
+ <constant>SD_PATH_USER_DOCUMENTS</constant>,
+ <constant>SD_PATH_USER_MUSIC</constant>,
+ <constant>SD_PATH_USER_PICTURES</constant>,
+ <constant>SD_PATH_USER_VIDEOS</constant>,
+ <constant>SD_PATH_USER_DOWNLOAD</constant>,
+ <constant>SD_PATH_USER_PUBLIC</constant>,
+ <constant>SD_PATH_USER_TEMPLATES</constant>,
+ <constant>SD_PATH_USER_DESKTOP</constant>,
+
+ <constant>SD_PATH_SEARCH_BINARIES</constant>,
+ <constant>SD_PATH_SEARCH_BINARIES_DEFAULT</constant>,
+ <constant>SD_PATH_SEARCH_LIBRARY_PRIVATE</constant>,
+ <constant>SD_PATH_SEARCH_LIBRARY_ARCH</constant>,
+ <constant>SD_PATH_SEARCH_SHARED</constant>,
+ <constant>SD_PATH_SEARCH_CONFIGURATION_FACTORY</constant>,
+ <constant>SD_PATH_SEARCH_STATE_FACTORY</constant>,
+ <constant>SD_PATH_SEARCH_CONFIGURATION</constant>,
+
+ <constant>SD_PATH_SYSTEMD_UTIL_DIR</constant>,
+ <constant>SD_PATH_SYSTEMD_SYSTEM_UNIT_DIR</constant>,
+ <constant>SD_PATH_SYSTEMD_SYSTEM_PRESET_DIR</constant>,
+ <constant>SD_PATH_SYSTEMD_USER_UNIT_DIR</constant>,
+ <constant>SD_PATH_SYSTEMD_USER_PRESET_DIR</constant>,
+ <constant>SD_PATH_SYSTEMD_SYSTEM_CONF_DIR</constant>,
+ <constant>SD_PATH_SYSTEMD_USER_CONF_DIR</constant>,
+ <constant>SD_PATH_SYSTEMD_SYSTEM_UNIT_PATH</constant>,
+ <constant>SD_PATH_SYSTEMD_USER_UNIT_PATH</constant>,
+ <constant>SD_PATH_SYSTEMD_SYSTEM_GENERATOR_DIR</constant>,
+ <constant>SD_PATH_SYSTEMD_USER_GENERATOR_DIR</constant>,
+ <constant>SD_PATH_SYSTEMD_SYSTEM_GENERATOR_PATH</constant>,
+ <constant>SD_PATH_SYSTEMD_USER_GENERATOR_PATH</constant>,
+ <constant>SD_PATH_SYSTEMD_SLEEP_DIR</constant>,
+ <constant>SD_PATH_SYSTEMD_SHUTDOWN_DIR</constant>,
+
+ <constant>SD_PATH_TMPFILES_DIR</constant>,
+ <constant>SD_PATH_SYSUSERS_DIR</constant>,
+ <constant>SD_PATH_SYSCTL_DIR</constant>,
+ <constant>SD_PATH_BINFMT_DIR</constant>,
+ <constant>SD_PATH_MODULES_LOAD_DIR</constant>,
+ <constant>SD_PATH_CATALOG_DIR</constant>,
+
+ <constant>SD_PATH_SYSTEMD_NETWORK_PATH</constant>,
+};</funcsynopsisinfo>
+
+ <funcprototype>
+ <funcdef>int <function>sd_path_lookup</function></funcdef>
+ <paramdef>uint64_t <parameter>type</parameter></paramdef>
+ <paramdef>const char *<parameter>suffix</parameter></paramdef>
+ <paramdef>char **<parameter>paths</parameter></paramdef>
+ </funcprototype>
+
+ <funcprototype>
+ <funcdef>int <function>sd_path_lookup_strv</function></funcdef>
+ <paramdef>uint64_t <parameter>type</parameter></paramdef>
+ <paramdef>const char *<parameter>suffix</parameter></paramdef>
+ <paramdef>char ***<parameter>paths</parameter></paramdef>
+ </funcprototype>
+ </funcsynopsis>
+ </refsynopsisdiv>
+
+ <refsect1>
+ <title>Description</title>
+
+ <para><function>sd_path_lookup()</function> and <function>sd_bus_path_lookup_strv()</function> return a
+ single path or set of file system paths specified by the argument <parameter>type</parameter>. In case of
+ <function>sd_path_lookup()</function> a single <constant>NUL</constant>-terminated string is returned.
+ When <parameter>type</parameter> specifies a set of paths, they are concatenated using
+ <literal>:</literal> as a separator (as is traditionally done for e.g. <varname>$PATH</varname> or
+ <varname>$LD_LIBRARY_PATH</varname>). In case of <function>sd_path_lookup_strv()</function> a
+ <constant>NULL</constant>-terminated array of strings is returned (strv). If suffix
+ <parameter>suffix</parameter> is given, it is concatenated to each of the paths after a slash
+ (<literal>/</literal>). All returned paths are absolute.</para>
+
+ <para>For paths which refer to user directories, the relevant XDG standard is followed, with support for
+ environment variables like <varname>$XDG_DOCUMENTS_DIR</varname>, <varname>$XDG_DESKTOP_DIR</varname>,
+ ..., and explicit configuration in <filename>/etc/xdg/user-dirs.conf</filename> or
+ <filename>${XDG_CONFIG_HOME}/user-dirs.dirs</filename>. See
+ <ulink url="https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html">
+ XDG Base Directory Specification</ulink> for details.</para>
+
+ <para><citerefentry><refentrytitle>systemd-path</refentrytitle><manvolnum>1</manvolnum></citerefentry> is
+ a wrapper around <function>sd_path_lookup()</function> and allows the same set of paths to be queried.
+ </para>
+ </refsect1>
+
+ <refsect1>
+ <title>Return Value</title>
+
+ <para>On success, <function>sd_path_lookup()</function> and <function>sd_path_lookup_strv()</function>
+ return a non-negative integer. On failure, a negative errno-style error number is returned by either
+ function.</para>
+
+ <para>The returned string or string array (strv) must be
+ <citerefentry project='man-pages'><refentrytitle>free</refentrytitle><manvolnum>3</manvolnum></citerefentry>'d by the
+ caller.</para>
+
+ <refsect2 id='errors'>
+ <title>Errors</title>
+
+ <para>Returned errors may indicate the following problems:</para>
+
+ <variablelist>
+ <varlistentry>
+ <term><constant>-EOPNOTSUPP</constant></term>
+
+ <listitem><para>Unknown identifier <parameter>type</parameter>.</para></listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><constant>-EINVAL</constant></term>
+
+ <listitem><para>Output argument is <constant>NULL</constant>.</para></listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><constant>-ENXIO</constant></term>
+
+ <listitem><para>Query failed because of an undefined environment variable (e.g. for
+ <constant>SD_PATH_USER_RUNTIME</constant> when <varname>$XDG_RUNTIME_DIR</varname> is not
+ defined).</para></listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><constant>-ENOMEM</constant></term>
+
+ <listitem><para>Memory allocation failed.</para></listitem>
+ </varlistentry>
+ </variablelist>
+ </refsect2>
+ </refsect1>
+
+ <refsect1>
+ <title>Examples</title>
+
+ <refsect2>
+ <title>Look up the location of ~/Documents</title>
+
+ <programlisting><xi:include href="path-documents.c" parse="text" /></programlisting>
+ <para>Note that the default answer of <filename index='false'>$HOME/Documents</filename> may be
+ overridden by <filename index='false'>user-dirs.conf</filename> or
+ <varname>$XDG_DOCUMENTS_DIR</varname>.</para>
+ </refsect2>
+ </refsect1>
+
+ <xi:include href="libsystemd-pkgconfig.xml" />
+
+ <refsect1>
+ <title>See Also</title>
+
+ <para>
+ <citerefentry><refentrytitle>systemd-path</refentrytitle><manvolnum>1</manvolnum></citerefentry>
+ </para>
+ </refsect1>
+
+</refentry>
diff --git a/man/sysctl.d.xml b/man/sysctl.d.xml
index 4df71e21eb..2735cb10dd 100644
--- a/man/sysctl.d.xml
+++ b/man/sysctl.d.xml
@@ -32,7 +32,7 @@ key.middle/part/with/dots.foo = 123
-key.that.will.not.fail = value
key.pattern.*.with.glob = whatever
-key.pattern.excluded.with.glob
-key.pattern.overriden.with.glob = custom
+key.pattern.overridden.with.glob = custom
</programlisting>
</refsynopsisdiv>
diff --git a/man/systemd.network.xml b/man/systemd.network.xml
index b13fcd1893..4b2e8b8614 100644
--- a/man/systemd.network.xml
+++ b/man/systemd.network.xml
@@ -1386,6 +1386,7 @@
read via <function>sd_network_link_get_sip_servers()</function> function.</para>
</listitem>
</varlistentry>
+
<varlistentry>
<term><varname>UseMTU=</varname></term>
<listitem>
@@ -1635,7 +1636,22 @@
<varlistentry>
<term><varname>SendOption=</varname></term>
<listitem>
- <para>Send an arbitrary option in the DHCPv4 request. Takes a DHCP option number, data type
+ <para>Send an arbitrary raw option in the DHCPv4 request. Takes a DHCP option number, data type
+ and data separated with a colon
+ (<literal><replaceable>option</replaceable>:<replaceable>type</replaceable>:<replaceable>value</replaceable></literal>).
+ The option number must be an integer in the range 1..254. The type takes one of <literal>uint8</literal>,
+ <literal>uint16</literal>, <literal>uint32</literal>, <literal>ipv4address</literal>, or
+ <literal>string</literal>. Special characters in the data string may be escaped using
+ <ulink url="https://en.wikipedia.org/wiki/Escape_sequences_in_C#Table_of_escape_sequences">C-style
+ escapes</ulink>. This setting can be specified multiple times. If an empty string is specified,
+ then all options specified earlier are cleared. Defaults to unset.</para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><varname>SendVendorOption=</varname></term>
+ <listitem>
+ <para>Send an arbitrary vendor option in the DHCPv4 request. Takes a DHCP option number, data type
and data separated with a colon
(<literal><replaceable>option</replaceable>:<replaceable>type</replaceable>:<replaceable>value</replaceable></literal>).
The option number must be an integer in the range 1..254. The type takes one of <literal>uint8</literal>,
@@ -1889,6 +1905,15 @@
</varlistentry>
<varlistentry>
+ <term><varname>POP3Servers=</varname></term>
+
+ <listitem><para>Similar to the <varname>DNS=</varname> settings described above, these
+ settings configure whether and what POP3 server information shall be emitted as part of
+ the DHCP lease. The same syntax, propagation semantics and defaults apply as for
+ <varname>DNS=</varname>.</para></listitem>
+ </varlistentry>
+
+ <varlistentry>
<term><varname>EmitRouter=</varname></term>
<listitem><para>Similar to the <varname>EmitDNS=</varname>
@@ -1926,6 +1951,20 @@
</listitem>
</varlistentry>
+ <varlistentry>
+ <term><varname>SendVendorOption=</varname></term>
+ <listitem>
+ <para>Send a vendor option with value via DHCPv4 server. Takes a DHCP option number, data type
+ and data (<literal><replaceable>option</replaceable>:<replaceable>type</replaceable>:<replaceable>value</replaceable></literal>).
+ The option number is an integer in the range 1..254. The type takes one of <literal>uint8</literal>,
+ <literal>uint16</literal>, <literal>uint32</literal>, <literal>ipv4address</literal>, or
+ <literal>string</literal>. Special characters in the data string may be escaped using
+ <ulink url="https://en.wikipedia.org/wiki/Escape_sequences_in_C#Table_of_escape_sequences">C-style
+ escapes</ulink>. This setting can be specified multiple times. If an empty string is specified,
+ then all options specified earlier are cleared. Defaults to unset.</para>
+ </listitem>
+ </varlistentry>
+
</variablelist>
</refsect1>
diff --git a/man/systemd.service.xml b/man/systemd.service.xml
index e178724c55..17e446e203 100644
--- a/man/systemd.service.xml
+++ b/man/systemd.service.xml
@@ -217,8 +217,7 @@
this notification message has been sent. If this option is used, <varname>NotifyAccess=</varname> (see
below) should be set to open access to the notification socket provided by systemd. If
<varname>NotifyAccess=</varname> is missing or set to <option>none</option>, it will be forcibly set to
- <option>main</option>. Note that currently <varname>Type=</varname><option>notify</option> will not work if
- used in combination with <varname>PrivateNetwork=</varname><option>yes</option>.</para></listitem>
+ <option>main</option></para></listitem>.
<listitem><para>Behavior of <option>idle</option> is very similar to <option>simple</option>; however,
actual execution of the service program is delayed until all active jobs are dispatched. This may be used
diff --git a/meson.build b/meson.build
index 28042f0ae6..fb90077563 100644
--- a/meson.build
+++ b/meson.build
@@ -39,13 +39,12 @@ conf.set_quoted('RELATIVE_SOURCE_PATH', relative_source_path)
want_ossfuzz = get_option('oss-fuzz')
want_libfuzzer = get_option('llvm-fuzz')
-want_fuzzbuzz = get_option('fuzzbuzz')
-if want_ossfuzz + want_libfuzzer + want_fuzzbuzz > 1
- error('only one of oss-fuzz, llvm-fuzz or fuzzbuzz can be specified')
+if want_ossfuzz + want_libfuzzer > 1
+ error('only one of oss-fuzz or llvm-fuzz can be specified')
endif
skip_deps = want_ossfuzz or want_libfuzzer
-fuzzer_build = want_ossfuzz or want_libfuzzer or want_fuzzbuzz
+fuzzer_build = want_ossfuzz or want_libfuzzer
#####################################################################
@@ -199,7 +198,7 @@ memory_accounting_default = get_option('memory-accounting-default')
status_unit_format_default = get_option('status-unit-format-default')
conf.set_quoted('PKGSYSCONFDIR', pkgsysconfdir)
-conf.set_quoted('SYSTEM_CONFIG_UNIT_PATH', join_paths(pkgsysconfdir, 'system'))
+conf.set_quoted('SYSTEM_CONFIG_UNIT_DIR', join_paths(pkgsysconfdir, 'system'))
conf.set_quoted('SYSTEM_DATA_UNIT_PATH', systemunitdir)
conf.set_quoted('SYSTEM_SYSVINIT_PATH', sysvinit_path)
conf.set_quoted('SYSTEM_SYSVRCND_PATH', sysvrcnd_path)
@@ -207,8 +206,8 @@ conf.set_quoted('RC_LOCAL_SCRIPT_PATH_START', get_option('rc-loc
conf.set('ANSI_OK_COLOR', 'ANSI_' + get_option('ok-color').underscorify().to_upper())
-conf.set_quoted('USER_CONFIG_UNIT_PATH', join_paths(pkgsysconfdir, 'user'))
-conf.set_quoted('USER_DATA_UNIT_PATH', userunitdir)
+conf.set_quoted('USER_CONFIG_UNIT_DIR', join_paths(pkgsysconfdir, 'user'))
+conf.set_quoted('USER_DATA_UNIT_DIR', userunitdir)
conf.set_quoted('CERTIFICATE_ROOT', get_option('certificate-root'))
conf.set_quoted('CATALOG_DATABASE', join_paths(catalogstatedir, 'database'))
conf.set_quoted('SYSTEMD_CGROUP_AGENT_PATH', join_paths(rootlibexecdir, 'systemd-cgroups-agent'))
@@ -224,10 +223,10 @@ conf.set_quoted('ROOTPREFIX', rootprefixdir)
conf.set_quoted('RANDOM_SEED_DIR', randomseeddir)
conf.set_quoted('RANDOM_SEED', join_paths(randomseeddir, 'random-seed'))
conf.set_quoted('SYSTEMD_CRYPTSETUP_PATH', join_paths(rootlibexecdir, 'systemd-cryptsetup'))
-conf.set_quoted('SYSTEM_GENERATOR_PATH', systemgeneratordir)
-conf.set_quoted('USER_GENERATOR_PATH', usergeneratordir)
-conf.set_quoted('SYSTEM_ENV_GENERATOR_PATH', systemenvgeneratordir)
-conf.set_quoted('USER_ENV_GENERATOR_PATH', userenvgeneratordir)
+conf.set_quoted('SYSTEM_GENERATOR_DIR', systemgeneratordir)
+conf.set_quoted('USER_GENERATOR_DIR', usergeneratordir)
+conf.set_quoted('SYSTEM_ENV_GENERATOR_DIR', systemenvgeneratordir)
+conf.set_quoted('USER_ENV_GENERATOR_DIR', userenvgeneratordir)
conf.set_quoted('SYSTEM_SHUTDOWN_PATH', systemshutdowndir)
conf.set_quoted('SYSTEM_SLEEP_PATH', systemsleepdir)
conf.set_quoted('SYSTEMD_KBD_MODEL_MAP', join_paths(pkgdatadir, 'kbd-model-map'))
@@ -325,8 +324,6 @@ if want_libfuzzer
endif
elif want_ossfuzz
fuzzing_engine = meson.get_compiler('cpp').find_library('FuzzingEngine')
-elif want_fuzzbuzz
- fuzzing_engine = meson.get_compiler('cpp').find_library(get_option('fuzzbuzz-engine'), dirs: get_option('fuzzbuzz-engine-dir'))
endif
# Those generate many false positives, and we do not want to change the code to
@@ -3115,7 +3112,7 @@ foreach tuple : fuzzers
incs = tuple.length() >= 5 ? tuple[4] : includes
link_args = []
- if want_ossfuzz or want_fuzzbuzz
+ if want_ossfuzz
dependencies += fuzzing_engine
elif want_libfuzzer
if fuzzing_engine.found()
@@ -3127,10 +3124,6 @@ foreach tuple : fuzzers
sources += 'src/fuzz/fuzz-main.c'
endif
- if want_fuzzbuzz
- sources += 'src/fuzz/fuzzer-entry-point.c'
- endif
-
name = sources[0].split('/')[-1].split('.')[0]
fuzzer_exes += executable(
diff --git a/meson_options.txt b/meson_options.txt
index 4988d41ff3..d1c752fda2 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -354,9 +354,3 @@ option('oss-fuzz', type : 'boolean', value : 'false',
description : 'build against oss-fuzz')
option('llvm-fuzz', type : 'boolean', value : 'false',
description : 'build against LLVM libFuzzer')
-option('fuzzbuzz', type : 'boolean', value : 'false',
- description : 'build against FuzzBuzz')
-option('fuzzbuzz-engine', type : 'string',
- description : 'the name of the FuzzBuzz fuzzing engine')
-option('fuzzbuzz-engine-dir', type : 'string',
- description : 'the directory where the FuzzBuzz fuzzing engine is')
diff --git a/po/uk.po b/po/uk.po
index c2902797db..aca1cf735c 100644
--- a/po/uk.po
+++ b/po/uk.po
@@ -7,8 +7,8 @@ msgid ""
msgstr ""
"Project-Id-Version: systemd master\n"
"Report-Msgid-Bugs-To: https://github.com/systemd/systemd/issues\n"
-"POT-Creation-Date: 2020-01-30 15:31+0000\n"
-"PO-Revision-Date: 2020-02-07 12:37+0200\n"
+"POT-Creation-Date: 2020-03-22 04:04+0000\n"
+"PO-Revision-Date: 2020-03-25 18:40+0200\n"
"Last-Translator: Yuri Chornoivan <yurchor@ukr.net>\n"
"Language-Team: Ukrainian <kde-i18n-uk@kde.org>\n"
"Language: uk\n"
@@ -94,8 +94,8 @@ msgstr "Перевірка реєстраційних даних для дост
msgid ""
"Authentication is required to check credentials against a user's home area."
msgstr ""
-"Для перевірки реєстраційних даних для доступу до домашньої теки користувача"
-" слід пройти розпізнавання."
+"Для перевірки реєстраційних даних для доступу до домашньої теки користувача "
+"слід пройти розпізнавання."
#: src/home/org.freedesktop.home1.policy:43
msgid "Update a home area"
@@ -119,10 +119,11 @@ msgid "Change password of a home area"
msgstr "Зміна пароля до домашньої теки"
#: src/home/org.freedesktop.home1.policy:64
-msgid "Authentication is required to change the password of a user's home area."
+msgid ""
+"Authentication is required to change the password of a user's home area."
msgstr ""
-"Для зміни пароля для доступу до домашньої теки користувача слід пройти"
-" розпізнавання."
+"Для зміни пароля для доступу до домашньої теки користувача слід пройти "
+"розпізнавання."
#: src/hostname/org.freedesktop.hostname1.policy:20
msgid "Set host name"
@@ -345,8 +346,7 @@ msgid "Flush device to seat attachments"
msgstr "Очисний пристрій для під'єднань до місця"
#: src/login/org.freedesktop.login1.policy:149
-msgid ""
-"Authentication is required to reset how devices are attached to seats."
+msgid "Authentication is required to reset how devices are attached to seats."
msgstr ""
"Потрібна автентифікація, щоб перезапустити спосіб під'єднання до місць."
@@ -375,8 +375,8 @@ msgstr "Вимкнути систему, коли програми намага
#: src/login/org.freedesktop.login1.policy:181
msgid ""
-"Authentication is required to power off the system while an application "
-"is inhibiting this."
+"Authentication is required to power off the system while an application is "
+"inhibiting this."
msgstr ""
"Потрібна автентифікація, щоб вимкнути систему, коли програми намагаються "
"перешкодити цьому."
@@ -395,8 +395,8 @@ msgstr "Перезавантажити, якщо інші користувачі
#: src/login/org.freedesktop.login1.policy:203
msgid ""
-"Authentication is required to reboot the system while other users are "
-"logged in."
+"Authentication is required to reboot the system while other users are logged "
+"in."
msgstr ""
"Потрібна автентифікація, щоб перезапустити систему, коли інші користувачі в "
"ній."
@@ -407,8 +407,8 @@ msgstr "Перезапустити систему, коли програми н
#: src/login/org.freedesktop.login1.policy:214
msgid ""
-"Authentication is required to reboot the system while an application "
-"is inhibiting this."
+"Authentication is required to reboot the system while an application is "
+"inhibiting this."
msgstr ""
"Потрібна автентифікація, щоб перезапустити систему, коли програми "
"намагаються перешкодити цьому."
@@ -427,8 +427,8 @@ msgstr "Зупинити систему, коли інші користувач
#: src/login/org.freedesktop.login1.policy:236
msgid ""
-"Authentication is required to halt the system while other users are "
-"logged in."
+"Authentication is required to halt the system while other users are logged "
+"in."
msgstr ""
"Потрібна автентифікація, щоб зупинити систему, коли інші користувачі в ній."
@@ -438,10 +438,11 @@ msgstr "Зупинити систему, коли програми намага
#: src/login/org.freedesktop.login1.policy:247
msgid ""
-"Authentication is required to halt the system while an application asked "
-"to inhibit it."
+"Authentication is required to halt the system while an application is "
+"inhibiting this."
msgstr ""
-"Потрібна автентифікація, щоб зупинити систему, коли програми намагаються "
+"Потрібна автентифікація, щоб зупинити систему, коли програма"
+" намагається "
"перешкодити цьому."
#: src/login/org.freedesktop.login1.policy:257
@@ -470,8 +471,8 @@ msgstr "Призупинити систему, коли програми нам
#: src/login/org.freedesktop.login1.policy:279
msgid ""
-"Authentication is required to suspend the system while an application "
-"is inhibiting this."
+"Authentication is required to suspend the system while an application is "
+"inhibiting this."
msgstr ""
"Потрібна автентифікація, щоб призупинити систему, коли програми намагаються "
"перешкодити цьому."
@@ -501,8 +502,8 @@ msgstr "Приспати систему, коли програми намага
#: src/login/org.freedesktop.login1.policy:311
msgid ""
-"Authentication is required to hibernate the system while an application "
-"is inhibiting this."
+"Authentication is required to hibernate the system while an application is "
+"inhibiting this."
msgstr ""
"Потрібна автентифікація, щоб приспати систему, коли програми намагаються "
"перешкодити цьому."
@@ -512,8 +513,7 @@ msgid "Manage active sessions, users and seats"
msgstr "Керувати сеансами, користувачами і робочими місцями"
#: src/login/org.freedesktop.login1.policy:322
-msgid ""
-"Authentication is required to manage active sessions, users and seats."
+msgid "Authentication is required to manage active sessions, users and seats."
msgstr ""
"Потрібна автентифікація, щоб керувати сеансами, користувачами і робочими "
"місцями."
@@ -767,26 +767,35 @@ msgid "Authentication is required to reset DNS settings."
msgstr "Для скидання параметрів DNS до типових слід пройти розпізнавання."
#: src/network/org.freedesktop.network1.policy:143
+msgid "DHCP server sends force renew message"
+msgstr "Сервер DHCP надсилає повідомлення щодо примусового оновлення"
+
+#: src/network/org.freedesktop.network1.policy:144
+msgid "Authentication is required to send force renew message."
+msgstr ""
+"Потрібна автентифікація, щоб надіслати повідомлення щодо примусового оновлення"
+
+#: src/network/org.freedesktop.network1.policy:154
msgid "Renew dynamic addresses"
msgstr "Оновлення динамічних адрес"
-#: src/network/org.freedesktop.network1.policy:144
+#: src/network/org.freedesktop.network1.policy:155
msgid "Authentication is required to renew dynamic addresses."
msgstr "Для оновлення динамічних адрес слід пройти розпізнавання."
-#: src/network/org.freedesktop.network1.policy:154
+#: src/network/org.freedesktop.network1.policy:165
msgid "Reload network settings"
msgstr "Перезавантаження параметрів мережі"
-#: src/network/org.freedesktop.network1.policy:155
+#: src/network/org.freedesktop.network1.policy:166
msgid "Authentication is required to reload network settings."
msgstr "Для перезавантаження параметрів мережі слід пройти розпізнавання."
-#: src/network/org.freedesktop.network1.policy:165
+#: src/network/org.freedesktop.network1.policy:176
msgid "Reconfigure network interface"
msgstr "Переналаштування інтерфейсу мережі"
-#: src/network/org.freedesktop.network1.policy:166
+#: src/network/org.freedesktop.network1.policy:177
msgid "Authentication is required to reconfigure network interface."
msgstr "Для зміни налаштувань інтерфейсу мережі слід пройти розпізнавання."
@@ -842,8 +851,8 @@ msgstr "Повернення до початкових параметрів ви
#: src/resolve/org.freedesktop.resolve1.policy:133
msgid "Authentication is required to reset name resolution settings."
msgstr ""
-"Для повернення до початкових параметрів визначення назв вузлів за адресами"
-" слід пройти розпізнавання."
+"Для повернення до початкових параметрів визначення назв вузлів за адресами "
+"слід пройти розпізнавання."
#: src/timedate/org.freedesktop.timedate1.policy:22
msgid "Set system time"
@@ -885,38 +894,38 @@ msgstr ""
"Потрібна автентифікація, щоб контролювати, чи синхронізування часу через "
"мережу запущено."
-#: src/core/dbus-unit.c:355
+#: src/core/dbus-unit.c:356
msgid "Authentication is required to start '$(unit)'."
msgstr "Потрібна автентифікація, щоб запустити «$(unit)»."
-#: src/core/dbus-unit.c:356
+#: src/core/dbus-unit.c:357
msgid "Authentication is required to stop '$(unit)'."
msgstr "Потрібна автентифікація, щоб зупинити «$(unit)»."
-#: src/core/dbus-unit.c:357
+#: src/core/dbus-unit.c:358
msgid "Authentication is required to reload '$(unit)'."
msgstr "Потрібна автентифікація, щоб перезавантажити «$(unit)»."
-#: src/core/dbus-unit.c:358 src/core/dbus-unit.c:359
+#: src/core/dbus-unit.c:359 src/core/dbus-unit.c:360
msgid "Authentication is required to restart '$(unit)'."
msgstr "Потрібна автентифікація, щоб перезапустити «$(unit)»."
-#: src/core/dbus-unit.c:531
+#: src/core/dbus-unit.c:532
msgid ""
"Authentication is required to send a UNIX signal to the processes of "
"'$(unit)'."
msgstr ""
"Потрібна автентифікація, щоб надіслати сигнал UNIX до процесів «$(unit)»."
-#: src/core/dbus-unit.c:562
+#: src/core/dbus-unit.c:563
msgid "Authentication is required to reset the \"failed\" state of '$(unit)'."
msgstr "Потрібна автентифікація, щоб скинути «пошкоджений» стан з «$(unit)»."
-#: src/core/dbus-unit.c:595
+#: src/core/dbus-unit.c:596
msgid "Authentication is required to set properties on '$(unit)'."
msgstr "Потрібна автентифікація, щоб вказати властивості на «$(unit)»."
-#: src/core/dbus-unit.c:704
+#: src/core/dbus-unit.c:705
msgid ""
"Authentication is required to delete files and directories associated with "
"'$(unit)'."
diff --git a/shell-completion/zsh/_machinectl b/shell-completion/zsh/_machinectl
index 5ffb7e8b9f..5955c765aa 100644
--- a/shell-completion/zsh/_machinectl
+++ b/shell-completion/zsh/_machinectl
@@ -28,6 +28,7 @@
"start:Start container as a service"
"stop:Stop container (equal to poweroff)"
"login:Get a login prompt on a VM/container"
+ "shell:Invoke a shell (or other command) in a container"
"enable:Enable automatic container start at boot"
"disable:Disable automatic container start at boot"
"poweroff:Power off one or more VMs/containers"
diff --git a/src/basic/capability-util.c b/src/basic/capability-util.c
index 93237646cc..caffda62af 100644
--- a/src/basic/capability-util.c
+++ b/src/basic/capability-util.c
@@ -107,6 +107,10 @@ int capability_ambient_set_apply(uint64_t set, bool also_inherit) {
unsigned long i;
int r;
+ /* Check that we can use PR_CAP_AMBIENT or quit early. */
+ if (!ambient_capabilities_supported())
+ return 0;
+
/* Add the capabilities to the ambient set. */
if (also_inherit) {
diff --git a/src/basic/cgroup-util.c b/src/basic/cgroup-util.c
index 489a155b48..be73cfa3f0 100644
--- a/src/basic/cgroup-util.c
+++ b/src/basic/cgroup-util.c
@@ -37,6 +37,7 @@
#include "strv.h"
#include "unit-name.h"
#include "user-util.h"
+#include "xattr-util.h"
static int cg_enumerate_items(const char *controller, const char *path, FILE **_f, const char *item) {
_cleanup_free_ char *fs = NULL;
@@ -605,6 +606,24 @@ int cg_get_xattr(const char *controller, const char *path, const char *name, voi
return (int) n;
}
+int cg_get_xattr_malloc(const char *controller, const char *path, const char *name, char **ret) {
+ _cleanup_free_ char *fs = NULL;
+ int r;
+
+ assert(path);
+ assert(name);
+
+ r = cg_get_path(controller, path, NULL, &fs);
+ if (r < 0)
+ return r;
+
+ r = getxattr_malloc(fs, name, ret, false);
+ if (r < 0)
+ return r;
+
+ return r;
+}
+
int cg_remove_xattr(const char *controller, const char *path, const char *name) {
_cleanup_free_ char *fs = NULL;
int r;
@@ -1639,6 +1658,32 @@ int cg_get_attribute(const char *controller, const char *path, const char *attri
return read_one_line_file(p, ret);
}
+int cg_get_attribute_as_uint64(const char *controller, const char *path, const char *attribute, uint64_t *ret) {
+ _cleanup_free_ char *value = NULL;
+ uint64_t v;
+ int r;
+
+ assert(ret);
+
+ r = cg_get_attribute(controller, path, attribute, &value);
+ if (r == -ENOENT)
+ return -ENODATA;
+ if (r < 0)
+ return r;
+
+ if (streq(value, "max")) {
+ *ret = CGROUP_LIMIT_MAX;
+ return 0;
+ }
+
+ r = safe_atou64(value, &v);
+ if (r < 0)
+ return r;
+
+ *ret = v;
+ return 0;
+}
+
int cg_get_keyed_attribute(
const char *controller,
const char *path,
diff --git a/src/basic/cgroup-util.h b/src/basic/cgroup-util.h
index 300555f1ac..237139fad0 100644
--- a/src/basic/cgroup-util.h
+++ b/src/basic/cgroup-util.h
@@ -184,10 +184,13 @@ int cg_set_attribute(const char *controller, const char *path, const char *attri
int cg_get_attribute(const char *controller, const char *path, const char *attribute, char **ret);
int cg_get_keyed_attribute(const char *controller, const char *path, const char *attribute, char **keys, char **values);
+int cg_get_attribute_as_uint64(const char *controller, const char *path, const char *attribute, uint64_t *ret);
+
int cg_set_access(const char *controller, const char *path, uid_t uid, gid_t gid);
int cg_set_xattr(const char *controller, const char *path, const char *name, const void *value, size_t size, int flags);
int cg_get_xattr(const char *controller, const char *path, const char *name, void *value, size_t size);
+int cg_get_xattr_malloc(const char *controller, const char *path, const char *name, char **ret);
int cg_remove_xattr(const char *controller, const char *path, const char *name);
int cg_install_release_agent(const char *controller, const char *agent);
diff --git a/src/basic/limits-util.c b/src/basic/limits-util.c
index a74d8197ea..43f6b6f68a 100644
--- a/src/basic/limits-util.c
+++ b/src/basic/limits-util.c
@@ -120,16 +120,9 @@ uint64_t system_tasks_max(void) {
if (r < 0)
log_debug_errno(r, "Failed to determine cgroup root path, ignoring: %m");
else {
- _cleanup_free_ char *value = NULL;
-
- r = cg_get_attribute("pids", root, "pids.max", &value);
+ r = cg_get_attribute_as_uint64("pids", root, "pids.max", &b);
if (r < 0)
log_debug_errno(r, "Failed to read pids.max attribute of cgroup root, ignoring: %m");
- else if (!streq(value, "max")) {
- r = safe_atou64(value, &b);
- if (r < 0)
- log_debug_errno(r, "Failed to parse pids.max attribute of cgroup root, ignoring: %m");
- }
}
return MIN3(TASKS_MAX,
diff --git a/src/basic/log.h b/src/basic/log.h
index 625be22402..740fdbf617 100644
--- a/src/basic/log.h
+++ b/src/basic/log.h
@@ -74,7 +74,7 @@ int log_get_max_level_realm(LogRealm realm) _pure_;
*/
assert_cc(STRLEN(__FILE__) > STRLEN(RELATIVE_SOURCE_PATH) + 1);
-#define PROJECT_FILE (__FILE__ + STRLEN(RELATIVE_SOURCE_PATH) + 1)
+#define PROJECT_FILE (&__FILE__[STRLEN(RELATIVE_SOURCE_PATH) + 1])
int log_open(void);
void log_close(void);
diff --git a/src/basic/meson.build b/src/basic/meson.build
index ccb22e1595..80ef6ff0ea 100644
--- a/src/basic/meson.build
+++ b/src/basic/meson.build
@@ -159,6 +159,8 @@ basic_sources = files('''
ordered-set.h
parse-util.c
parse-util.h
+ path-lookup.c
+ path-lookup.h
path-util.c
path-util.h
prioq.c
diff --git a/src/basic/mountpoint-util.c b/src/basic/mountpoint-util.c
index 1d8147b248..0b3587ff55 100644
--- a/src/basic/mountpoint-util.c
+++ b/src/basic/mountpoint-util.c
@@ -310,7 +310,8 @@ bool fstype_is_network(const char *fstype) {
"glusterfs",
"pvfs2", /* OrangeFS */
"ocfs2",
- "lustre");
+ "lustre",
+ "davfs");
}
bool fstype_is_api_vfs(const char *fstype) {
diff --git a/src/shared/path-lookup.c b/src/basic/path-lookup.c
index 20d6c03a9a..52968dee34 100644
--- a/src/shared/path-lookup.c
+++ b/src/basic/path-lookup.c
@@ -6,19 +6,15 @@
#include "alloc-util.h"
#include "fs-util.h"
-#include "install.h"
#include "log.h"
#include "macro.h"
-#include "mkdir.h"
#include "path-lookup.h"
#include "path-util.h"
-#include "rm-rf.h"
#include "stat-util.h"
#include "string-util.h"
#include "strv.h"
#include "tmpfile-util.h"
#include "user-util.h"
-#include "util.h"
int xdg_user_runtime_dir(char **ret, const char *suffix) {
const char *e;
@@ -100,14 +96,14 @@ int xdg_user_data_dir(char **ret, const char *suffix) {
static const char* const user_data_unit_paths[] = {
"/usr/local/lib/systemd/user",
"/usr/local/share/systemd/user",
- USER_DATA_UNIT_PATH,
+ USER_DATA_UNIT_DIR,
"/usr/lib/systemd/user",
"/usr/share/systemd/user",
NULL
};
static const char* const user_config_unit_paths[] = {
- USER_CONFIG_UNIT_PATH,
+ USER_CONFIG_UNIT_DIR,
"/etc/systemd/user",
NULL
};
@@ -125,11 +121,12 @@ int xdg_user_dirs(char ***ret_config_dirs, char ***ret_data_dirs) {
_cleanup_strv_free_ char **config_dirs = NULL, **data_dirs = NULL;
e = getenv("XDG_CONFIG_DIRS");
- if (e) {
+ if (e)
config_dirs = strv_split(e, ":");
- if (!config_dirs)
- return -ENOMEM;
- }
+ else
+ config_dirs = strv_new("/etc/xdg");
+ if (!config_dirs)
+ return -ENOMEM;
e = getenv("XDG_DATA_DIRS");
if (e)
@@ -324,12 +321,12 @@ static int acquire_config_dirs(UnitFileScope scope, char **persistent, char **ru
switch (scope) {
case UNIT_FILE_SYSTEM:
- a = strdup(SYSTEM_CONFIG_UNIT_PATH);
+ a = strdup(SYSTEM_CONFIG_UNIT_DIR);
b = strdup("/run/systemd/system");
break;
case UNIT_FILE_GLOBAL:
- a = strdup(USER_CONFIG_UNIT_PATH);
+ a = strdup(USER_CONFIG_UNIT_DIR);
b = strdup("/run/systemd/user");
break;
@@ -617,7 +614,7 @@ int lookup_paths_init(
STRV_IFNOTNULL(transient),
STRV_IFNOTNULL(generator_early),
persistent_config,
- SYSTEM_CONFIG_UNIT_PATH,
+ SYSTEM_CONFIG_UNIT_DIR,
"/etc/systemd/system",
STRV_IFNOTNULL(persistent_attached),
runtime_config,
@@ -641,7 +638,7 @@ int lookup_paths_init(
STRV_IFNOTNULL(transient),
STRV_IFNOTNULL(generator_early),
persistent_config,
- USER_CONFIG_UNIT_PATH,
+ USER_CONFIG_UNIT_DIR,
"/etc/systemd/user",
runtime_config,
"/run/systemd/user",
@@ -649,7 +646,7 @@ int lookup_paths_init(
"/usr/local/share/systemd/user",
"/usr/share/systemd/user",
"/usr/local/lib/systemd/user",
- USER_DATA_UNIT_PATH,
+ USER_DATA_UNIT_DIR,
"/usr/lib/systemd/user",
STRV_IFNOTNULL(generator_late));
break;
@@ -782,56 +779,6 @@ void lookup_paths_log(LookupPaths *p) {
}
}
-int lookup_paths_mkdir_generator(LookupPaths *p) {
- int r, q;
-
- assert(p);
-
- if (!p->generator || !p->generator_early || !p->generator_late)
- return -EINVAL;
-
- r = mkdir_p_label(p->generator, 0755);
-
- q = mkdir_p_label(p->generator_early, 0755);
- if (q < 0 && r >= 0)
- r = q;
-
- q = mkdir_p_label(p->generator_late, 0755);
- if (q < 0 && r >= 0)
- r = q;
-
- return r;
-}
-
-void lookup_paths_trim_generator(LookupPaths *p) {
- assert(p);
-
- /* Trim empty dirs */
-
- if (p->generator)
- (void) rmdir(p->generator);
- if (p->generator_early)
- (void) rmdir(p->generator_early);
- if (p->generator_late)
- (void) rmdir(p->generator_late);
-}
-
-void lookup_paths_flush_generator(LookupPaths *p) {
- assert(p);
-
- /* Flush the generated unit files in full */
-
- if (p->generator)
- (void) rm_rf(p->generator, REMOVE_ROOT|REMOVE_PHYSICAL);
- if (p->generator_early)
- (void) rm_rf(p->generator_early, REMOVE_ROOT|REMOVE_PHYSICAL);
- if (p->generator_late)
- (void) rm_rf(p->generator_late, REMOVE_ROOT|REMOVE_PHYSICAL);
-
- if (p->temporary_dir)
- (void) rm_rf(p->temporary_dir, REMOVE_ROOT|REMOVE_PHYSICAL);
-}
-
char **generator_binary_paths(UnitFileScope scope) {
bool append = false; /* Add items from SYSTEMD_GENERATOR_PATH before normal directories */
_cleanup_strv_free_ char **paths = NULL;
@@ -851,7 +798,7 @@ char **generator_binary_paths(UnitFileScope scope) {
add = strv_new("/run/systemd/system-generators",
"/etc/systemd/system-generators",
"/usr/local/lib/systemd/system-generators",
- SYSTEM_GENERATOR_PATH);
+ SYSTEM_GENERATOR_DIR);
break;
case UNIT_FILE_GLOBAL:
@@ -859,7 +806,7 @@ char **generator_binary_paths(UnitFileScope scope) {
add = strv_new("/run/systemd/user-generators",
"/etc/systemd/user-generators",
"/usr/local/lib/systemd/user-generators",
- USER_GENERATOR_PATH);
+ USER_GENERATOR_DIR);
break;
default:
@@ -898,12 +845,12 @@ char **env_generator_binary_paths(bool is_system) {
add = strv_new("/run/systemd/system-environment-generators",
"/etc/systemd/system-environment-generators",
"/usr/local/lib/systemd/system-environment-generators",
- SYSTEM_ENV_GENERATOR_PATH);
+ SYSTEM_ENV_GENERATOR_DIR);
else
add = strv_new("/run/systemd/user-environment-generators",
"/etc/systemd/user-environment-generators",
"/usr/local/lib/systemd/user-environment-generators",
- USER_ENV_GENERATOR_PATH);
+ USER_ENV_GENERATOR_DIR);
if (!add)
return NULL;
diff --git a/src/shared/path-lookup.h b/src/basic/path-lookup.h
index b99e918144..ae37f9feb9 100644
--- a/src/shared/path-lookup.h
+++ b/src/basic/path-lookup.h
@@ -5,6 +5,7 @@
typedef struct LookupPaths LookupPaths;
+#include "def.h"
#include "unit-file.h"
#include "macro.h"
@@ -64,12 +65,10 @@ bool path_is_user_data_dir(const char *path);
bool path_is_user_config_dir(const char *path);
void lookup_paths_log(LookupPaths *p);
-
-int lookup_paths_mkdir_generator(LookupPaths *p);
-void lookup_paths_trim_generator(LookupPaths *p);
-void lookup_paths_flush_generator(LookupPaths *p);
-
void lookup_paths_free(LookupPaths *p);
char **generator_binary_paths(UnitFileScope scope);
char **env_generator_binary_paths(bool is_system);
+
+#define NETWORK_DIRS ((const char* const*) CONF_PATHS_STRV("systemd/network"))
+#define NETWORK_DIRS_NULSTR CONF_PATHS_NULSTR("systemd/network")
diff --git a/src/basic/selinux-util.c b/src/basic/selinux-util.c
index 2d5e750ea5..33ff427ae7 100644
--- a/src/basic/selinux-util.c
+++ b/src/basic/selinux-util.c
@@ -44,8 +44,10 @@ static struct selabel_handle *label_hnd = NULL;
bool mac_selinux_use(void) {
#if HAVE_SELINUX
- if (cached_use < 0)
+ if (_unlikely_(cached_use < 0)) {
cached_use = is_selinux_enabled() > 0;
+ log_debug("SELinux enabled state cached to: %s", cached_use ? "enabled" : "disabled");
+ }
return cached_use;
#else
@@ -55,14 +57,15 @@ bool mac_selinux_use(void) {
bool mac_selinux_enforcing(void) {
#if HAVE_SELINUX
- if (cached_enforcing < 0) {
+ if (_unlikely_(cached_enforcing < 0)) {
cached_enforcing = security_getenforce();
- if (cached_enforcing == -1) {
- log_error_errno(errno, "Failed to get SELinux enforced status: %m");
- }
+ if (cached_enforcing == -1)
+ log_error_errno(errno, "Failed to get SELinux enforced status, continue in enforcing mode: %m");
+ else
+ log_debug("SELinux enforcing state cached to: %s", cached_enforcing ? "enforcing" : "permissive");
}
- /* treat failure as enforced mode */
+ /* treat failure as enforcing mode */
return (cached_enforcing != 0);
#else
return false;
@@ -80,6 +83,8 @@ void mac_selinux_retest(void) {
static int setenforce_callback(int enforcing) {
cached_enforcing = enforcing;
+ log_debug("SELinux enforcing state updated to: %s", cached_enforcing ? "enforcing" : "permissive");
+
return 0;
}
#endif
diff --git a/src/basic/strv.h b/src/basic/strv.h
index e7c2b1a604..dd3323c223 100644
--- a/src/basic/strv.h
+++ b/src/basic/strv.h
@@ -87,6 +87,16 @@ char **strv_parse_nulstr(const char *s, size_t l);
char **strv_split_nulstr(const char *s);
int strv_make_nulstr(char * const *l, char **p, size_t *n);
+static inline int strv_from_nulstr(char ***a, const char *nulstr) {
+ char **t;
+
+ t = strv_split_nulstr(nulstr);
+ if (!t)
+ return -ENOMEM;
+ *a = t;
+ return 0;
+}
+
bool strv_overlap(char * const *a, char * const *b) _pure_;
#define STRV_FOREACH(s, l) \
diff --git a/src/basic/user-util.c b/src/basic/user-util.c
index a491f5505e..e998a46e72 100644
--- a/src/basic/user-util.c
+++ b/src/basic/user-util.c
@@ -701,16 +701,18 @@ int take_etc_passwd_lock(const char *root) {
bool valid_user_group_name_full(const char *u, bool strict) {
const char *i;
long sz;
+ bool warned = false;
/* Checks if the specified name is a valid user/group name. Also see POSIX IEEE Std 1003.1-2008, 2016 Edition,
* 3.437. We are a bit stricter here however. Specifically we deviate from POSIX rules:
*
* - We require that names fit into the appropriate utmp field
* - We don't allow empty user names
- * - No dots or digits in the first character
+ * - No dots in the first character
*
* If strict==true, additionally:
* - We don't allow any dots (this conflicts with chown syntax which permits dots as user/group name separator)
+ * - We don't allow a digit as the first character
*
* Note that other systems are even more restrictive, and don't permit underscores or uppercase characters.
*/
@@ -720,17 +722,26 @@ bool valid_user_group_name_full(const char *u, bool strict) {
if (!(u[0] >= 'a' && u[0] <= 'z') &&
!(u[0] >= 'A' && u[0] <= 'Z') &&
+ !(u[0] >= '0' && u[0] <= '9' && !strict) &&
u[0] != '_')
return false;
- bool warned = false;
+ bool only_digits_seen = u[0] >= '0' && u[0] <= '9';
+
+ if (only_digits_seen) {
+ log_warning("User or group name \"%s\" starts with a digit, accepting for compatibility.", u);
+ warned = true;
+ }
for (i = u+1; *i; i++) {
if (((*i >= 'a' && *i <= 'z') ||
(*i >= 'A' && *i <= 'Z') ||
(*i >= '0' && *i <= '9') ||
- IN_SET(*i, '_', '-')))
+ IN_SET(*i, '_', '-'))) {
+ if (!(*i >= '0' && *i <= '9'))
+ only_digits_seen = false;
continue;
+ }
if (*i == '.' && !strict) {
if (!warned) {
@@ -744,6 +755,9 @@ bool valid_user_group_name_full(const char *u, bool strict) {
return false;
}
+ if (only_digits_seen)
+ return false;
+
sz = sysconf(_SC_LOGIN_NAME_MAX);
assert_se(sz > 0);
diff --git a/src/core/cgroup.c b/src/core/cgroup.c
index ddd3f40817..5e4fe600a2 100644
--- a/src/core/cgroup.c
+++ b/src/core/cgroup.c
@@ -215,31 +215,12 @@ void cgroup_context_done(CGroupContext *c) {
}
static int unit_get_kernel_memory_limit(Unit *u, const char *file, uint64_t *ret) {
- _cleanup_free_ char *raw_kval = NULL;
- uint64_t kval;
- int r;
-
assert(u);
if (!u->cgroup_realized)
return -EOWNERDEAD;
- r = cg_get_attribute("memory", u->cgroup_path, file, &raw_kval);
- if (r < 0)
- return r;
-
- if (streq(raw_kval, "max")) {
- *ret = CGROUP_LIMIT_MAX;
- return 0;
- }
-
- r = safe_atou64(raw_kval, &kval);
- if (r < 0)
- return r;
-
- *ret = kval;
-
- return 0;
+ return cg_get_attribute_as_uint64("memory", u->cgroup_path, file, ret);
}
static int unit_compare_memory_limit(Unit *u, const char *property_name, uint64_t *ret_unit_value, uint64_t *ret_kernel_value) {
@@ -3112,7 +3093,6 @@ int manager_notify_cgroup_empty(Manager *m, const char *cgroup) {
}
int unit_get_memory_current(Unit *u, uint64_t *ret) {
- _cleanup_free_ char *v = NULL;
int r;
assert(u);
@@ -3134,22 +3114,11 @@ int unit_get_memory_current(Unit *u, uint64_t *ret) {
r = cg_all_unified();
if (r < 0)
return r;
- if (r > 0)
- r = cg_get_attribute("memory", u->cgroup_path, "memory.current", &v);
- else
- r = cg_get_attribute("memory", u->cgroup_path, "memory.usage_in_bytes", &v);
- if (r == -ENOENT)
- return -ENODATA;
- if (r < 0)
- return r;
- return safe_atou64(v, ret);
+ return cg_get_attribute_as_uint64("memory", u->cgroup_path, r > 0 ? "memory.current" : "memory.usage_in_bytes", ret);
}
int unit_get_tasks_current(Unit *u, uint64_t *ret) {
- _cleanup_free_ char *v = NULL;
- int r;
-
assert(u);
assert(ret);
@@ -3166,17 +3135,10 @@ int unit_get_tasks_current(Unit *u, uint64_t *ret) {
if ((u->cgroup_realized_mask & CGROUP_MASK_PIDS) == 0)
return -ENODATA;
- r = cg_get_attribute("pids", u->cgroup_path, "pids.current", &v);
- if (r == -ENOENT)
- return -ENODATA;
- if (r < 0)
- return r;
-
- return safe_atou64(v, ret);
+ return cg_get_attribute_as_uint64("pids", u->cgroup_path, "pids.current", ret);
}
static int unit_get_cpu_usage_raw(Unit *u, nsec_t *ret) {
- _cleanup_free_ char *v = NULL;
uint64_t ns;
int r;
@@ -3212,17 +3174,8 @@ static int unit_get_cpu_usage_raw(Unit *u, nsec_t *ret) {
return r;
ns = us * NSEC_PER_USEC;
- } else {
- r = cg_get_attribute("cpuacct", u->cgroup_path, "cpuacct.usage", &v);
- if (r == -ENOENT)
- return -ENODATA;
- if (r < 0)
- return r;
-
- r = safe_atou64(v, &ns);
- if (r < 0)
- return r;
- }
+ } else
+ return cg_get_attribute_as_uint64("cpuacct", u->cgroup_path, "cpuacct.usage", ret);
*ret = ns;
return 0;
diff --git a/src/core/device.c b/src/core/device.c
index 06bbbf8d2c..8e00fd3df6 100644
--- a/src/core/device.c
+++ b/src/core/device.c
@@ -83,6 +83,8 @@ static int device_set_sysfs(Device *d, const char *sysfs) {
}
d->sysfs = TAKE_PTR(copy);
+ unit_add_to_dbus_queue(UNIT(d));
+
return 0;
}
@@ -562,9 +564,6 @@ static int device_setup_unit(Manager *m, sd_device *dev, const char *path, bool
if (dev && device_is_bound_by_mounts(DEVICE(u), dev))
device_upgrade_mount_deps(u);
- /* Note that this won't dispatch the load queue, the caller has to do that if needed and appropriate */
- unit_add_to_dbus_queue(u);
-
return 0;
fail:
diff --git a/src/core/generator-setup.c b/src/core/generator-setup.c
new file mode 100644
index 0000000000..78ff590902
--- /dev/null
+++ b/src/core/generator-setup.c
@@ -0,0 +1,58 @@
+/* SPDX-License-Identifier: LGPL-2.1+ */
+
+#include <unistd.h>
+
+#include "generator-setup.h"
+#include "macro.h"
+#include "mkdir.h"
+#include "rm-rf.h"
+
+int lookup_paths_mkdir_generator(LookupPaths *p) {
+ int r, q;
+
+ assert(p);
+
+ if (!p->generator || !p->generator_early || !p->generator_late)
+ return -EINVAL;
+
+ r = mkdir_p_label(p->generator, 0755);
+
+ q = mkdir_p_label(p->generator_early, 0755);
+ if (q < 0 && r >= 0)
+ r = q;
+
+ q = mkdir_p_label(p->generator_late, 0755);
+ if (q < 0 && r >= 0)
+ r = q;
+
+ return r;
+}
+
+void lookup_paths_trim_generator(LookupPaths *p) {
+ assert(p);
+
+ /* Trim empty dirs */
+
+ if (p->generator)
+ (void) rmdir(p->generator);
+ if (p->generator_early)
+ (void) rmdir(p->generator_early);
+ if (p->generator_late)
+ (void) rmdir(p->generator_late);
+}
+
+void lookup_paths_flush_generator(LookupPaths *p) {
+ assert(p);
+
+ /* Flush the generated unit files in full */
+
+ if (p->generator)
+ (void) rm_rf(p->generator, REMOVE_ROOT|REMOVE_PHYSICAL);
+ if (p->generator_early)
+ (void) rm_rf(p->generator_early, REMOVE_ROOT|REMOVE_PHYSICAL);
+ if (p->generator_late)
+ (void) rm_rf(p->generator_late, REMOVE_ROOT|REMOVE_PHYSICAL);
+
+ if (p->temporary_dir)
+ (void) rm_rf(p->temporary_dir, REMOVE_ROOT|REMOVE_PHYSICAL);
+}
diff --git a/src/core/generator-setup.h b/src/core/generator-setup.h
new file mode 100644
index 0000000000..9688601a76
--- /dev/null
+++ b/src/core/generator-setup.h
@@ -0,0 +1,8 @@
+/* SPDX-License-Identifier: LGPL-2.1+ */
+#pragma once
+
+#include "path-lookup.h"
+
+int lookup_paths_mkdir_generator(LookupPaths *p);
+void lookup_paths_trim_generator(LookupPaths *p);
+void lookup_paths_flush_generator(LookupPaths *p);
diff --git a/src/core/manager.c b/src/core/manager.c
index 38f7ba1eb8..148df8d523 100644
--- a/src/core/manager.c
+++ b/src/core/manager.c
@@ -44,6 +44,7 @@
#include "fd-util.h"
#include "fileio.h"
#include "fs-util.h"
+#include "generator-setup.h"
#include "hashmap.h"
#include "install.h"
#include "io-util.h"
@@ -689,7 +690,7 @@ static int manager_setup_prefix(Manager *m) {
p = paths_user;
for (i = 0; i < _EXEC_DIRECTORY_TYPE_MAX; i++) {
- r = sd_path_home(p[i].type, p[i].suffix, &m->prefix[i]);
+ r = sd_path_lookup(p[i].type, p[i].suffix, &m->prefix[i]);
if (r < 0)
return r;
}
diff --git a/src/core/meson.build b/src/core/meson.build
index 3586838f59..0b31bb79ed 100644
--- a/src/core/meson.build
+++ b/src/core/meson.build
@@ -72,6 +72,8 @@ libcore_sources = '''
emergency-action.h
execute.c
execute.h
+ generator-setup.c
+ generator-setup.h
hostname-setup.c
hostname-setup.h
ima-setup.c
diff --git a/src/core/selinux-access.c b/src/core/selinux-access.c
index 008a8ba9b6..56448c18f1 100644
--- a/src/core/selinux-access.c
+++ b/src/core/selinux-access.c
@@ -185,7 +185,7 @@ int mac_selinux_generic_access_check(
_cleanup_free_ char *cl = NULL;
_cleanup_freecon_ char *fcon = NULL;
char **cmdline = NULL;
- const bool enforce = mac_selinux_enforcing();
+ bool enforce;
int r = 0;
assert(message);
@@ -196,6 +196,9 @@ int mac_selinux_generic_access_check(
if (r <= 0)
return r;
+ /* delay call until we checked in `access_init()` if SELinux is actually enabled */
+ enforce = mac_selinux_enforcing();
+
r = sd_bus_query_sender_creds(
message,
SD_BUS_CREDS_PID|SD_BUS_CREDS_EUID|SD_BUS_CREDS_EGID|
@@ -269,8 +272,8 @@ int mac_selinux_generic_access_check(
sd_bus_error_setf(error, SD_BUS_ERROR_ACCESS_DENIED, "SELinux policy denies access.");
}
- log_debug_errno(r, "SELinux access check scon=%s tcon=%s tclass=%s perm=%s path=%s cmdline=%s: %m",
- scon, fcon, tclass, permission, path, cl);
+ log_debug_errno(r, "SELinux access check scon=%s tcon=%s tclass=%s perm=%s state=%s path=%s cmdline=%s: %m",
+ scon, fcon, tclass, permission, enforce ? "enforcing" : "permissive", path, cl);
return enforce ? r : 0;
}
diff --git a/src/core/swap.c b/src/core/swap.c
index d4da840c0f..c5945371df 100644
--- a/src/core/swap.c
+++ b/src/core/swap.c
@@ -207,7 +207,7 @@ static int swap_add_device_dependencies(Swap *s) {
return 0;
p = swap_get_parameters(s);
- if (!p)
+ if (!p || !p->what)
return 0;
mask = s->from_proc_swaps ? UNIT_DEPENDENCY_PROC_SWAP : UNIT_DEPENDENCY_FILE;
diff --git a/src/core/systemd.pc.in b/src/core/systemd.pc.in
index 8331832c7a..da7e74ed7b 100644
--- a/src/core/systemd.pc.in
+++ b/src/core/systemd.pc.in
@@ -7,36 +7,93 @@
# the Free Software Foundation; either version 2.1 of the License, or
# (at your option) any later version.
+# Names with prefixes are prefered, and the run-together names should be
+# considered deprecated (though there is no plan to remove them). New names
+# shall have underscores.
+
prefix=@prefix@
-rootprefix=@rootprefix_noslash@
-sysconfdir=@sysconfdir@
-systemdutildir=${rootprefix}/lib/systemd
-systemdsystemunitdir=${rootprefix}/lib/systemd/system
-systemdsystempresetdir=${rootprefix}/lib/systemd/system-preset
-systemduserunitdir=${prefix}/lib/systemd/user
-systemduserpresetdir=${prefix}/lib/systemd/user-preset
-systemdsystemconfdir=${sysconfdir}/systemd/system
-systemduserconfdir=${sysconfdir}/systemd/user
-systemdsystemunitpath=${systemdsystemconfdir}:/etc/systemd/system:/run/systemd/system:/usr/local/lib/systemd/system:${systemdsystemunitdir}:/usr/lib/systemd/system:/lib/systemd/system
-systemduserunitpath=${systemduserconfdir}:/etc/systemd/user:/run/systemd/user:/usr/local/lib/systemd/user:/usr/local/share/systemd/user:${systemduserunitdir}:/usr/lib/systemd/user:/usr/share/systemd/user
-systemdsystemgeneratordir=${rootprefix}/lib/systemd/system-generators
-systemdusergeneratordir=${prefix}/lib/systemd/user-generators
-systemdsystemgeneratorpath=/run/systemd/system-generators:/etc/systemd/system-generators:/usr/local/lib/systemd/system-generators:${systemdsystemgeneratordir}
-systemdusergeneratorpath=/run/systemd/user-generators:/etc/systemd/user-generators:/usr/local/lib/systemd/user-generators:${systemdusergeneratordir}
-systemdsleepdir=${rootprefix}/lib/systemd/system-sleep
-systemdshutdowndir=${rootprefix}/lib/systemd/system-shutdown
-tmpfilesdir=${prefix}/lib/tmpfiles.d
-sysusersdir=${prefix}/lib/sysusers.d
-sysctldir=${prefix}/lib/sysctl.d
-binfmtdir=${prefix}/lib/binfmt.d
-modulesloaddir=${prefix}/lib/modules-load.d
-catalogdir=${prefix}/lib/systemd/catalog
-systemuidmax=@systemuidmax@
-systemgidmax=@systemgidmax@
-dynamicuidmin=@dynamicuidmin@
-dynamicuidmax=@dynamicuidmax@
-containeruidbasemin=@containeruidbasemin@
-containeruidbasemax=@containeruidbasemax@
+root_prefix=@rootprefix_noslash@
+rootprefix=${root_prefix}
+sysconf_dir=@sysconfdir@
+sysconfdir=${sysconf_dir}
+
+systemd_util_dir=${root_prefix}/lib/systemd
+systemdutildir=${systemd_util_dir}
+
+systemd_system_unit_dir=${rootprefix}/lib/systemd/system
+systemdsystemunitdir=${systemd_system_unit_dir}
+
+systemd_system_preset_dir=${rootprefix}/lib/systemd/system-preset
+systemdsystempresetdir=${systemd_system_preset_dir}
+
+systemd_user_unit_dir=${prefix}/lib/systemd/user
+systemduserunitdir=${systemd_user_unit_dir}
+
+systemd_user_preset_dir=${prefix}/lib/systemd/user-preset
+systemduserpresetdir=${systemd_user_preset_dir}
+
+systemd_system_conf_dir=${sysconfdir}/systemd/system
+systemdsystemconfdir=${systemd_system_conf_dir}
+
+systemd_user_conf_dir=${sysconfdir}/systemd/user
+systemduserconfdir=${systemd_user_conf_dir}
+
+systemd_system_unit_path=${systemd_system_conf_dir}:/etc/systemd/system:/run/systemd/system:/usr/local/lib/systemd/system:${systemd_system_unit_dir}:/usr/lib/systemd/system:/lib/systemd/system
+systemdsystemunitpath=${systemd_system_unit_path}
+
+systemd_user_unit_path=${systemd_user_conf_dir}:/etc/systemd/user:/run/systemd/user:/usr/local/lib/systemd/user:/usr/local/share/systemd/user:${systemd_user_unit_dir}:/usr/lib/systemd/user:/usr/share/systemd/user
+systemduserunitpath=${systemd_user_unit_path}
+
+systemd_system_generator_dir=${root_prefix}/lib/systemd/system-generators
+systemdsystemgeneratordir=${systemd_system_generator_dir}
+
+systemd_user_generator_dir=${prefix}/lib/systemd/user-generators
+systemdusergeneratordir=${systemd_user_generator_dir}
+
+systemd_system_generator_path=/run/systemd/system-generators:/etc/systemd/system-generators:/usr/local/lib/systemd/system-generators:${systemd_system_generator_dir}
+systemdsystemgeneratorpath=${systemd_system_generator_path}
+
+systemd_user_generator_path=/run/systemd/user-generators:/etc/systemd/user-generators:/usr/local/lib/systemd/user-generators:${systemd_user_generator_dir}
+systemdusergeneratorpath=${systemd_user_generator_path}
+
+systemd_sleep_dir=${root_prefix}/lib/systemd/system-sleep
+systemdsleepdir=${systemd_sleep_dir}
+
+systemd_shutdown_dir=${root_prefix}/lib/systemd/system-shutdown
+systemdshutdowndir=${systemd_shutdown_dir}
+
+tmpfiles_dir=${prefix}/lib/tmpfiles.d
+tmpfilesdir=${tmpfiles_dir}
+
+sysusers_dir=${prefix}/lib/sysusers.d
+sysusersdir=${sysusers_dir}
+
+sysctl_dir=${prefix}/lib/sysctl.d
+sysctldir=${sysctl_dir}
+
+binfmt_dir=${prefix}/lib/binfmt.d
+binfmtdir=${binfmt_dir}
+
+modules_load_dir=${prefix}/lib/modules-load.d
+modulesloaddir=${modules_load_dir}
+
+catalog_dir=${prefix}/lib/systemd/catalog
+catalogdir=${catalog_dir}
+
+system_uid_max=@systemuidmax@
+systemuidmax=${system_uid_max}
+system_gid_max=@systemgidmax@
+systemgidmax=${system_gid_max}
+
+dynamic_uid_min=@dynamicuidmin@
+dynamicuidmin=${dynamic_uid_min}
+dynamic_uid_max=@dynamicuidmax@
+dynamicuidmax=${dynamic_uid_max}
+
+container_uid_base_min=@containeruidbasemin@
+containeruidbasemin=${container_uid_base_min}
+container_uid_base_max=@containeruidbasemax@
+containeruidbasemax=${container_uid_base_max}
Name: systemd
Description: systemd System and Service Manager
diff --git a/src/core/unit.c b/src/core/unit.c
index 2816bcef55..96e1a6c320 100644
--- a/src/core/unit.c
+++ b/src/core/unit.c
@@ -210,11 +210,13 @@ int unit_add_name(Unit *u, const char *text) {
if (unit_name_is_valid(text, UNIT_NAME_TEMPLATE)) {
if (!u->instance)
- return -EINVAL;
+ return log_unit_debug_errno(u, SYNTHETIC_ERRNO(EINVAL),
+ "instance is not set when adding name '%s': %m", text);
r = unit_name_replace_instance(text, u->instance, &s);
if (r < 0)
- return r;
+ return log_unit_debug_errno(u, r,
+ "failed to build instance name from '%s': %m", text);
} else {
s = strdup(text);
if (!s)
@@ -224,36 +226,43 @@ int unit_add_name(Unit *u, const char *text) {
if (set_contains(u->names, s))
return 0;
if (hashmap_contains(u->manager->units, s))
- return -EEXIST;
+ return log_unit_debug_errno(u, SYNTHETIC_ERRNO(EEXIST),
+ "unit already exist when adding name '%s': %m", text);
if (!unit_name_is_valid(s, UNIT_NAME_PLAIN|UNIT_NAME_INSTANCE))
- return -EINVAL;
+ return log_unit_debug_errno(u, SYNTHETIC_ERRNO(EINVAL),
+ "name '%s' is invalid: %m", text);
t = unit_name_to_type(s);
if (t < 0)
- return -EINVAL;
+ return log_unit_debug_errno(u, SYNTHETIC_ERRNO(EINVAL),
+ "failed to to derive unit type from name '%s': %m", text);
if (u->type != _UNIT_TYPE_INVALID && t != u->type)
- return -EINVAL;
+ return log_unit_debug_errno(u, SYNTHETIC_ERRNO(EINVAL),
+ "unit type is illegal: u->type(%d) and t(%d) for name '%s': %m",
+ u->type, t, text);
r = unit_name_to_instance(s, &i);
if (r < 0)
- return r;
+ return log_unit_debug_errno(u, r, "failed to extract instance from name '%s': %m", text);
if (i && !unit_type_may_template(t))
- return -EINVAL;
+ return log_unit_debug_errno(u, SYNTHETIC_ERRNO(EINVAL), "templates are not allowed for name '%s': %m", text);
/* Ensure that this unit is either instanced or not instanced,
* but not both. Note that we do allow names with different
* instance names however! */
if (u->type != _UNIT_TYPE_INVALID && !u->instance != !i)
- return -EINVAL;
+ return log_unit_debug_errno(u, SYNTHETIC_ERRNO(EINVAL),
+ "instance is illegal: u->type(%d), u->instance(%s) and i(%s) for name '%s': %m",
+ u->type, u->instance, i, text);
if (!unit_type_may_alias(t) && !set_isempty(u->names))
- return -EEXIST;
+ return log_unit_debug_errno(u, SYNTHETIC_ERRNO(EEXIST), "symlinks are not allowed for name '%s': %m", text);
if (hashmap_size(u->manager->units) >= MANAGER_MAX_NAMES)
- return -E2BIG;
+ return log_unit_debug_errno(u, SYNTHETIC_ERRNO(E2BIG), "too many units: %m");
r = set_put(u->names, s);
if (r < 0)
@@ -263,7 +272,7 @@ int unit_add_name(Unit *u, const char *text) {
r = hashmap_put(u->manager->units, s, u);
if (r < 0) {
(void) set_remove(u->names, s);
- return r;
+ return log_unit_debug_errno(u, r, "add unit to hashmap failed for name '%s': %m", text);
}
if (u->type == _UNIT_TYPE_INVALID) {
diff --git a/src/environment-d-generator/environment-d-generator.c b/src/environment-d-generator/environment-d-generator.c
index 5fe51359f6..4a14c23f11 100644
--- a/src/environment-d-generator/environment-d-generator.c
+++ b/src/environment-d-generator/environment-d-generator.c
@@ -20,7 +20,7 @@ static int environment_dirs(char ***ret) {
return -ENOMEM;
/* ~/.config/systemd/environment.d */
- r = sd_path_home(SD_PATH_USER_CONFIGURATION, "environment.d", &c);
+ r = sd_path_lookup(SD_PATH_USER_CONFIGURATION, "environment.d", &c);
if (r < 0)
return r;
diff --git a/src/fuzz/fuzz.h b/src/fuzz/fuzz.h
index 83b1ac11ad..1e56526259 100644
--- a/src/fuzz/fuzz.h
+++ b/src/fuzz/fuzz.h
@@ -6,6 +6,3 @@
/* The entry point into the fuzzer */
int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size);
-
-/* https://docs.fuzzbuzz.io/developer-documentation/porting-targets-to-fuzzbuzz/libfuzzer-targets */
-int FuzzerEntrypoint(const uint8_t *data, size_t size);
diff --git a/src/fuzz/fuzzer-entry-point.c b/src/fuzz/fuzzer-entry-point.c
deleted file mode 100644
index 020c111650..0000000000
--- a/src/fuzz/fuzzer-entry-point.c
+++ /dev/null
@@ -1,5 +0,0 @@
-#include "fuzz.h"
-
-int FuzzerEntrypoint(const uint8_t *data, size_t size) {
- return LLVMFuzzerTestOneInput(data, size);
-}
diff --git a/src/journal/sd-journal.c b/src/journal/sd-journal.c
index 56a6a9c431..36f65ad688 100644
--- a/src/journal/sd-journal.c
+++ b/src/journal/sd-journal.c
@@ -2675,13 +2675,12 @@ _public_ int sd_journal_wait(sd_journal *j, uint64_t timeout_usec) {
Get rid of the deleted files now so they don't stay around indefinitely. */
ORDERED_HASHMAP_FOREACH(f, j->files, i) {
r = journal_file_fstat(f);
- if (r < 0) {
+ if (r == -EIDRM)
+ remove_file_real(j, f);
+ else if (r < 0) {
log_debug_errno(r,"Failed to fstat() journal file '%s' : %m", f->path);
continue;
}
-
- if (f->last_stat.st_nlink <= 0)
- remove_file_real(j, f);
}
/* The journal might have changed since the context
diff --git a/src/libsystemd-network/dhcp-lease-internal.h b/src/libsystemd-network/dhcp-lease-internal.h
index a2d0f8bd5e..efc7976838 100644
--- a/src/libsystemd-network/dhcp-lease-internal.h
+++ b/src/libsystemd-network/dhcp-lease-internal.h
@@ -61,6 +61,9 @@ struct sd_dhcp_lease {
struct in_addr *sip;
size_t sip_size;
+ struct in_addr *pop3_server;
+ size_t pop3_server_size;
+
struct sd_dhcp_route *static_route;
size_t static_route_size, static_route_allocated;
diff --git a/src/libsystemd-network/dhcp-server-internal.h b/src/libsystemd-network/dhcp-server-internal.h
index 42c3ceb8b1..468bd303dc 100644
--- a/src/libsystemd-network/dhcp-server-internal.h
+++ b/src/libsystemd-network/dhcp-server-internal.h
@@ -55,10 +55,11 @@ struct sd_dhcp_server {
char *timezone;
- struct in_addr *ntp, *dns, *sip;
- unsigned n_ntp, n_dns, n_sip;
+ struct in_addr *ntp, *dns, *sip, *pop3_server;
+ unsigned n_ntp, n_dns, n_sip, n_pop3_server;
- OrderedHashmap *raw_option;
+ OrderedHashmap *extra_options;
+ OrderedHashmap *vendor_options;
bool emit_router;
diff --git a/src/libsystemd-network/network-internal.h b/src/libsystemd-network/network-internal.h
index 593bad2230..16ff173ac6 100644
--- a/src/libsystemd-network/network-internal.h
+++ b/src/libsystemd-network/network-internal.h
@@ -8,7 +8,6 @@
#include "sd-dhcp-lease.h"
#include "conf-parser.h"
-#include "def.h"
#include "set.h"
#include "strv.h"
@@ -66,5 +65,3 @@ int deserialize_dhcp_routes(struct sd_dhcp_route **ret, size_t *ret_size, size_t
/* It is not necessary to add deserialize_dhcp_option(). Use unhexmem() instead. */
int serialize_dhcp_option(FILE *f, const char *key, const void *data, size_t size);
-
-#define NETWORK_DIRS ((const char* const*) CONF_PATHS_STRV("systemd/network"))
diff --git a/src/libsystemd-network/sd-dhcp-client.c b/src/libsystemd-network/sd-dhcp-client.c
index 4122d08d96..82553e79ca 100644
--- a/src/libsystemd-network/sd-dhcp-client.c
+++ b/src/libsystemd-network/sd-dhcp-client.c
@@ -89,7 +89,8 @@ struct sd_dhcp_client {
usec_t start_time;
uint64_t attempt;
uint64_t max_attempts;
- OrderedHashmap *options;
+ OrderedHashmap *extra_options;
+ OrderedHashmap *vendor_options;
usec_t request_sent;
sd_event_source *timeout_t1;
sd_event_source *timeout_t2;
@@ -540,17 +541,17 @@ int sd_dhcp_client_set_max_attempts(sd_dhcp_client *client, uint64_t max_attempt
return 0;
}
-int sd_dhcp_client_set_dhcp_option(sd_dhcp_client *client, sd_dhcp_option *v) {
+int sd_dhcp_client_add_option(sd_dhcp_client *client, sd_dhcp_option *v) {
int r;
assert_return(client, -EINVAL);
assert_return(v, -EINVAL);
- r = ordered_hashmap_ensure_allocated(&client->options, &dhcp_option_hash_ops);
+ r = ordered_hashmap_ensure_allocated(&client->extra_options, &dhcp_option_hash_ops);
if (r < 0)
return r;
- r = ordered_hashmap_put(client->options, UINT_TO_PTR(v->option), v);
+ r = ordered_hashmap_put(client->extra_options, UINT_TO_PTR(v->option), v);
if (r < 0)
return r;
@@ -558,6 +559,25 @@ int sd_dhcp_client_set_dhcp_option(sd_dhcp_client *client, sd_dhcp_option *v) {
return 0;
}
+int sd_dhcp_client_add_vendor_option(sd_dhcp_client *client, sd_dhcp_option *v) {
+ int r;
+
+ assert_return(client, -EINVAL);
+ assert_return(v, -EINVAL);
+
+ r = ordered_hashmap_ensure_allocated(&client->vendor_options, &dhcp_option_hash_ops);
+ if (r < 0)
+ return -ENOMEM;
+
+ r = ordered_hashmap_put(client->vendor_options, v, v);
+ if (r < 0)
+ return r;
+
+ sd_dhcp_option_ref(v);
+
+ return 1;
+}
+
int sd_dhcp_client_get_lease(sd_dhcp_client *client, sd_dhcp_lease **ret) {
assert_return(client, -EINVAL);
@@ -884,13 +904,22 @@ static int client_send_discover(sd_dhcp_client *client) {
return r;
}
- ORDERED_HASHMAP_FOREACH(j, client->options, i) {
+ ORDERED_HASHMAP_FOREACH(j, client->extra_options, i) {
r = dhcp_option_append(&discover->dhcp, optlen, &optoffset, 0,
j->option, j->length, j->data);
if (r < 0)
return r;
}
+ if (!ordered_hashmap_isempty(client->vendor_options)) {
+ r = dhcp_option_append(
+ &discover->dhcp, optlen, &optoffset, 0,
+ SD_DHCP_OPTION_VENDOR_SPECIFIC,
+ ordered_hashmap_size(client->vendor_options), client->vendor_options);
+ if (r < 0)
+ return r;
+ }
+
r = dhcp_option_append(&discover->dhcp, optlen, &optoffset, 0,
SD_DHCP_OPTION_END, 0, NULL);
if (r < 0)
@@ -2073,7 +2102,8 @@ static sd_dhcp_client *dhcp_client_free(sd_dhcp_client *client) {
free(client->hostname);
free(client->vendor_class_identifier);
client->user_class = strv_free(client->user_class);
- ordered_hashmap_free(client->options);
+ ordered_hashmap_free(client->extra_options);
+ ordered_hashmap_free(client->vendor_options);
return mfree(client);
}
diff --git a/src/libsystemd-network/sd-dhcp-lease.c b/src/libsystemd-network/sd-dhcp-lease.c
index 48e8aad8f3..4a6c56ecbf 100644
--- a/src/libsystemd-network/sd-dhcp-lease.c
+++ b/src/libsystemd-network/sd-dhcp-lease.c
@@ -129,6 +129,17 @@ int sd_dhcp_lease_get_sip(sd_dhcp_lease *lease, const struct in_addr **addr) {
return (int) lease->sip_size;
}
+int sd_dhcp_lease_get_pop3_server(sd_dhcp_lease *lease, const struct in_addr **addr) {
+ assert_return(lease, -EINVAL);
+ assert_return(addr, -EINVAL);
+
+ if (lease->pop3_server_size <= 0)
+ return -ENODATA;
+
+ *addr = lease->pop3_server;
+ return (int) lease->pop3_server_size;
+}
+
int sd_dhcp_lease_get_domainname(sd_dhcp_lease *lease, const char **domainname) {
assert_return(lease, -EINVAL);
assert_return(domainname, -EINVAL);
@@ -279,6 +290,7 @@ static sd_dhcp_lease *dhcp_lease_free(sd_dhcp_lease *lease) {
free(lease->dns);
free(lease->ntp);
free(lease->sip);
+ free(lease->pop3_server);
free(lease->static_route);
free(lease->client_id);
free(lease->vendor_specific);
@@ -601,6 +613,12 @@ int dhcp_lease_parse_options(uint8_t code, uint8_t len, const void *option, void
log_debug_errno(r, "Failed to parse SIP server, ignoring: %m");
break;
+ case SD_DHCP_OPTION_POP3_SERVER:
+ r = lease_parse_in_addrs(option, len, &lease->pop3_server, &lease->pop3_server_size);
+ if (r < 0)
+ log_debug_errno(r, "Failed to parse POP3 server, ignoring: %m");
+ break;
+
case SD_DHCP_OPTION_STATIC_ROUTE:
r = lease_parse_routes(option, len, &lease->static_route, &lease->static_route_size, &lease->static_route_allocated);
if (r < 0)
@@ -1037,6 +1055,7 @@ int dhcp_lease_load(sd_dhcp_lease **ret, const char *lease_file) {
*dns = NULL,
*ntp = NULL,
*sip = NULL,
+ *pop3_server = NULL,
*mtu = NULL,
*routes = NULL,
*domains = NULL,
@@ -1066,6 +1085,7 @@ int dhcp_lease_load(sd_dhcp_lease **ret, const char *lease_file) {
"DNS", &dns,
"NTP", &ntp,
"SIP", &sip,
+ "POP3_SERVERS", &pop3_server,
"MTU", &mtu,
"DOMAINNAME", &lease->domainname,
"HOSTNAME", &lease->hostname,
@@ -1175,7 +1195,15 @@ int dhcp_lease_load(sd_dhcp_lease **ret, const char *lease_file) {
if (r < 0)
log_debug_errno(r, "Failed to deserialize SIP servers %s, ignoring: %m", sip);
else
- lease->ntp_size = r;
+ lease->sip_size = r;
+ }
+
+ if (pop3_server) {
+ r = deserialize_in_addrs(&lease->pop3_server, pop3_server);
+ if (r < 0)
+ log_debug_errno(r, "Failed to deserialize POP3 server %s, ignoring: %m", pop3_server);
+ else
+ lease->pop3_server_size = r;
}
if (mtu) {
diff --git a/src/libsystemd-network/sd-dhcp-server.c b/src/libsystemd-network/sd-dhcp-server.c
index 546b5d02c4..89a487cf01 100644
--- a/src/libsystemd-network/sd-dhcp-server.c
+++ b/src/libsystemd-network/sd-dhcp-server.c
@@ -140,10 +140,12 @@ static sd_dhcp_server *dhcp_server_free(sd_dhcp_server *server) {
free(server->dns);
free(server->ntp);
free(server->sip);
+ free(server->pop3_server);
hashmap_free(server->leases_by_client_id);
- ordered_hashmap_free(server->raw_option);
+ ordered_hashmap_free(server->extra_options);
+ ordered_hashmap_free(server->vendor_options);
free(server->bound_leases);
return mfree(server);
@@ -455,6 +457,8 @@ static int server_send_ack(sd_dhcp_server *server, DHCPRequest *req,
be32_t address) {
_cleanup_free_ DHCPPacket *packet = NULL;
be32_t lease_time;
+ sd_dhcp_option *j;
+ Iterator i;
size_t offset;
int r;
@@ -510,6 +514,15 @@ static int server_send_ack(sd_dhcp_server *server, DHCPRequest *req,
return r;
}
+ if (server->n_pop3_server > 0) {
+ r = dhcp_option_append(
+ &packet->dhcp, req->max_optlen, &offset, 0,
+ SD_DHCP_OPTION_POP3_SERVER,
+ sizeof(struct in_addr) * server->n_pop3_server, server->pop3_server);
+ if (r < 0)
+ return r;
+ }
+
if (server->timezone) {
r = dhcp_option_append(
&packet->dhcp, req->max_optlen, &offset, 0,
@@ -519,11 +532,18 @@ static int server_send_ack(sd_dhcp_server *server, DHCPRequest *req,
return r;
}
- if (!ordered_hashmap_isempty(server->raw_option)) {
+ ORDERED_HASHMAP_FOREACH(j, server->extra_options, i) {
+ r = dhcp_option_append(&packet->dhcp, req->max_optlen, &offset, 0,
+ j->option, j->length, j->data);
+ if (r < 0)
+ return r;
+ }
+
+ if (!ordered_hashmap_isempty(server->vendor_options)) {
r = dhcp_option_append(
&packet->dhcp, req->max_optlen, &offset, 0,
SD_DHCP_OPTION_VENDOR_SPECIFIC,
- ordered_hashmap_size(server->raw_option), server->raw_option);
+ ordered_hashmap_size(server->vendor_options), server->vendor_options);
if (r < 0)
return r;
}
@@ -1171,6 +1191,31 @@ int sd_dhcp_server_set_sip(sd_dhcp_server *server, const struct in_addr sip[], u
return 1;
}
+int sd_dhcp_server_set_pop3_server(sd_dhcp_server *server, const struct in_addr pop3_server[], unsigned n) {
+ assert_return(server, -EINVAL);
+ assert_return(pop3_server || n <= 0, -EINVAL);
+
+ if (server->n_pop3_server == n &&
+ memcmp(server->pop3_server, pop3_server, sizeof(struct in_addr) * n) == 0)
+ return 0;
+
+ if (n <= 0) {
+ server->pop3_server = mfree(server->pop3_server);
+ server->n_pop3_server = 0;
+ } else {
+ struct in_addr *c;
+
+ c = newdup(struct in_addr, pop3_server, n);
+ if (!c)
+ return -ENOMEM;
+
+ free_and_replace(server->pop3_server, c);
+ server->n_pop3_server = n;
+ }
+
+ return 1;
+}
+
int sd_dhcp_server_set_emit_router(sd_dhcp_server *server, int enabled) {
assert_return(server, -EINVAL);
@@ -1188,11 +1233,29 @@ int sd_dhcp_server_add_option(sd_dhcp_server *server, sd_dhcp_option *v) {
assert_return(server, -EINVAL);
assert_return(v, -EINVAL);
- r = ordered_hashmap_ensure_allocated(&server->raw_option, &dhcp_option_hash_ops);
+ r = ordered_hashmap_ensure_allocated(&server->extra_options, &dhcp_option_hash_ops);
+ if (r < 0)
+ return r;
+
+ r = ordered_hashmap_put(server->extra_options, UINT_TO_PTR(v->option), v);
+ if (r < 0)
+ return r;
+
+ sd_dhcp_option_ref(v);
+ return 0;
+}
+
+int sd_dhcp_server_add_vendor_option(sd_dhcp_server *server, sd_dhcp_option *v) {
+ int r;
+
+ assert_return(server, -EINVAL);
+ assert_return(v, -EINVAL);
+
+ r = ordered_hashmap_ensure_allocated(&server->vendor_options, &dhcp_option_hash_ops);
if (r < 0)
return -ENOMEM;
- r = ordered_hashmap_put(server->raw_option, v, v);
+ r = ordered_hashmap_put(server->vendor_options, v, v);
if (r < 0)
return r;
diff --git a/src/libsystemd/libsystemd.sym b/src/libsystemd/libsystemd.sym
index 8b6ebbcf8b..2c1bcab576 100644
--- a/src/libsystemd/libsystemd.sym
+++ b/src/libsystemd/libsystemd.sym
@@ -697,3 +697,9 @@ global:
sd_event_source_send_child_signal;
sd_journal_open_namespace;
} LIBSYSTEMD_243;
+
+LIBSYSTEMD_246 {
+global:
+ sd_path_lookup;
+ sd_path_lookup_strv;
+} LIBSYSTEMD_245;
diff --git a/src/libsystemd/sd-bus/bus-convenience.c b/src/libsystemd/sd-bus/bus-convenience.c
index 4ec061644d..89547a252d 100644
--- a/src/libsystemd/sd-bus/bus-convenience.c
+++ b/src/libsystemd/sd-bus/bus-convenience.c
@@ -96,6 +96,7 @@ _public_ int sd_bus_call_method(
int r;
bus_assert_return(bus, -EINVAL, error);
+ bus_assert_return(bus = bus_resolve(bus), -ENOPKG, error);
bus_assert_return(!bus_pid_changed(bus), -ECHILD, error);
if (!BUS_IS_OPEN(bus->state)) {
@@ -283,6 +284,7 @@ _public_ int sd_bus_get_property(
int r;
bus_assert_return(bus, -EINVAL, error);
+ bus_assert_return(bus = bus_resolve(bus), -ENOPKG, error);
bus_assert_return(isempty(interface) || interface_name_is_valid(interface), -EINVAL, error);
bus_assert_return(member_name_is_valid(member), -EINVAL, error);
bus_assert_return(reply, -EINVAL, error);
@@ -294,7 +296,10 @@ _public_ int sd_bus_get_property(
goto fail;
}
- r = sd_bus_call_method(bus, destination, path, "org.freedesktop.DBus.Properties", "Get", error, &rep, "ss", strempty(interface), member);
+ r = sd_bus_call_method(bus, destination, path,
+ "org.freedesktop.DBus.Properties", "Get",
+ error, &rep,
+ "ss", strempty(interface), member);
if (r < 0)
return r;
@@ -324,6 +329,7 @@ _public_ int sd_bus_get_property_trivial(
int r;
bus_assert_return(bus, -EINVAL, error);
+ bus_assert_return(bus = bus_resolve(bus), -ENOPKG, error);
bus_assert_return(isempty(interface) || interface_name_is_valid(interface), -EINVAL, error);
bus_assert_return(member_name_is_valid(member), -EINVAL, error);
bus_assert_return(bus_type_is_trivial(type), -EINVAL, error);
@@ -368,6 +374,7 @@ _public_ int sd_bus_get_property_string(
int r;
bus_assert_return(bus, -EINVAL, error);
+ bus_assert_return(bus = bus_resolve(bus), -ENOPKG, error);
bus_assert_return(isempty(interface) || interface_name_is_valid(interface), -EINVAL, error);
bus_assert_return(member_name_is_valid(member), -EINVAL, error);
bus_assert_return(ret, -EINVAL, error);
@@ -416,6 +423,7 @@ _public_ int sd_bus_get_property_strv(
int r;
bus_assert_return(bus, -EINVAL, error);
+ bus_assert_return(bus = bus_resolve(bus), -ENOPKG, error);
bus_assert_return(isempty(interface) || interface_name_is_valid(interface), -EINVAL, error);
bus_assert_return(member_name_is_valid(member), -EINVAL, error);
bus_assert_return(ret, -EINVAL, error);
@@ -458,6 +466,7 @@ _public_ int sd_bus_set_property(
int r;
bus_assert_return(bus, -EINVAL, error);
+ bus_assert_return(bus = bus_resolve(bus), -ENOPKG, error);
bus_assert_return(isempty(interface) || interface_name_is_valid(interface), -EINVAL, error);
bus_assert_return(member_name_is_valid(member), -EINVAL, error);
bus_assert_return(signature_is_single(type, false), -EINVAL, error);
diff --git a/src/libsystemd/sd-bus/bus-message.c b/src/libsystemd/sd-bus/bus-message.c
index 73127dfe02..62c34d9312 100644
--- a/src/libsystemd/sd-bus/bus-message.c
+++ b/src/libsystemd/sd-bus/bus-message.c
@@ -585,14 +585,13 @@ _public_ int sd_bus_message_new(
sd_bus_message **m,
uint8_t type) {
- sd_bus_message *t;
-
assert_return(bus, -ENOTCONN);
+ assert_return(bus = bus_resolve(bus), -ENOPKG);
assert_return(bus->state != BUS_UNSET, -ENOTCONN);
assert_return(m, -EINVAL);
assert_return(type < _SD_BUS_MESSAGE_TYPE_MAX, -EINVAL);
- t = malloc0(ALIGN(sizeof(sd_bus_message)) + sizeof(struct bus_header));
+ sd_bus_message *t = malloc0(ALIGN(sizeof(sd_bus_message)) + sizeof(struct bus_header));
if (!t)
return -ENOMEM;
@@ -623,6 +622,7 @@ _public_ int sd_bus_message_new_signal(
int r;
assert_return(bus, -ENOTCONN);
+ assert_return(bus = bus_resolve(bus), -ENOPKG);
assert_return(bus->state != BUS_UNSET, -ENOTCONN);
assert_return(object_path_is_valid(path), -EINVAL);
assert_return(interface_name_is_valid(interface), -EINVAL);
@@ -663,6 +663,7 @@ _public_ int sd_bus_message_new_method_call(
int r;
assert_return(bus, -ENOTCONN);
+ assert_return(bus = bus_resolve(bus), -ENOPKG);
assert_return(bus->state != BUS_UNSET, -ENOTCONN);
assert_return(!destination || service_name_is_valid(destination), -EINVAL);
assert_return(object_path_is_valid(path), -EINVAL);
diff --git a/src/libsystemd/sd-bus/sd-bus.c b/src/libsystemd/sd-bus/sd-bus.c
index 7ad03680f4..5cbd01594c 100644
--- a/src/libsystemd/sd-bus/sd-bus.c
+++ b/src/libsystemd/sd-bus/sd-bus.c
@@ -504,7 +504,6 @@ static int synthesize_connected_signal(sd_bus *bus) {
}
void bus_set_state(sd_bus *bus, enum bus_state state) {
-
static const char * const table[_BUS_STATE_MAX] = {
[BUS_UNSET] = "UNSET",
[BUS_WATCH_BIND] = "WATCH_BIND",
@@ -980,9 +979,8 @@ static int parse_container_unix_address(sd_bus *b, const char **p, char **guid)
return -EINVAL;
free_and_replace(b->machine, machine);
- } else {
+ } else
b->machine = mfree(b->machine);
- }
if (pid) {
r = parse_pid(pid, &b->nspid);
@@ -1271,10 +1269,7 @@ int bus_set_address_system(sd_bus *b) {
assert(b);
e = secure_getenv("DBUS_SYSTEM_BUS_ADDRESS");
- if (e)
- return sd_bus_set_address(b, e);
-
- return sd_bus_set_address(b, DEFAULT_SYSTEM_BUS_ADDRESS);
+ return sd_bus_set_address(b, e ?: DEFAULT_SYSTEM_BUS_ADDRESS);
}
_public_ int sd_bus_open_system_with_description(sd_bus **ret, const char *description) {
@@ -1319,29 +1314,30 @@ _public_ int sd_bus_open_system(sd_bus **ret) {
}
int bus_set_address_user(sd_bus *b) {
- const char *e;
- _cleanup_free_ char *ee = NULL, *s = NULL;
+ const char *a;
+ _cleanup_free_ char *_a = NULL;
assert(b);
- e = secure_getenv("DBUS_SESSION_BUS_ADDRESS");
- if (e)
- return sd_bus_set_address(b, e);
+ a = secure_getenv("DBUS_SESSION_BUS_ADDRESS");
+ if (!a) {
+ const char *e;
+ _cleanup_free_ char *ee = NULL;
- e = secure_getenv("XDG_RUNTIME_DIR");
- if (!e)
- return -ENOENT;
-
- ee = bus_address_escape(e);
- if (!ee)
- return -ENOMEM;
+ e = secure_getenv("XDG_RUNTIME_DIR");
+ if (!e)
+ return -ENOENT;
- if (asprintf(&s, DEFAULT_USER_BUS_ADDRESS_FMT, ee) < 0)
- return -ENOMEM;
+ ee = bus_address_escape(e);
+ if (!ee)
+ return -ENOMEM;
- b->address = TAKE_PTR(s);
+ if (asprintf(&_a, DEFAULT_USER_BUS_ADDRESS_FMT, ee) < 0)
+ return -ENOMEM;
+ a = _a;
+ }
- return 0;
+ return sd_bus_set_address(b, a);
}
_public_ int sd_bus_open_user_with_description(sd_bus **ret, const char *description) {
@@ -1902,9 +1898,10 @@ _public_ int sd_bus_send(sd_bus *bus, sd_bus_message *_m, uint64_t *cookie) {
assert_return(m, -EINVAL);
- if (!bus)
- bus = m->bus;
-
+ if (bus)
+ assert_return(bus = bus_resolve(bus), -ENOPKG);
+ else
+ assert_return(bus = m->bus, -ENOTCONN);
assert_return(!bus_pid_changed(bus), -ECHILD);
if (!BUS_IS_OPEN(bus->state))
@@ -1986,9 +1983,10 @@ _public_ int sd_bus_send_to(sd_bus *bus, sd_bus_message *m, const char *destinat
assert_return(m, -EINVAL);
- if (!bus)
- bus = m->bus;
-
+ if (bus)
+ assert_return(bus = bus_resolve(bus), -ENOPKG);
+ else
+ assert_return(bus = m->bus, -ENOTCONN);
assert_return(!bus_pid_changed(bus), -ECHILD);
if (!BUS_IS_OPEN(bus->state))
@@ -2051,9 +2049,10 @@ _public_ int sd_bus_call_async(
assert_return(m->header->type == SD_BUS_MESSAGE_METHOD_CALL, -EINVAL);
assert_return(!m->sealed || (!!callback == !(m->header->flags & BUS_MESSAGE_NO_REPLY_EXPECTED)), -EINVAL);
- if (!bus)
- bus = m->bus;
-
+ if (bus)
+ assert_return(bus = bus_resolve(bus), -ENOPKG);
+ else
+ assert_return(bus = m->bus, -ENOTCONN);
assert_return(!bus_pid_changed(bus), -ECHILD);
if (!BUS_IS_OPEN(bus->state))
@@ -2157,9 +2156,10 @@ _public_ int sd_bus_call(
bus_assert_return(!(m->header->flags & BUS_MESSAGE_NO_REPLY_EXPECTED), -EINVAL, error);
bus_assert_return(!bus_error_is_dirty(error), -EINVAL, error);
- if (!bus)
- bus = m->bus;
-
+ if (bus)
+ assert_return(bus = bus_resolve(bus), -ENOPKG);
+ else
+ assert_return(bus = m->bus, -ENOTCONN);
bus_assert_return(!bus_pid_changed(bus), -ECHILD, error);
if (!BUS_IS_OPEN(bus->state)) {
@@ -2286,7 +2286,6 @@ fail:
}
_public_ int sd_bus_get_fd(sd_bus *bus) {
-
assert_return(bus, -EINVAL);
assert_return(bus = bus_resolve(bus), -ENOPKG);
assert_return(bus->input_fd == bus->output_fd, -EPERM);
@@ -3677,31 +3676,31 @@ _public_ int sd_bus_detach_event(sd_bus *bus) {
}
_public_ sd_event* sd_bus_get_event(sd_bus *bus) {
- assert_return(bus, NULL);
+ assert_return(bus = bus_resolve(bus), NULL);
return bus->event;
}
_public_ sd_bus_message* sd_bus_get_current_message(sd_bus *bus) {
- assert_return(bus, NULL);
+ assert_return(bus = bus_resolve(bus), NULL);
return bus->current_message;
}
_public_ sd_bus_slot* sd_bus_get_current_slot(sd_bus *bus) {
- assert_return(bus, NULL);
+ assert_return(bus = bus_resolve(bus), NULL);
return bus->current_slot;
}
_public_ sd_bus_message_handler_t sd_bus_get_current_handler(sd_bus *bus) {
- assert_return(bus, NULL);
+ assert_return(bus = bus_resolve(bus), NULL);
return bus->current_handler;
}
_public_ void* sd_bus_get_current_userdata(sd_bus *bus) {
- assert_return(bus, NULL);
+ assert_return(bus = bus_resolve(bus), NULL);
return bus->current_userdata;
}
@@ -4018,7 +4017,6 @@ _public_ int sd_bus_get_scope(sd_bus *bus, const char **scope) {
}
_public_ int sd_bus_get_address(sd_bus *bus, const char **address) {
-
assert_return(bus, -EINVAL);
assert_return(bus = bus_resolve(bus), -ENOPKG);
assert_return(address, -EINVAL);
diff --git a/src/libsystemd/sd-network/sd-network.c b/src/libsystemd/sd-network/sd-network.c
index b9b618e585..a5ab5b3c36 100644
--- a/src/libsystemd/sd-network/sd-network.c
+++ b/src/libsystemd/sd-network/sd-network.c
@@ -240,6 +240,10 @@ _public_ int sd_network_link_get_ntp(int ifindex, char ***ret) {
return network_link_get_strv(ifindex, "NTP", ret);
}
+_public_ int sd_network_link_get_sip(int ifindex, char ***ret) {
+ return network_link_get_strv(ifindex, "SIP", ret);
+}
+
_public_ int sd_network_link_get_search_domains(int ifindex, char ***ret) {
return network_link_get_strv(ifindex, "DOMAINS", ret);
}
@@ -252,6 +256,10 @@ _public_ int sd_network_link_get_sip_servers(int ifindex, char ***ret) {
return network_link_get_strv(ifindex, "SIP", ret);
}
+_public_ int sd_network_link_get_pop3_servers(int ifindex, char ***pop3) {
+ return network_link_get_strv(ifindex, "POP3_SERVERS", pop3);
+}
+
_public_ int sd_network_link_get_dns_default_route(int ifindex) {
char path[STRLEN("/run/systemd/netif/links/") + DECIMAL_STR_MAX(ifindex) + 1];
_cleanup_free_ char *s = NULL;
diff --git a/src/libsystemd/sd-path/sd-path.c b/src/libsystemd/sd-path/sd-path.c
index 95d6551e5c..2a9c04a84d 100644
--- a/src/libsystemd/sd-path/sd-path.c
+++ b/src/libsystemd/sd-path/sd-path.c
@@ -7,6 +7,7 @@
#include "fd-util.h"
#include "fileio.h"
#include "fs-util.h"
+#include "path-lookup.h"
#include "path-util.h"
#include "string-util.h"
#include "strv.h"
@@ -318,64 +319,130 @@ static int get_path(uint64_t type, char **buffer, const char **ret) {
case SD_PATH_USER_DESKTOP:
return from_user_dir("XDG_DESKTOP_DIR", buffer, ret);
+
+ case SD_PATH_SYSTEMD_UTIL_DIR:
+ *ret = ROOTPREFIX "lib/systemd";
+ return 0;
+
+ case SD_PATH_SYSTEMD_SYSTEM_UNIT_DIR:
+ *ret = SYSTEM_DATA_UNIT_PATH;
+ return 0;
+
+ case SD_PATH_SYSTEMD_SYSTEM_PRESET_DIR:
+ *ret = ROOTPREFIX "lib/systemd/system-preset";
+ return 0;
+
+ case SD_PATH_SYSTEMD_USER_UNIT_DIR:
+ *ret = USER_DATA_UNIT_DIR;
+ return 0;
+
+ case SD_PATH_SYSTEMD_USER_PRESET_DIR:
+ *ret = ROOTPREFIX "lib/systemd/user-preset";
+ return 0;
+
+ case SD_PATH_SYSTEMD_SYSTEM_CONF_DIR:
+ *ret = SYSTEM_CONFIG_UNIT_DIR;
+ return 0;
+
+ case SD_PATH_SYSTEMD_USER_CONF_DIR:
+ *ret = USER_CONFIG_UNIT_DIR;
+ return 0;
+
+ case SD_PATH_SYSTEMD_SYSTEM_GENERATOR_DIR:
+ *ret = SYSTEM_GENERATOR_DIR;
+ return 0;
+
+ case SD_PATH_SYSTEMD_USER_GENERATOR_DIR:
+ *ret = USER_GENERATOR_DIR;
+ return 0;
+
+ case SD_PATH_SYSTEMD_SLEEP_DIR:
+ *ret = ROOTPREFIX "lib/systemd/system-sleep";
+ return 0;
+
+ case SD_PATH_SYSTEMD_SHUTDOWN_DIR:
+ *ret = ROOTPREFIX "lib/systemd/system-shutdown";
+ return 0;
+
+ /* FIXME: systemd.pc uses ${prefix}, but CONF_PATHS_NULSTR doesn't.
+ * Should ${prefix} use in systemd.pc be removed? */
+ case SD_PATH_TMPFILES_DIR:
+ *ret = "/usr/lib/tmpfiles.d";
+ return 0;
+
+ case SD_PATH_SYSUSERS_DIR:
+ *ret = "/usr/lib/sysusers.d";
+ return 0;
+
+ case SD_PATH_SYSCTL_DIR:
+ *ret = "/usr/lib/sysctl.d";
+ return 0;
+
+ case SD_PATH_BINFMT_DIR:
+ *ret = "/usr/lib/binfmt.d";
+ return 0;
+
+ case SD_PATH_MODULES_LOAD_DIR:
+ *ret = "/usr/lib/modules-load.d";
+ return 0;
+
+ case SD_PATH_CATALOG_DIR:
+ *ret = "/usr/lib/systemd/catalog";
+ return 0;
}
return -EOPNOTSUPP;
}
-_public_ int sd_path_home(uint64_t type, const char *suffix, char **path) {
+static int get_path_alloc(uint64_t type, const char *suffix, char **path) {
_cleanup_free_ char *buffer = NULL;
+ char *buffer2 = NULL;
const char *ret;
- char *cc;
int r;
- assert_return(path, -EINVAL);
-
- if (IN_SET(type,
- SD_PATH_SEARCH_BINARIES,
- SD_PATH_SEARCH_BINARIES_DEFAULT,
- SD_PATH_SEARCH_LIBRARY_PRIVATE,
- SD_PATH_SEARCH_LIBRARY_ARCH,
- SD_PATH_SEARCH_SHARED,
- SD_PATH_SEARCH_CONFIGURATION_FACTORY,
- SD_PATH_SEARCH_STATE_FACTORY,
- SD_PATH_SEARCH_CONFIGURATION)) {
+ assert(path);
- _cleanup_strv_free_ char **l = NULL;
-
- r = sd_path_search(type, suffix, &l);
- if (r < 0)
- return r;
+ r = get_path(type, &buffer, &ret);
+ if (r < 0)
+ return r;
- buffer = strv_join(l, ":");
+ if (suffix) {
+ suffix += strspn(suffix, "/");
+ buffer2 = path_join(ret, suffix);
+ if (!buffer2)
+ return -ENOMEM;
+ } else if (!buffer) {
+ buffer = strdup(ret);
if (!buffer)
return -ENOMEM;
-
- *path = TAKE_PTR(buffer);
- return 0;
}
- r = get_path(type, &buffer, &ret);
- if (r < 0)
+ *path = buffer2 ?: TAKE_PTR(buffer);
+ return 0;
+}
+
+_public_ int sd_path_lookup(uint64_t type, const char *suffix, char **path) {
+ int r;
+
+ assert_return(path, -EINVAL);
+
+ r = get_path_alloc(type, suffix, path);
+ if (r != -EOPNOTSUPP)
return r;
- if (!suffix) {
- if (!buffer) {
- buffer = strdup(ret);
- if (!buffer)
- return -ENOMEM;
- }
+ /* Fall back to sd_path_lookup_strv */
+ _cleanup_strv_free_ char **l = NULL;
+ char *buffer;
- *path = TAKE_PTR(buffer);
- return 0;
- }
+ r = sd_path_lookup_strv(type, suffix, &l);
+ if (r < 0)
+ return r;
- suffix += strspn(suffix, "/");
- cc = path_join(ret, suffix);
- if (!cc)
+ buffer = strv_join(l, ":");
+ if (!buffer)
return -ENOMEM;
- *path = TAKE_PTR(cc);
+ *path = buffer;
return 0;
}
@@ -454,6 +521,7 @@ static int search_from_environment(
#endif
static int get_search(uint64_t type, char ***list) {
+ int r;
assert(list);
@@ -536,58 +604,69 @@ static int get_search(uint64_t type, char ***list) {
"/etc",
NULL);
- case SD_PATH_SEARCH_BINARIES_DEFAULT: {
+ case SD_PATH_SEARCH_BINARIES_DEFAULT:
+ return strv_from_nulstr(list, DEFAULT_PATH_NULSTR);
+
+ case SD_PATH_SYSTEMD_SYSTEM_UNIT_PATH:
+ case SD_PATH_SYSTEMD_USER_UNIT_PATH: {
+ _cleanup_(lookup_paths_free) LookupPaths lp = {};
+ const UnitFileScope scope = type == SD_PATH_SYSTEMD_SYSTEM_UNIT_PATH ?
+ UNIT_FILE_SYSTEM : UNIT_FILE_USER;
+
+ r = lookup_paths_init(&lp, scope, 0, NULL);
+ if (r < 0)
+ return r;
+
+ *list = TAKE_PTR(lp.search_path);
+ return 0;
+ }
+
+ case SD_PATH_SYSTEMD_SYSTEM_GENERATOR_PATH:
+ case SD_PATH_SYSTEMD_USER_GENERATOR_PATH: {
char **t;
+ const UnitFileScope scope = type == SD_PATH_SYSTEMD_SYSTEM_UNIT_PATH ?
+ UNIT_FILE_SYSTEM : UNIT_FILE_USER;
- t = strv_split_nulstr(DEFAULT_PATH_NULSTR);
+ t = generator_binary_paths(scope);
if (!t)
return -ENOMEM;
*list = t;
return 0;
- }}
+ }
+
+ case SD_PATH_SYSTEMD_NETWORK_PATH:
+ return strv_from_nulstr(list, NETWORK_DIRS_NULSTR);
+
+ }
return -EOPNOTSUPP;
}
-_public_ int sd_path_search(uint64_t type, const char *suffix, char ***paths) {
- char **i, **j;
+_public_ int sd_path_lookup_strv(uint64_t type, const char *suffix, char ***paths) {
_cleanup_strv_free_ char **l = NULL, **n = NULL;
int r;
assert_return(paths, -EINVAL);
- if (!IN_SET(type,
- SD_PATH_SEARCH_BINARIES,
- SD_PATH_SEARCH_BINARIES_DEFAULT,
- SD_PATH_SEARCH_LIBRARY_PRIVATE,
- SD_PATH_SEARCH_LIBRARY_ARCH,
- SD_PATH_SEARCH_SHARED,
- SD_PATH_SEARCH_CONFIGURATION_FACTORY,
- SD_PATH_SEARCH_STATE_FACTORY,
- SD_PATH_SEARCH_CONFIGURATION)) {
-
- char *p;
+ r = get_search(type, &l);
+ if (r == -EOPNOTSUPP) {
+ _cleanup_free_ char *t = NULL;
- r = sd_path_home(type, suffix, &p);
+ r = get_path_alloc(type, suffix, &t);
if (r < 0)
return r;
l = new(char*, 2);
- if (!l) {
- free(p);
+ if (!l)
return -ENOMEM;
- }
-
- l[0] = p;
+ l[0] = TAKE_PTR(t);
l[1] = NULL;
*paths = TAKE_PTR(l);
return 0;
- }
- r = get_search(type, &l);
- if (r < 0)
+ } else if (r < 0)
return r;
if (!suffix) {
@@ -599,7 +678,7 @@ _public_ int sd_path_search(uint64_t type, const char *suffix, char ***paths) {
if (!n)
return -ENOMEM;
- j = n;
+ char **i, **j = n;
STRV_FOREACH(i, l) {
*j = path_join(*i, suffix);
if (!*j)
@@ -607,8 +686,8 @@ _public_ int sd_path_search(uint64_t type, const char *suffix, char ***paths) {
j++;
}
-
*j = NULL;
+
*paths = TAKE_PTR(n);
return 0;
}
diff --git a/src/login/logind-dbus.c b/src/login/logind-dbus.c
index 52a7ea3c77..15201f900f 100644
--- a/src/login/logind-dbus.c
+++ b/src/login/logind-dbus.c
@@ -3424,7 +3424,7 @@ const sd_bus_vtable manager_vtable[] = {
SD_BUS_VTABLE_END
};
-static int session_jobs_reply(Session *s, const char *unit, const char *result) {
+static int session_jobs_reply(Session *s, uint32_t jid, const char *unit, const char *result) {
assert(s);
assert(unit);
@@ -3435,7 +3435,7 @@ static int session_jobs_reply(Session *s, const char *unit, const char *result)
_cleanup_(sd_bus_error_free) sd_bus_error e = SD_BUS_ERROR_NULL;
sd_bus_error_setf(&e, BUS_ERROR_JOB_FAILED,
- "Start job for unit '%s' failed with '%s'", unit, result);
+ "Job %u for unit '%s' failed with '%s'", jid, unit, result);
return session_send_create_reply(s, &e);
}
@@ -3475,7 +3475,7 @@ int match_job_removed(sd_bus_message *message, void *userdata, sd_bus_error *err
if (session) {
if (streq_ptr(path, session->scope_job)) {
session->scope_job = mfree(session->scope_job);
- (void) session_jobs_reply(session, unit, result);
+ (void) session_jobs_reply(session, id, unit, result);
session_save(session);
user_save(session->user);
@@ -3490,7 +3490,7 @@ int match_job_removed(sd_bus_message *message, void *userdata, sd_bus_error *err
user->service_job = mfree(user->service_job);
LIST_FOREACH(sessions_by_user, session, user->sessions)
- (void) session_jobs_reply(session, unit, NULL /* don't propagate user service failures to the client */);
+ (void) session_jobs_reply(session, id, unit, NULL /* don't propagate user service failures to the client */);
user_save(user);
}
diff --git a/src/login/org.freedesktop.login1.policy b/src/login/org.freedesktop.login1.policy
index b726634cbf..1b6d85e5f9 100644
--- a/src/login/org.freedesktop.login1.policy
+++ b/src/login/org.freedesktop.login1.policy
@@ -396,7 +396,7 @@
<message gettext-domain="systemd">Authentication is required to change the virtual terminal.</message>
<defaults>
<allow_any>auth_admin_keep</allow_any>
- <allow_inactive>auth_admin_keep</allow_inactive>
+ <allow_inactive>yes</allow_inactive>
<allow_active>yes</allow_active>
</defaults>
</action>
diff --git a/src/network/netdev/netdev.c b/src/network/netdev/netdev.c
index f8121a48ed..bc85d4babb 100644
--- a/src/network/netdev/netdev.c
+++ b/src/network/netdev/netdev.c
@@ -24,6 +24,7 @@
#include "network-internal.h"
#include "networkd-manager.h"
#include "nlmon.h"
+#include "path-lookup.h"
#include "siphash24.h"
#include "stat-util.h"
#include "string-table.h"
diff --git a/src/network/networkctl.c b/src/network/networkctl.c
index 7db2142ef2..cfe511c387 100644
--- a/src/network/networkctl.c
+++ b/src/network/networkctl.c
@@ -7,6 +7,7 @@
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
+#include <linux/if_bridge.h>
#include <linux/if_tunnel.h>
#include "sd-bus.h"
@@ -20,6 +21,7 @@
#include "bus-common-errors.h"
#include "bus-error.h"
#include "bus-util.h"
+#include "bridge-util.h"
#include "device-util.h"
#include "escape.h"
#include "ether-addr-util.h"
@@ -27,6 +29,7 @@
#include "fd-util.h"
#include "format-table.h"
#include "format-util.h"
+#include "geneve-util.h"
#include "glob-util.h"
#include "hwdb-util.h"
#include "local-addresses.h"
@@ -127,6 +130,7 @@ typedef struct LinkInfo {
uint32_t max_mtu;
uint32_t tx_queues;
uint32_t rx_queues;
+ uint8_t addr_gen_mode;
char *qdisc;
char **alternative_names;
@@ -144,8 +148,10 @@ typedef struct LinkInfo {
uint32_t max_age;
uint32_t ageing_time;
uint32_t stp_state;
+ uint32_t cost;
uint16_t priority;
uint8_t mcast_igmp_version;
+ uint8_t port_state;
/* vxlan info */
VxLanInfo vxlan_info;
@@ -156,8 +162,14 @@ typedef struct LinkInfo {
/* tunnel info */
uint8_t ttl;
uint8_t tos;
+ uint8_t inherit;
+ uint8_t df;
+ uint8_t csum;
+ uint8_t csum6_tx;
+ uint8_t csum6_rx;
uint16_t tunnel_port;
uint32_t vni;
+ uint32_t label;
union in_addr_union local;
union in_addr_union remote;
@@ -188,6 +200,7 @@ typedef struct LinkInfo {
bool has_ethtool_link_info:1;
bool has_wlan_link_info:1;
bool has_tunnel_ipv4:1;
+ bool has_ipv6_address_generation_mode:1;
bool needs_freeing:1;
} LinkInfo;
@@ -233,8 +246,10 @@ static int decode_netdev(sd_netlink_message *m, LinkInfo *info) {
(void) sd_netlink_message_read_u32(m, IFLA_BR_MAX_AGE, &info->max_age);
(void) sd_netlink_message_read_u32(m, IFLA_BR_AGEING_TIME, &info->ageing_time);
(void) sd_netlink_message_read_u32(m, IFLA_BR_STP_STATE, &info->stp_state);
+ (void) sd_netlink_message_read_u32(m, IFLA_BRPORT_COST, &info->cost);
(void) sd_netlink_message_read_u16(m, IFLA_BR_PRIORITY, &info->priority);
(void) sd_netlink_message_read_u8(m, IFLA_BR_MCAST_IGMP_VERSION, &info->mcast_igmp_version);
+ (void) sd_netlink_message_read_u8(m, IFLA_BRPORT_STATE, &info->port_state);
} if (streq(received_kind, "bond")) {
(void) sd_netlink_message_read_u8(m, IFLA_BOND_MODE, &info->mode);
(void) sd_netlink_message_read_u32(m, IFLA_BOND_MIIMON, &info->miimon);
@@ -278,8 +293,14 @@ static int decode_netdev(sd_netlink_message *m, LinkInfo *info) {
(void) sd_netlink_message_read_in6_addr(m, IFLA_GENEVE_REMOTE6, &info->remote.in6);
(void) sd_netlink_message_read_u8(m, IFLA_GENEVE_TTL, &info->ttl);
+ (void) sd_netlink_message_read_u8(m, IFLA_GENEVE_TTL_INHERIT, &info->inherit);
(void) sd_netlink_message_read_u8(m, IFLA_GENEVE_TOS, &info->tos);
+ (void) sd_netlink_message_read_u8(m, IFLA_GENEVE_DF, &info->df);
+ (void) sd_netlink_message_read_u8(m, IFLA_GENEVE_UDP_CSUM, &info->csum);
+ (void) sd_netlink_message_read_u8(m, IFLA_GENEVE_UDP_ZERO_CSUM6_TX, &info->csum6_tx);
+ (void) sd_netlink_message_read_u8(m, IFLA_GENEVE_UDP_ZERO_CSUM6_RX, &info->csum6_rx);
(void) sd_netlink_message_read_u16(m, IFLA_GENEVE_PORT, &info->tunnel_port);
+ (void) sd_netlink_message_read_u32(m, IFLA_GENEVE_LABEL, &info->label);
} else if (STR_IN_SET(received_kind, "gre", "gretap", "erspan")) {
(void) sd_netlink_message_read_in_addr(m, IFLA_GRE_LOCAL, &info->local.in);
(void) sd_netlink_message_read_in_addr(m, IFLA_GRE_REMOTE, &info->remote.in);
@@ -397,6 +418,19 @@ static int decode_link(sd_netlink_message *m, LinkInfo *info, char **patterns, b
(void) sd_netlink_message_read_u32(m, IFLA_MASTER, &info->master);
+ r = sd_netlink_message_enter_container(m, IFLA_AF_SPEC);
+ if (r >= 0) {
+ r = sd_netlink_message_enter_container(m, AF_INET6);
+ if (r >= 0) {
+ r = sd_netlink_message_read_u8(m, IFLA_INET6_ADDR_GEN_MODE, &info->addr_gen_mode);
+ if (r >= 0)
+ info->has_ipv6_address_generation_mode = true;
+
+ (void) sd_netlink_message_exit_container(m);
+ }
+ (void) sd_netlink_message_exit_container(m);
+ }
+
/* fill kind info */
(void) decode_netdev(m, info);
@@ -1206,7 +1240,8 @@ static int link_status_one(
sd_hwdb *hwdb,
const LinkInfo *info) {
- _cleanup_strv_free_ char **dns = NULL, **ntp = NULL, **search_domains = NULL, **route_domains = NULL;
+ _cleanup_strv_free_ char **dns = NULL, **ntp = NULL, **sip = NULL, **search_domains = NULL, **route_domains = NULL,
+ **pop3_server = NULL;
_cleanup_free_ char *setup_state = NULL, *operational_state = NULL, *tz = NULL;
_cleanup_free_ char *t = NULL, *network = NULL;
const char *driver = NULL, *path = NULL, *vendor = NULL, *model = NULL, *link = NULL;
@@ -1232,6 +1267,8 @@ static int link_status_one(
(void) sd_network_link_get_search_domains(info->ifindex, &search_domains);
(void) sd_network_link_get_route_domains(info->ifindex, &route_domains);
(void) sd_network_link_get_ntp(info->ifindex, &ntp);
+ (void) sd_network_link_get_sip(info->ifindex, &sip);
+ (void) sd_network_link_get_pop3_servers(info->ifindex, &pop3_server);
if (info->sd_device) {
(void) sd_device_get_property_value(info->sd_device, "ID_NET_LINK_FILE", &link);
@@ -1418,6 +1455,24 @@ static int link_status_one(
return table_log_add_error(r);
}
+ if (info->has_ipv6_address_generation_mode) {
+ static const struct {
+ const char *mode;
+ } mode_table[] = {
+ { "eui64" },
+ { "none" },
+ { "stable-privacy" },
+ { "random" },
+ };
+
+ r = table_add_many(table,
+ TABLE_EMPTY,
+ TABLE_STRING, "IPv6 Address Generation Mode:",
+ TABLE_STRING, mode_table[info->addr_gen_mode]);
+ if (r < 0)
+ return table_log_add_error(r);
+ }
+
if (streq_ptr(info->netdev_kind, "bridge")) {
r = table_add_many(table,
TABLE_EMPTY,
@@ -1440,10 +1495,19 @@ static int link_status_one(
TABLE_BOOLEAN, info->stp_state > 0,
TABLE_EMPTY,
TABLE_STRING, "Multicast IGMP Version:",
- TABLE_UINT8, info->mcast_igmp_version);
+ TABLE_UINT8, info->mcast_igmp_version,
+ TABLE_EMPTY,
+ TABLE_STRING, "Cost:",
+ TABLE_UINT32, info->cost);
if (r < 0)
return table_log_add_error(r);
+ if (info->port_state <= BR_STATE_BLOCKING) {
+ r = table_add_many(table,
+ TABLE_EMPTY,
+ TABLE_STRING, "Port State:",
+ TABLE_STRING, bridge_state_to_string(info->port_state));
+ }
} else if (streq_ptr(info->netdev_kind, "bond")) {
static const struct {
const char *mode;
@@ -1611,6 +1675,52 @@ static int link_status_one(
TABLE_UINT16, info->tunnel_port);
if (r < 0)
return table_log_add_error(r);
+
+ r = table_add_many(table,
+ TABLE_EMPTY,
+ TABLE_STRING, "Inherit:",
+ TABLE_STRING, geneve_df_to_string(info->inherit));
+ if (r < 0)
+ return table_log_add_error(r);
+
+ if (info->df > 0) {
+ r = table_add_many(table,
+ TABLE_EMPTY,
+ TABLE_STRING, "IPDoNotFragment:",
+ TABLE_UINT8, info->df);
+ if (r < 0)
+ return table_log_add_error(r);
+ }
+
+ r = table_add_many(table,
+ TABLE_EMPTY,
+ TABLE_STRING, "UDPChecksum:",
+ TABLE_BOOLEAN, info->csum);
+ if (r < 0)
+ return table_log_add_error(r);
+
+ r = table_add_many(table,
+ TABLE_EMPTY,
+ TABLE_STRING, "UDP6ZeroChecksumTx:",
+ TABLE_BOOLEAN, info->csum6_tx);
+ if (r < 0)
+ return table_log_add_error(r);
+
+ r = table_add_many(table,
+ TABLE_EMPTY,
+ TABLE_STRING, "UDP6ZeroChecksumRx:",
+ TABLE_BOOLEAN, info->csum6_rx);
+ if (r < 0)
+ return table_log_add_error(r);
+
+ if (info->label > 0) {
+ r = table_add_many(table,
+ TABLE_EMPTY,
+ TABLE_STRING, "FlowLabel:",
+ TABLE_UINT32, info->label);
+ if (r < 0)
+ return table_log_add_error(r);
+ }
}
if (info->has_wlan_link_info) {
@@ -1718,6 +1828,12 @@ static int link_status_one(
r = dump_list(table, "NTP:", ntp);
if (r < 0)
return r;
+ r = dump_list(table, "SIP:", sip);
+ if (r < 0)
+ return r;
+ r = dump_list(table, "POP3 servers:", pop3_server);
+ if (r < 0)
+ return r;
r = dump_ifindexes(table, "Carrier Bound To:", carrier_bound_to);
if (r < 0)
return r;
diff --git a/src/network/networkd-dhcp-server.c b/src/network/networkd-dhcp-server.c
index bee75a6930..83caef6fc0 100644
--- a/src/network/networkd-dhcp-server.c
+++ b/src/network/networkd-dhcp-server.c
@@ -140,6 +140,55 @@ static int link_push_uplink_ntp_to_dhcp_server(Link *link, sd_dhcp_server *s) {
return sd_dhcp_server_set_ntp(s, addresses, n_addresses);
}
+static int link_push_uplink_pop3_to_dhcp_server(Link *link, sd_dhcp_server *s) {
+ _cleanup_free_ struct in_addr *addresses = NULL;
+ size_t n_addresses = 0, n_allocated = 0;
+ char **a;
+
+ if (!link->network)
+ return 0;
+
+ log_link_debug(link, "Copying POP3 server information from link");
+
+ STRV_FOREACH(a, link->network->pop3) {
+ union in_addr_union ia;
+
+ /* Only look for IPv4 addresses */
+ if (in_addr_from_string(AF_INET, *a, &ia) <= 0)
+ continue;
+
+ /* Never propagate obviously borked data */
+ if (in4_addr_is_null(&ia.in) || in4_addr_is_localhost(&ia.in))
+ continue;
+
+ if (!GREEDY_REALLOC(addresses, n_allocated, n_addresses + 1))
+ return log_oom();
+
+ addresses[n_addresses++] = ia.in;
+ }
+
+ if (link->dhcp_lease) {
+ const struct in_addr *da = NULL;
+ int j, n;
+
+ n = sd_dhcp_lease_get_pop3_server(link->dhcp_lease, &da);
+ if (n > 0) {
+
+ if (!GREEDY_REALLOC(addresses, n_allocated, n_addresses + n))
+ return log_oom();
+
+ for (j = 0; j < n; j++)
+ if (in4_addr_is_non_local(&da[j]))
+ addresses[n_addresses++] = da[j];
+ }
+ }
+
+ if (n_addresses <= 0)
+ return 0;
+
+ return sd_dhcp_server_set_pop3_server(s, addresses, n_addresses);
+}
+
static int link_push_uplink_sip_to_dhcp_server(Link *link, sd_dhcp_server *s) {
_cleanup_free_ struct in_addr *addresses = NULL;
size_t n_addresses = 0, n_allocated = 0;
@@ -281,6 +330,22 @@ int dhcp4_server_configure(Link *link) {
log_link_warning_errno(link, r, "Failed to set SIP server for DHCP server, ignoring: %m");
}
+ if (link->network->n_dhcp_server_pop3 > 0)
+ r = sd_dhcp_server_set_pop3_server(link->dhcp_server, link->network->dhcp_server_pop3, link->network->n_dhcp_server_pop3);
+ else {
+ if (!acquired_uplink)
+ uplink = manager_find_uplink(link->manager, link);
+
+ if (!uplink) {
+ log_link_debug(link, "Not emitting POP3 server information on link, couldn't find suitable uplink.");
+ r = 0;
+ } else
+ r = link_push_uplink_pop3_to_dhcp_server(uplink, link->dhcp_server);
+
+ }
+ if (r < 0)
+ log_link_warning_errno(link, r, "Failed to set POP3 server for DHCP server, ignoring: %m");
+
r = sd_dhcp_server_set_emit_router(link->dhcp_server, link->network->dhcp_server_emit_router);
if (r < 0)
return log_link_error_errno(link, r, "Failed to set router emission for DHCP server: %m");
@@ -312,6 +377,14 @@ int dhcp4_server_configure(Link *link) {
return log_link_error_errno(link, r, "Failed to set DHCPv4 option: %m");
}
+ ORDERED_HASHMAP_FOREACH(p, link->network->dhcp_server_send_vendor_options, i) {
+ r = sd_dhcp_server_add_vendor_option(link->dhcp_server, p);
+ if (r == -EEXIST)
+ continue;
+ if (r < 0)
+ return log_link_error_errno(link, r, "Failed to set DHCPv4 option: %m");
+ }
+
if (!sd_dhcp_server_is_running(link->dhcp_server)) {
r = sd_dhcp_server_start(link->dhcp_server);
if (r < 0)
@@ -478,3 +551,55 @@ int config_parse_dhcp_server_sip(
n->dhcp_server_sip = m;
}
}
+
+int config_parse_dhcp_server_pop3_servers(
+ const char *unit,
+ const char *filename,
+ unsigned line,
+ const char *section,
+ unsigned section_line,
+ const char *lvalue,
+ int ltype,
+ const char *rvalue,
+ void *data,
+ void *userdata) {
+
+ Network *n = data;
+ const char *p = rvalue;
+ int r;
+
+ assert(filename);
+ assert(lvalue);
+ assert(rvalue);
+
+ for (;;) {
+ _cleanup_free_ char *w = NULL;
+ union in_addr_union a;
+ struct in_addr *m;
+
+ r = extract_first_word(&p, &w, NULL, 0);
+ if (r == -ENOMEM)
+ return log_oom();
+ if (r < 0) {
+ log_syntax(unit, LOG_ERR, filename, line, r,
+ "Failed to extract word, ignoring: %s", rvalue);
+ return 0;
+ }
+ if (r == 0)
+ return 0;
+
+ r = in_addr_from_string(AF_INET, w, &a);
+ if (r < 0) {
+ log_syntax(unit, LOG_ERR, filename, line, r,
+ "Failed to parse POP3 server address '%s', ignoring: %m", w);
+ continue;
+ }
+
+ m = reallocarray(n->dhcp_server_pop3, n->n_dhcp_server_pop3 + 1, sizeof(struct in_addr));
+ if (!m)
+ return log_oom();
+
+ m[n->n_dhcp_server_pop3++] = a.in;
+ n->dhcp_server_pop3 = m;
+ }
+}
diff --git a/src/network/networkd-dhcp-server.h b/src/network/networkd-dhcp-server.h
index c90d48ec00..a388f6b81c 100644
--- a/src/network/networkd-dhcp-server.h
+++ b/src/network/networkd-dhcp-server.h
@@ -12,3 +12,4 @@ int dhcp4_server_configure(Link *link);
CONFIG_PARSER_PROTOTYPE(config_parse_dhcp_server_dns);
CONFIG_PARSER_PROTOTYPE(config_parse_dhcp_server_ntp);
CONFIG_PARSER_PROTOTYPE(config_parse_dhcp_server_sip);
+CONFIG_PARSER_PROTOTYPE(config_parse_dhcp_server_pop3_servers);
diff --git a/src/network/networkd-dhcp4.c b/src/network/networkd-dhcp4.c
index 64190375a4..83fb25264a 100644
--- a/src/network/networkd-dhcp4.c
+++ b/src/network/networkd-dhcp4.c
@@ -1430,7 +1430,17 @@ int dhcp4_configure(Link *link) {
}
ORDERED_HASHMAP_FOREACH(send_option, link->network->dhcp_client_send_options, i) {
- r = sd_dhcp_client_set_dhcp_option(link->dhcp_client, send_option);
+ r = sd_dhcp_client_add_option(link->dhcp_client, send_option);
+ if (r == -EEXIST)
+ continue;
+ if (r < 0)
+ return log_link_error_errno(link, r, "DHCP4 CLIENT: Failed to set send option: %m");
+ }
+
+ ORDERED_HASHMAP_FOREACH(send_option, link->network->dhcp_client_send_vendor_options, i) {
+ r = sd_dhcp_client_add_vendor_option(link->dhcp_client, send_option);
+ if (r == -EEXIST)
+ continue;
if (r < 0)
return log_link_error_errno(link, r, "DHCP4 CLIENT: Failed to set send option: %m");
}
diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c
index d7845760c5..376596bf57 100644
--- a/src/network/networkd-link.c
+++ b/src/network/networkd-link.c
@@ -3487,6 +3487,10 @@ network_file_fail:
if (r < 0)
return log_link_error_errno(link, r, "Failed to create DHCPv4 client: %m");
+ r = sd_dhcp_client_attach_event(link->dhcp_client, NULL, 0);
+ if (r < 0)
+ return log_link_error_errno(link, r, "Failed to attach DHCPv4 event: %m");
+
r = sd_dhcp_client_set_request_address(link->dhcp_client, &address.in);
if (r < 0)
return log_link_error_errno(link, r, "Failed to set initial DHCPv4 address %s: %m", dhcp4_address);
@@ -3505,6 +3509,10 @@ dhcp4_address_fail:
if (r < 0)
return log_link_error_errno(link, r, "Failed to create IPv4LL client: %m");
+ r = sd_ipv4ll_attach_event(link->ipv4ll, NULL, 0);
+ if (r < 0)
+ return log_link_error_errno(link, r, "Failed to attach IPv4LL event: %m");
+
r = sd_ipv4ll_set_address(link->ipv4ll, &address.in);
if (r < 0)
return log_link_error_errno(link, r, "Failed to set initial IPv4LL address %s: %m", ipv4ll_address);
@@ -4092,6 +4100,21 @@ int link_save(Link *link) {
space = true;
}
+ fputc('\n', f);
+
+ fputs("POP3_SERVERS=", f);
+ space = false;
+ fputstrv(f, link->network->pop3, NULL, &space);
+
+ if (link->dhcp_lease) {
+ const struct in_addr *addresses;
+
+ r = sd_dhcp_lease_get_pop3_server(link->dhcp_lease, &addresses);
+ if (r > 0)
+ if (serialize_in_addrs(f, addresses, r, space, in4_addr_is_non_local) > 0)
+ space = true;
+ }
+
if (link->network->dhcp6_use_ntp && dhcp6_lease) {
struct in6_addr *in6_addrs;
char **hosts;
diff --git a/src/network/networkd-manager.c b/src/network/networkd-manager.c
index 804f33d6cb..066c72ab5b 100644
--- a/src/network/networkd-manager.c
+++ b/src/network/networkd-manager.c
@@ -30,6 +30,7 @@
#include "networkd-network-bus.h"
#include "networkd-speed-meter.h"
#include "ordered-set.h"
+#include "path-lookup.h"
#include "path-util.h"
#include "set.h"
#include "signal-util.h"
@@ -1488,7 +1489,8 @@ static int ordered_set_put_in4_addrv(OrderedSet *s,
}
static int manager_save(Manager *m) {
- _cleanup_ordered_set_free_free_ OrderedSet *dns = NULL, *ntp = NULL, *sip = NULL, *search_domains = NULL, *route_domains = NULL;
+ _cleanup_ordered_set_free_free_ OrderedSet *dns = NULL, *ntp = NULL, *sip = NULL, *pop3 = NULL,
+ *search_domains = NULL, *route_domains = NULL;
const char *operstate_str, *carrier_state_str, *address_state_str;
LinkOperationalState operstate = LINK_OPERSTATE_OFF;
LinkCarrierState carrier_state = LINK_CARRIER_STATE_OFF;
@@ -1496,6 +1498,7 @@ static int manager_save(Manager *m) {
_cleanup_free_ char *temp_path = NULL;
_cleanup_strv_free_ char **p = NULL;
_cleanup_fclose_ FILE *f = NULL;
+ const struct in_addr *addresses;
Link *link;
Iterator i;
int r;
@@ -1512,10 +1515,14 @@ static int manager_save(Manager *m) {
if (!ntp)
return -ENOMEM;
- sip = ordered_set_new(&string_hash_ops);
- if (!sip)
+ sip = ordered_set_new(&string_hash_ops);
+ if (!sip)
return -ENOMEM;
+ pop3 = ordered_set_new(&string_hash_ops);
+ if (!pop3)
+ return -ENOMEM;
+
search_domains = ordered_set_new(&dns_name_hash_ops);
if (!search_domains)
return -ENOMEM;
@@ -1562,8 +1569,6 @@ static int manager_save(Manager *m) {
/* Secondly, add the entries acquired via DHCP */
if (link->network->dhcp_use_dns) {
- const struct in_addr *addresses;
-
r = sd_dhcp_lease_get_dns(link->dhcp_lease, &addresses);
if (r > 0) {
r = ordered_set_put_in4_addrv(dns, addresses, r, in4_addr_is_non_local);
@@ -1574,8 +1579,6 @@ static int manager_save(Manager *m) {
}
if (link->network->dhcp_use_ntp) {
- const struct in_addr *addresses;
-
r = sd_dhcp_lease_get_ntp(link->dhcp_lease, &addresses);
if (r > 0) {
r = ordered_set_put_in4_addrv(ntp, addresses, r, in4_addr_is_non_local);
@@ -1586,8 +1589,6 @@ static int manager_save(Manager *m) {
}
if (link->network->dhcp_use_sip) {
- const struct in_addr *addresses;
-
r = sd_dhcp_lease_get_sip(link->dhcp_lease, &addresses);
if (r > 0) {
r = ordered_set_put_in4_addrv(sip, addresses, r, in4_addr_is_non_local);
@@ -1597,6 +1598,15 @@ static int manager_save(Manager *m) {
return r;
}
+
+ r = sd_dhcp_lease_get_pop3_server(link->dhcp_lease, &addresses);
+ if (r > 0) {
+ r = ordered_set_put_in4_addrv(pop3, addresses, r, in4_addr_is_non_local);
+ if (r < 0)
+ return r;
+ } else if (r < 0 && r != -ENODATA)
+ return r;
+
if (link->network->dhcp_use_domains != DHCP_USE_DOMAINS_NO) {
const char *domainname;
char **domains = NULL;
@@ -1648,6 +1658,7 @@ static int manager_save(Manager *m) {
ordered_set_print(f, "DNS=", dns);
ordered_set_print(f, "NTP=", ntp);
ordered_set_print(f, "SIP=", sip);
+ ordered_set_print(f, "POP3_SERVERS=", pop3);
ordered_set_print(f, "DOMAINS=", search_domains);
ordered_set_print(f, "ROUTE_DOMAINS=", route_domains);
diff --git a/src/network/networkd-network-gperf.gperf b/src/network/networkd-network-gperf.gperf
index c75a07e4f3..25730b58f7 100644
--- a/src/network/networkd-network-gperf.gperf
+++ b/src/network/networkd-network-gperf.gperf
@@ -184,6 +184,7 @@ DHCPv4.SendDecline, config_parse_bool,
DHCPv4.BlackList, config_parse_dhcp_black_listed_ip_address, 0, 0
DHCPv4.IPServiceType, config_parse_dhcp_ip_service_type, 0, offsetof(Network, ip_service_type)
DHCPv4.SendOption, config_parse_dhcp_send_option, 0, offsetof(Network, dhcp_client_send_options)
+DHCPv4.SendVendorOption, config_parse_dhcp_send_option, 0, offsetof(Network, dhcp_client_send_vendor_options)
DHCPv4.RouteMTUBytes, config_parse_mtu, AF_INET, offsetof(Network, dhcp_route_mtu)
DHCPv6.UseDNS, config_parse_bool, 0, offsetof(Network, dhcp6_use_dns)
DHCPv6.UseNTP, config_parse_bool, 0, offsetof(Network, dhcp6_use_ntp)
@@ -206,11 +207,13 @@ DHCPServer.EmitNTP, config_parse_bool,
DHCPServer.NTP, config_parse_dhcp_server_ntp, 0, 0
DHCPServer.EmitSIP, config_parse_bool, 0, offsetof(Network, dhcp_server_emit_sip)
DHCPServer.SIP, config_parse_dhcp_server_sip, 0, 0
+DHCPServer.POP3Servers, config_parse_dhcp_server_pop3_servers, 0, 0
DHCPServer.EmitRouter, config_parse_bool, 0, offsetof(Network, dhcp_server_emit_router)
DHCPServer.EmitTimezone, config_parse_bool, 0, offsetof(Network, dhcp_server_emit_timezone)
DHCPServer.Timezone, config_parse_timezone, 0, offsetof(Network, dhcp_server_timezone)
DHCPServer.PoolOffset, config_parse_uint32, 0, offsetof(Network, dhcp_server_pool_offset)
DHCPServer.PoolSize, config_parse_uint32, 0, offsetof(Network, dhcp_server_pool_size)
+DHCPServer.SendVendorOption, config_parse_dhcp_send_option, 0, offsetof(Network, dhcp_server_send_vendor_options)
DHCPServer.SendOption, config_parse_dhcp_send_option, 0, offsetof(Network, dhcp_server_send_options)
Bridge.Cost, config_parse_uint32, 0, offsetof(Network, cost)
Bridge.UseBPDU, config_parse_tristate, 0, offsetof(Network, use_bpdu)
diff --git a/src/network/networkd-network.c b/src/network/networkd-network.c
index 248172f8a2..0007f78ae3 100644
--- a/src/network/networkd-network.c
+++ b/src/network/networkd-network.c
@@ -16,6 +16,7 @@
#include "networkd-manager.h"
#include "networkd-network.h"
#include "parse-util.h"
+#include "path-lookup.h"
#include "set.h"
#include "socket-util.h"
#include "stat-util.h"
@@ -723,7 +724,9 @@ static Network *network_free(Network *network) {
set_free_free(network->dnssec_negative_trust_anchors);
ordered_hashmap_free(network->dhcp_client_send_options);
+ ordered_hashmap_free(network->dhcp_client_send_vendor_options);
ordered_hashmap_free(network->dhcp_server_send_options);
+ ordered_hashmap_free(network->dhcp_server_send_vendor_options);
ordered_hashmap_free(network->ipv6_tokens);
return mfree(network);
diff --git a/src/network/networkd-network.h b/src/network/networkd-network.h
index b687282124..58b310f59e 100644
--- a/src/network/networkd-network.h
+++ b/src/network/networkd-network.h
@@ -121,7 +121,9 @@ struct Network {
Set *dhcp_black_listed_ip;
Set *dhcp_request_options;
OrderedHashmap *dhcp_client_send_options;
+ OrderedHashmap *dhcp_client_send_vendor_options;
OrderedHashmap *dhcp_server_send_options;
+ OrderedHashmap *dhcp_server_send_vendor_options;
/* DHCPv6 Client support*/
bool dhcp6_use_dns;
@@ -145,6 +147,9 @@ struct Network {
struct in_addr *dhcp_server_sip;
unsigned n_dhcp_server_sip;
+ struct in_addr *dhcp_server_pop3;
+ unsigned n_dhcp_server_pop3;
+
bool dhcp_server_emit_router;
bool dhcp_server_emit_timezone;
char *dhcp_server_timezone;
@@ -294,6 +299,7 @@ struct Network {
char **ntp;
char **sip;
+ char **pop3;
char **bind_carrier;
};
diff --git a/src/path/path.c b/src/path/path.c
index 568b5fb04b..5d6afb96f0 100644
--- a/src/path/path.c
+++ b/src/path/path.c
@@ -18,46 +18,71 @@
static const char *arg_suffix = NULL;
static const char* const path_table[_SD_PATH_MAX] = {
- [SD_PATH_TEMPORARY] = "temporary",
- [SD_PATH_TEMPORARY_LARGE] = "temporary-large",
- [SD_PATH_SYSTEM_BINARIES] = "system-binaries",
- [SD_PATH_SYSTEM_INCLUDE] = "system-include",
- [SD_PATH_SYSTEM_LIBRARY_PRIVATE] = "system-library-private",
- [SD_PATH_SYSTEM_LIBRARY_ARCH] = "system-library-arch",
- [SD_PATH_SYSTEM_SHARED] = "system-shared",
- [SD_PATH_SYSTEM_CONFIGURATION_FACTORY] = "system-configuration-factory",
- [SD_PATH_SYSTEM_STATE_FACTORY] = "system-state-factory",
- [SD_PATH_SYSTEM_CONFIGURATION] = "system-configuration",
- [SD_PATH_SYSTEM_RUNTIME] = "system-runtime",
- [SD_PATH_SYSTEM_RUNTIME_LOGS] = "system-runtime-logs",
- [SD_PATH_SYSTEM_STATE_PRIVATE] = "system-state-private",
- [SD_PATH_SYSTEM_STATE_LOGS] = "system-state-logs",
- [SD_PATH_SYSTEM_STATE_CACHE] = "system-state-cache",
- [SD_PATH_SYSTEM_STATE_SPOOL] = "system-state-spool",
- [SD_PATH_USER_BINARIES] = "user-binaries",
- [SD_PATH_USER_LIBRARY_PRIVATE] = "user-library-private",
- [SD_PATH_USER_LIBRARY_ARCH] = "user-library-arch",
- [SD_PATH_USER_SHARED] = "user-shared",
- [SD_PATH_USER_CONFIGURATION] = "user-configuration",
- [SD_PATH_USER_RUNTIME] = "user-runtime",
- [SD_PATH_USER_STATE_CACHE] = "user-state-cache",
- [SD_PATH_USER] = "user",
- [SD_PATH_USER_DOCUMENTS] = "user-documents",
- [SD_PATH_USER_MUSIC] = "user-music",
- [SD_PATH_USER_PICTURES] = "user-pictures",
- [SD_PATH_USER_VIDEOS] = "user-videos",
- [SD_PATH_USER_DOWNLOAD] = "user-download",
- [SD_PATH_USER_PUBLIC] = "user-public",
- [SD_PATH_USER_TEMPLATES] = "user-templates",
- [SD_PATH_USER_DESKTOP] = "user-desktop",
- [SD_PATH_SEARCH_BINARIES] = "search-binaries",
- [SD_PATH_SEARCH_BINARIES_DEFAULT] = "search-binaries-default",
- [SD_PATH_SEARCH_LIBRARY_PRIVATE] = "search-library-private",
- [SD_PATH_SEARCH_LIBRARY_ARCH] = "search-library-arch",
- [SD_PATH_SEARCH_SHARED] = "search-shared",
- [SD_PATH_SEARCH_CONFIGURATION_FACTORY] = "search-configuration-factory",
- [SD_PATH_SEARCH_STATE_FACTORY] = "search-state-factory",
- [SD_PATH_SEARCH_CONFIGURATION] = "search-configuration",
+ [SD_PATH_TEMPORARY] = "temporary",
+ [SD_PATH_TEMPORARY_LARGE] = "temporary-large",
+ [SD_PATH_SYSTEM_BINARIES] = "system-binaries",
+ [SD_PATH_SYSTEM_INCLUDE] = "system-include",
+ [SD_PATH_SYSTEM_LIBRARY_PRIVATE] = "system-library-private",
+ [SD_PATH_SYSTEM_LIBRARY_ARCH] = "system-library-arch",
+ [SD_PATH_SYSTEM_SHARED] = "system-shared",
+ [SD_PATH_SYSTEM_CONFIGURATION_FACTORY] = "system-configuration-factory",
+ [SD_PATH_SYSTEM_STATE_FACTORY] = "system-state-factory",
+ [SD_PATH_SYSTEM_CONFIGURATION] = "system-configuration",
+ [SD_PATH_SYSTEM_RUNTIME] = "system-runtime",
+ [SD_PATH_SYSTEM_RUNTIME_LOGS] = "system-runtime-logs",
+ [SD_PATH_SYSTEM_STATE_PRIVATE] = "system-state-private",
+ [SD_PATH_SYSTEM_STATE_LOGS] = "system-state-logs",
+ [SD_PATH_SYSTEM_STATE_CACHE] = "system-state-cache",
+ [SD_PATH_SYSTEM_STATE_SPOOL] = "system-state-spool",
+ [SD_PATH_USER_BINARIES] = "user-binaries",
+ [SD_PATH_USER_LIBRARY_PRIVATE] = "user-library-private",
+ [SD_PATH_USER_LIBRARY_ARCH] = "user-library-arch",
+ [SD_PATH_USER_SHARED] = "user-shared",
+ [SD_PATH_USER_CONFIGURATION] = "user-configuration",
+ [SD_PATH_USER_RUNTIME] = "user-runtime",
+ [SD_PATH_USER_STATE_CACHE] = "user-state-cache",
+ [SD_PATH_USER] = "user",
+ [SD_PATH_USER_DOCUMENTS] = "user-documents",
+ [SD_PATH_USER_MUSIC] = "user-music",
+ [SD_PATH_USER_PICTURES] = "user-pictures",
+ [SD_PATH_USER_VIDEOS] = "user-videos",
+ [SD_PATH_USER_DOWNLOAD] = "user-download",
+ [SD_PATH_USER_PUBLIC] = "user-public",
+ [SD_PATH_USER_TEMPLATES] = "user-templates",
+ [SD_PATH_USER_DESKTOP] = "user-desktop",
+ [SD_PATH_SEARCH_BINARIES] = "search-binaries",
+ [SD_PATH_SEARCH_BINARIES_DEFAULT] = "search-binaries-default",
+ [SD_PATH_SEARCH_LIBRARY_PRIVATE] = "search-library-private",
+ [SD_PATH_SEARCH_LIBRARY_ARCH] = "search-library-arch",
+ [SD_PATH_SEARCH_SHARED] = "search-shared",
+ [SD_PATH_SEARCH_CONFIGURATION_FACTORY] = "search-configuration-factory",
+ [SD_PATH_SEARCH_STATE_FACTORY] = "search-state-factory",
+ [SD_PATH_SEARCH_CONFIGURATION] = "search-configuration",
+
+ [SD_PATH_SYSTEMD_UTIL_DIR] = "systemd-util-dir",
+ [SD_PATH_SYSTEMD_SYSTEM_UNIT_DIR] = "systemd-system-unit-dir",
+ [SD_PATH_SYSTEMD_SYSTEM_PRESET_DIR] = "systemd-system-preset-dir",
+ [SD_PATH_SYSTEMD_USER_UNIT_DIR] = "systemd-user-unit-dir",
+ [SD_PATH_SYSTEMD_USER_PRESET_DIR] = "systemd-user-preset-dir",
+ [SD_PATH_SYSTEMD_SYSTEM_CONF_DIR] = "systemd-system-conf-dir",
+ [SD_PATH_SYSTEMD_USER_CONF_DIR] = "systemd-user-conf-dir",
+ [SD_PATH_SYSTEMD_SYSTEM_UNIT_PATH] = "systemd-system-unit-path",
+ [SD_PATH_SYSTEMD_USER_UNIT_PATH] = "systemd-user-unit-path",
+ [SD_PATH_SYSTEMD_SYSTEM_GENERATOR_DIR] = "systemd-system-generator-dir",
+ [SD_PATH_SYSTEMD_USER_GENERATOR_DIR] = "systemd-user-generator-dir",
+ [SD_PATH_SYSTEMD_SYSTEM_GENERATOR_PATH] = "systemd-system-generator-path",
+ [SD_PATH_SYSTEMD_USER_GENERATOR_PATH] = "systemd-user-generator-path",
+ [SD_PATH_SYSTEMD_SLEEP_DIR] = "systemd-sleep-dir",
+ [SD_PATH_SYSTEMD_SHUTDOWN_DIR] = "systemd-shutdown-dir",
+
+ [SD_PATH_TMPFILES_DIR] = "tmpfiles-dir",
+ [SD_PATH_SYSUSERS_DIR] = "sysusers-dir",
+ [SD_PATH_SYSCTL_DIR] = "sysctl-dir",
+ [SD_PATH_BINFMT_DIR] = "binfmt-dir",
+ [SD_PATH_MODULES_LOAD_DIR] = "modules-load-dir",
+ [SD_PATH_CATALOG_DIR] = "catalog-dir",
+
+ [SD_PATH_SYSTEMD_NETWORK_PATH] = "systemd-network-path",
};
static int list_homes(void) {
@@ -68,12 +93,12 @@ static int list_homes(void) {
_cleanup_free_ char *p = NULL;
int q;
- q = sd_path_home(i, arg_suffix, &p);
- if (q == -ENXIO)
- continue;
+ q = sd_path_lookup(i, arg_suffix, &p);
if (q < 0) {
- log_error_errno(r, "Failed to query %s: %m", path_table[i]);
- r = q;
+ log_full_errno(q == -ENXIO ? LOG_DEBUG : LOG_ERR,
+ q, "Failed to query %s: %m", path_table[i]);
+ if (q != -ENXIO)
+ r = q;
continue;
}
@@ -91,7 +116,7 @@ static int print_home(const char *n) {
if (streq(path_table[i], n)) {
_cleanup_free_ char *p = NULL;
- r = sd_path_home(i, arg_suffix, &p);
+ r = sd_path_lookup(i, arg_suffix, &p);
if (r < 0)
return log_error_errno(r, "Failed to query %s: %m", n);
@@ -126,7 +151,6 @@ static int help(void) {
}
static int parse_argv(int argc, char *argv[]) {
-
enum {
ARG_VERSION = 0x100,
ARG_SUFFIX,
diff --git a/src/shared/bridge-util.c b/src/shared/bridge-util.c
new file mode 100644
index 0000000000..2e45a1bd59
--- /dev/null
+++ b/src/shared/bridge-util.c
@@ -0,0 +1,13 @@
+/* SPDX-License-Identifier: LGPL-2.1+ */
+
+#include "bridge-util.h"
+#include "string-table.h"
+
+static const char* const bridge_state_table[_NETDEV_BRIDGE_STATE_MAX] = {
+ [NETDEV_BRIDGE_STATE_DISABLED] = "disabled",
+ [NETDEV_BRIDGE_STATE_LISTENING] = "listening",
+ [NETDEV_BRIDGE_STATE_LEARNING] = "learning",
+ [NETDEV_BRIDGE_STATE_FORWARDING] = "forwading",
+};
+
+DEFINE_STRING_TABLE_LOOKUP(bridge_state, BridgeState);
diff --git a/src/shared/bridge-util.h b/src/shared/bridge-util.h
new file mode 100644
index 0000000000..5b1c3e9ea9
--- /dev/null
+++ b/src/shared/bridge-util.h
@@ -0,0 +1,20 @@
+/* SPDX-License-Identifier: LGPL-2.1+ */
+#pragma once
+
+#include <netinet/in.h>
+#include <linux/if_bridge.h>
+
+#include "conf-parser.h"
+
+typedef enum BridgeState {
+ NETDEV_BRIDGE_STATE_DISABLED = BR_STATE_DISABLED,
+ NETDEV_BRIDGE_STATE_LISTENING = BR_STATE_LISTENING,
+ NETDEV_BRIDGE_STATE_LEARNING = BR_STATE_LEARNING,
+ NETDEV_BRIDGE_STATE_FORWARDING = BR_STATE_FORWARDING,
+ NETDEV_BRIDGE_STATE_BLOCKING = BR_STATE_BLOCKING,
+ _NETDEV_BRIDGE_STATE_MAX,
+ _NETDEV_BRIDGE_STATE_INVALID = -1,
+} BridgeState;
+
+const char *bridge_state_to_string(BridgeState d) _const_;
+BridgeState bridge_state_from_string(const char *d) _pure_;
diff --git a/src/shared/bus-util.c b/src/shared/bus-util.c
index 8e6a6e2ce2..4b0a3a3e31 100644
--- a/src/shared/bus-util.c
+++ b/src/shared/bus-util.c
@@ -115,36 +115,16 @@ int bus_event_loop_with_idle(
return r;
if (r == 0 && !exiting && idle) {
+ /* Inform the service manager that we are going down, so that it will queue all
+ * further start requests, instead of assuming we are already running. */
+ sd_notify(false, "STOPPING=1");
- r = sd_bus_try_close(bus);
- if (r == -EBUSY)
- continue;
-
- /* Fallback for dbus1 connections: we
- * unregister the name and wait for the
- * response to come through for it */
- if (r == -EOPNOTSUPP) {
-
- /* Inform the service manager that we
- * are going down, so that it will
- * queue all further start requests,
- * instead of assuming we are already
- * running. */
- sd_notify(false, "STOPPING=1");
-
- r = bus_async_unregister_and_exit(e, bus, name);
- if (r < 0)
- return r;
-
- exiting = true;
- continue;
- }
-
+ r = bus_async_unregister_and_exit(e, bus, name);
if (r < 0)
return r;
- sd_event_exit(e, 0);
- break;
+ exiting = true;
+ continue;
}
}
diff --git a/src/shared/geneve-util.c b/src/shared/geneve-util.c
new file mode 100644
index 0000000000..fad01e208b
--- /dev/null
+++ b/src/shared/geneve-util.c
@@ -0,0 +1,12 @@
+/* SPDX-License-Identifier: LGPL-2.1+ */
+
+#include "geneve-util.h"
+#include "string-table.h"
+
+static const char* const geneve_df_table[_NETDEV_GENEVE_DF_MAX] = {
+ [NETDEV_GENEVE_DF_UNSET] = "unset",
+ [NETDEV_GENEVE_DF_SET] = "set",
+ [NETDEV_GENEVE_DF_INHERIT] = "inherit",
+};
+
+DEFINE_STRING_TABLE_LOOKUP(geneve_df, GeneveDF);
diff --git a/src/shared/geneve-util.h b/src/shared/geneve-util.h
new file mode 100644
index 0000000000..63c03ae02a
--- /dev/null
+++ b/src/shared/geneve-util.h
@@ -0,0 +1,17 @@
+/* SPDX-License-Identifier: LGPL-2.1+ */
+#pragma once
+
+#include <linux/if_link.h>
+
+#include "conf-parser.h"
+
+typedef enum GeneveDF {
+ NETDEV_GENEVE_DF_UNSET = GENEVE_DF_UNSET,
+ NETDEV_GENEVE_DF_SET = GENEVE_DF_SET,
+ NETDEV_GENEVE_DF_INHERIT = GENEVE_DF_INHERIT,
+ _NETDEV_GENEVE_DF_MAX,
+ _NETDEV_GENEVE_DF_INVALID = -1,
+} GeneveDF;
+
+const char *geneve_df_to_string(GeneveDF d) _const_;
+GeneveDF geneve_df_from_string(const char *d) _pure_;
diff --git a/src/shared/meson.build b/src/shared/meson.build
index 94174347a1..45a723f363 100644
--- a/src/shared/meson.build
+++ b/src/shared/meson.build
@@ -21,6 +21,8 @@ shared_sources = files('''
bootspec.h
bpf-program.c
bpf-program.h
+ bridge-util.c
+ bridge-util.h
bus-unit-procs.c
bus-unit-procs.h
bus-unit-util.c
@@ -87,6 +89,8 @@ shared_sources = files('''
fstab-util.h
generator.c
generator.h
+ geneve-util.c
+ geneve-util.h
gpt.c
gpt.h
group-record-nss.c
@@ -156,8 +160,6 @@ shared_sources = files('''
output-mode.h
pager.c
pager.h
- path-lookup.c
- path-lookup.h
pe-header.h
pkcs11-util.c
pkcs11-util.h
diff --git a/src/shutdown/shutdown.c b/src/shutdown/shutdown.c
index 15e6c1799e..918cf20bd0 100644
--- a/src/shutdown/shutdown.c
+++ b/src/shutdown/shutdown.c
@@ -547,6 +547,9 @@ int main(int argc, char *argv[]) {
/* Child */
execv(args[0], (char * const *) args);
+
+ /* execv failed (kexec binary missing?), so try simply reboot(RB_KEXEC) */
+ (void) reboot(cmd);
_exit(EXIT_FAILURE);
}
diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c
index f8b0adc334..58b0fd3688 100644
--- a/src/systemctl/systemctl.c
+++ b/src/systemctl/systemctl.c
@@ -1659,6 +1659,9 @@ static int list_unit_files(int argc, char *argv[], void *userdata) {
for (unit = units; unit < units + c; unit++)
free(unit->path);
+ if (c == 0)
+ return -ENOENT;
+
return 0;
}
diff --git a/src/systemd/meson.build b/src/systemd/meson.build
index 05196554ac..63d0829b67 100644
--- a/src/systemd/meson.build
+++ b/src/systemd/meson.build
@@ -12,6 +12,7 @@ _systemd_headers = '''
sd-journal.h
sd-login.h
sd-messages.h
+ sd-path.h
'''.split()
# https://github.com/mesonbuild/meson/issues/1633
@@ -30,7 +31,6 @@ _not_installed_headers = '''
sd-ndisc.h
sd-netlink.h
sd-network.h
- sd-path.h
sd-radv.h
sd-resolve.h
sd-utf8.h
diff --git a/src/systemd/sd-bus.h b/src/systemd/sd-bus.h
index e6f3298745..8e4866671c 100644
--- a/src/systemd/sd-bus.h
+++ b/src/systemd/sd-bus.h
@@ -55,7 +55,7 @@ typedef struct {
} sd_bus_error;
typedef struct {
- const char* name;
+ const char *name;
int code;
} sd_bus_error_map;
@@ -177,13 +177,13 @@ int sd_bus_get_sender(sd_bus *bus, const char **ret);
int sd_bus_start(sd_bus *bus);
-int sd_bus_try_close(sd_bus *bus);
+int sd_bus_try_close(sd_bus *bus) _sd_deprecated_; /* deprecated */
void sd_bus_close(sd_bus *bus);
-sd_bus *sd_bus_ref(sd_bus *bus);
-sd_bus *sd_bus_unref(sd_bus *bus);
-sd_bus *sd_bus_close_unref(sd_bus *bus);
-sd_bus *sd_bus_flush_close_unref(sd_bus *bus);
+sd_bus* sd_bus_ref(sd_bus *bus);
+sd_bus* sd_bus_unref(sd_bus *bus);
+sd_bus* sd_bus_close_unref(sd_bus *bus);
+sd_bus* sd_bus_flush_close_unref(sd_bus *bus);
void sd_bus_default_flush_close(void);
@@ -216,7 +216,7 @@ void* sd_bus_get_current_userdata(sd_bus *bus);
int sd_bus_attach_event(sd_bus *bus, sd_event *e, int priority);
int sd_bus_detach_event(sd_bus *bus);
-sd_event *sd_bus_get_event(sd_bus *bus);
+sd_event* sd_bus_get_event(sd_bus *bus);
int sd_bus_get_n_queued_read(sd_bus *bus, uint64_t *ret);
int sd_bus_get_n_queued_write(sd_bus *bus, uint64_t *ret);
@@ -240,8 +240,8 @@ sd_bus_slot* sd_bus_slot_ref(sd_bus_slot *slot);
sd_bus_slot* sd_bus_slot_unref(sd_bus_slot *slot);
sd_bus* sd_bus_slot_get_bus(sd_bus_slot *slot);
-void *sd_bus_slot_get_userdata(sd_bus_slot *slot);
-void *sd_bus_slot_set_userdata(sd_bus_slot *slot, void *userdata);
+void* sd_bus_slot_get_userdata(sd_bus_slot *slot);
+void* sd_bus_slot_set_userdata(sd_bus_slot *slot, void *userdata);
int sd_bus_slot_set_description(sd_bus_slot *slot, const char *description);
int sd_bus_slot_get_description(sd_bus_slot *slot, const char **description);
int sd_bus_slot_get_floating(sd_bus_slot *slot);
@@ -251,7 +251,7 @@ int sd_bus_slot_get_destroy_callback(sd_bus_slot *s, sd_bus_destroy_t *callback)
sd_bus_message* sd_bus_slot_get_current_message(sd_bus_slot *slot);
sd_bus_message_handler_t sd_bus_slot_get_current_handler(sd_bus_slot *slot);
-void *sd_bus_slot_get_current_userdata(sd_bus_slot *slot);
+void* sd_bus_slot_get_current_userdata(sd_bus_slot *slot);
/* Message object */
@@ -278,21 +278,21 @@ int sd_bus_message_get_expect_reply(sd_bus_message *m);
int sd_bus_message_get_auto_start(sd_bus_message *m);
int sd_bus_message_get_allow_interactive_authorization(sd_bus_message *m);
-const char *sd_bus_message_get_signature(sd_bus_message *m, int complete);
-const char *sd_bus_message_get_path(sd_bus_message *m);
-const char *sd_bus_message_get_interface(sd_bus_message *m);
-const char *sd_bus_message_get_member(sd_bus_message *m);
-const char *sd_bus_message_get_destination(sd_bus_message *m);
-const char *sd_bus_message_get_sender(sd_bus_message *m);
-const sd_bus_error *sd_bus_message_get_error(sd_bus_message *m);
+const char* sd_bus_message_get_signature(sd_bus_message *m, int complete);
+const char* sd_bus_message_get_path(sd_bus_message *m);
+const char* sd_bus_message_get_interface(sd_bus_message *m);
+const char* sd_bus_message_get_member(sd_bus_message *m);
+const char* sd_bus_message_get_destination(sd_bus_message *m);
+const char* sd_bus_message_get_sender(sd_bus_message *m);
+const sd_bus_error* sd_bus_message_get_error(sd_bus_message *m);
int sd_bus_message_get_errno(sd_bus_message *m);
int sd_bus_message_get_monotonic_usec(sd_bus_message *m, uint64_t *usec);
int sd_bus_message_get_realtime_usec(sd_bus_message *m, uint64_t *usec);
-int sd_bus_message_get_seqnum(sd_bus_message *m, uint64_t* seqnum);
+int sd_bus_message_get_seqnum(sd_bus_message *m, uint64_t *seqnum);
sd_bus* sd_bus_message_get_bus(sd_bus_message *m);
-sd_bus_creds *sd_bus_message_get_creds(sd_bus_message *m); /* do not unref the result */
+sd_bus_creds* sd_bus_message_get_creds(sd_bus_message *m); /* do not unref the result */
int sd_bus_message_is_signal(sd_bus_message *m, const char *interface, const char *member);
int sd_bus_message_is_method_call(sd_bus_message *m, const char *interface, const char *member);
@@ -387,8 +387,8 @@ int sd_bus_match_signal_async(sd_bus *bus, sd_bus_slot **ret, const char *sender
/* Credential handling */
int sd_bus_creds_new_from_pid(sd_bus_creds **ret, pid_t pid, uint64_t creds_mask);
-sd_bus_creds *sd_bus_creds_ref(sd_bus_creds *c);
-sd_bus_creds *sd_bus_creds_unref(sd_bus_creds *c);
+sd_bus_creds* sd_bus_creds_ref(sd_bus_creds *c);
+sd_bus_creds* sd_bus_creds_unref(sd_bus_creds *c);
uint64_t sd_bus_creds_get_mask(const sd_bus_creds *c);
uint64_t sd_bus_creds_get_augmented_mask(const sd_bus_creds *c);
@@ -486,8 +486,8 @@ sd_bus_track* sd_bus_track_ref(sd_bus_track *track);
sd_bus_track* sd_bus_track_unref(sd_bus_track *track);
sd_bus* sd_bus_track_get_bus(sd_bus_track *track);
-void *sd_bus_track_get_userdata(sd_bus_track *track);
-void *sd_bus_track_set_userdata(sd_bus_track *track, void *userdata);
+void* sd_bus_track_get_userdata(sd_bus_track *track);
+void* sd_bus_track_set_userdata(sd_bus_track *track, void *userdata);
int sd_bus_track_add_sender(sd_bus_track *track, sd_bus_message *m);
int sd_bus_track_remove_sender(sd_bus_track *track, sd_bus_message *m);
diff --git a/src/systemd/sd-dhcp-client.h b/src/systemd/sd-dhcp-client.h
index 0002ea0e59..b8ffe78468 100644
--- a/src/systemd/sd-dhcp-client.h
+++ b/src/systemd/sd-dhcp-client.h
@@ -83,6 +83,7 @@ enum {
SD_DHCP_OPTION_REBINDING_T2_TIME = 59,
SD_DHCP_OPTION_VENDOR_CLASS_IDENTIFIER = 60,
SD_DHCP_OPTION_CLIENT_IDENTIFIER = 61,
+ SD_DHCP_OPTION_POP3_SERVER = 70,
SD_DHCP_OPTION_USER_CLASS = 77,
SD_DHCP_OPTION_FQDN = 81,
SD_DHCP_OPTION_NEW_POSIX_TIMEZONE = 100,
@@ -179,7 +180,8 @@ int sd_dhcp_client_set_service_type(
sd_dhcp_client *client,
int type);
-int sd_dhcp_client_set_dhcp_option(sd_dhcp_client *client, sd_dhcp_option *v);
+int sd_dhcp_client_add_option(sd_dhcp_client *client, sd_dhcp_option *v);
+int sd_dhcp_client_add_vendor_option(sd_dhcp_client *client, sd_dhcp_option *v);
int sd_dhcp_client_stop(sd_dhcp_client *client);
int sd_dhcp_client_start(sd_dhcp_client *client);
diff --git a/src/systemd/sd-dhcp-lease.h b/src/systemd/sd-dhcp-lease.h
index b80d607fea..e216c768d4 100644
--- a/src/systemd/sd-dhcp-lease.h
+++ b/src/systemd/sd-dhcp-lease.h
@@ -45,6 +45,7 @@ int sd_dhcp_lease_get_server_identifier(sd_dhcp_lease *lease, struct in_addr *ad
int sd_dhcp_lease_get_dns(sd_dhcp_lease *lease, const struct in_addr **addr);
int sd_dhcp_lease_get_ntp(sd_dhcp_lease *lease, const struct in_addr **addr);
int sd_dhcp_lease_get_sip(sd_dhcp_lease *lease, const struct in_addr **addr);
+int sd_dhcp_lease_get_pop3_server(sd_dhcp_lease *lease, const struct in_addr **addr);
int sd_dhcp_lease_get_mtu(sd_dhcp_lease *lease, uint16_t *mtu);
int sd_dhcp_lease_get_domainname(sd_dhcp_lease *lease, const char **domainname);
int sd_dhcp_lease_get_search_domains(sd_dhcp_lease *lease, char ***domains);
diff --git a/src/systemd/sd-dhcp-server.h b/src/systemd/sd-dhcp-server.h
index 5950506c9b..98db7aded5 100644
--- a/src/systemd/sd-dhcp-server.h
+++ b/src/systemd/sd-dhcp-server.h
@@ -50,9 +50,11 @@ int sd_dhcp_server_set_timezone(sd_dhcp_server *server, const char *timezone);
int sd_dhcp_server_set_dns(sd_dhcp_server *server, const struct in_addr dns[], unsigned n);
int sd_dhcp_server_set_ntp(sd_dhcp_server *server, const struct in_addr ntp[], unsigned n);
int sd_dhcp_server_set_sip(sd_dhcp_server *server, const struct in_addr sip[], unsigned n);
+int sd_dhcp_server_set_pop3_server(sd_dhcp_server *server, const struct in_addr pop3_server[], unsigned n);
int sd_dhcp_server_set_emit_router(sd_dhcp_server *server, int enabled);
int sd_dhcp_server_add_option(sd_dhcp_server *server, sd_dhcp_option *v);
+int sd_dhcp_server_add_vendor_option(sd_dhcp_server *server, sd_dhcp_option *v);
int sd_dhcp_server_set_max_lease_time(sd_dhcp_server *server, uint32_t t);
int sd_dhcp_server_set_default_lease_time(sd_dhcp_server *server, uint32_t t);
diff --git a/src/systemd/sd-network.h b/src/systemd/sd-network.h
index d0b432274c..ea06c9d875 100644
--- a/src/systemd/sd-network.h
+++ b/src/systemd/sd-network.h
@@ -118,6 +118,10 @@ int sd_network_link_get_dhcp4_address(int ifindex, char **ret);
* representations of IP addresses */
int sd_network_link_get_ntp(int ifindex, char ***ret);
+/* Get SIP entries for a given link. These are string
+ * representations of IP addresses */
+int sd_network_link_get_sip(int ifindex, char ***ret);
+
/* Indicates whether or not LLMNR should be enabled for the link
* Possible levels of support: yes, no, resolve
* Possible return codes:
@@ -163,6 +167,9 @@ int sd_network_link_get_route_domains(int ifindex, char ***domains);
/* Get the sip servers for a given link. */
int sd_network_link_get_sip_servers(int ifindex, char ***sip);
+/* Get the pop3 servers for a given link. */
+int sd_network_link_get_pop3_servers(int ifindex, char ***pop3);
+
/* Get whether this link shall be used as 'default route' for DNS queries */
int sd_network_link_get_dns_default_route(int ifindex);
diff --git a/src/systemd/sd-path.h b/src/systemd/sd-path.h
index 16379876eb..7da7a9f814 100644
--- a/src/systemd/sd-path.h
+++ b/src/systemd/sd-path.h
@@ -78,11 +78,38 @@ enum {
SD_PATH_SEARCH_STATE_FACTORY,
SD_PATH_SEARCH_CONFIGURATION,
+ /* Various systemd paths, generally mirroring systemd.pc */
+ SD_PATH_SYSTEMD_UTIL_DIR,
+ SD_PATH_SYSTEMD_SYSTEM_UNIT_DIR,
+ SD_PATH_SYSTEMD_SYSTEM_PRESET_DIR,
+ SD_PATH_SYSTEMD_USER_UNIT_DIR,
+ SD_PATH_SYSTEMD_USER_PRESET_DIR,
+ SD_PATH_SYSTEMD_SYSTEM_CONF_DIR,
+ SD_PATH_SYSTEMD_USER_CONF_DIR,
+ SD_PATH_SYSTEMD_SYSTEM_UNIT_PATH,
+ SD_PATH_SYSTEMD_USER_UNIT_PATH,
+ SD_PATH_SYSTEMD_SYSTEM_GENERATOR_DIR,
+ SD_PATH_SYSTEMD_USER_GENERATOR_DIR,
+ SD_PATH_SYSTEMD_SYSTEM_GENERATOR_PATH,
+ SD_PATH_SYSTEMD_USER_GENERATOR_PATH,
+ SD_PATH_SYSTEMD_SLEEP_DIR,
+ SD_PATH_SYSTEMD_SHUTDOWN_DIR,
+
+ SD_PATH_TMPFILES_DIR,
+ SD_PATH_SYSUSERS_DIR,
+ SD_PATH_SYSCTL_DIR,
+ SD_PATH_BINFMT_DIR,
+ SD_PATH_MODULES_LOAD_DIR,
+ SD_PATH_CATALOG_DIR,
+
+ /* systemd-networkd search paths */
+ SD_PATH_SYSTEMD_NETWORK_PATH,
+
_SD_PATH_MAX,
};
-int sd_path_home(uint64_t type, const char *suffix, char **path);
-int sd_path_search(uint64_t type, const char *suffix, char ***paths);
+int sd_path_lookup(uint64_t type, const char *suffix, char **path);
+int sd_path_lookup_strv(uint64_t type, const char *suffix, char ***paths);
_SD_END_DECLARATIONS;
diff --git a/src/test/meson.build b/src/test/meson.build
index 7c55f65be1..6297875c0d 100644
--- a/src/test/meson.build
+++ b/src/test/meson.build
@@ -778,6 +778,10 @@ tests += [
[],
[]],
+ [['src/test/test-sd-path.c'],
+ [],
+ []],
+
[['src/test/test-local-addresses.c'],
[],
[]],
@@ -1022,10 +1026,7 @@ tests += [
]
-# test-bus-vtable-cc.cc is a symlink and symlinks get lost in containers on FuzzBuzz.
-# The issue has been reported to the developers of FuzzBuzz and hopefully will be fixed soon.
-# In the meantime, let's just skip the symlink there.
-if cxx_cmd != '' and not want_fuzzbuzz
+if cxx_cmd != ''
tests += [
[['src/libsystemd/sd-bus/test-bus-vtable-cc.cc'],
[],
diff --git a/src/test/test-install-root.c b/src/test/test-install-root.c
index 25498916f1..49faa6a33b 100644
--- a/src/test/test-install-root.c
+++ b/src/test/test-install-root.c
@@ -55,7 +55,7 @@ static void test_basic_mask_and_enable(const char *root) {
assert_se(n_changes == 1);
assert_se(changes[0].type == UNIT_FILE_SYMLINK);
assert_se(streq(changes[0].source, "/dev/null"));
- p = strjoina(root, SYSTEM_CONFIG_UNIT_PATH"/a.service");
+ p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/a.service");
assert_se(streq(changes[0].path, p));
unit_file_changes_free(changes, n_changes);
@@ -74,7 +74,7 @@ static void test_basic_mask_and_enable(const char *root) {
assert_se(unit_file_unmask(UNIT_FILE_SYSTEM, 0, root, STRV_MAKE("a.service"), &changes, &n_changes) >= 0);
assert_se(n_changes == 1);
assert_se(changes[0].type == UNIT_FILE_UNLINK);
- p = strjoina(root, SYSTEM_CONFIG_UNIT_PATH"/a.service");
+ p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/a.service");
assert_se(streq(changes[0].path, p));
unit_file_changes_free(changes, n_changes);
changes = NULL; n_changes = 0;
@@ -83,7 +83,7 @@ static void test_basic_mask_and_enable(const char *root) {
assert_se(n_changes == 1);
assert_se(changes[0].type == UNIT_FILE_SYMLINK);
assert_se(streq(changes[0].source, "/usr/lib/systemd/system/a.service"));
- p = strjoina(root, SYSTEM_CONFIG_UNIT_PATH"/multi-user.target.wants/a.service");
+ p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/multi-user.target.wants/a.service");
assert_se(streq(changes[0].path, p));
unit_file_changes_free(changes, n_changes);
changes = NULL; n_changes = 0;
@@ -102,7 +102,7 @@ static void test_basic_mask_and_enable(const char *root) {
assert_se(unit_file_disable(UNIT_FILE_SYSTEM, 0, root, STRV_MAKE("a.service"), &changes, &n_changes) >= 0);
assert_se(n_changes == 1);
assert_se(changes[0].type == UNIT_FILE_UNLINK);
- p = strjoina(root, SYSTEM_CONFIG_UNIT_PATH"/multi-user.target.wants/a.service");
+ p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/multi-user.target.wants/a.service");
assert_se(streq(changes[0].path, p));
unit_file_changes_free(changes, n_changes);
changes = NULL; n_changes = 0;
@@ -123,7 +123,7 @@ static void test_basic_mask_and_enable(const char *root) {
assert_se(n_changes == 1);
assert_se(changes[0].type == UNIT_FILE_SYMLINK);
assert_se(streq(changes[0].source, "/usr/lib/systemd/system/a.service"));
- p = strjoina(root, SYSTEM_CONFIG_UNIT_PATH"/multi-user.target.wants/a.service");
+ p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/multi-user.target.wants/a.service");
assert_se(streq(changes[0].path, p));
unit_file_changes_free(changes, n_changes);
changes = NULL; n_changes = 0;
@@ -138,7 +138,7 @@ static void test_basic_mask_and_enable(const char *root) {
assert_se(unit_file_reenable(UNIT_FILE_SYSTEM, 0, root, STRV_MAKE("b.service"), &changes, &n_changes) >= 0);
assert_se(n_changes == 2);
assert_se(changes[0].type == UNIT_FILE_UNLINK);
- p = strjoina(root, SYSTEM_CONFIG_UNIT_PATH"/multi-user.target.wants/a.service");
+ p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/multi-user.target.wants/a.service");
assert_se(streq(changes[0].path, p));
assert_se(changes[1].type == UNIT_FILE_SYMLINK);
assert_se(streq(changes[1].source, "/usr/lib/systemd/system/a.service"));
@@ -196,7 +196,7 @@ static void test_linked_units(const char *root) {
p = strjoina(root, "/usr/lib/systemd/system/linked2.service");
assert_se(symlink("/opt/linked2.service", p) >= 0);
- p = strjoina(root, SYSTEM_CONFIG_UNIT_PATH"/linked3.service");
+ p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/linked3.service");
assert_se(symlink("/opt/linked3.service", p) >= 0);
assert_se(unit_file_get_state(UNIT_FILE_SYSTEM, root, "linked.service", &state) == -ENOENT);
@@ -208,7 +208,7 @@ static void test_linked_units(const char *root) {
assert_se(n_changes == 1);
assert_se(changes[0].type == UNIT_FILE_SYMLINK);
assert_se(streq(changes[0].source, "/opt/linked.service"));
- p = strjoina(root, SYSTEM_CONFIG_UNIT_PATH"/linked.service");
+ p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/linked.service");
assert_se(streq(changes[0].path, p));
unit_file_changes_free(changes, n_changes);
changes = NULL; n_changes = 0;
@@ -219,7 +219,7 @@ static void test_linked_units(const char *root) {
assert_se(unit_file_disable(UNIT_FILE_SYSTEM, 0, root, STRV_MAKE("linked.service"), &changes, &n_changes) >= 0);
assert_se(n_changes == 1);
assert_se(changes[0].type == UNIT_FILE_UNLINK);
- p = strjoina(root, SYSTEM_CONFIG_UNIT_PATH"/linked.service");
+ p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/linked.service");
assert_se(streq(changes[0].path, p));
unit_file_changes_free(changes, n_changes);
changes = NULL; n_changes = 0;
@@ -229,8 +229,8 @@ static void test_linked_units(const char *root) {
/* Now, let's not just link it, but also enable it */
assert_se(unit_file_enable(UNIT_FILE_SYSTEM, 0, root, STRV_MAKE("/opt/linked.service"), &changes, &n_changes) >= 0);
assert_se(n_changes == 2);
- p = strjoina(root, SYSTEM_CONFIG_UNIT_PATH"/multi-user.target.wants/linked.service");
- q = strjoina(root, SYSTEM_CONFIG_UNIT_PATH"/linked.service");
+ p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/multi-user.target.wants/linked.service");
+ q = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/linked.service");
for (i = 0 ; i < n_changes; i++) {
assert_se(changes[i].type == UNIT_FILE_SYMLINK);
assert_se(streq(changes[i].source, "/opt/linked.service"));
@@ -251,8 +251,8 @@ static void test_linked_units(const char *root) {
/* And let's unlink it again */
assert_se(unit_file_disable(UNIT_FILE_SYSTEM, 0, root, STRV_MAKE("linked.service"), &changes, &n_changes) >= 0);
assert_se(n_changes == 2);
- p = strjoina(root, SYSTEM_CONFIG_UNIT_PATH"/multi-user.target.wants/linked.service");
- q = strjoina(root, SYSTEM_CONFIG_UNIT_PATH"/linked.service");
+ p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/multi-user.target.wants/linked.service");
+ q = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/linked.service");
for (i = 0; i < n_changes; i++) {
assert_se(changes[i].type == UNIT_FILE_UNLINK);
@@ -271,8 +271,8 @@ static void test_linked_units(const char *root) {
assert_se(unit_file_enable(UNIT_FILE_SYSTEM, 0, root, STRV_MAKE("linked2.service"), &changes, &n_changes) >= 0);
assert_se(n_changes == 2);
- p = strjoina(root, SYSTEM_CONFIG_UNIT_PATH"/multi-user.target.wants/linked2.service");
- q = strjoina(root, SYSTEM_CONFIG_UNIT_PATH"/linked2.service");
+ p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/multi-user.target.wants/linked2.service");
+ q = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/linked2.service");
for (i = 0 ; i < n_changes; i++) {
assert_se(changes[i].type == UNIT_FILE_SYMLINK);
assert_se(streq(changes[i].source, "/opt/linked2.service"));
@@ -325,7 +325,7 @@ static void test_default(const char *root) {
assert_se(n_changes == 1);
assert_se(changes[0].type == UNIT_FILE_SYMLINK);
assert_se(streq(changes[0].source, "/usr/lib/systemd/system/test-default-real.target"));
- p = strjoina(root, SYSTEM_CONFIG_UNIT_PATH "/" SPECIAL_DEFAULT_TARGET);
+ p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR "/" SPECIAL_DEFAULT_TARGET);
assert_se(streq(changes[0].path, p));
unit_file_changes_free(changes, n_changes);
changes = NULL; n_changes = 0;
@@ -355,7 +355,7 @@ static void test_add_dependency(const char *root) {
assert_se(n_changes == 1);
assert_se(changes[0].type == UNIT_FILE_SYMLINK);
assert_se(streq(changes[0].source, "/usr/lib/systemd/system/real-add-dependency-test-service.service"));
- p = strjoina(root, SYSTEM_CONFIG_UNIT_PATH"/real-add-dependency-test-target.target.wants/real-add-dependency-test-service.service");
+ p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/real-add-dependency-test-target.target.wants/real-add-dependency-test-service.service");
assert_se(streq(changes[0].path, p));
unit_file_changes_free(changes, n_changes);
changes = NULL; n_changes = 0;
@@ -396,7 +396,7 @@ static void test_template_enable(const char *root) {
assert_se(n_changes == 1);
assert_se(changes[0].type == UNIT_FILE_SYMLINK);
assert_se(streq(changes[0].source, "/usr/lib/systemd/system/template@.service"));
- p = strjoina(root, SYSTEM_CONFIG_UNIT_PATH"/multi-user.target.wants/template@def.service");
+ p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/multi-user.target.wants/template@def.service");
assert_se(streq(changes[0].path, p));
unit_file_changes_free(changes, n_changes);
changes = NULL; n_changes = 0;
@@ -427,7 +427,7 @@ static void test_template_enable(const char *root) {
assert_se(unit_file_enable(UNIT_FILE_SYSTEM, 0, root, STRV_MAKE("template@foo.service"), &changes, &n_changes) >= 0);
assert_se(changes[0].type == UNIT_FILE_SYMLINK);
assert_se(streq(changes[0].source, "/usr/lib/systemd/system/template@.service"));
- p = strjoina(root, SYSTEM_CONFIG_UNIT_PATH"/multi-user.target.wants/template@foo.service");
+ p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/multi-user.target.wants/template@foo.service");
assert_se(streq(changes[0].path, p));
unit_file_changes_free(changes, n_changes);
changes = NULL; n_changes = 0;
@@ -460,7 +460,7 @@ static void test_template_enable(const char *root) {
assert_se(unit_file_enable(UNIT_FILE_SYSTEM, 0, root, STRV_MAKE("template-symlink@quux.service"), &changes, &n_changes) >= 0);
assert_se(changes[0].type == UNIT_FILE_SYMLINK);
assert_se(streq(changes[0].source, "/usr/lib/systemd/system/template@.service"));
- p = strjoina(root, SYSTEM_CONFIG_UNIT_PATH"/multi-user.target.wants/template@quux.service");
+ p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/multi-user.target.wants/template@quux.service");
assert_se(streq(changes[0].path, p));
unit_file_changes_free(changes, n_changes);
changes = NULL; n_changes = 0;
@@ -506,7 +506,7 @@ static void test_indirect(const char *root) {
assert_se(n_changes == 1);
assert_se(changes[0].type == UNIT_FILE_SYMLINK);
assert_se(streq(changes[0].source, "/usr/lib/systemd/system/indirectb.service"));
- p = strjoina(root, SYSTEM_CONFIG_UNIT_PATH"/multi-user.target.wants/indirectb.service");
+ p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/multi-user.target.wants/indirectb.service");
assert_se(streq(changes[0].path, p));
unit_file_changes_free(changes, n_changes);
changes = NULL; n_changes = 0;
@@ -518,7 +518,7 @@ static void test_indirect(const char *root) {
assert_se(unit_file_disable(UNIT_FILE_SYSTEM, 0, root, STRV_MAKE("indirectc.service"), &changes, &n_changes) >= 0);
assert_se(n_changes == 1);
assert_se(changes[0].type == UNIT_FILE_UNLINK);
- p = strjoina(root, SYSTEM_CONFIG_UNIT_PATH"/multi-user.target.wants/indirectb.service");
+ p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/multi-user.target.wants/indirectb.service");
assert_se(streq(changes[0].path, p));
unit_file_changes_free(changes, n_changes);
changes = NULL; n_changes = 0;
@@ -559,7 +559,7 @@ static void test_preset_and_list(const char *root) {
assert_se(n_changes == 1);
assert_se(changes[0].type == UNIT_FILE_SYMLINK);
assert_se(streq(changes[0].source, "/usr/lib/systemd/system/preset-yes.service"));
- p = strjoina(root, SYSTEM_CONFIG_UNIT_PATH"/multi-user.target.wants/preset-yes.service");
+ p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/multi-user.target.wants/preset-yes.service");
assert_se(streq(changes[0].path, p));
unit_file_changes_free(changes, n_changes);
changes = NULL; n_changes = 0;
@@ -570,7 +570,7 @@ static void test_preset_and_list(const char *root) {
assert_se(unit_file_disable(UNIT_FILE_SYSTEM, 0, root, STRV_MAKE("preset-yes.service"), &changes, &n_changes) >= 0);
assert_se(n_changes == 1);
assert_se(changes[0].type == UNIT_FILE_UNLINK);
- p = strjoina(root, SYSTEM_CONFIG_UNIT_PATH"/multi-user.target.wants/preset-yes.service");
+ p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/multi-user.target.wants/preset-yes.service");
assert_se(streq(changes[0].path, p));
unit_file_changes_free(changes, n_changes);
changes = NULL; n_changes = 0;
@@ -590,7 +590,7 @@ static void test_preset_and_list(const char *root) {
assert_se(n_changes > 0);
- p = strjoina(root, SYSTEM_CONFIG_UNIT_PATH"/multi-user.target.wants/preset-yes.service");
+ p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/multi-user.target.wants/preset-yes.service");
for (i = 0; i < n_changes; i++) {
@@ -655,7 +655,7 @@ static void test_revert(const char *root) {
unit_file_changes_free(changes, n_changes);
changes = NULL; n_changes = 0;
- p = strjoina(root, SYSTEM_CONFIG_UNIT_PATH"/xx.service");
+ p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/xx.service");
assert_se(write_string_file(p, "# Empty override\n", WRITE_STRING_FILE_CREATE) >= 0);
/* Revert the override file */
@@ -666,7 +666,7 @@ static void test_revert(const char *root) {
unit_file_changes_free(changes, n_changes);
changes = NULL; n_changes = 0;
- p = strjoina(root, SYSTEM_CONFIG_UNIT_PATH"/xx.service.d/dropin.conf");
+ p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/xx.service.d/dropin.conf");
assert_se(mkdir_parents(p, 0755) >= 0);
assert_se(write_string_file(p, "# Empty dropin\n", WRITE_STRING_FILE_CREATE) >= 0);
@@ -676,7 +676,7 @@ static void test_revert(const char *root) {
assert_se(changes[0].type == UNIT_FILE_UNLINK);
assert_se(streq(changes[0].path, p));
- p = strjoina(root, SYSTEM_CONFIG_UNIT_PATH"/xx.service.d");
+ p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/xx.service.d");
assert_se(changes[1].type == UNIT_FILE_UNLINK);
assert_se(streq(changes[1].path, p));
unit_file_changes_free(changes, n_changes);
@@ -715,7 +715,7 @@ static void test_preset_order(const char *root) {
assert_se(n_changes == 1);
assert_se(changes[0].type == UNIT_FILE_SYMLINK);
assert_se(streq(changes[0].source, "/usr/lib/systemd/system/prefix-1.service"));
- p = strjoina(root, SYSTEM_CONFIG_UNIT_PATH"/multi-user.target.wants/prefix-1.service");
+ p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/multi-user.target.wants/prefix-1.service");
assert_se(streq(changes[0].path, p));
unit_file_changes_free(changes, n_changes);
changes = NULL; n_changes = 0;
@@ -777,7 +777,7 @@ static void test_with_dropin(const char *root) {
assert_se(unit_file_get_state(UNIT_FILE_SYSTEM, root, "with-dropin-1.service", &state) >= 0 && state == UNIT_FILE_DISABLED);
- p = strjoina(root, SYSTEM_CONFIG_UNIT_PATH"/with-dropin-2.service");
+ p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/with-dropin-2.service");
assert_se(write_string_file(p,
"[Install]\n"
"WantedBy=multi-user.target\n", WRITE_STRING_FILE_CREATE) >= 0);
@@ -795,7 +795,7 @@ static void test_with_dropin(const char *root) {
"[Install]\n"
"WantedBy=multi-user.target\n", WRITE_STRING_FILE_CREATE) >= 0);
- p = strjoina(root, SYSTEM_CONFIG_UNIT_PATH"/with-dropin-3.service.d/dropin.conf");
+ p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/with-dropin-3.service.d/dropin.conf");
assert_se(mkdir_parents(p, 0755) >= 0);
assert_se(write_string_file(p,
"[Install]\n"
@@ -808,7 +808,7 @@ static void test_with_dropin(const char *root) {
"[Install]\n"
"WantedBy=multi-user.target\n", WRITE_STRING_FILE_CREATE) >= 0);
- p = strjoina(root, SYSTEM_CONFIG_UNIT_PATH"/with-dropin-4a.service.d/dropin.conf");
+ p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/with-dropin-4a.service.d/dropin.conf");
assert_se(mkdir_parents(p, 0755) >= 0);
assert_se(write_string_file(p,
"[Install]\n"
@@ -829,9 +829,9 @@ static void test_with_dropin(const char *root) {
assert_se(changes[1].type == UNIT_FILE_SYMLINK);
assert_se(streq(changes[0].source, "/usr/lib/systemd/system/with-dropin-1.service"));
assert_se(streq(changes[1].source, "/usr/lib/systemd/system/with-dropin-1.service"));
- p = strjoina(root, SYSTEM_CONFIG_UNIT_PATH"/multi-user.target.wants/with-dropin-1.service");
+ p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/multi-user.target.wants/with-dropin-1.service");
assert_se(streq(changes[0].path, p));
- p = strjoina(root, SYSTEM_CONFIG_UNIT_PATH"/graphical.target.wants/with-dropin-1.service");
+ p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/graphical.target.wants/with-dropin-1.service");
assert_se(streq(changes[1].path, p));
unit_file_changes_free(changes, n_changes);
changes = NULL; n_changes = 0;
@@ -841,11 +841,11 @@ static void test_with_dropin(const char *root) {
assert_se(n_changes == 2);
assert_se(changes[0].type == UNIT_FILE_SYMLINK);
assert_se(changes[1].type == UNIT_FILE_SYMLINK);
- assert_se(streq(changes[0].source, SYSTEM_CONFIG_UNIT_PATH"/with-dropin-2.service"));
- assert_se(streq(changes[1].source, SYSTEM_CONFIG_UNIT_PATH"/with-dropin-2.service"));
- p = strjoina(root, SYSTEM_CONFIG_UNIT_PATH"/multi-user.target.wants/with-dropin-2.service");
+ assert_se(streq(changes[0].source, SYSTEM_CONFIG_UNIT_DIR"/with-dropin-2.service"));
+ assert_se(streq(changes[1].source, SYSTEM_CONFIG_UNIT_DIR"/with-dropin-2.service"));
+ p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/multi-user.target.wants/with-dropin-2.service");
assert_se(streq(changes[0].path, p));
- p = strjoina(root, SYSTEM_CONFIG_UNIT_PATH"/graphical.target.wants/with-dropin-2.service");
+ p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/graphical.target.wants/with-dropin-2.service");
assert_se(streq(changes[1].path, p));
unit_file_changes_free(changes, n_changes);
changes = NULL; n_changes = 0;
@@ -857,9 +857,9 @@ static void test_with_dropin(const char *root) {
assert_se(changes[1].type == UNIT_FILE_SYMLINK);
assert_se(streq(changes[0].source, "/usr/lib/systemd/system/with-dropin-3.service"));
assert_se(streq(changes[1].source, "/usr/lib/systemd/system/with-dropin-3.service"));
- p = strjoina(root, SYSTEM_CONFIG_UNIT_PATH"/multi-user.target.wants/with-dropin-3.service");
+ p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/multi-user.target.wants/with-dropin-3.service");
assert_se(streq(changes[0].path, p));
- p = strjoina(root, SYSTEM_CONFIG_UNIT_PATH"/graphical.target.wants/with-dropin-3.service");
+ p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/graphical.target.wants/with-dropin-3.service");
assert_se(streq(changes[1].path, p));
unit_file_changes_free(changes, n_changes);
changes = NULL; n_changes = 0;
@@ -871,9 +871,9 @@ static void test_with_dropin(const char *root) {
assert_se(changes[1].type == UNIT_FILE_SYMLINK);
assert_se(streq(changes[0].source, "/usr/lib/systemd/system/with-dropin-4a.service"));
assert_se(streq(changes[1].source, "/usr/lib/systemd/system/with-dropin-4b.service"));
- p = strjoina(root, SYSTEM_CONFIG_UNIT_PATH"/multi-user.target.wants/with-dropin-4a.service");
+ p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/multi-user.target.wants/with-dropin-4a.service");
assert_se(streq(changes[0].path, p));
- p = strjoina(root, SYSTEM_CONFIG_UNIT_PATH"/multi-user.target.wants/with-dropin-4b.service");
+ p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/multi-user.target.wants/with-dropin-4b.service");
assert_se(streq(changes[1].path, p));
unit_file_changes_free(changes, n_changes);
changes = NULL; n_changes = 0;
@@ -941,9 +941,9 @@ static void test_with_dropin_template(const char *root) {
assert_se(changes[1].type == UNIT_FILE_SYMLINK);
assert_se(streq(changes[0].source, "/usr/lib/systemd/system/with-dropin-1@.service"));
assert_se(streq(changes[1].source, "/usr/lib/systemd/system/with-dropin-1@.service"));
- p = strjoina(root, SYSTEM_CONFIG_UNIT_PATH"/multi-user.target.wants/with-dropin-1@instance-1.service");
+ p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/multi-user.target.wants/with-dropin-1@instance-1.service");
assert_se(streq(changes[0].path, p));
- p = strjoina(root, SYSTEM_CONFIG_UNIT_PATH"/graphical.target.wants/with-dropin-1@instance-1.service");
+ p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/graphical.target.wants/with-dropin-1@instance-1.service");
assert_se(streq(changes[1].path, p));
unit_file_changes_free(changes, n_changes);
changes = NULL; n_changes = 0;
@@ -954,9 +954,9 @@ static void test_with_dropin_template(const char *root) {
assert_se(changes[1].type == UNIT_FILE_SYMLINK);
assert_se(streq(changes[0].source, "/usr/lib/systemd/system/with-dropin-2@.service"));
assert_se(streq(changes[1].source, "/usr/lib/systemd/system/with-dropin-2@.service"));
- p = strjoina(root, SYSTEM_CONFIG_UNIT_PATH"/multi-user.target.wants/with-dropin-2@instance-1.service");
+ p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/multi-user.target.wants/with-dropin-2@instance-1.service");
assert_se(streq(changes[0].path, p));
- p = strjoina(root, SYSTEM_CONFIG_UNIT_PATH"/graphical.target.wants/with-dropin-2@instance-1.service");
+ p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/graphical.target.wants/with-dropin-2@instance-1.service");
assert_se(streq(changes[1].path, p));
unit_file_changes_free(changes, n_changes);
changes = NULL; n_changes = 0;
@@ -965,7 +965,7 @@ static void test_with_dropin_template(const char *root) {
assert_se(n_changes == 1);
assert_se(changes[0].type == UNIT_FILE_SYMLINK);
assert_se(streq(changes[0].source, "/usr/lib/systemd/system/with-dropin-2@.service"));
- p = strjoina(root, SYSTEM_CONFIG_UNIT_PATH"/multi-user.target.wants/with-dropin-2@instance-2.service");
+ p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/multi-user.target.wants/with-dropin-2@instance-2.service");
assert_se(streq(changes[0].path, p));
unit_file_changes_free(changes, n_changes);
changes = NULL; n_changes = 0;
@@ -974,7 +974,7 @@ static void test_with_dropin_template(const char *root) {
assert_se(n_changes == 1);
assert_se(changes[0].type == UNIT_FILE_SYMLINK);
assert_se(streq(changes[0].source, "/usr/lib/systemd/system/with-dropin-3@.service"));
- p = strjoina(root, SYSTEM_CONFIG_UNIT_PATH"/multi-user.target.wants/with-dropin-3@instance-2.service");
+ p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/multi-user.target.wants/with-dropin-3@instance-2.service");
assert_se(streq(changes[0].path, p));
unit_file_changes_free(changes, n_changes);
changes = NULL; n_changes = 0;
@@ -1014,7 +1014,7 @@ static void test_preset_multiple_instances(const char *root) {
assert_se(unit_file_get_state(UNIT_FILE_SYSTEM, root, "foo@bar0.service", &state) >= 0 && state == UNIT_FILE_ENABLED);
assert_se(n_changes == 1);
assert_se(changes[0].type == UNIT_FILE_SYMLINK);
- p = strjoina(root, SYSTEM_CONFIG_UNIT_PATH"/multi-user.target.wants/foo@bar0.service");
+ p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/multi-user.target.wants/foo@bar0.service");
assert_se(streq(changes[0].path, p));
unit_file_changes_free(changes, n_changes);
changes = NULL; n_changes = 0;
@@ -1022,7 +1022,7 @@ static void test_preset_multiple_instances(const char *root) {
assert_se(unit_file_disable(UNIT_FILE_SYSTEM, 0, root, STRV_MAKE("foo@bar0.service"), &changes, &n_changes) >= 0);
assert_se(n_changes == 1);
assert_se(changes[0].type == UNIT_FILE_UNLINK);
- p = strjoina(root, SYSTEM_CONFIG_UNIT_PATH"/multi-user.target.wants/foo@bar0.service");
+ p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/multi-user.target.wants/foo@bar0.service");
assert_se(streq(changes[0].path, p));
unit_file_changes_free(changes, n_changes);
changes = NULL; n_changes = 0;
@@ -1214,7 +1214,7 @@ int main(int argc, char *argv[]) {
p = strjoina(root, "/usr/lib/systemd/system/");
assert_se(mkdir_p(p, 0755) >= 0);
- p = strjoina(root, SYSTEM_CONFIG_UNIT_PATH"/");
+ p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/");
assert_se(mkdir_p(p, 0755) >= 0);
p = strjoina(root, "/run/systemd/system/");
diff --git a/src/test/test-sd-path.c b/src/test/test-sd-path.c
new file mode 100644
index 0000000000..9260db5ace
--- /dev/null
+++ b/src/test/test-sd-path.c
@@ -0,0 +1,69 @@
+/* SPDX-License-Identifier: LGPL-2.1+ */
+
+#include "sd-path.h"
+
+#include "alloc-util.h"
+#include "string-util.h"
+#include "strv.h"
+#include "tests.h"
+
+static void test_sd_path_lookup(void) {
+ log_info("/* %s */", __func__);
+
+ for (uint64_t i = 0; i < _SD_PATH_MAX; i++) {
+ _cleanup_free_ char *t = NULL, *s = NULL;
+ int r;
+
+ r = sd_path_lookup(i, NULL, &t);
+ if (i == SD_PATH_USER_RUNTIME && r == -ENXIO)
+ continue;
+ assert_se(r == 0);
+ assert_se(t);
+ log_info("%02"PRIu64": \"%s\"", i, t);
+
+ assert_se(sd_path_lookup(i, "suffix", &s) == 0);
+ assert_se(s);
+ log_info("%02"PRIu64": \"%s\"", i, s);
+ assert_se(endswith(s, "/suffix"));
+ }
+
+ char *tt;
+ assert_se(sd_path_lookup(_SD_PATH_MAX, NULL, &tt) == -EOPNOTSUPP);
+}
+
+static void test_sd_path_lookup_strv(void) {
+ log_info("/* %s */", __func__);
+
+ for (uint64_t i = 0; i < _SD_PATH_MAX; i++) {
+ _cleanup_strv_free_ char **t = NULL, **s = NULL;
+ char **item;
+ int r;
+
+ r = sd_path_lookup_strv(i, NULL, &t);
+ if (i == SD_PATH_USER_RUNTIME && r == -ENXIO)
+ continue;
+ assert_se(r == 0);
+ assert_se(t);
+ log_info("%02"PRIu64":", i);
+ STRV_FOREACH(item, t)
+ log_debug(" %s", *item);
+
+ assert_se(sd_path_lookup_strv(i, "suffix", &s) == 0);
+ assert_se(s);
+ log_info("%02"PRIu64":", i);
+ STRV_FOREACH(item, s) {
+ assert_se(endswith(*item, "/suffix"));
+ log_debug(" %s", *item);
+ }
+ }
+
+ char *tt;
+ assert_se(sd_path_lookup(_SD_PATH_MAX, NULL, &tt) == -EOPNOTSUPP);
+}
+
+int main(void) {
+ test_setup_logging(LOG_DEBUG);
+
+ test_sd_path_lookup();
+ test_sd_path_lookup_strv();
+}
diff --git a/src/test/test-user-util.c b/src/test/test-user-util.c
index 084a584876..11c01e5189 100644
--- a/src/test/test-user-util.c
+++ b/src/test/test-user-util.c
@@ -96,7 +96,7 @@ static void test_valid_user_group_name_compat(void) {
assert_se(valid_user_group_name_compat("eff."));
assert_se(valid_user_group_name_compat("some5"));
- assert_se(!valid_user_group_name_compat("5some"));
+ assert_se(valid_user_group_name_compat("5some"));
assert_se(valid_user_group_name_compat("INNER5NUMBER"));
}
@@ -166,7 +166,7 @@ static void test_valid_user_group_name_or_id_compat(void) {
assert_se(valid_user_group_name_or_id_compat("kk-k"));
assert_se(valid_user_group_name_or_id_compat("some5"));
- assert_se(!valid_user_group_name_or_id_compat("5some"));
+ assert_se(valid_user_group_name_or_id_compat("5some"));
assert_se(valid_user_group_name_or_id_compat("INNER5NUMBER"));
}
diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c
index d1ba5841fd..6ab30cdecf 100644
--- a/src/tmpfiles/tmpfiles.c
+++ b/src/tmpfiles/tmpfiles.c
@@ -244,7 +244,7 @@ static int specifier_directory(char specifier, const void *data, const void *use
i = PTR_TO_UINT(data);
assert(i < ELEMENTSOF(paths_system));
- return sd_path_home(paths[i].type, paths[i].suffix, ret);
+ return sd_path_lookup(paths[i].type, paths[i].suffix, ret);
}
static int log_unresolvable_specifier(const char *filename, unsigned line) {
diff --git a/src/udev/net/link-config.c b/src/udev/net/link-config.c
index 9c82759818..71946c9ecc 100644
--- a/src/udev/net/link-config.c
+++ b/src/udev/net/link-config.c
@@ -20,6 +20,7 @@
#include "netlink-util.h"
#include "network-internal.h"
#include "parse-util.h"
+#include "path-lookup.h"
#include "path-util.h"
#include "proc-cmdline.h"
#include "random-util.h"
diff --git a/src/udev/udev.pc.in b/src/udev/udev.pc.in
index 5acbb2d01a..7b4f4006b5 100644
--- a/src/udev/udev.pc.in
+++ b/src/udev/udev.pc.in
@@ -2,4 +2,5 @@ Name: udev
Description: udev
Version: @PROJECT_VERSION@
-udevdir=@udevlibexecdir@
+udev_dir=@udevlibexecdir@
+udevdir=${udev_dir}
diff --git a/test/fuzz/fuzz-network-parser/directives.network b/test/fuzz/fuzz-network-parser/directives.network
index b3465ceb8c..01cc490c96 100644
--- a/test/fuzz/fuzz-network-parser/directives.network
+++ b/test/fuzz/fuzz-network-parser/directives.network
@@ -100,6 +100,7 @@ SendRelease=
MaxAttempts=
IPServiceType=
SendOption=
+SendVendorOption=
SendDecline=
RouteMTUBytes=
[DHCPv6]
@@ -267,12 +268,14 @@ EmitDNS=
NTP=
EmitSIP=
SIP=
+POP3Servers=
EmitRouter=
MaxLeaseTimeSec=
DefaultLeaseTimeSec=
EmitTimezone=
DNS=
SendOption=
+SendVendorOption=
[NextHop]
Id=
Gateway=
diff --git a/tools/meson-check-api-docs.sh b/tools/meson-check-api-docs.sh
index bd320562ad..c33672934d 100755
--- a/tools/meson-check-api-docs.sh
+++ b/tools/meson-check-api-docs.sh
@@ -6,7 +6,7 @@ sd_total=0
udev_good=0
udev_total=0
-for symbol in `nm -g --defined-only "$@" | grep " T " | cut -d" " -f3 | sort -u` ; do
+for symbol in `nm -g --defined-only "$@" | grep " T " | cut -d" " -f3 | grep -wv sd_bus_try_close | sort -u` ; do
if test -f ${MESON_BUILD_ROOT}/man/$symbol.3 ; then
echo "✓ Symbol $symbol() is documented."
good=1
diff --git a/travis-ci/managers/fuzzbuzz.sh b/travis-ci/managers/fuzzbuzz.sh
index c841af1214..295fc03613 100755
--- a/travis-ci/managers/fuzzbuzz.sh
+++ b/travis-ci/managers/fuzzbuzz.sh
@@ -20,11 +20,6 @@ tools/oss-fuzz.sh
./out/fuzz-unit-file -max_total_time=5
git clean -dxff
-wget https://app.fuzzbuzz.io/releases/cli/latest/linux/fuzzbuzz
-chmod +x fuzzbuzz
-./fuzzbuzz validate
-./fuzzbuzz target test fuzz-unit-file --all
-
git clone https://github.com/google/oss-fuzz /tmp/oss-fuzz
cd /tmp/oss-fuzz
sudo ./infra/helper.py pull_images
diff --git a/travis-ci/managers/fuzzit.sh b/travis-ci/managers/fuzzit.sh
index c3d76134fe..6c487de6ed 100755
--- a/travis-ci/managers/fuzzit.sh
+++ b/travis-ci/managers/fuzzit.sh
@@ -13,10 +13,10 @@ REPO_ROOT=${REPO_ROOT:-$(pwd)}
sudo bash -c "echo 'deb-src http://archive.ubuntu.com/ubuntu/ xenial main restricted universe multiverse' >>/etc/apt/sources.list"
sudo apt-get update -y
sudo apt-get build-dep systemd -y
-sudo apt-get install -y ninja-build python3-pip python3-setuptools
+sudo apt-get install -y python3-pip python3-setuptools
# The following should be dropped when debian packaging has been updated to include them
sudo apt-get install -y libfdisk-dev libp11-kit-dev libssl-dev libpwquality-dev
-pip3 install meson
+pip3 install ninja meson
cd $REPO_ROOT
export PATH="$HOME/.local/bin/:$PATH"
diff --git a/units/sys-kernel-tracing.mount b/units/sys-kernel-tracing.mount
index cb42b47012..e29b258a47 100644
--- a/units/sys-kernel-tracing.mount
+++ b/units/sys-kernel-tracing.mount
@@ -12,6 +12,7 @@ Description=Kernel Trace File System
Documentation=https://www.kernel.org/doc/Documentation/trace/ftrace.txt
Documentation=https://www.freedesktop.org/wiki/Software/systemd/APIFileSystems
DefaultDependencies=no
+ConditionVirtualization=!lxc
ConditionPathExists=/sys/kernel/tracing
ConditionCapability=CAP_SYS_RAWIO
Before=sysinit.target
diff --git a/units/systemd-network-generator.service.in b/units/systemd-network-generator.service.in
index 070d87e154..248a8dc64e 100644
--- a/units/systemd-network-generator.service.in
+++ b/units/systemd-network-generator.service.in
@@ -12,6 +12,7 @@ Description=Generate network units from Kernel command line
Documentation=man:systemd-network-generator.service(8)
DefaultDependencies=no
Before=network-pre.target
+Wants=network-pre.target
[Service]
Type=oneshot
@@ -19,4 +20,4 @@ RemainAfterExit=yes
ExecStart=@rootlibexecdir@/systemd-network-generator
[Install]
-WantedBy=network-pre.target
+WantedBy=sysinit.target