Compare commits

...

27 Commits

Author SHA1 Message Date
Lennart Poettering 185924ab63 update TODO 2020-04-23 16:01:46 +02:00
Lennart Poettering 2d69cf6eb0
Merge pull request #15543 from poettering/fix-ubsan-sd-bus
sd-bus: work around ubsan warning
2020-04-23 13:39:58 +02:00
Balint Reczey 9f65637308 shared: Don't try calling NULL callback in bus_wait_for_units_clear
BugLink: https://bugs.launchpad.net/bugs/1870930
2020-04-23 12:25:20 +02:00
Lennart Poettering b70cc80ffb
Merge pull request #15544 from poettering/fix-journalctl-namespace
sd-journal: fix namespace check
2020-04-23 12:19:25 +02:00
Lennart Poettering a5f0f46f1a
Merge pull request #15538 from poettering/nspawn-no-netns
nspawn: politely refuse --image= when run inside non-host netns
2020-04-23 11:11:11 +02:00
Zbigniew Jędrzejewski-Szmek ca57eed2e1
Merge pull request #15527 from Werkov/mkosi-opensuse
Add mkosi config for openSUSE Tumbleweed
2020-04-23 11:00:02 +02:00
Michal Koutný 69d95d6468 mkosi: Add openSUSE params file
The setup is meant to run against openSUSE Tumbleweed and install
minimum packages necessary for successful build and passing tests.

To speed up incremental build an external build directory is used.
2020-04-23 10:28:03 +02:00
Lennart Poettering a7c71d214c run: don't wait for start job to complete when running interactively anyway
Otherwise we'd not read the services input while waiting for the job to
wait, and there's no point in waiting for the job anyway if we wait for
the unit to stop ultimately.

Fixes: #15395
2020-04-23 09:47:20 +02:00
Kumar Kartikeya Dwivedi 5c568be167 test: add a test case for #15528 2020-04-23 09:24:17 +02:00
Lennart Poettering 2b6df46d21 sd-journal: don't check namespaces if we have no namespace to go by
Fixes: #15528
2020-04-23 09:23:53 +02:00
Lennart Poettering 287b737693 nspawn: refuse politely when we are run in the non-host netns in combination with --image=
Strictly speaking this doesn't really fix #15079, but it at least means
we won't hang anymore.

Fixes: #15079
2020-04-23 09:18:43 +02:00
Lennart Poettering 1433e0f212 nspawn: minor simplification 2020-04-23 09:18:05 +02:00
Zbigniew Jędrzejewski-Szmek 73781de41f
Merge pull request #15530 from ssahani/lpr-dhcpv4-option-9
network: add support to DHCPv4 server/client option 9 LPR
2020-04-23 09:10:14 +02:00
Daan De Meyer 0076098b0a sd-bus: Add sd_bus_message_get_error/errno docs 2020-04-23 08:57:39 +02:00
Lennart Poettering 49490c1d35 acpi-fpdt: mark structures as packed
Let's make sure the alignment doesn't matter.
2020-04-23 08:55:08 +02:00
Lennart Poettering 0cd41757d0 sd-bus: work around ubsan warning
ubsan complains that we add an offset to a NULL ptr here in some cases.
Which isn't really a bug though, since we only use it as the end
condition for a for loop, but we can still fix it...

Fixes: #15522
2020-04-23 08:54:30 +02:00
Daan De Meyer 570f92c691 sd-bus: Add sd_bus_get/set_allow_interactive_authorization docs 2020-04-23 08:53:27 +02:00
Zbigniew Jędrzejewski-Szmek 9786b27cbb
Merge pull request #15546 from poettering/pid1-serialize-comand-fix
core: make sure to restore the control command id, too
2020-04-23 08:51:58 +02:00
Lennart Poettering e9da62b18a core: make sure to restore the control command id, too
Fixes: #15356
2020-04-22 20:34:02 +02:00
Lennart Poettering 5b99bd5fd4 core: some minor clean-ups/modernizations 2020-04-22 20:33:57 +02:00
Susant Sahani 828e653c48 networkctl: Add support to display LPR servers 2020-04-22 14:50:27 +02:00
Susant Sahani d64cc72e80 sd-network: Add support to retrive LPR servers 2020-04-22 14:49:52 +02:00
Susant Sahani d361b3730a network: Add support send and receive LPR servers 2020-04-22 14:49:27 +02:00
Susant Sahani 50018bfa84 sd-network: DHCPv4 Add support to send and receive LPR servers. 2020-04-22 14:48:11 +02:00
Michal Koutný ff5499824f mkosi: Unify environment for unit tests
Some testcases in test-execute rely on existence of user groups with
certain gids. However, their existence is not universally granted [1].
Although the test could be skipped in their absence and give up testing
some code paths, different approach was chosen -- create dummy groups in
the testing image.

[1] See how systemd-sysusers allocates gids (e.g.
src/test/test-uid-range.c).
2020-04-22 10:35:12 +02:00
Michal Koutný 9acb2964d7 test: Simplify hostname checking
Both hostname and uname utilities boil down to uname(2) syscall. Reduce
tests dependency footprint by using uname for checking hostname too.
2020-04-22 10:35:12 +02:00
Michal Koutný bac567a53b mkosi: Use distro-invariant rootprefix
Distributions may be build with various configs, e.g. customized
rootprefix. It'd be unmaintanable to have specific mkosi.build for each
supported distro. Hence, make the build script flexible yet distro
oblivious.
2020-04-22 10:35:12 +02:00
41 changed files with 442 additions and 95 deletions

View File

@ -31,7 +31,6 @@ BuildPackages=
gnu-efi-devel
gnutls-devel
gperf
hostname
iptables-devel
kmod-devel
libacl-devel

60
.mkosi/mkosi.opensuse Normal file
View File

@ -0,0 +1,60 @@
# SPDX-License-Identifier: LGPL-2.1+
# This is a settings file for OS image generation using mkosi (https://github.com/systemd/mkosi).
# Simply invoke "mkosi" in the project directory to build an OS image.
[Distribution]
Distribution=opensuse
Release=tumbleweed
[Output]
Format=raw_btrfs
Bootable=yes
[Partitions]
RootSize=3G
[Packages]
# Uncomment to share system RPM cache (works only with Tumbleweed)
#Cache=/var/cache/zypp/packages
BuildDirectory=mkosi.builddir
BuildPackages=
docbook-xsl-stylesheets
fdupes
gcc
gnu-efi
gperf
intltool
libacl-devel
libapparmor-devel
libblkid-devel
libbz2-devel
libcap-devel
libcryptsetup-devel
libcurl-devel
libgcrypt-devel
libkmod-devel
liblz4-devel
libmicrohttpd-devel
libmount-devel
libseccomp-devel
libselinux-devel
libxslt-tools
m4
meson
pam-devel
pciutils-devel
pcre-devel
python3
python3-lxml
qrencode-devel
zlib-devel
# to satisfy tests
acl
glibc-locale
system-group-obsolete
timezone
Packages=
# brought in via meson->python3
libp11-kit0

2
TODO
View File

@ -22,6 +22,8 @@ Janitorial Clean-ups:
Features:
* homed: add homed.conf setting DefaultStorage= or so
* homed: maybe pre-create ~/.cache as subvol so that it can have separate quota
easily?

View File

@ -291,7 +291,9 @@ manpages = [
''],
['sd_bus_message_get_type',
'3',
['sd_bus_message_is_method_call',
['sd_bus_message_get_errno',
'sd_bus_message_get_error',
'sd_bus_message_is_method_call',
'sd_bus_message_is_method_error',
'sd_bus_message_is_signal'],
''],
@ -335,8 +337,10 @@ manpages = [
''],
['sd_bus_message_set_expect_reply',
'3',
['sd_bus_message_get_auto_start',
['sd_bus_message_get_allow_interactive_authorization',
'sd_bus_message_get_auto_start',
'sd_bus_message_get_expect_reply',
'sd_bus_message_set_allow_interactive_authorization',
'sd_bus_message_set_auto_start'],
''],
['sd_bus_message_skip', '3', [], ''],

View File

@ -72,6 +72,7 @@
<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_allow_interactive_authorization</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
<citerefentry><refentrytitle>sd_bus_get_bus_id</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
<citerefentry><refentrytitle>sd_bus_get_current_handler</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
<citerefentry><refentrytitle>sd_bus_get_current_message</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
@ -96,7 +97,10 @@
<citerefentry><refentrytitle>sd_bus_message_at_end</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
<citerefentry><refentrytitle>sd_bus_message_copy</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
<citerefentry><refentrytitle>sd_bus_message_dump</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
<citerefentry><refentrytitle>sd_bus_message_get_allow_interactive_authorization</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
<citerefentry><refentrytitle>sd_bus_message_get_cookie</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
<citerefentry><refentrytitle>sd_bus_message_get_errno</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
<citerefentry><refentrytitle>sd_bus_message_get_error</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
<citerefentry><refentrytitle>sd_bus_message_get_monotonic_usec</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
<citerefentry><refentrytitle>sd_bus_message_get_property</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
<citerefentry><refentrytitle>sd_bus_message_get_property_trivial</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
@ -115,6 +119,7 @@
<citerefentry><refentrytitle>sd_bus_message_read_strv</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_allow_interactive_authorization</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
<citerefentry><refentrytitle>sd_bus_message_set_destination</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
<citerefentry><refentrytitle>sd_bus_message_set_sender</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
<citerefentry><refentrytitle>sd_bus_message_set_expect_reply</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
@ -129,6 +134,7 @@
<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_allow_interactive_authorization</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
<citerefentry><refentrytitle>sd_bus_set_bus_client</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
<citerefentry><refentrytitle>sd_bus_set_close_on_exit</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
<citerefentry><refentrytitle>sd_bus_set_connected_signal</refentrytitle><manvolnum>3</manvolnum></citerefentry>,

View File

@ -17,6 +17,8 @@
<refnamediv>
<refname>sd_bus_message_get_type</refname>
<refname>sd_bus_message_get_error</refname>
<refname>sd_bus_message_get_errno</refname>
<refname>sd_bus_message_is_signal</refname>
<refname>sd_bus_message_is_method_call</refname>
<refname>sd_bus_message_is_method_error</refname>
@ -30,27 +32,37 @@
<funcprototype>
<funcdef>int <function>sd_bus_message_get_type</function></funcdef>
<paramdef>sd_bus_message *<parameter>message</parameter></paramdef>
<paramdef>sd_bus_message *<parameter>m</parameter></paramdef>
<paramdef>uint8_t *<parameter>type</parameter></paramdef>
</funcprototype>
<funcprototype>
<funcdef>sd_bus_error* <function>sd_bus_message_get_error</function></funcdef>
<paramdef>sd_bus_message *<parameter>m</parameter></paramdef>
</funcprototype>
<funcprototype>
<funcdef>int <function>sd_bus_message_get_errno</function></funcdef>
<paramdef>sd_bus_message *<parameter>m</parameter></paramdef>
</funcprototype>
<funcprototype>
<funcdef>int <function>sd_bus_message_is_signal</function></funcdef>
<paramdef>sd_bus_message *<parameter>message</parameter></paramdef>
<paramdef>sd_bus_message *<parameter>m</parameter></paramdef>
<paramdef>const char *<parameter>interface</parameter></paramdef>
<paramdef>const char *<parameter>member</parameter></paramdef>
</funcprototype>
<funcprototype>
<funcdef>int <function>sd_bus_message_is_method_call</function></funcdef>
<paramdef>sd_bus_message *<parameter>message</parameter></paramdef>
<paramdef>sd_bus_message *<parameter>m</parameter></paramdef>
<paramdef>const char *<parameter>interface</parameter></paramdef>
<paramdef>const char *<parameter>member</parameter></paramdef>
</funcprototype>
<funcprototype>
<funcdef>int <function>sd_bus_message_is_method_error</function></funcdef>
<paramdef>sd_bus_message *<parameter>message</parameter></paramdef>
<paramdef>sd_bus_message *<parameter>m</parameter></paramdef>
<paramdef>const char *<parameter>name</parameter></paramdef>
</funcprototype>
</funcsynopsis>
@ -62,40 +74,52 @@
<para><function>sd_bus_message_get_type()</function> returns the type of a message in the output
parameter <parameter>type</parameter>, one of <constant>SD_BUS_MESSAGE_METHOD_CALL</constant>,
<constant>SD_BUS_MESSAGE_METHOD_RETURN</constant>,
<constant>SD_BUS_MESSAGE_METHOD_ERROR</constant>, <constant>SD_BUS_MESSAGE_SIGNAL</constant>.
This type is either specified as a parameter when the message is created using
<constant>SD_BUS_MESSAGE_METHOD_RETURN</constant>, <constant>SD_BUS_MESSAGE_METHOD_ERROR</constant>,
<constant>SD_BUS_MESSAGE_SIGNAL</constant>. This type is either specified as a parameter when the message
is created using
<citerefentry><refentrytitle>sd_bus_set_message_new</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
or is set automatically when the message is created using
<citerefentry><refentrytitle>sd_bus_set_message_new_signal</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
<citerefentry><refentrytitle>sd_bus_set_message_new_method_call</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
<citerefentry><refentrytitle>sd_bus_set_message_new_method_error</refentrytitle><manvolnum>3</manvolnum></citerefentry>
and similar functions.
and similar functions.</para>
<para><function>sd_bus_message_get_error()</function> returns the error stored in the message
<parameter>m</parameter>, if there is any. Otherwise, it returns <constant>NULL</constant>.
<function>sd_bus_message_get_errno()</function> returns the error stored in the message
<parameter>m</parameter> as a positive errno-style value, if there is any. Otherwise, it returns zero.
Errors are mapped to errno values according to the default and any additional registered error mappings.
See <citerefentry><refentrytitle>sd-bus-errors</refentrytitle><manvolnum>3</manvolnum></citerefentry> and
<citerefentry><refentrytitle>sd_bus_error_add_map</refentrytitle><manvolnum>3</manvolnum></citerefentry>.
</para>
<para><function>sd_bus_message_is_signal()</function> checks if message <parameter>m</parameter>
is a signal message. If <parameter>interface</parameter> is non-null, it also checks if the
message has the same interface set. If <parameter>member</parameter> is non-null, it also checks
if the message has the same member set. Also see
<citerefentry><refentrytitle>sd_bus_set_message_new_signal</refentrytitle><manvolnum>3</manvolnum></citerefentry>. It returns true when all checks pass.</para>
<para><function>sd_bus_message_is_signal()</function> checks if message <parameter>m</parameter> is a
signal message. If <parameter>interface</parameter> is non-null, it also checks if the message has the
same interface set. If <parameter>member</parameter> is non-null, it also checks if the message has the
same member set. Also see
<citerefentry><refentrytitle>sd_bus_set_message_new_signal</refentrytitle><manvolnum>3</manvolnum></citerefentry>.
It returns true when all checks pass.</para>
<para><function>sd_bus_message_is_method_call()</function> checks if message <parameter>m</parameter>
is a method call message. If <parameter>interface</parameter> is non-null, it also checks if the
message has the same interface set. If <parameter>member</parameter> is non-null, it also checks
if the message has the same member set. Also see
<citerefentry><refentrytitle>sd_bus_set_message_new_method_call</refentrytitle><manvolnum>3</manvolnum></citerefentry>. It returns true when all checks pass.</para>
is a method call message. If <parameter>interface</parameter> is non-null, it also checks if the message
has the same interface set. If <parameter>member</parameter> is non-null, it also checks if the message
has the same member set. Also see
<citerefentry><refentrytitle>sd_bus_set_message_new_method_call</refentrytitle><manvolnum>3</manvolnum></citerefentry>.
It returns true when all checks pass.</para>
<para><function>sd_bus_message_is_method_error()</function> checks if message <parameter>m</parameter>
is an error reply message. If <parameter>name</parameter> is non-null, it also checks if the
message has the same error identifier set. Also see
<citerefentry><refentrytitle>sd_bus_set_message_new_method_error</refentrytitle><manvolnum>3</manvolnum></citerefentry>. It returns true when all checks pass.</para>
</refsect1>
is an error reply message. If <parameter>name</parameter> is non-null, it also checks if the message has
the same error identifier set. Also see
<citerefentry><refentrytitle>sd_bus_set_message_new_method_error</refentrytitle><manvolnum>3</manvolnum></citerefentry>.
It returns true when all checks pass.</para>
</refsect1>
<refsect1>
<title>Return Value</title>
<para>On success, those functions return 0 or a positive
integer. On failure, it returns 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. <function>sd_bus_message_get_errno()</function> always returns a non-negative
integer, even on failure.</para>
<refsect2>
<title>Errors</title>
@ -106,7 +130,7 @@
<varlistentry>
<term><constant>-EINVAL</constant></term>
<listitem><para>The <parameter>message</parameter> parameter or the output parameter are
<listitem><para>The message parameter <parameter>m</parameter> or an output parameter is
<constant>NULL</constant>.</para></listitem>
</varlistentry>
</variablelist>
@ -122,7 +146,9 @@
<citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
<citerefentry><refentrytitle>sd-bus</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
<citerefentry><refentrytitle>sd_bus_message_new</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
<citerefentry><refentrytitle>sd_bus_message_set_destination</refentrytitle><manvolnum>3</manvolnum></citerefentry>
<citerefentry><refentrytitle>sd_bus_message_set_destination</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
<citerefentry><refentrytitle>sd-bus-errors</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
<citerefentry><refentrytitle>sd_bus_error_add_map</refentrytitle><manvolnum>3</manvolnum></citerefentry>
</para>
</refsect1>

View File

@ -20,6 +20,8 @@
<refname>sd_bus_message_get_expect_reply</refname>
<refname>sd_bus_message_set_auto_start</refname>
<refname>sd_bus_message_get_auto_start</refname>
<refname>sd_bus_message_set_allow_interactive_authorization</refname>
<refname>sd_bus_message_get_allow_interactive_authorization</refname>
<refpurpose>Set and query bus message metadata</refpurpose>
</refnamediv>
@ -49,41 +51,61 @@
<funcdef>int <function>sd_bus_message_get_auto_start</function></funcdef>
<paramdef>sd_bus_message *<parameter>message</parameter></paramdef>
</funcprototype>
</funcsynopsis>
<funcprototype>
<funcdef>int <function>sd_bus_message_set_allow_interactive_authorization</function></funcdef>
<paramdef>sd_bus_message *<parameter>message</parameter></paramdef>
<paramdef>int <parameter>b</parameter></paramdef>
</funcprototype>
<funcprototype>
<funcdef>int <function>sd_bus_message_get_allow_interactive_authorization</function></funcdef>
<paramdef>sd_bus_message *<parameter>message</parameter></paramdef>
</funcprototype>
</funcsynopsis>
</refsynopsisdiv>
<refsect1>
<title>Description</title>
<para><function>sd_bus_message_set_expect_reply()</function> sets or clears the
<constant>NO_REPLY_EXPECTED</constant> flag on the message <parameter>m</parameter>. This flag
matters only for method call messages and is used to specify that no method return or error
reply is expected. It is ignored for other types. Thus, for a method call message, calling
<programlisting>sd_bus_message_set_expect_reply(…, 0)</programlisting> sets the flag and
suppresses the reply.</para>
<constant>NO_REPLY_EXPECTED</constant> flag on the message <parameter>m</parameter>. This flag matters
only for method call messages and is used to specify that no method return or error reply is expected.
It is ignored for other types. Thus, for a method call message, calling
<programlisting>sd_bus_message_set_expect_reply(…, 0)</programlisting> sets the flag and suppresses the
reply.</para>
<para><function>sd_bus_message_get_expect_reply()</function> checks if the
<constant>NO_REPLY_EXPECTED</constant> flag is set on the message <parameter>m</parameter>. It
will return positive if it is not set, and zero if it is.</para>
<constant>NO_REPLY_EXPECTED</constant> flag is set on the message <parameter>m</parameter>. It will
return positive if it is not set, and zero if it is.</para>
<para><function>sd_bus_message_set_auto_start()</function> sets or clears the
<constant>NO_AUTO_START</constant> flag on the message <parameter>m</parameter>. When the flag
is set the bus must not launch an owner for the destination name in response to this message.
Calling
<programlisting>sd_bus_message_set_auto_start(…, 0)</programlisting> sets the flag.
</para>
<constant>NO_AUTO_START</constant> flag on the message <parameter>m</parameter>. When the flag is set,
the bus must not launch an owner for the destination name in response to this message. Calling
<programlisting>sd_bus_message_set_auto_start(…, 0)</programlisting> sets the flag.</para>
<para><function>sd_bus_message_get_auto_start()</function> checks if the
<constant>NO_AUTO_START</constant> flag is set on the message <parameter>m</parameter>. It
will return positive if it is not set, and zero if it is.</para>
<constant>NO_AUTO_START</constant> flag is set on the message <parameter>m</parameter>. It will return
positive if it is not set, and zero if it is.</para>
<para><function>sd_bus_message_set_allow_interactive_authorization()</function> sets or clears the
<constant>ALLOW_INTERACTIVE_AUTHORIZATION</constant> flag on the message <parameter>m</parameter>.
Setting this flag informs the receiver that the caller is prepared to wait for interactive authorization
via polkit or a similar framework. Note that setting this flag does not guarantee that the receiver will
actually perform interactive authorization. Also, make sure to set a suitable message timeout when using
this flag since interactive authorization could potentially take a long time as it depends on user input.
If <parameter>b</parameter> is non-zero, the flag is set.</para>
<para><function>sd_bus_message_get_allow_interactive_authorization()</function> checks if the
<constant>ALLOW_INTERACTIVE_AUTHORIZATION</constant> flag is set on the message <parameter>m</parameter>.
It will return a positive integer if the flag is set. Otherwise, it returns zero.</para>
</refsect1>
<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>
<refsect2>
<title>Errors</title>
@ -94,18 +116,17 @@
<varlistentry>
<term><constant>-EINVAL</constant></term>
<listitem><para>The <parameter>message</parameter> parameter is
<constant>NULL</constant>.</para></listitem>
<listitem><para>The <parameter>message</parameter> parameter is <constant>NULL</constant>.
</para></listitem>
</varlistentry>
<varlistentry>
<term><constant>-EPERM</constant></term>
<listitem><para>The message <parameter>message</parameter> is sealed
when trying to set a flag.</para>
<listitem>
<para>The message <parameter>message</parameter> is sealed when trying to set a flag.</para>
<para>The message <parameter>message</parameter> has wrong
type.</para>
<para>The message <parameter>message</parameter> has wrong type.</para>
</listitem>
</varlistentry>
</variablelist>
@ -123,5 +144,4 @@
<citerefentry><refentrytitle>sd_bus_set_description</refentrytitle><manvolnum>3</manvolnum></citerefentry>
</para>
</refsect1>
</refentry>

View File

@ -1946,6 +1946,15 @@
<varname>DNS=</varname>.</para></listitem>
</varlistentry>
<varlistentry>
<term><varname>LPRServers=</varname></term>
<listitem><para>Similar to the <varname>DNS=</varname> setting described above, this
setting configures whether and what LPR (line printer) 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>

View File

@ -42,6 +42,14 @@ fi
if [ ! -f "$BUILDDIR"/build.ninja ] ; then
sysvinit_path=`realpath /etc/init.d`
init_path=`realpath /sbin/init 2>/dev/null`
if [ -z "$init_path" ] ; then
rootprefix=""
else
rootprefix=${init_path%/lib/systemd/systemd}
rootprefix=/${rootprefix#/}
fi
nobody_user=`id -u -n 65534 2> /dev/null`
if [ "$nobody_user" != "" ] ; then
# Validate that we can translate forth and back
@ -76,11 +84,17 @@ if [ ! -f "$BUILDDIR"/build.ninja ] ; then
fi
fi
meson "$BUILDDIR" -D "sysvinit-path=$sysvinit_path" -D default-hierarchy=unified -D man=false -D "nobody-user=$nobody_user" -D "nobody-group=$nobody_group"
meson "$BUILDDIR" -D "sysvinit-path=$sysvinit_path" -D "rootprefix=$rootprefix" -D default-hierarchy=unified -D man=false -D "nobody-user=$nobody_user" -D "nobody-group=$nobody_group"
fi
ninja -C "$BUILDDIR" all
[ "$WITH_TESTS" = 0 ] || ninja -C "$BUILDDIR" test
if [ "$WITH_TESTS" = 1 ] ; then
for id in 1 2 3; do
groupadd -g $id testgroup$id || :
done
ninja -C "$BUILDDIR" test
fi
ninja -C "$BUILDDIR" install
mkdir -p "$DESTDIR"/etc

View File

@ -111,7 +111,7 @@ bool strv_overlap(char * const *a, char * const *b) _pure_;
(s)--)
#define STRV_FOREACH_PAIR(x, y, l) \
for ((x) = (l), (y) = (x+1); (x) && *(x) && *(y); (x) += 2, (y) = (x + 1))
for ((x) = (l), (y) = (x) ? (x+1) : NULL; (x) && *(x) && *(y); (x) += 2, (y) = (x + 1))
char **strv_sort(char **l);
void strv_print(char * const *l);

View File

@ -1624,6 +1624,7 @@ int setup_namespace(
r = 0;
finish:
if (n_mounts > 0)
for (m = mounts; m < mounts + n_mounts; m++)
mount_entry_done(m);

View File

@ -2569,6 +2569,8 @@ static unsigned service_exec_command_index(Unit *u, ServiceExecCommand id, ExecC
ExecCommand *first, *c;
assert(s);
assert(id >= 0);
assert(id < _SERVICE_EXEC_COMMAND_MAX);
first = s->exec_command[id];
@ -2632,10 +2634,12 @@ static int service_serialize_exec_command(Unit *u, FILE *f, ExecCommand *command
p = cescape(command->path);
if (!p)
return -ENOMEM;
return log_oom();
key = strjoina(type, "-command");
return serialize_item_format(f, key, "%s %u %s %s", service_exec_command_to_string(id), idx, p, args);
(void) serialize_item_format(f, key, "%s %u %s %s", service_exec_command_to_string(id), idx, p, args);
return 0;
}
static int service_serialize(Unit *u, FILE *f, FDSet *fds) {
@ -2737,7 +2741,11 @@ static int service_serialize(Unit *u, FILE *f, FDSet *fds) {
return 0;
}
static int service_deserialize_exec_command(Unit *u, const char *key, const char *value) {
static int service_deserialize_exec_command(
Unit *u,
const char *key,
const char *value) {
Service *s = SERVICE(u);
int r;
unsigned idx = 0, i;
@ -2826,9 +2834,10 @@ static int service_deserialize_exec_command(Unit *u, const char *key, const char
break;
}
if (command && control)
if (command && control) {
s->control_command = command;
else if (command)
s->control_command_id = id;
} else if (command)
s->main_command = command;
else
log_unit_warning(u, "Current command vanished from the unit file, execution of the command list won't be resumed.");

View File

@ -1626,9 +1626,10 @@ static int add_directory(
!((dirname && dirname_is_machine_id(dirname) > 0) || path_has_prefix(j, path, "/run")))
return 0;
if (!(FLAGS_SET(j->flags, SD_JOURNAL_ALL_NAMESPACES) ||
if (dirname &&
(!(FLAGS_SET(j->flags, SD_JOURNAL_ALL_NAMESPACES) ||
dirname_has_namespace(dirname, j->namespace) > 0 ||
(FLAGS_SET(j->flags, SD_JOURNAL_INCLUDE_DEFAULT_NAMESPACE) && dirname_has_namespace(dirname, NULL) > 0)))
(FLAGS_SET(j->flags, SD_JOURNAL_INCLUDE_DEFAULT_NAMESPACE) && dirname_has_namespace(dirname, NULL) > 0))))
return 0;
r = directory_open(j, path, &d);

View File

@ -67,6 +67,9 @@ struct sd_dhcp_lease {
struct in_addr *smtp_server;
size_t smtp_server_size;
struct in_addr *lpr_server;
size_t lpr_server_size;
struct sd_dhcp_route *static_route;
size_t static_route_size, static_route_allocated;

View File

@ -55,8 +55,8 @@ struct sd_dhcp_server {
char *timezone;
struct in_addr *ntp, *dns, *sip, *pop3_server, *smtp_server;
unsigned n_ntp, n_dns, n_sip, n_pop3_server, n_smtp_server;
struct in_addr *ntp, *dns, *sip, *pop3_server, *smtp_server, *lpr_server;
unsigned n_ntp, n_dns, n_sip, n_pop3_server, n_smtp_server, n_lpr_server;
OrderedHashmap *extra_options;
OrderedHashmap *vendor_options;

View File

@ -140,6 +140,13 @@ int sd_dhcp_lease_get_servers(
*addr = lease->smtp_server;
return (int) lease->smtp_server_size;
case SD_DHCP_LEASE_LPR_SERVERS:
if (lease->lpr_server_size <= 0)
return -ENODATA;
*addr = lease->lpr_server;
return (int) lease->lpr_server_size;
default:
return log_debug_errno(SYNTHETIC_ERRNO(ENXIO),
"Unknown DHCP lease info item %d.", what);
@ -161,6 +168,9 @@ int sd_dhcp_lease_get_pop3_server(sd_dhcp_lease *lease, const struct in_addr **a
int sd_dhcp_lease_get_smtp_server(sd_dhcp_lease *lease, const struct in_addr **addr) {
return sd_dhcp_lease_get_servers(lease, SD_DHCP_LEASE_SMTP_SERVERS, addr);
}
int sd_dhcp_lease_get_lpr_servers(sd_dhcp_lease *lease, const struct in_addr **addr) {
return sd_dhcp_lease_get_servers(lease, SD_DHCP_LEASE_LPR_SERVERS, addr);
}
int sd_dhcp_lease_get_domainname(sd_dhcp_lease *lease, const char **domainname) {
assert_return(lease, -EINVAL);
@ -314,6 +324,7 @@ static sd_dhcp_lease *dhcp_lease_free(sd_dhcp_lease *lease) {
free(lease->sip);
free(lease->pop3_server);
free(lease->smtp_server);
free(lease->lpr_server);
free(lease->static_route);
free(lease->client_id);
free(lease->vendor_specific);
@ -648,6 +659,12 @@ int dhcp_lease_parse_options(uint8_t code, uint8_t len, const void *option, void
log_debug_errno(r, "Failed to parse SMTP server, ignoring: %m");
break;
case SD_DHCP_OPTION_LPR_SERVER:
r = lease_parse_in_addrs(option, len, &lease->lpr_server, &lease->lpr_server_size);
if (r < 0)
log_debug_errno(r, "Failed to parse LPR 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)
@ -1086,6 +1103,7 @@ int dhcp_lease_load(sd_dhcp_lease **ret, const char *lease_file) {
*sip = NULL,
*pop3_server = NULL,
*smtp_server = NULL,
*lpr_server = NULL,
*mtu = NULL,
*routes = NULL,
*domains = NULL,
@ -1117,6 +1135,7 @@ int dhcp_lease_load(sd_dhcp_lease **ret, const char *lease_file) {
"SIP", &sip,
"POP3_SERVERS", &pop3_server,
"SMTP_SERVERS", &smtp_server,
"LPR_SERVERS", &lpr_server,
"MTU", &mtu,
"DOMAINNAME", &lease->domainname,
"HOSTNAME", &lease->hostname,
@ -1245,6 +1264,15 @@ int dhcp_lease_load(sd_dhcp_lease **ret, const char *lease_file) {
lease->smtp_server_size = r;
}
if (lpr_server) {
r = deserialize_in_addrs(&lease->lpr_server, lpr_server);
if (r < 0)
log_debug_errno(r, "Failed to deserialize LPR server %s, ignoring: %m", lpr_server);
else
lease->lpr_server_size = r;
}
if (mtu) {
r = safe_atou16(mtu, &lease->mtu);
if (r < 0)

View File

@ -142,6 +142,7 @@ static sd_dhcp_server *dhcp_server_free(sd_dhcp_server *server) {
free(server->sip);
free(server->pop3_server);
free(server->smtp_server);
free(server->lpr_server);
hashmap_free(server->leases_by_client_id);
@ -533,6 +534,15 @@ static int server_send_ack(sd_dhcp_server *server, DHCPRequest *req,
return r;
}
if (server->n_lpr_server > 0) {
r = dhcp_option_append(
&packet->dhcp, req->max_optlen, &offset, 0,
SD_DHCP_OPTION_LPR_SERVER,
sizeof(struct in_addr) * server->n_lpr_server, server->lpr_server);
if (r < 0)
return r;
}
if (server->timezone) {
r = dhcp_option_append(
&packet->dhcp, req->max_optlen, &offset, 0,
@ -1161,6 +1171,11 @@ int sd_dhcp_server_set_servers(
n_a = &server->n_smtp_server;
break;
case SD_DHCP_LEASE_LPR_SERVERS:
a = &server->lpr_server;
n_a = &server->n_lpr_server;
break;
default:
return log_debug_errno(SYNTHETIC_ERRNO(ENXIO),
"Unknown DHCP lease info item %d.", what);
@ -1199,6 +1214,9 @@ int sd_dhcp_server_set_pop3_server(sd_dhcp_server *server, const struct in_addr
int sd_dhcp_server_set_smtp_server(sd_dhcp_server *server, const struct in_addr smtp[], unsigned n) {
return sd_dhcp_server_set_servers(server, SD_DHCP_LEASE_SMTP_SERVERS, smtp, n);
}
int sd_dhcp_server_set_lpr(sd_dhcp_server *server, const struct in_addr lpr[], unsigned n) {
return sd_dhcp_server_set_servers(server, SD_DHCP_LEASE_LPR_SERVERS, lpr, n);
}
int sd_dhcp_server_set_emit_router(sd_dhcp_server *server, int enabled) {
assert_return(server, -EINVAL);

View File

@ -1298,19 +1298,18 @@ static int message_add_offset(sd_bus_message *m, size_t offset) {
}
static void message_extend_containers(sd_bus_message *m, size_t expand) {
struct bus_container *c;
assert(m);
if (expand <= 0)
return;
/* Update counters */
for (c = m->containers; c < m->containers + m->n_containers; c++) {
if (m->n_containers <= 0)
return;
/* Update counters */
for (struct bus_container *c = m->containers; c < m->containers + m->n_containers; c++)
if (c->array_size)
*c->array_size += expand;
}
}
static void *message_extend_body(
@ -1373,7 +1372,6 @@ static void *message_extend_body(
if (r < 0)
return NULL;
} else {
struct bus_container *c;
void *op;
size_t os, start_part, end_part;
@ -1394,7 +1392,8 @@ static void *message_extend_body(
}
/* Readjust pointers */
for (c = m->containers; c < m->containers + m->n_containers; c++)
if (m->n_containers > 0)
for (struct bus_container *c = m->containers; c < m->containers + m->n_containers; c++)
c->array_size = adjust_pointer(c->array_size, op, os, part->data);
m->error.message = (const char*) adjust_pointer(m->error.message, op, os, part->data);

View File

@ -56,12 +56,18 @@ static int node_vtable_get_userdata(
static void *vtable_method_convert_userdata(const sd_bus_vtable *p, void *u) {
assert(p);
if (!u)
return SIZE_TO_PTR(p->x.method.offset); /* don't add offset on NULL, to make ubsan happy */
return (uint8_t*) u + p->x.method.offset;
}
static void *vtable_property_convert_userdata(const sd_bus_vtable *p, void *u) {
assert(p);
if (!u)
return SIZE_TO_PTR(p->x.property.offset); /* as above */
return (uint8_t*) u + p->x.property.offset;
}

View File

@ -264,6 +264,10 @@ _public_ int sd_network_link_get_smtp_servers(int ifindex, char ***ret) {
return network_link_get_strv(ifindex, "SMTP_SERVERS", ret);
}
_public_ int sd_network_link_get_lpr_servers(int ifindex, char ***ret) {
return network_link_get_strv(ifindex, "LPR_SERVERS", ret);
}
_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;

View File

@ -1241,7 +1241,7 @@ static int link_status_one(
const LinkInfo *info) {
_cleanup_strv_free_ char **dns = NULL, **ntp = NULL, **sip = NULL, **search_domains = NULL, **route_domains = NULL,
**pop3_server = NULL, **smtp_server = NULL;
**pop3_server = NULL, **smtp_server = NULL, **lpr_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;
@ -1270,6 +1270,7 @@ static int link_status_one(
(void) sd_network_link_get_sip(info->ifindex, &sip);
(void) sd_network_link_get_pop3_servers(info->ifindex, &pop3_server);
(void) sd_network_link_get_smtp_servers(info->ifindex, &smtp_server);
(void) sd_network_link_get_lpr_servers(info->ifindex, &lpr_server);
if (info->sd_device) {
(void) sd_device_get_property_value(info->sd_device, "ID_NET_LINK_FILE", &link);
@ -1844,6 +1845,9 @@ static int link_status_one(
if (r < 0)
return r;
r = dump_list(table, "SMTP servers:", smtp_server);
if (r < 0)
return r;
r = dump_list(table, "LPR servers:", lpr_server);
if (r < 0)
return r;
r = dump_ifindexes(table, "Carrier Bound To:", carrier_bound_to);

View File

@ -127,6 +127,11 @@ static int link_push_uplink_to_dhcp_server(
lease_condition = link->network->dhcp_use_sip;
break;
case SD_DHCP_LEASE_LPR_SERVERS:
servers = link->network->lpr;
lease_condition = true;
break;
default:
assert_not_reached("Unknown DHCP lease info item");
}
@ -238,6 +243,11 @@ int dhcp4_server_configure(Link *link) {
link->network->dhcp_server_smtp,
link->network->n_dhcp_server_smtp,
},
[SD_DHCP_LEASE_LPR_SERVERS] = {
true,
link->network->dhcp_server_lpr,
link->network->n_dhcp_server_lpr,
},
};
assert_cc(ELEMENTSOF(configs) == _SD_DHCP_LEASE_INFO_MAX);
@ -454,3 +464,23 @@ int config_parse_dhcp_server_smtp_servers(
&n->dhcp_server_smtp, &n->n_dhcp_server_smtp);
}
int config_parse_dhcp_server_lpr_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;
return config_parse_dhcp_lease_server_list(unit, filename, line,
lvalue, rvalue,
&n->dhcp_server_lpr, &n->n_dhcp_server_lpr);
}

View File

@ -14,3 +14,4 @@ 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);
CONFIG_PARSER_PROTOTYPE(config_parse_dhcp_server_smtp_servers);
CONFIG_PARSER_PROTOTYPE(config_parse_dhcp_server_lpr_servers);

View File

@ -3951,9 +3951,9 @@ static void link_save_dns(FILE *f, struct in_addr_data *dns, unsigned n_dns, boo
}
int link_save(Link *link) {
const char *admin_state, *oper_state, *carrier_state, *address_state;
_cleanup_free_ char *temp_path = NULL;
_cleanup_fclose_ FILE *f = NULL;
const char *admin_state, *oper_state, *carrier_state, *address_state;
Address *a;
Route *route;
Iterator i;
@ -4112,6 +4112,12 @@ int link_save(Link *link) {
space = false;
fputstrv(f, link->network->smtp, NULL, &space);
fputc('\n', f);
fputs("LPR_SERVERS=", f);
space = false;
fputstrv(f, link->network->lpr, NULL, &space);
if (link->dhcp_lease) {
const struct in_addr *addresses;
@ -4130,6 +4136,15 @@ int link_save(Link *link) {
space = true;
}
if (link->dhcp_lease) {
const struct in_addr *addresses;
r = sd_dhcp_lease_get_lpr_servers(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;

View File

@ -1495,7 +1495,7 @@ 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, *pop3 = NULL,
*smtp = NULL, *search_domains = NULL, *route_domains = NULL;
*smtp = NULL, *lpr = 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;
@ -1532,6 +1532,10 @@ static int manager_save(Manager *m) {
if (!smtp)
return -ENOMEM;
lpr = ordered_set_new(&string_hash_ops);
if (!lpr)
return -ENOMEM;
search_domains = ordered_set_new(&dns_name_hash_ops);
if (!search_domains)
return -ENOMEM;
@ -1623,6 +1627,14 @@ static int manager_save(Manager *m) {
} else if (r < 0 && r != -ENODATA)
return r;
r = sd_dhcp_lease_get_lpr_servers(link->dhcp_lease, &addresses);
if (r > 0) {
r = ordered_set_put_in4_addrv(lpr, 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;
@ -1676,6 +1688,7 @@ static int manager_save(Manager *m) {
ordered_set_print(f, "SIP=", sip);
ordered_set_print(f, "POP3_SERVERS=", pop3);
ordered_set_print(f, "SMTP_SERVERS=", smtp);
ordered_set_print(f, "LPR_SERVERS=", lpr);
ordered_set_print(f, "DOMAINS=", search_domains);
ordered_set_print(f, "ROUTE_DOMAINS=", route_domains);

View File

@ -212,6 +212,7 @@ DHCPServer.EmitSIP, config_parse_bool,
DHCPServer.SIP, config_parse_dhcp_server_sip, 0, 0
DHCPServer.POP3Servers, config_parse_dhcp_server_pop3_servers, 0, 0
DHCPServer.SMTPServers, config_parse_dhcp_server_smtp_servers, 0, 0
DHCPServer.LPRServers, config_parse_dhcp_server_lpr_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)

View File

@ -155,6 +155,9 @@ struct Network {
struct in_addr *dhcp_server_smtp;
unsigned n_dhcp_server_smtp;
struct in_addr *dhcp_server_lpr;
unsigned n_dhcp_server_lpr;
bool dhcp_server_emit_router;
bool dhcp_server_emit_timezone;
char *dhcp_server_timezone;
@ -312,6 +315,7 @@ struct Network {
char **sip;
char **pop3;
char **smtp;
char **lpr;
char **bind_carrier;
};

View File

@ -43,6 +43,7 @@ static const char* const dhcp_lease_info_table[_SD_DHCP_LEASE_INFO_MAX] = {
[SD_DHCP_LEASE_SIP_SERVERS] = "SIP servers",
[SD_DHCP_LEASE_POP3_SERVERS] = "POP3 servers",
[SD_DHCP_LEASE_SMTP_SERVERS] = "SMTP servers",
[SD_DHCP_LEASE_LPR_SERVERS] = "LPR servers",
};
DEFINE_STRING_TABLE_LOOKUP_WITH_BOOLEAN(address_family, AddressFamily, ADDRESS_FAMILY_YES);

View File

@ -2974,13 +2974,10 @@ static int inner_child(
arg_uid_range,
arg_selinux_apifs_context,
true);
if (r < 0)
return r;
} else {
} else
r = mount_systemd_cgroup_writable("", arg_unified_cgroup_hierarchy);
if (r < 0)
return r;
}
r = setup_boot_id();
if (r < 0)
@ -4823,6 +4820,58 @@ static int initialize_rlimits(void) {
return 0;
}
static int cant_be_in_netns(void) {
union sockaddr_union sa = {
.un = {
.sun_family = AF_UNIX,
.sun_path = "/run/udev/control",
},
};
char udev_path[STRLEN("/proc//ns/net") + DECIMAL_STR_MAX(pid_t)];
_cleanup_free_ char *udev_ns = NULL, *our_ns = NULL;
_cleanup_close_ int fd = -1;
struct ucred ucred;
int r;
/* Check if we are in the same netns as udev. If we aren't, then device monitoring (and thus waiting
* for loopback block devices) won't work, and we will hang. Detect this case and exit early with a
* nice message. */
if (!arg_image) /* only matters if --image= us used, i.e. we actually need to use loopback devices */
return 0;
fd = socket(AF_UNIX, SOCK_SEQPACKET|SOCK_NONBLOCK|SOCK_CLOEXEC, 0);
if (fd < 0)
return log_error_errno(errno, "Failed to allocate udev control socket: %m");
if (connect(fd, &sa.un, SOCKADDR_UN_LEN(sa.un)) < 0) {
if (errno == ENOENT || ERRNO_IS_DISCONNECT(errno))
return log_error_errno(SYNTHETIC_ERRNO(EOPNOTSUPP),
"Sorry, but --image= requires access to the host's /run/ hierarchy, since we need access to udev.");
return log_error_errno(errno, "Failed to connect socket to udev control socket: %m");
}
r = getpeercred(fd, &ucred);
if (r < 0)
return log_error_errno(r, "Failed to determine peer of udev control socket: %m");
xsprintf(udev_path, "/proc/" PID_FMT "/ns/net", ucred.pid);
r = readlink_malloc(udev_path, &udev_ns);
if (r < 0)
return log_error_errno(r, "Failed to read network namespace of udev: %m");
r = readlink_malloc("/proc/self/ns/net", &our_ns);
if (r < 0)
return log_error_errno(r, "Failed to read our own network namespace: %m");
if (!streq(our_ns, udev_ns))
return log_error_errno(SYNTHETIC_ERRNO(EOPNOTSUPP),
"Sorry, but --image= is only supported in the main network namespace, since we need access to udev/AF_NETLINK.");
return 0;
}
static int run(int argc, char *argv[]) {
bool secondary = false, remove_directory = false, remove_image = false,
veth_created = false, remove_tmprootdir = false;
@ -4849,6 +4898,10 @@ static int run(int argc, char *argv[]) {
if (r < 0)
goto finish;
r = cant_be_in_netns();
if (r < 0)
goto finish;
r = initialize_rlimits();
if (r < 0)
goto finish;

View File

@ -1144,7 +1144,11 @@ static int start_transient_service(
assert_not_reached("Can't allocate tty via ssh");
}
if (!arg_no_block) {
/* Optionally, wait for the start job to complete. If we are supposed to read the service's stdin
* lets skip this however, because we should start that already when the start job is running, and
* there's little point in waiting for the start job to complete in that case anyway, as we'll wait
* for EOF anyway, which is going to be much later. */
if (!arg_no_block && arg_stdio == ARG_STDIO_NONE) {
r = bus_wait_for_jobs_new(bus, &w);
if (r < 0)
return log_error_errno(r, "Could not watch jobs: %m");

View File

@ -23,7 +23,7 @@ struct acpi_table_header {
uint32_t oem_revision;
char asl_compiler_id[4];
uint32_t asl_compiler_revision;
};
} _packed_;
enum {
ACPI_FPDT_TYPE_BOOT = 0,
@ -36,12 +36,12 @@ struct acpi_fpdt_header {
uint8_t revision;
uint8_t reserved[4];
uint64_t ptr;
};
} _packed_;
struct acpi_fpdt_boot_header {
char signature[4];
uint32_t length;
};
} _packed_;
enum {
ACPI_FPDT_S3PERF_RESUME_REC = 0,
@ -59,7 +59,7 @@ struct acpi_fpdt_boot {
uint64_t startup_start;
uint64_t exit_services_entry;
uint64_t exit_services_exit;
};
} _packed;
int acpi_get_boot_usec(usec_t *loader_start, usec_t *loader_exit) {
_cleanup_free_ char *buf = NULL;

View File

@ -91,6 +91,7 @@ static void bus_wait_for_units_clear(BusWaitForUnits *d) {
while ((item = hashmap_first(d->items))) {
d->current = item;
if (item->unit_callback)
item->unit_callback(d, item->bus_path, false, item->userdata);
wait_for_item_free(item);
}

View File

@ -410,7 +410,7 @@ static int output_units_list(const UnitInfo *unit_infos, unsigned c) {
if (arg_full)
table_set_width(table, 0);
for (u = unit_infos; u < unit_infos + c; u++) {
for (u = unit_infos; unit_infos && u < unit_infos + c; u++) {
_cleanup_free_ char *j = NULL;
const char *on_underline = "", *on_loaded = "", *on_active = "";
const char *on_circle = "", *id;

View File

@ -48,6 +48,7 @@ enum {
SD_DHCP_OPTION_TIME_OFFSET = 2,
SD_DHCP_OPTION_ROUTER = 3,
SD_DHCP_OPTION_DOMAIN_NAME_SERVER = 6,
SD_DHCP_OPTION_LPR_SERVER = 9,
SD_DHCP_OPTION_HOST_NAME = 12,
SD_DHCP_OPTION_BOOT_FILE_SIZE = 13,
SD_DHCP_OPTION_DOMAIN_NAME = 15,

View File

@ -39,6 +39,7 @@ typedef enum sd_dhcp_lease_info {
SD_DHCP_LEASE_SIP_SERVERS,
SD_DHCP_LEASE_POP3_SERVERS,
SD_DHCP_LEASE_SMTP_SERVERS,
SD_DHCP_LEASE_LPR_SERVERS,
_SD_DHCP_LEASE_INFO_MAX,
} sd_dhcp_lease_info;
@ -57,6 +58,7 @@ 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_smtp_server(sd_dhcp_lease *lease, const struct in_addr **addr);
int sd_dhcp_lease_get_lpr_servers(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);

View File

@ -56,6 +56,7 @@ int sd_dhcp_server_set_servers(
const struct in_addr addresses[],
unsigned n_addresses);
int sd_dhcp_server_set_lpr(sd_dhcp_server *server, const struct in_addr lpr[], unsigned n);
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);

View File

@ -173,6 +173,9 @@ int sd_network_link_get_pop3_servers(int ifindex, char ***pop3);
/* Get the SMTP servers for a given link. */
int sd_network_link_get_smtp_servers(int ifindex, char ***smtp);
/* Get the LPR servers for a given link. */
int sd_network_link_get_lpr_servers(int ifindex, char ***lpr);
/* Get whether this link shall be used as 'default route' for DNS queries */
int sd_network_link_get_dns_default_route(int ifindex);

View File

@ -278,6 +278,7 @@ EmitSIP=
SIP=
POP3Servers=
SMTPServers=
LPRServers=
EmitRouter=
MaxLeaseTimeSec=
DefaultLeaseTimeSec=

View File

@ -27,5 +27,5 @@ ExecStart=test %h = /root
ExecStart=sh -c 'test %s = /bin/sh'
ExecStart=sh -c 'test %m = $$(cat /etc/machine-id)'
ExecStart=sh -c 'test %b = $$(cat /proc/sys/kernel/random/boot_id | sed -e 's/-//g')'
ExecStart=sh -c 'test %H = $$(hostname)'
ExecStart=sh -c 'test %H = $$(uname -n)'
ExecStart=sh -c 'test %v = $$(uname -r)'

View File

@ -25,5 +25,5 @@ ExecStart=test %h = /root
ExecStart=sh -c 'test %s = /bin/sh'
ExecStart=sh -c 'test %m = $$(cat /etc/machine-id)'
ExecStart=sh -c 'test %b = $$(cat /proc/sys/kernel/random/boot_id | sed -e 's/-//g')'
ExecStart=sh -c 'test %H = $$(hostname)'
ExecStart=sh -c 'test %H = $$(uname -n)'
ExecStart=sh -c 'test %v = $$(uname -r)'

View File

@ -106,4 +106,7 @@ systemctl kill --signal=SIGKILL systemd-journald
sleep 3
[[ ! -f "/i-lose-my-logs" ]]
# https://github.com/systemd/systemd/issues/15528
journalctl --follow --file=/var/log/journal/*/* | head -n1 || [[ $? -eq 1 ]]
touch /testok