mirror of
https://git.proxmox.com/git/systemd
synced 2025-10-04 16:46:31 +00:00
New upstream version 250.3
This commit is contained in:
parent
36ceca0325
commit
a80b52fdbc
12
NEWS
12
NEWS
@ -10698,7 +10698,7 @@ CHANGES WITH 211:
|
||||
also supports LUKS-encrypted partitions now. With this in
|
||||
place, automatic discovery of partitions to mount following
|
||||
the Discoverable Partitions Specification
|
||||
(https://www.freedesktop.org/wiki/Specifications/DiscoverablePartitionsSpec)
|
||||
(https://systemd.io/DISCOVERABLE_PARTITIONS/)
|
||||
is now a lot more complete. This allows booting without
|
||||
/etc/fstab and without root= on the kernel command line on
|
||||
systems prepared appropriately.
|
||||
@ -12203,7 +12203,7 @@ CHANGES WITH 198:
|
||||
only in conjunction with Gummiboot, but could be supported
|
||||
by other boot loaders too. For details see:
|
||||
|
||||
https://www.freedesktop.org/wiki/Software/systemd/BootLoaderInterface
|
||||
https://systemd.io/BOOT_LOADER_INTERFACE
|
||||
|
||||
* A new generator has been added that automatically mounts the
|
||||
EFI System Partition (ESP) to /boot, if that directory
|
||||
@ -12279,7 +12279,7 @@ CHANGES WITH 198:
|
||||
* A new tool kernel-install has been added that can install
|
||||
kernel images according to the Boot Loader Specification:
|
||||
|
||||
https://www.freedesktop.org/wiki/Specifications/BootLoaderSpec
|
||||
https://systemd.io/BOOT_LOADER_SPECIFICATION
|
||||
|
||||
* Boot time console output has been improved to provide
|
||||
animated boot time output for hanging jobs.
|
||||
@ -12369,7 +12369,7 @@ CHANGES WITH 197:
|
||||
of these policies is now the default. Please see this wiki
|
||||
document for details:
|
||||
|
||||
https://www.freedesktop.org/wiki/Software/systemd/PredictableNetworkInterfaceNames
|
||||
https://www.freedesktop.org/software/systemd/man/systemd.net-naming-scheme.html
|
||||
|
||||
* Auke Kok's bootchart implementation has been added to the
|
||||
systemd tree. It is an optional component that can graph the
|
||||
@ -13368,7 +13368,7 @@ CHANGES WITH 183:
|
||||
|
||||
* A framework for implementing offline system updates is now
|
||||
integrated, for details see:
|
||||
https://www.freedesktop.org/wiki/Software/systemd/SystemUpdates
|
||||
https://www.freedesktop.org/software/systemd/man/systemd.offline-updates.html
|
||||
|
||||
* A new service type Type=idle is available now which helps us
|
||||
avoiding ugly interleaving of getty output and boot status
|
||||
@ -13736,7 +13736,7 @@ CHANGES WITH 38:
|
||||
* Processes with '@' in argv[0][0] are now excluded from the
|
||||
final shut-down killing spree, following the logic explained
|
||||
in:
|
||||
https://www.freedesktop.org/wiki/Software/systemd/RootStorageDaemons
|
||||
https://systemd.io/ROOT_STORAGE_DAEMONS/
|
||||
|
||||
* All processes remaining in a service cgroup when we enter
|
||||
the START or START_PRE states are now killed with
|
||||
|
10
README
10
README
@ -1,10 +1,7 @@
|
||||
systemd System and Service Manager
|
||||
|
||||
DETAILS:
|
||||
http://0pointer.de/blog/projects/systemd.html
|
||||
|
||||
WEB SITE:
|
||||
https://www.freedesktop.org/wiki/Software/systemd
|
||||
https://systemd.io
|
||||
|
||||
GIT:
|
||||
git@github.com:systemd/systemd.git
|
||||
@ -19,6 +16,11 @@ IRC:
|
||||
BUG REPORTS:
|
||||
https://github.com/systemd/systemd/issues
|
||||
|
||||
OLDER DOCUMENTATION:
|
||||
|
||||
http://0pointer.de/blog/projects/systemd.html
|
||||
https://www.freedesktop.org/wiki/Software/systemd
|
||||
|
||||
AUTHOR:
|
||||
Lennart Poettering
|
||||
Kay Sievers
|
||||
|
2
TODO
2
TODO
@ -816,7 +816,7 @@ Features:
|
||||
Note that we start initrd-fs.target and initrd-cleanup.target there, so a straightforward
|
||||
ConditionPathExists= is not enough.
|
||||
|
||||
* docs: bring http://www.freedesktop.org/wiki/Software/systemd/MyServiceCantGetRealtime up to date
|
||||
* docs: bring https://www.freedesktop.org/wiki/Software/systemd/MyServiceCantGetRealtime up to date
|
||||
|
||||
* add a job mode that will fail if a transaction would mean stopping
|
||||
running units. Use this in timedated to manage the NTP service
|
||||
|
@ -8,7 +8,7 @@ SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
# The Container Interface
|
||||
|
||||
Also consult [Writing Virtual Machine or Container
|
||||
Managers](http://www.freedesktop.org/wiki/Software/systemd/writing-vm-managers).
|
||||
Managers](https://www.freedesktop.org/wiki/Software/systemd/writing-vm-managers).
|
||||
|
||||
systemd has a number of interfaces for interacting with container managers,
|
||||
when systemd is used inside of an OS container. If you work on a container
|
||||
|
@ -31,8 +31,8 @@ for specific uses. This has many benefits:
|
||||
descriptive information about partitions tables.
|
||||
|
||||
Note that the OS side of this specification is currently implemented in
|
||||
[systemd](http://systemd.io/) 211 and newer in the
|
||||
[systemd-gpt-auto-generator(8)](http://www.freedesktop.org/software/systemd/man/systemd-gpt-auto-generator.html)
|
||||
[systemd](https://systemd.io/) 211 and newer in the
|
||||
[systemd-gpt-auto-generator(8)](https://www.freedesktop.org/software/systemd/man/systemd-gpt-auto-generator.html)
|
||||
generator tool. Note that automatic discovery of the root only works if the
|
||||
boot loader communicates this information to the OS, by implementing the [Boot
|
||||
Loader
|
||||
@ -164,7 +164,7 @@ Other GPT type IDs might be used on Linux, for example to mark software RAID or
|
||||
LVM partitions. The definitions of those GPT types is outside of the scope of
|
||||
this specification.
|
||||
|
||||
[systemd-id128(1)](http://www.freedesktop.org/software/systemd/man/systemd-id128.html)'s
|
||||
[systemd-id128(1)](https://www.freedesktop.org/software/systemd/man/systemd-id128.html)'s
|
||||
`show` command may be used to list those GPT partition type UUIDs.
|
||||
|
||||
## Partition Names
|
||||
|
@ -7,11 +7,9 @@ SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
|
||||
# Journal File Format
|
||||
|
||||
_Note that this document describes the binary on-disk format of journals
|
||||
only. For interfacing with web technologies there's the [Journal JSON
|
||||
Format](http://www.freedesktop.org/wiki/Software/systemd/json). For transfer
|
||||
of journal data across the network there's the [Journal Export
|
||||
Format](http://www.freedesktop.org/wiki/Software/systemd/export)._
|
||||
_Note that this document describes the binary on-disk format of journals only.
|
||||
For interfacing with web technologies there's the [Journal JSON Format](https://systemd.io/JOURNAL_EXPORT_FORMATS#journal-json-format).
|
||||
For transfer of journal data across the network there's the [Journal Export Format](https://systemd.io/JOURNAL_EXPORT_FORMATS#journal-export-format)._
|
||||
|
||||
The systemd journal stores log data in a binary format with several features:
|
||||
|
||||
@ -32,30 +30,30 @@ keep this document up-to-date and accurate.
|
||||
|
||||
Instead of implementing your own reader or writer for journal files we ask you
|
||||
to use the [Journal's native C
|
||||
API](http://www.freedesktop.org/software/systemd/man/sd-journal.html) to access
|
||||
API](https://www.freedesktop.org/software/systemd/man/sd-journal.html) to access
|
||||
these files. It provides you with full access to the files, and will not
|
||||
withhold any data. If you find a limitation, please ping us and we might add
|
||||
some additional interfaces for you.
|
||||
|
||||
If you need access to the raw journal data in serialized stream form without C
|
||||
API our recommendation is to make use of the [Journal Export
|
||||
Format](http://www.freedesktop.org/wiki/Software/systemd/export), which you can
|
||||
get via "journalctl -o export" or via systemd-journal-gatewayd. The export
|
||||
Format](https://systemd.io/JOURNAL_EXPORT_FORMATS#journal-export-format), which you can
|
||||
get via `journalctl -o export` or via `systemd-journal-gatewayd`. The export
|
||||
format is much simpler to parse, but complete and accurate. Due to its
|
||||
stream-based nature it is not indexed.
|
||||
|
||||
_Or, to put this in other words: this low-level document is probably not what
|
||||
you want to use as base of your project. You want our [C
|
||||
API](http://www.freedesktop.org/software/systemd/man/sd-journal.html) instead!
|
||||
API](https://www.freedesktop.org/software/systemd/man/sd-journal.html) instead!
|
||||
And if you really don't want the C API, then you want the [Journal Export
|
||||
Format](http://www.freedesktop.org/wiki/Software/systemd/export) instead! This
|
||||
document is primarily for your entertainment and education. Thank you!_
|
||||
Format or Journal JSON Format](https://systemd.io/JOURNAL_EXPORT_FORMATS) instead!
|
||||
This document is primarily for your entertainment and education. Thank you!_
|
||||
|
||||
This document assumes you have a basic understanding of the journal concepts,
|
||||
the properties of a journal entry and so on. If not, please go and read up,
|
||||
then come back! This is a good opportunity to read about the [basic properties
|
||||
of journal
|
||||
entries](http://www.freedesktop.org/software/systemd/man/systemd.journal-fields.html),
|
||||
entries](https://www.freedesktop.org/software/systemd/man/systemd.journal-fields.html),
|
||||
in particular realize that they may include binary non-text data (though
|
||||
usually don't), and the same field might have multiple values assigned within
|
||||
the same entry.
|
||||
|
@ -100,7 +100,7 @@ And now, here's the list of (hopefully) all APIs that we have introduced with sy
|
||||
| [Network](https://www.freedesktop.org/software/systemd/man/systemd.network.html) & [Netdev file format](https://www.freedesktop.org/software/systemd/man/systemd.netdev.html) | File format | yes | yes | no | no | - | no |
|
||||
| [Link file format](https://www.freedesktop.org/software/systemd/man/systemd.link.html) | File format | yes | yes | no | no | - | no |
|
||||
| [Journal File Format](https://systemd.io/JOURNAL_FILE_FORMAT) | File format | yes | yes | - | maybe | - | no |
|
||||
| [Journal Export Format](https://www.freedesktop.org/wiki/Software/systemd/export) | File format | yes | yes | - | yes | - | no |
|
||||
| [Journal Export Format](https://systemd.io/JOURNAL_EXPORT_FORMATS#journal-export-format) | File format | yes | yes | - | yes | - | no |
|
||||
| [Cooperation in cgroup tree](https://www.freedesktop.org/wiki/Software/systemd/PaxControlGroups) | Treaty | yes | yes | libvirt | yes | libvirt | no |
|
||||
| [Password Agents](https://systemd.io/PASSWORD_AGENTS) | Socket+Files | yes | yes | - | yes | - | no |
|
||||
| [udev multi-seat properties](https://www.freedesktop.org/software/systemd/man/sd-login.html) | udev Property | yes | yes | X11, gdm | no | - | no |
|
||||
|
@ -62,7 +62,7 @@ Does this have any drawbacks? Yes, it does. Previously it was practically guaran
|
||||
You basically have three options:
|
||||
|
||||
1. You disable the assignment of fixed names, so that the unpredictable kernel names are used again. For this, simply mask udev's .link file for the default policy: `ln -s /dev/null /etc/systemd/network/99-default.link`
|
||||
1. You create your own manual naming scheme, for example by naming your interfaces `internet0`, `dmz0` or `lan0`. For that create your own `.link` files in `/etc/systemd/network/`, that choose an explicit name or a better naming scheme for one, some, or all of your interfaces. See [systemd.link(5)](http://www.freedesktop.org/software/systemd/man/systemd.link.html) for more information.
|
||||
1. You create your own manual naming scheme, for example by naming your interfaces `internet0`, `dmz0` or `lan0`. For that create your own `.link` files in `/etc/systemd/network/`, that choose an explicit name or a better naming scheme for one, some, or all of your interfaces. See [systemd.link(5)](https://www.freedesktop.org/software/systemd/man/systemd.link.html) for more information.
|
||||
1. You pass the `net.ifnames=0` on the kernel command line
|
||||
|
||||
## How does the new naming scheme look like, precisely?
|
||||
|
@ -34,6 +34,7 @@ Most generic unit settings are available for transient units.
|
||||
✓ PropagatesReloadTo=
|
||||
✓ ReloadPropagatedFrom=
|
||||
✓ PartOf=
|
||||
✓ Upholds=
|
||||
✓ JoinsNamespaceOf=
|
||||
✓ RequiresMountsFor=
|
||||
✓ StopWhenUnneeded=
|
||||
|
@ -2,7 +2,7 @@
|
||||
# SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
title: systemd
|
||||
baseurl: "" # the subpath of your site, e.g. /blog/
|
||||
url: "http://systemd.io" # the base hostname & protocol for your site
|
||||
url: "https://systemd.io" # the base hostname & protocol for your site
|
||||
|
||||
permalink: /:title/
|
||||
|
||||
|
@ -301,7 +301,7 @@
|
||||
<para>serializes the journal into a binary (but mostly
|
||||
text-based) stream suitable for backups and network
|
||||
transfer (see
|
||||
<ulink url="https://www.freedesktop.org/wiki/Software/systemd/export">Journal Export Format</ulink>
|
||||
<ulink url="https://systemd.io/JOURNAL_EXPORT_FORMATS#journal-export-format">Journal Export Format</ulink>
|
||||
for more information). To import the binary stream back
|
||||
into native journald format use
|
||||
<citerefentry><refentrytitle>systemd-journal-remote</refentrytitle><manvolnum>8</manvolnum></citerefentry>.</para>
|
||||
@ -314,7 +314,7 @@
|
||||
</term>
|
||||
<listitem>
|
||||
<para>formats entries as JSON objects, separated by newline characters (see <ulink
|
||||
url="https://www.freedesktop.org/wiki/Software/systemd/json">Journal JSON Format</ulink> for more
|
||||
url="https://systemd.io/JOURNAL_EXPORT_FORMATS#journal-json-format">Journal JSON Format</ulink> for more
|
||||
information). Field values are generally encoded as JSON strings, with three exceptions:
|
||||
<orderedlist>
|
||||
<listitem><para>Fields larger than 4096 bytes are encoded as <constant>null</constant> values. (This
|
||||
|
@ -621,7 +621,7 @@ node /org/freedesktop/login1 {
|
||||
whether the inhibit shall be consider mandatory or whether it should just delay the operation to a
|
||||
certain maximum time. The method returns a file descriptor. The lock is released the moment this file
|
||||
descriptor and all its duplicates are closed. For more information on the inhibition logic see
|
||||
<ulink url="http://www.freedesktop.org/wiki/Software/systemd/inhibit">Inhibitor Locks</ulink>.
|
||||
<ulink url="https://www.freedesktop.org/wiki/Software/systemd/inhibit">Inhibitor Locks</ulink>.
|
||||
</para>
|
||||
</refsect2>
|
||||
|
||||
@ -644,7 +644,7 @@ node /org/freedesktop/login1 {
|
||||
that should be done shortly before shutdown/sleep, in conjunction with delay inhibitor locks. After
|
||||
completion of this work they should release their inhibition locks in order to not delay the operation
|
||||
any further. For more information see
|
||||
<ulink url="http://www.freedesktop.org/wiki/Software/systemd/inhibit">Inhibitor Locks</ulink>.
|
||||
<ulink url="https://www.freedesktop.org/wiki/Software/systemd/inhibit">Inhibitor Locks</ulink>.
|
||||
</para>
|
||||
</refsect2>
|
||||
|
||||
|
@ -506,7 +506,7 @@ node /org/freedesktop/resolve1 {
|
||||
<filename>/etc/hosts</filename>. Moreover, it is set for all LLMNR or mDNS RRs which originate from
|
||||
the local host. Applications that require authenticated RR data for operation should check this flag
|
||||
before trusting the data. Note that <filename>systemd-resolved</filename> will never return
|
||||
invalidated data, hence this flag simply allows to discern the cases where data is known to be
|
||||
invalidated data, hence this flag simply allows one to discern the cases where data is known to be
|
||||
trusted, or where there is proof that the data is "rightfully" unauthenticated (which includes cases
|
||||
where the underlying protocol or server does not support authenticating data).</para>
|
||||
|
||||
|
@ -1427,7 +1427,7 @@ node /org/freedesktop/systemd1 {
|
||||
<varname>properties</varname> contains properties of the unit, specified like in
|
||||
<function>SetUnitProperties()</function>. <varname>aux</varname> is currently unused and should be
|
||||
passed as an empty array. See the
|
||||
<ulink url="http://www.freedesktop.org/wiki/Software/systemd/ControlGroupInterface/">New Control Group
|
||||
<ulink url="https://www.freedesktop.org/wiki/Software/systemd/ControlGroupInterface/">New Control Group
|
||||
Interface</ulink> for more information how to make use of this functionality for resource control
|
||||
purposes.</para>
|
||||
</refsect2>
|
||||
@ -1649,6 +1649,8 @@ node /org/freedesktop/systemd1/unit/avahi_2ddaemon_2eservice {
|
||||
@org.freedesktop.DBus.Property.EmitsChangedSignal("const")
|
||||
readonly as PartOf = ['...', ...];
|
||||
@org.freedesktop.DBus.Property.EmitsChangedSignal("const")
|
||||
readonly as Upholds = ['...', ...];
|
||||
@org.freedesktop.DBus.Property.EmitsChangedSignal("const")
|
||||
readonly as RequiredBy = ['...', ...];
|
||||
@org.freedesktop.DBus.Property.EmitsChangedSignal("const")
|
||||
readonly as RequisiteOf = ['...', ...];
|
||||
@ -1657,6 +1659,8 @@ node /org/freedesktop/systemd1/unit/avahi_2ddaemon_2eservice {
|
||||
@org.freedesktop.DBus.Property.EmitsChangedSignal("const")
|
||||
readonly as BoundBy = ['...', ...];
|
||||
@org.freedesktop.DBus.Property.EmitsChangedSignal("const")
|
||||
readonly as UpheldBy = ['...', ...];
|
||||
@org.freedesktop.DBus.Property.EmitsChangedSignal("const")
|
||||
readonly as ConsistsOf = ['...', ...];
|
||||
@org.freedesktop.DBus.Property.EmitsChangedSignal("const")
|
||||
readonly as Conflicts = ['...', ...];
|
||||
@ -1667,14 +1671,14 @@ node /org/freedesktop/systemd1/unit/avahi_2ddaemon_2eservice {
|
||||
@org.freedesktop.DBus.Property.EmitsChangedSignal("const")
|
||||
readonly as After = ['...', ...];
|
||||
@org.freedesktop.DBus.Property.EmitsChangedSignal("const")
|
||||
readonly as OnFailure = ['...', ...];
|
||||
@org.freedesktop.DBus.Property.EmitsChangedSignal("const")
|
||||
readonly as OnFailureOf = ['...', ...];
|
||||
@org.freedesktop.DBus.Property.EmitsChangedSignal("const")
|
||||
readonly as OnSuccess = ['...', ...];
|
||||
@org.freedesktop.DBus.Property.EmitsChangedSignal("const")
|
||||
readonly as OnSuccessOf = ['...', ...];
|
||||
@org.freedesktop.DBus.Property.EmitsChangedSignal("const")
|
||||
readonly as OnFailure = ['...', ...];
|
||||
@org.freedesktop.DBus.Property.EmitsChangedSignal("const")
|
||||
readonly as OnFailureOf = ['...', ...];
|
||||
@org.freedesktop.DBus.Property.EmitsChangedSignal("const")
|
||||
readonly as Triggers = ['...', ...];
|
||||
@org.freedesktop.DBus.Property.EmitsChangedSignal("const")
|
||||
readonly as TriggeredBy = ['...', ...];
|
||||
@ -1820,16 +1824,20 @@ node /org/freedesktop/systemd1/unit/avahi_2ddaemon_2eservice {
|
||||
|
||||
<!--property PartOf is not documented!-->
|
||||
|
||||
<!--property Upholds is not documented!-->
|
||||
|
||||
<!--property RequisiteOf is not documented!-->
|
||||
|
||||
<!--property ConsistsOf is not documented!-->
|
||||
<!--property UpheldBy is not documented!-->
|
||||
|
||||
<!--property OnFailureOf is not documented!-->
|
||||
<!--property ConsistsOf is not documented!-->
|
||||
|
||||
<!--property OnSuccess is not documented!-->
|
||||
|
||||
<!--property OnSuccessOf is not documented!-->
|
||||
|
||||
<!--property OnFailureOf is not documented!-->
|
||||
|
||||
<!--property ReloadPropagatedFrom is not documented!-->
|
||||
|
||||
<!--property PropagatesStopTo is not documented!-->
|
||||
@ -1948,6 +1956,8 @@ node /org/freedesktop/systemd1/unit/avahi_2ddaemon_2eservice {
|
||||
|
||||
<variablelist class="dbus-property" generated="True" extra-ref="PartOf"/>
|
||||
|
||||
<variablelist class="dbus-property" generated="True" extra-ref="Upholds"/>
|
||||
|
||||
<variablelist class="dbus-property" generated="True" extra-ref="RequiredBy"/>
|
||||
|
||||
<variablelist class="dbus-property" generated="True" extra-ref="RequisiteOf"/>
|
||||
@ -1956,6 +1966,8 @@ node /org/freedesktop/systemd1/unit/avahi_2ddaemon_2eservice {
|
||||
|
||||
<variablelist class="dbus-property" generated="True" extra-ref="BoundBy"/>
|
||||
|
||||
<variablelist class="dbus-property" generated="True" extra-ref="UpheldBy"/>
|
||||
|
||||
<variablelist class="dbus-property" generated="True" extra-ref="ConsistsOf"/>
|
||||
|
||||
<variablelist class="dbus-property" generated="True" extra-ref="Conflicts"/>
|
||||
@ -1966,14 +1978,14 @@ node /org/freedesktop/systemd1/unit/avahi_2ddaemon_2eservice {
|
||||
|
||||
<variablelist class="dbus-property" generated="True" extra-ref="After"/>
|
||||
|
||||
<variablelist class="dbus-property" generated="True" extra-ref="OnFailure"/>
|
||||
|
||||
<variablelist class="dbus-property" generated="True" extra-ref="OnFailureOf"/>
|
||||
|
||||
<variablelist class="dbus-property" generated="True" extra-ref="OnSuccess"/>
|
||||
|
||||
<variablelist class="dbus-property" generated="True" extra-ref="OnSuccessOf"/>
|
||||
|
||||
<variablelist class="dbus-property" generated="True" extra-ref="OnFailure"/>
|
||||
|
||||
<variablelist class="dbus-property" generated="True" extra-ref="OnFailureOf"/>
|
||||
|
||||
<variablelist class="dbus-property" generated="True" extra-ref="Triggers"/>
|
||||
|
||||
<variablelist class="dbus-property" generated="True" extra-ref="TriggeredBy"/>
|
||||
|
@ -962,6 +962,7 @@ manpages = [
|
||||
['systemd-sleep.conf', '5', ['sleep.conf.d'], ''],
|
||||
['systemd-socket-activate', '1', [], ''],
|
||||
['systemd-socket-proxyd', '8', [], ''],
|
||||
['systemd-stdio-bridge', '1', [], ''],
|
||||
['systemd-stub',
|
||||
'7',
|
||||
['linuxaa64.efi.stub', 'linuxia32.efi.stub', 'linuxx64.efi.stub'],
|
||||
|
@ -172,7 +172,23 @@
|
||||
<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_read_basic.xml" xpointer="errors" />
|
||||
<refsect2 id='errors'>
|
||||
<title>Errors</title>
|
||||
|
||||
<para>Returned errors may indicate the following problems:</para>
|
||||
|
||||
<variablelist>
|
||||
<xi:include href="sd_bus_message_read_basic.xml" xpointer="errors-einval"/>
|
||||
<xi:include href="sd_bus_message_read_basic.xml" xpointer="errors-enxio"/>
|
||||
<xi:include href="sd_bus_message_read_basic.xml" xpointer="errors-ebadmsg"/>
|
||||
<varlistentry>
|
||||
<term><constant>-EBUSY</constant></term>
|
||||
|
||||
<listitem><para>When reading from a container, this error will be returned if unread elements
|
||||
are left in the container.</para></listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</refsect2>
|
||||
</refsect1>
|
||||
|
||||
<xi:include href="libsystemd-pkgconfig.xml" />
|
||||
|
@ -199,21 +199,21 @@
|
||||
<para>Returned errors may indicate the following problems:</para>
|
||||
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<varlistentry id="errors-einval">
|
||||
<term><constant>-EINVAL</constant></term>
|
||||
|
||||
<listitem><para>Specified type string is invalid or the message parameter is
|
||||
<constant>NULL</constant>.</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<varlistentry id="errors-enxio">
|
||||
<term><constant>-ENXIO</constant></term>
|
||||
|
||||
<listitem><para>The message does not contain the specified type at current position.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<varlistentry id="errors-ebadmsg">
|
||||
<term><constant>-EBADMSG</constant></term>
|
||||
|
||||
<listitem><para>The message cannot be parsed.</para></listitem>
|
||||
|
@ -141,7 +141,7 @@
|
||||
specification, informing the receiving side that the caller is prepared to wait for interactive
|
||||
authorization, which might take a considerable time to complete. If this flag is set, the user
|
||||
may be queried for passwords or confirmation via
|
||||
<ulink url="http://www.freedesktop.org/wiki/Software/polkit">polkit</ulink> or a similar
|
||||
<ulink url="https://www.freedesktop.org/wiki/Software/polkit">polkit</ulink> or a similar
|
||||
framework.</para>
|
||||
|
||||
<para><function>sd_bus_get_allow_interactive_authorization()</function> returns true if
|
||||
|
@ -79,7 +79,7 @@
|
||||
<para>It is also possible to invoke <command>systemd-coredump</command> with
|
||||
<option>--backtrace</option> option. In this case, <command>systemd-coredump</command> expects a
|
||||
journal entry in the journal
|
||||
<ulink url="https://www.freedesktop.org/wiki/Software/systemd/export">Journal Export Format</ulink>
|
||||
<ulink url="https://systemd.io/JOURNAL_EXPORT_FORMATS#journal-export-format">Journal Export Format</ulink>
|
||||
on standard input. The entry should contain a <varname>MESSAGE=</varname> field and any additional
|
||||
metadata fields the caller deems reasonable. <command>systemd-coredump</command> will append additional
|
||||
metadata fields in the same way it does for core dumps received from the kernel. In this mode, no core
|
||||
|
@ -212,9 +212,8 @@
|
||||
<listitem><para>Entries are formatted as JSON data structures,
|
||||
one per line
|
||||
(like <command>journalctl --output json</command>).
|
||||
See <ulink
|
||||
url="https://www.freedesktop.org/wiki/Software/systemd/json">Journal
|
||||
JSON Format</ulink> for more information.</para>
|
||||
See <ulink url="https://systemd.io/JOURNAL_EXPORT_FORMATS#journal-json-format">Journal JSON Format</ulink>
|
||||
for more information.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
@ -233,13 +232,10 @@
|
||||
<varlistentry>
|
||||
<term><constant>application/vnd.fdo.journal</constant></term>
|
||||
|
||||
<listitem><para>Entries are serialized into a binary (but
|
||||
mostly text-based) stream suitable for backups and network
|
||||
transfer
|
||||
(like <command>journalctl --output export</command>).
|
||||
See <ulink
|
||||
url="https://www.freedesktop.org/wiki/Software/systemd/export">Journal
|
||||
Export Format</ulink> for more information.</para>
|
||||
<listitem><para>Entries are serialized into a binary (but mostly text-based) stream suitable for
|
||||
backups and network transfer (like <command>journalctl --output export</command>). See <ulink
|
||||
url="https://systemd.io/JOURNAL_EXPORT_FORMATS#journal-export-format">Journal Export Format</ulink>
|
||||
for more information.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
@ -303,10 +299,8 @@
|
||||
|
||||
<refsect1>
|
||||
<title>Examples</title>
|
||||
<para>Retrieve events from this boot from local journal
|
||||
in <ulink
|
||||
url="https://www.freedesktop.org/wiki/Software/systemd/export">Journal
|
||||
Export Format</ulink>:
|
||||
<para>Retrieve events from this boot from local journal in
|
||||
<ulink url="https://systemd.io/JOURNAL_EXPORT_FORMATS#journal-export-format">Journal Export Format</ulink>:
|
||||
<programlisting>curl --silent -H'Accept: application/vnd.fdo.journal' \
|
||||
'http://localhost:19531/entries?boot'</programlisting>
|
||||
</para>
|
||||
|
@ -42,7 +42,7 @@
|
||||
|
||||
<para><command>systemd-journal-remote</command> is a command to receive serialized journal
|
||||
events and store them to journal files. Input streams are in the
|
||||
<ulink url="https://www.freedesktop.org/wiki/Software/systemd/export">Journal Export Format</ulink>,
|
||||
<ulink url="https://systemd.io/JOURNAL_EXPORT_FORMATS#journal-export-format">Journal Export Format</ulink>,
|
||||
i.e. like the output from <command>journalctl --output=export</command>. For transport over the
|
||||
network, this serialized stream is usually carried over an HTTPS connection.</para>
|
||||
|
||||
|
@ -43,7 +43,7 @@
|
||||
used.</para></listitem>
|
||||
|
||||
<listitem><para>Providing <ulink
|
||||
url="http://www.freedesktop.org/wiki/Software/polkit">polkit</ulink>-based
|
||||
url="https://www.freedesktop.org/wiki/Software/polkit">polkit</ulink>-based
|
||||
access for users for operations such as system shutdown or sleep</para>
|
||||
</listitem>
|
||||
|
||||
@ -92,7 +92,7 @@
|
||||
<ulink url="https://www.freedesktop.org/wiki/Software/systemd/writing-display-managers">Writing Display
|
||||
Managers</ulink>.
|
||||
If you are interested in writing a desktop environment that makes use of logind, please have look at
|
||||
<ulink url="http://www.freedesktop.org/wiki/Software/systemd/writing-desktop-environments">Writing
|
||||
<ulink url="https://www.freedesktop.org/wiki/Software/systemd/writing-desktop-environments">Writing
|
||||
Desktop Environments</ulink>.</para>
|
||||
</refsect1>
|
||||
|
||||
|
92
man/systemd-stdio-bridge.xml
Normal file
92
man/systemd-stdio-bridge.xml
Normal file
@ -0,0 +1,92 @@
|
||||
<?xml version='1.0'?> <!--*-nxml-*-->
|
||||
<!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-or-later -->
|
||||
|
||||
<refentry id="systemd-stdio-bridge"
|
||||
xmlns:xi="http://www.w3.org/2001/XInclude">
|
||||
|
||||
<refentryinfo>
|
||||
<title>systemd-stdio-bridge</title>
|
||||
<productname>systemd</productname>
|
||||
</refentryinfo>
|
||||
|
||||
<refmeta>
|
||||
<refentrytitle>systemd-stdio-bridge</refentrytitle>
|
||||
<manvolnum>1</manvolnum>
|
||||
</refmeta>
|
||||
|
||||
<refnamediv>
|
||||
<refname>systemd-stdio-bridge</refname>
|
||||
<refpurpose>D-Bus proxy</refpurpose>
|
||||
</refnamediv>
|
||||
|
||||
<refsynopsisdiv>
|
||||
<cmdsynopsis>
|
||||
<command>systemd-stdio-bridge</command>
|
||||
<arg choice="opt" rep="repeat">OPTIONS</arg>
|
||||
</cmdsynopsis>
|
||||
</refsynopsisdiv>
|
||||
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
|
||||
<para><command>systemd-stdio-bridge</command> implements a proxy for a D-Bus endpoint. It expects to
|
||||
receive an open connection to a bus when started, and will also connect to a (different) bus as a
|
||||
client. It will then act as a server on the first connection, and forward messages between the two
|
||||
busses. This program is suitable for socket activation: the first connection may be a pipe or a socket
|
||||
and must be passed as either standard input, or as an open file descriptor according to the protocol
|
||||
described in
|
||||
<citerefentry><refentrytitle>sd_listen_fds</refentrytitle><manvolnum>3</manvolnum></citerefentry>. The
|
||||
second connection will be made by default to the local system bus, but this can be influenced by the
|
||||
<option>--user</option>, <option>--system</option>, <option>--machine=</option>, and
|
||||
<option>--bus-path=</option> options described below.</para>
|
||||
|
||||
<para><citerefentry><refentrytitle>sd-bus</refentrytitle><manvolnum>3</manvolnum></citerefentry> uses
|
||||
<command>systemd-stdio-bridge</command> to forward D-Bus connections over
|
||||
<citerefentry project='die-net'><refentrytitle>ssh</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
|
||||
or to connect to the bus of a different user, see
|
||||
<citerefentry><refentrytitle>sd_bus_set_address</refentrytitle><manvolnum>3</manvolnum></citerefentry>.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1>
|
||||
<title>Options</title>
|
||||
|
||||
<para>The following options are understood:</para>
|
||||
|
||||
<variablelist>
|
||||
<xi:include href="user-system-options.xml" xpointer="user" />
|
||||
<xi:include href="user-system-options.xml" xpointer="system" />
|
||||
<xi:include href="user-system-options.xml" xpointer="machine" />
|
||||
|
||||
<varlistentry>
|
||||
<term><option>-p <replaceable>PATH</replaceable></option></term>
|
||||
<term><option>--bus-path=<replaceable>PATH</replaceable></option></term>
|
||||
|
||||
<listitem><para>Path to the bus address. Default: <literal>unix:path=/run/dbus/system_bus_socket</literal>
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<xi:include href="standard-options.xml" xpointer="help" />
|
||||
<xi:include href="standard-options.xml" xpointer="version" />
|
||||
</variablelist>
|
||||
</refsect1>
|
||||
|
||||
<refsect1>
|
||||
<title>Exit status</title>
|
||||
|
||||
<para>On success, 0 is returned, a non-zero failure code otherwise.</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1>
|
||||
<title>See Also</title>
|
||||
<para>
|
||||
<citerefentry project='dbus'><refentrytitle>dbus-daemon</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
|
||||
<citerefentry project='dbus'><refentrytitle>dbus-broker</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
|
||||
<ulink url="https://www.freedesktop.org/wiki/Software/dbus">D-Bus</ulink>,
|
||||
<citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
</refentry>
|
@ -41,6 +41,55 @@
|
||||
<citerefentry><refentrytitle>systemd.special</refentrytitle><manvolnum>7</manvolnum></citerefentry>
|
||||
for more details.</para>
|
||||
|
||||
<para>XDG autostart may be conditionalized using both standardized and non-standardized keys.
|
||||
In order to handle these, the generator may create one or more <varname>ExecCondition=</varname> entries.
|
||||
For non-standardized keys, well-known helper binaries provided by Desktop Environments are used.
|
||||
All external helpers <emphasis>must</emphasis> detect their corresponding desktop environment and
|
||||
<emphasis>must</emphasis> return success when run in a different environment.
|
||||
This is important as all <varname>ExecCondition=</varname> directives must succeed for an application to be started.</para>
|
||||
|
||||
<table>
|
||||
<title>
|
||||
Special XDG desktop file entries that are processed
|
||||
</title>
|
||||
<tgroup cols='2'>
|
||||
<colspec colname='entry' />
|
||||
<colspec colname='handling' />
|
||||
<thead>
|
||||
<row>
|
||||
<entry>Entry</entry>
|
||||
<entry>Handling</entry>
|
||||
</row>
|
||||
</thead>
|
||||
<tbody>
|
||||
<row>
|
||||
<entry><varname>Hidden=</varname>, <varname>X-systemd-skip=</varname></entry>
|
||||
<entry>No service will be generated if set to true</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><varname>OnlyShowIn=</varname>, <varname>NotShowIn=</varname></entry>
|
||||
<entry><varname>ExecCondition=</varname> using <filename>systemd-xdg-autostart-condition</filename></entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><varname>TryExec=</varname></entry>
|
||||
<entry>No service will be generated if the binary does not exist or cannot be executed</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><varname>AutostartCondition=</varname> (GNOME extension)</entry>
|
||||
<entry><varname>ExecCondition=</varname> using <filename>gnome-systemd-autostart-condition</filename></entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><varname>X-GNOME-Autostart-Phase=</varname></entry>
|
||||
<entry>No service will be generated if set to any value</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><varname>X-KDE-autostart-condition=</varname></entry>
|
||||
<entry><varname>ExecCondition=</varname> using <filename>kde-systemd-start-condition</filename></entry>
|
||||
</row>
|
||||
</tbody>
|
||||
</tgroup>
|
||||
</table>
|
||||
|
||||
<para><filename>systemd-xdg-autostart-generator</filename> implements
|
||||
<citerefentry><refentrytitle>systemd.generator</refentrytitle><manvolnum>7</manvolnum></citerefentry>.</para>
|
||||
</refsect1>
|
||||
|
@ -515,11 +515,10 @@
|
||||
<title>Address Fields</title>
|
||||
|
||||
<para>During serialization into external formats, such as the
|
||||
<ulink
|
||||
url="https://www.freedesktop.org/wiki/Software/systemd/export">Journal
|
||||
Export Format</ulink> or the <ulink
|
||||
url="https://www.freedesktop.org/wiki/Software/systemd/json">Journal
|
||||
JSON Format</ulink>, the addresses of journal entries are
|
||||
<ulink url="https://systemd.io/JOURNAL_EXPORT_FORMATS#journal-export-format">Journal Export Format</ulink>
|
||||
or the
|
||||
<ulink url="https://systemd.io/JOURNAL_EXPORT_FORMATS#journal-json-format">Journal JSON Format</ulink>,
|
||||
the addresses of journal entries are
|
||||
serialized into fields prefixed with double underscores. Note that
|
||||
these are not proper fields when stored in the journal but for
|
||||
addressing metadata of entries. They cannot be written as part of
|
||||
|
@ -1566,14 +1566,14 @@
|
||||
<term><varname>RouteTable=</varname></term>
|
||||
<listitem>
|
||||
<para>The table identifier for the routes to the addresses specified in the
|
||||
<varname>AllowedIPs=</varname>. Takes the special value <literal>off</literal>, one of the
|
||||
predefined names <literal>default</literal>, <literal>main</literal>, and
|
||||
<literal>local</literal>, names defined in <varname>RouteTable=</varname> in
|
||||
<varname>AllowedIPs=</varname>. Takes a negative boolean value, one of the predefined names
|
||||
<literal>default</literal>, <literal>main</literal>, and <literal>local</literal>, names
|
||||
defined in <varname>RouteTable=</varname> in
|
||||
<citerefentry><refentrytitle>networkd.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
|
||||
or a number in the range 1…4294967295. When <literal>off</literal> the routes to the
|
||||
addresses specified in the <varname>AllowedIPs=</varname> setting will not be configured.
|
||||
Defaults to <literal>main</literal>. This setting will be ignored when the same setting is
|
||||
specified in the [WireGuardPeer] section.</para>
|
||||
Defaults to false. This setting will be ignored when the same setting is specified in the
|
||||
[WireGuardPeer] section.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
@ -1673,9 +1673,9 @@
|
||||
<term><varname>RouteTable=</varname></term>
|
||||
<listitem>
|
||||
<para>The table identifier for the routes to the addresses specified in the
|
||||
<varname>AllowedIPs=</varname>. Takes the special value <literal>off</literal>, one of the
|
||||
predefined names <literal>default</literal>, <literal>main</literal>, and
|
||||
<literal>local</literal>, names defined in <varname>RouteTable=</varname> in
|
||||
<varname>AllowedIPs=</varname>. Takes a negative boolean value, one of the predefined names
|
||||
<literal>default</literal>, <literal>main</literal>, and <literal>local</literal>, names
|
||||
defined in <varname>RouteTable=</varname> in
|
||||
<citerefentry><refentrytitle>networkd.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
|
||||
or a number in the range 1…4294967295. Defaults to unset, and the value specified in the
|
||||
same setting in the [WireGuard] section will be used.</para>
|
||||
@ -2064,7 +2064,7 @@
|
||||
<varlistentry>
|
||||
<term><varname>HopPenalty=</varname></term>
|
||||
<listitem>
|
||||
<para>The hop penalty setting allows to modify
|
||||
<para>The hop penalty setting allows one to modify
|
||||
<citerefentry project='mankier'><refentrytitle>batctl</refentrytitle><manvolnum>8</manvolnum></citerefentry>
|
||||
preference for multihop routes vs. short routes. This integer value is applied to the
|
||||
TQ (Transmit Quality) of each forwarded OGM (Originator Message), thereby propagating the
|
||||
|
@ -362,7 +362,7 @@
|
||||
<varlistentry>
|
||||
<term><varname>Trust=</varname></term>
|
||||
<listitem>
|
||||
<para>Takes a boolean. Allows to set trust mode of the virtual function (VF). When set, VF
|
||||
<para>Takes a boolean. Allows one to set trust mode of the virtual function (VF). When set, VF
|
||||
users can set a specific feature which may impact security and/or performance. When unset,
|
||||
the kernel's default will be used.</para>
|
||||
</listitem>
|
||||
@ -371,7 +371,7 @@
|
||||
<varlistentry>
|
||||
<term><varname>LinkState=</varname></term>
|
||||
<listitem>
|
||||
<para>Allows to set the link state of the virtual function (VF). Takes a boolean or a
|
||||
<para>Allows one to set the link state of the virtual function (VF). Takes a boolean or a
|
||||
special value <literal>auto</literal>. Setting to <literal>auto</literal> means a
|
||||
reflection of the physical function (PF) link state, <literal>yes</literal> lets the VF to
|
||||
communicate with other VFs on this host even if the PF link state is down,
|
||||
@ -2038,7 +2038,7 @@ Table=1234</programlisting></para>
|
||||
<varlistentry>
|
||||
<term><varname>FallbackLeaseLifetimeSec=</varname></term>
|
||||
<listitem>
|
||||
<para>Allows to set DHCPv4 lease lifetime when DHCPv4 server does not send the lease
|
||||
<para>Allows one to set DHCPv4 lease lifetime when DHCPv4 server does not send the lease
|
||||
lifetime. Takes one of <literal>forever</literal> or <literal>infinity</literal>. If
|
||||
specified, the acquired address never expires. Defaults to unset.</para>
|
||||
</listitem>
|
||||
@ -3234,7 +3234,7 @@ Token=prefixstable:2002:da8:1::</programlisting></para>
|
||||
<term><varname>SyncJumpWidth=</varname></term>
|
||||
<listitem>
|
||||
<para>Specifies the time quanta, propagation segment, phase buffer segment 1 and 2, and the
|
||||
synchronization jump width, which allow to define the CAN bit-timing in a hardware
|
||||
synchronization jump width, which allow one to define the CAN bit-timing in a hardware
|
||||
independent format as proposed by the Bosch CAN 2.0 Specification.
|
||||
<varname>TimeQuantaNSec=</varname> takes a timespan in nanoseconds.
|
||||
<varname>PropagationSegment=</varname>, <varname>PhaseBufferSegment1=</varname>,
|
||||
|
@ -1189,14 +1189,9 @@ static bool should_parse_proc_cmdline(void) {
|
||||
return getpid_cached() == p;
|
||||
}
|
||||
|
||||
void log_parse_environment(void) {
|
||||
void log_parse_environment_variables(void) {
|
||||
const char *e;
|
||||
|
||||
/* Do not call from library code. */
|
||||
|
||||
if (should_parse_proc_cmdline())
|
||||
(void) proc_cmdline_parse(parse_proc_cmdline_item, NULL, PROC_CMDLINE_STRIP_RD_PREFIX);
|
||||
|
||||
e = getenv("SYSTEMD_LOG_TARGET");
|
||||
if (e && log_set_target_from_string(e) < 0)
|
||||
log_warning("Failed to parse log target '%s'. Ignoring.", e);
|
||||
@ -1222,6 +1217,15 @@ void log_parse_environment(void) {
|
||||
log_warning("Failed to parse log tid '%s'. Ignoring.", e);
|
||||
}
|
||||
|
||||
void log_parse_environment(void) {
|
||||
/* Do not call from library code. */
|
||||
|
||||
if (should_parse_proc_cmdline())
|
||||
(void) proc_cmdline_parse(parse_proc_cmdline_item, NULL, PROC_CMDLINE_STRIP_RD_PREFIX);
|
||||
|
||||
log_parse_environment_variables();
|
||||
}
|
||||
|
||||
LogTarget log_get_target(void) {
|
||||
return log_target;
|
||||
}
|
||||
|
@ -82,6 +82,7 @@ int log_open(void);
|
||||
void log_close(void);
|
||||
void log_forget_fds(void);
|
||||
|
||||
void log_parse_environment_variables(void);
|
||||
void log_parse_environment(void);
|
||||
|
||||
int log_dispatch_internal(
|
||||
|
@ -1382,6 +1382,39 @@ static void print_yes_no_line(bool first, bool good, const char *name) {
|
||||
name);
|
||||
}
|
||||
|
||||
static int are_we_installed(void) {
|
||||
int r;
|
||||
|
||||
r = acquire_esp(/* privileged_mode= */ false, /* graceful= */ false, NULL, NULL, NULL, NULL);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
/* Tests whether systemd-boot is installed. It's not obvious what to use as check here: we could
|
||||
* check EFI variables, we could check what binary /EFI/BOOT/BOOT*.EFI points to, or whether the
|
||||
* loader entries directory exists. Here we opted to check whether /EFI/systemd/ is non-empty, which
|
||||
* should be a suitable and very minimal check for a number of reasons:
|
||||
*
|
||||
* → The check is architecture independent (i.e. we check if any systemd-boot loader is installed,
|
||||
* not a specific one.)
|
||||
*
|
||||
* → It doesn't assume we are the only boot loader (i.e doesn't check if we own the main
|
||||
* /EFI/BOOT/BOOT*.EFI fallback binary.
|
||||
*
|
||||
* → It specifically checks for systemd-boot, not for other boot loaders (which a check for
|
||||
* /boot/loader/entries would do). */
|
||||
|
||||
_cleanup_free_ char *p = path_join(arg_esp_path, "/EFI/systemd/");
|
||||
if (!p)
|
||||
return log_oom();
|
||||
|
||||
log_debug("Checking whether %s contains any files…", p);
|
||||
r = dir_is_empty(p);
|
||||
if (r < 0 && r != -ENOENT)
|
||||
return log_error_errno(r, "Failed to check whether %s contains any files: %m", p);
|
||||
|
||||
return r == 0;
|
||||
}
|
||||
|
||||
static int verb_status(int argc, char *argv[], void *userdata) {
|
||||
sd_id128_t esp_uuid = SD_ID128_NULL, xbootldr_uuid = SD_ID128_NULL;
|
||||
int r, k;
|
||||
@ -1758,6 +1791,17 @@ static int verb_install(int argc, char *argv[], void *userdata) {
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
if (!install) {
|
||||
/* If we are updating, don't do anything if sd-boot wasn't actually installed. */
|
||||
r = are_we_installed();
|
||||
if (r < 0)
|
||||
return r;
|
||||
if (r == 0) {
|
||||
log_debug("Skipping update because sd-boot is not installed in the ESP.");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
r = acquire_xbootldr(/* unprivileged_mode= */ false, NULL);
|
||||
if (r < 0)
|
||||
return r;
|
||||
@ -1880,41 +1924,19 @@ static int verb_remove(int argc, char *argv[], void *userdata) {
|
||||
}
|
||||
|
||||
static int verb_is_installed(int argc, char *argv[], void *userdata) {
|
||||
_cleanup_free_ char *p = NULL;
|
||||
int r;
|
||||
|
||||
r = acquire_esp(/* privileged_mode= */ false, /* graceful= */ false, NULL, NULL, NULL, NULL);
|
||||
r = are_we_installed();
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
/* Tests whether systemd-boot is installed. It's not obvious what to use as check here: we could
|
||||
* check EFI variables, we could check what binary /EFI/BOOT/BOOT*.EFI points to, or whether the
|
||||
* loader entries directory exists. Here we opted to check whether /EFI/systemd/ is non-empty, which
|
||||
* should be a suitable and very minimal check for a number of reasons:
|
||||
*
|
||||
* → The check is architecture independent (i.e. we check if any systemd-boot loader is installed, not a
|
||||
* specific one.)
|
||||
*
|
||||
* → It doesn't assume we are the only boot loader (i.e doesn't check if we own the main
|
||||
* /EFI/BOOT/BOOT*.EFI fallback binary.
|
||||
*
|
||||
* → It specifically checks for systemd-boot, not for other boot loaders (which a check for
|
||||
* /boot/loader/entries would do). */
|
||||
|
||||
p = path_join(arg_esp_path, "/EFI/systemd/");
|
||||
if (!p)
|
||||
return log_oom();
|
||||
|
||||
r = dir_is_empty(p);
|
||||
if (r > 0 || r == -ENOENT) {
|
||||
if (r > 0) {
|
||||
puts("yes");
|
||||
return EXIT_SUCCESS;
|
||||
} else {
|
||||
puts("no");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Failed to detect whether systemd-boot is installed: %m");
|
||||
|
||||
puts("yes");
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
static int parse_timeout(const char *arg1, char16_t **ret_timeout, size_t *ret_timeout_size) {
|
||||
|
@ -1572,7 +1572,7 @@ static void config_load_entries(
|
||||
_cleanup_freepool_ CHAR8 *content = NULL;
|
||||
|
||||
err = readdir_harder(entries_dir, &f, &f_size);
|
||||
if (f_size == 0 || EFI_ERROR(err))
|
||||
if (EFI_ERROR(err) || !f)
|
||||
break;
|
||||
|
||||
if (f->FileName[0] == '.')
|
||||
@ -2007,7 +2007,7 @@ static void config_entry_add_linux(
|
||||
CHAR8 *key, *value;
|
||||
|
||||
err = readdir_harder(linux_dir, &f, &f_size);
|
||||
if (f_size == 0 || EFI_ERROR(err))
|
||||
if (EFI_ERROR(err) || !f)
|
||||
break;
|
||||
|
||||
if (f->FileName[0] == '.')
|
||||
@ -2341,7 +2341,7 @@ static void config_load_all_entries(
|
||||
}
|
||||
|
||||
EFI_STATUS efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE *sys_table) {
|
||||
_cleanup_freepool_ EFI_LOADED_IMAGE *loaded_image = NULL;
|
||||
EFI_LOADED_IMAGE *loaded_image;
|
||||
_cleanup_(FileHandleClosep) EFI_FILE *root_dir = NULL;
|
||||
_cleanup_(config_free) Config config = {};
|
||||
CHAR16 *loaded_image_path;
|
||||
|
@ -118,13 +118,14 @@ static EFIAPI EFI_STATUS security_policy_authentication (const EFI_SECURITY_PROT
|
||||
if (!dev_path)
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
|
||||
status = BS->LocateDevicePath(&FileSystemProtocol, &dev_path, &h);
|
||||
EFI_DEVICE_PATH *dp = dev_path;
|
||||
status = BS->LocateDevicePath(&FileSystemProtocol, &dp, &h);
|
||||
if (EFI_ERROR(status))
|
||||
return status;
|
||||
|
||||
/* No need to check return value, this already happened in efi_main() */
|
||||
root = LibOpenRoot(h);
|
||||
dev_path_str = DevicePathToStr(dev_path);
|
||||
dev_path_str = DevicePathToStr(dp);
|
||||
if (!dev_path_str)
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
|
||||
|
@ -596,7 +596,12 @@ EFI_STATUS readdir_harder(
|
||||
* the specified buffer needs to be freed by caller, after final use. */
|
||||
|
||||
if (!*buffer) {
|
||||
sz = offsetof(EFI_FILE_INFO, FileName) /* + 256 */;
|
||||
/* Some broken firmware violates the EFI spec by still advancing the readdir
|
||||
* position when returning EFI_BUFFER_TOO_SMALL, effectively skipping over any files when
|
||||
* the buffer was too small. Therefore, start with a buffer that should handle FAT32 max
|
||||
* file name length.
|
||||
* As a side effect, most readdir_harder() calls will now be slightly faster. */
|
||||
sz = sizeof(EFI_FILE_INFO) + 256 * sizeof(CHAR16);
|
||||
*buffer = xallocate_pool(sz);
|
||||
*buffer_size = sz;
|
||||
} else
|
||||
|
@ -286,7 +286,8 @@ EFI_STATUS xbootldr_open(EFI_HANDLE *device, EFI_HANDLE *ret_device, EFI_FILE **
|
||||
hd->SignatureType = SIGNATURE_TYPE_GUID;
|
||||
}
|
||||
|
||||
err = BS->LocateDevicePath(&BlockIoProtocol, &partition_path, &new_device);
|
||||
EFI_DEVICE_PATH *dp = partition_path;
|
||||
err = BS->LocateDevicePath(&BlockIoProtocol, &dp, &new_device);
|
||||
if (EFI_ERROR(err))
|
||||
return err;
|
||||
|
||||
|
@ -872,19 +872,21 @@ const sd_bus_vtable bus_unit_vtable[] = {
|
||||
SD_BUS_PROPERTY("Wants", "as", property_get_dependencies, 0, SD_BUS_VTABLE_PROPERTY_CONST),
|
||||
SD_BUS_PROPERTY("BindsTo", "as", property_get_dependencies, 0, SD_BUS_VTABLE_PROPERTY_CONST),
|
||||
SD_BUS_PROPERTY("PartOf", "as", property_get_dependencies, 0, SD_BUS_VTABLE_PROPERTY_CONST),
|
||||
SD_BUS_PROPERTY("Upholds", "as", property_get_dependencies, 0, SD_BUS_VTABLE_PROPERTY_CONST),
|
||||
SD_BUS_PROPERTY("RequiredBy", "as", property_get_dependencies, 0, SD_BUS_VTABLE_PROPERTY_CONST),
|
||||
SD_BUS_PROPERTY("RequisiteOf", "as", property_get_dependencies, 0, SD_BUS_VTABLE_PROPERTY_CONST),
|
||||
SD_BUS_PROPERTY("WantedBy", "as", property_get_dependencies, 0, SD_BUS_VTABLE_PROPERTY_CONST),
|
||||
SD_BUS_PROPERTY("BoundBy", "as", property_get_dependencies, 0, SD_BUS_VTABLE_PROPERTY_CONST),
|
||||
SD_BUS_PROPERTY("UpheldBy", "as", property_get_dependencies, 0, SD_BUS_VTABLE_PROPERTY_CONST),
|
||||
SD_BUS_PROPERTY("ConsistsOf", "as", property_get_dependencies, 0, SD_BUS_VTABLE_PROPERTY_CONST),
|
||||
SD_BUS_PROPERTY("Conflicts", "as", property_get_dependencies, 0, SD_BUS_VTABLE_PROPERTY_CONST),
|
||||
SD_BUS_PROPERTY("ConflictedBy", "as", property_get_dependencies, 0, SD_BUS_VTABLE_PROPERTY_CONST),
|
||||
SD_BUS_PROPERTY("Before", "as", property_get_dependencies, 0, SD_BUS_VTABLE_PROPERTY_CONST),
|
||||
SD_BUS_PROPERTY("After", "as", property_get_dependencies, 0, SD_BUS_VTABLE_PROPERTY_CONST),
|
||||
SD_BUS_PROPERTY("OnFailure", "as", property_get_dependencies, 0, SD_BUS_VTABLE_PROPERTY_CONST),
|
||||
SD_BUS_PROPERTY("OnFailureOf", "as", property_get_dependencies, 0, SD_BUS_VTABLE_PROPERTY_CONST),
|
||||
SD_BUS_PROPERTY("OnSuccess", "as", property_get_dependencies, 0, SD_BUS_VTABLE_PROPERTY_CONST),
|
||||
SD_BUS_PROPERTY("OnSuccessOf", "as", property_get_dependencies, 0, SD_BUS_VTABLE_PROPERTY_CONST),
|
||||
SD_BUS_PROPERTY("OnFailure", "as", property_get_dependencies, 0, SD_BUS_VTABLE_PROPERTY_CONST),
|
||||
SD_BUS_PROPERTY("OnFailureOf", "as", property_get_dependencies, 0, SD_BUS_VTABLE_PROPERTY_CONST),
|
||||
SD_BUS_PROPERTY("Triggers", "as", property_get_dependencies, 0, SD_BUS_VTABLE_PROPERTY_CONST),
|
||||
SD_BUS_PROPERTY("TriggeredBy", "as", property_get_dependencies, 0, SD_BUS_VTABLE_PROPERTY_CONST),
|
||||
SD_BUS_PROPERTY("PropagatesReloadTo", "as", property_get_dependencies, 0, SD_BUS_VTABLE_PROPERTY_CONST),
|
||||
@ -1312,11 +1314,15 @@ static int append_cgroup(sd_bus_message *reply, const char *p, Set *pids) {
|
||||
for (;;) {
|
||||
pid_t pid;
|
||||
|
||||
/* libvirt / qemu uses threaded mode and cgroup.procs cannot be read at the lower levels.
|
||||
* From https://www.kernel.org/doc/html/latest/admin-guide/cgroup-v2.html#threads,
|
||||
* “cgroup.procs” in a threaded domain cgroup contains the PIDs of all processes in
|
||||
* the subtree and is not readable in the subtree proper. */
|
||||
r = cg_read_pid(f, &pid);
|
||||
if (IN_SET(r, 0, -EOPNOTSUPP))
|
||||
break;
|
||||
if (r < 0)
|
||||
return r;
|
||||
if (r == 0)
|
||||
break;
|
||||
|
||||
if (is_kernel_thread(pid) > 0)
|
||||
continue;
|
||||
|
@ -16,7 +16,7 @@
|
||||
<policyconfig>
|
||||
|
||||
<vendor>The systemd Project</vendor>
|
||||
<vendor_url>http://www.freedesktop.org/wiki/Software/systemd</vendor_url>
|
||||
<vendor_url>https://systemd.io</vendor_url>
|
||||
|
||||
<action id="org.freedesktop.systemd1.reply-password">
|
||||
<description gettext-domain="systemd">Send passphrase back to system</description>
|
||||
|
@ -19,9 +19,12 @@ static struct restrict_ifaces_bpf *restrict_ifaces_bpf_free(struct restrict_ifac
|
||||
|
||||
DEFINE_TRIVIAL_CLEANUP_FUNC(struct restrict_ifaces_bpf *, restrict_ifaces_bpf_free);
|
||||
|
||||
static int prepare_restrict_ifaces_bpf(Unit* u, bool is_allow_list,
|
||||
static int prepare_restrict_ifaces_bpf(
|
||||
Unit* u,
|
||||
bool is_allow_list,
|
||||
const Set *restrict_network_interfaces,
|
||||
struct restrict_ifaces_bpf **ret_object) {
|
||||
|
||||
_cleanup_(restrict_ifaces_bpf_freep) struct restrict_ifaces_bpf *obj = NULL;
|
||||
_cleanup_(sd_netlink_unrefp) sd_netlink *rtnl = NULL;
|
||||
char *iface;
|
||||
@ -50,9 +53,10 @@ static int prepare_restrict_ifaces_bpf(Unit* u, bool is_allow_list,
|
||||
SET_FOREACH(iface, restrict_network_interfaces) {
|
||||
uint8_t dummy = 0;
|
||||
int ifindex;
|
||||
|
||||
ifindex = rtnl_resolve_interface(&rtnl, iface);
|
||||
if (ifindex < 0) {
|
||||
log_unit_warning_errno(u, ifindex, "Couldn't find index of network interface: %m. Ignoring '%s'", iface);
|
||||
log_unit_warning_errno(u, ifindex, "Couldn't find index of network interface '%s', ignoring: %m", iface);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
<policyconfig>
|
||||
|
||||
<vendor>The systemd Project</vendor>
|
||||
<vendor_url>http://www.freedesktop.org/wiki/Software/systemd</vendor_url>
|
||||
<vendor_url>https://systemd.io</vendor_url>
|
||||
|
||||
<action id="org.freedesktop.home1.create-home">
|
||||
<description gettext-domain="systemd">Create a home area</description>
|
||||
|
@ -14,7 +14,7 @@
|
||||
<policyconfig>
|
||||
|
||||
<vendor>The systemd Project</vendor>
|
||||
<vendor_url>http://www.freedesktop.org/wiki/Software/systemd</vendor_url>
|
||||
<vendor_url>https://systemd.io</vendor_url>
|
||||
|
||||
<action id="org.freedesktop.hostname1.set-hostname">
|
||||
<description gettext-domain="systemd">Set hostname</description>
|
||||
|
@ -16,7 +16,7 @@
|
||||
<policyconfig>
|
||||
|
||||
<vendor>The systemd Project</vendor>
|
||||
<vendor_url>http://www.freedesktop.org/wiki/Software/systemd</vendor_url>
|
||||
<vendor_url>https://systemd.io</vendor_url>
|
||||
|
||||
<action id="org.freedesktop.import1.import">
|
||||
<description gettext-domain="systemd">Import a VM or container image</description>
|
||||
|
@ -552,8 +552,6 @@ static int parse_argv(int argc, char *argv[]) {
|
||||
arg_lines = 1000;
|
||||
|
||||
arg_boot = true;
|
||||
arg_boot_id = SD_ID128_NULL;
|
||||
arg_boot_offset = 0;
|
||||
|
||||
break;
|
||||
|
||||
|
@ -76,17 +76,17 @@ static void test_non_empty(void) {
|
||||
assert_se(le64toh(o->entry.seqnum) == 1);
|
||||
|
||||
assert_se(journal_file_find_data_object(f->file, test, strlen(test), NULL, &p) == 1);
|
||||
assert_se(journal_file_next_entry_for_data(f->file, NULL, 0, p, DIRECTION_DOWN, &o, NULL) == 1);
|
||||
assert_se(journal_file_next_entry_for_data(f->file, p, DIRECTION_DOWN, &o, NULL) == 1);
|
||||
assert_se(le64toh(o->entry.seqnum) == 1);
|
||||
|
||||
assert_se(journal_file_next_entry_for_data(f->file, NULL, 0, p, DIRECTION_UP, &o, NULL) == 1);
|
||||
assert_se(journal_file_next_entry_for_data(f->file, p, DIRECTION_UP, &o, NULL) == 1);
|
||||
assert_se(le64toh(o->entry.seqnum) == 3);
|
||||
|
||||
assert_se(journal_file_find_data_object(f->file, test2, strlen(test2), NULL, &p) == 1);
|
||||
assert_se(journal_file_next_entry_for_data(f->file, NULL, 0, p, DIRECTION_UP, &o, NULL) == 1);
|
||||
assert_se(journal_file_next_entry_for_data(f->file, p, DIRECTION_UP, &o, NULL) == 1);
|
||||
assert_se(le64toh(o->entry.seqnum) == 2);
|
||||
|
||||
assert_se(journal_file_next_entry_for_data(f->file, NULL, 0, p, DIRECTION_DOWN, &o, NULL) == 1);
|
||||
assert_se(journal_file_next_entry_for_data(f->file, p, DIRECTION_DOWN, &o, NULL) == 1);
|
||||
assert_se(le64toh(o->entry.seqnum) == 2);
|
||||
|
||||
assert_se(journal_file_find_data_object(f->file, "quux", 4, NULL, &p) == 0);
|
||||
|
@ -36,7 +36,7 @@ case "$COMMAND" in
|
||||
remove)
|
||||
[ "$KERNEL_INSTALL_VERBOSE" -gt 0 ] && \
|
||||
echo "Removing /lib/modules/${KERNEL_VERSION}/modules.dep and associated files"
|
||||
exec rm -f /lib/modules/"${KERNEL_VERSION}"/modules.{alias{,.bin},builtin.bin,dep{,.bin},devname,softdep,symbols{,.bin}}
|
||||
exec rm -f /lib/modules/"${KERNEL_VERSION}"/modules.{alias{,.bin},builtin{,.alias}.bin,dep{,.bin},devname,softdep,symbols{,.bin}}
|
||||
;;
|
||||
*)
|
||||
exit 0
|
||||
|
@ -11,6 +11,7 @@
|
||||
#include "sd-event.h"
|
||||
#include "sd-dhcp6-client.h"
|
||||
|
||||
#include "dhcp6-protocol.h"
|
||||
#include "hashmap.h"
|
||||
#include "list.h"
|
||||
#include "macro.h"
|
||||
@ -130,6 +131,12 @@ int dhcp6_network_bind_udp_socket(int ifindex, struct in6_addr *address);
|
||||
int dhcp6_network_send_udp_socket(int s, struct in6_addr *address,
|
||||
const void *packet, size_t len);
|
||||
|
||||
int client_parse_message(
|
||||
sd_dhcp6_client *client,
|
||||
DHCP6Message *message,
|
||||
size_t len,
|
||||
sd_dhcp6_lease *lease);
|
||||
|
||||
const char *dhcp6_message_type_to_string(int s) _const_;
|
||||
int dhcp6_message_type_from_string(const char *s) _pure_;
|
||||
const char *dhcp6_message_status_to_string(int s) _const_;
|
||||
|
@ -1124,7 +1124,7 @@ static int client_ensure_iaid(sd_dhcp6_client *client) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int client_parse_message(
|
||||
int client_parse_message(
|
||||
sd_dhcp6_client *client,
|
||||
DHCP6Message *message,
|
||||
size_t len,
|
||||
@ -1261,35 +1261,35 @@ static int client_parse_message(
|
||||
case SD_DHCP6_OPTION_DNS_SERVERS:
|
||||
r = dhcp6_lease_add_dns(lease, optval, optlen);
|
||||
if (r < 0)
|
||||
return r;
|
||||
log_dhcp6_client_errno(client, r, "Failed to parse DNS server option, ignoring: %m");
|
||||
|
||||
break;
|
||||
|
||||
case SD_DHCP6_OPTION_DOMAIN_LIST:
|
||||
r = dhcp6_lease_add_domains(lease, optval, optlen);
|
||||
if (r < 0)
|
||||
return r;
|
||||
log_dhcp6_client_errno(client, r, "Failed to parse domain list option, ignoring: %m");
|
||||
|
||||
break;
|
||||
|
||||
case SD_DHCP6_OPTION_NTP_SERVER:
|
||||
r = dhcp6_lease_add_ntp(lease, optval, optlen);
|
||||
if (r < 0)
|
||||
return r;
|
||||
log_dhcp6_client_errno(client, r, "Failed to parse NTP server option, ignoring: %m");
|
||||
|
||||
break;
|
||||
|
||||
case SD_DHCP6_OPTION_SNTP_SERVERS:
|
||||
r = dhcp6_lease_add_sntp(lease, optval, optlen);
|
||||
if (r < 0)
|
||||
return r;
|
||||
log_dhcp6_client_errno(client, r, "Failed to parse SNTP server option, ignoring: %m");
|
||||
|
||||
break;
|
||||
|
||||
case SD_DHCP6_OPTION_CLIENT_FQDN:
|
||||
r = dhcp6_lease_set_fqdn(lease, optval, optlen);
|
||||
if (r < 0)
|
||||
return r;
|
||||
log_dhcp6_client_errno(client, r, "Failed to parse FQDN option, ignoring: %m");
|
||||
|
||||
break;
|
||||
|
||||
|
@ -37,7 +37,7 @@ static int test_client_message_num;
|
||||
static be32_t test_iaid = 0;
|
||||
static uint8_t test_duid[14] = { };
|
||||
|
||||
static int test_client_basic(sd_event *e) {
|
||||
static void test_client_basic(sd_event *e) {
|
||||
sd_dhcp6_client *client;
|
||||
int v;
|
||||
|
||||
@ -108,11 +108,9 @@ static int test_client_basic(sd_event *e) {
|
||||
|
||||
assert_se(sd_dhcp6_client_detach_event(client) >= 0);
|
||||
assert_se(!sd_dhcp6_client_unref(client));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int test_parse_domain(sd_event *e) {
|
||||
static void test_parse_domain(void) {
|
||||
uint8_t *data;
|
||||
char *domain;
|
||||
char **list;
|
||||
@ -154,11 +152,9 @@ static int test_parse_domain(sd_event *e) {
|
||||
data = (uint8_t []) { 0 , 0 };
|
||||
r = dhcp6_option_parse_domainname_list(data, 2, &list);
|
||||
assert_se(r < 0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int test_option(sd_event *e) {
|
||||
static void test_option(void) {
|
||||
uint8_t packet[] = {
|
||||
'F', 'O', 'O', 'H', 'O', 'G', 'E',
|
||||
0x00, SD_DHCP6_OPTION_ORO, 0x00, 0x07,
|
||||
@ -232,11 +228,9 @@ static int test_option(sd_event *e) {
|
||||
assert_se(*out == 'B');
|
||||
|
||||
assert_se(memcmp(packet, result, sizeof(packet)) == 0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int test_option_status(sd_event *e) {
|
||||
static void test_option_status(void) {
|
||||
uint8_t option1[] = {
|
||||
/* IA NA */
|
||||
0x00, 0x03, 0x00, 0x12, 0x1a, 0x1d, 0x1a, 0x1d,
|
||||
@ -370,8 +364,56 @@ static int test_option_status(sd_event *e) {
|
||||
assert_se(r >= 0);
|
||||
assert_se(pd.addresses);
|
||||
dhcp6_lease_free_ia(&pd);
|
||||
}
|
||||
|
||||
return 0;
|
||||
static void test_client_parse_message_issue_22099(void) {
|
||||
static const uint8_t msg[] = {
|
||||
/* xid */
|
||||
0x07, 0x7c, 0x4c, 0x16,
|
||||
/* status code (zero length) */
|
||||
0x00, 0x0e, 0x00, 0x00,
|
||||
/* NTP servers (broken sub option and sub option length) */
|
||||
0x00, 0x38, 0x00, 0x14, 0x01, 0x00, 0x10, 0x00, 0xfd, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0xde, 0x15, 0xc8, 0xff, 0xfe, 0xef, 0x1e, 0x4e,
|
||||
/* client ID */
|
||||
0x00, 0x01, 0x00, 0x0e, 0x00, 0x02, 0x00, 0x00, 0xab, 0x11, 0x5c, 0x6b, 0x90, 0xec, 0xda, 0x95,
|
||||
0x15, 0x45,
|
||||
/* server ID */
|
||||
0x00, 0x02, 0x00, 0x0a, 0x00, 0x03, 0x00, 0x01, 0xdc, 0x15, 0xc8, 0xef, 0x1e, 0x4e,
|
||||
/* preference */
|
||||
0x00, 0x07, 0x00, 0x01, 0x00,
|
||||
/* DNS servers */
|
||||
0x00, 0x17, 0x00, 0x10, 0xfd, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xde, 0x15, 0xc8, 0xff,
|
||||
0xfe, 0xef, 0x1e, 0x4e,
|
||||
/* v6 pcp server */
|
||||
0x00, 0x56, 0x00, 0x10, 0x2a, 0x02, 0x81, 0x0d, 0x98, 0x80, 0x37, 0x00, 0xde, 0x15, 0xc8, 0xff,
|
||||
0xfe, 0xef, 0x1e, 0x4e,
|
||||
/* IA_NA */
|
||||
0x00, 0x03, 0x00, 0x28, 0xcc, 0x59, 0x11, 0x7b, 0x00, 0x00, 0x07, 0x08, 0x00, 0x00, 0x0b, 0x40,
|
||||
/* IA_NA (iaaddr) */
|
||||
0x00, 0x05, 0x00, 0x18, 0x2a, 0x02, 0x81, 0x0d, 0x98, 0x80, 0x37, 0x00, 0x6a, 0x05, 0xca, 0xff,
|
||||
0xfe, 0xf1, 0x51, 0x53, 0x00, 0x00, 0x0e, 0x10, 0x00, 0x00, 0x1c, 0x20,
|
||||
/* IA_PD */
|
||||
0x00, 0x19, 0x00, 0x29, 0xcc, 0x59, 0x11, 0x7b, 0x00, 0x00, 0x07, 0x08, 0x00, 0x00, 0x0b, 0x40,
|
||||
/* IA_PD (iaprefix) */
|
||||
0x00, 0x1a, 0x00, 0x19, 0x00, 0x00, 0x0e, 0x10, 0x00, 0x00, 0x1c, 0x20, 0x3a, 0x2a, 0x02, 0x81,
|
||||
0x0d, 0x98, 0x80, 0x37, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
};
|
||||
static const uint8_t duid[] = {
|
||||
0x00, 0x00, 0xab, 0x11, 0x5c, 0x6b, 0x90, 0xec, 0xda, 0x95, 0x15, 0x45,
|
||||
};
|
||||
_cleanup_(sd_dhcp6_client_unrefp) sd_dhcp6_client *client = NULL;
|
||||
_cleanup_(sd_dhcp6_lease_unrefp) sd_dhcp6_lease *lease = NULL;
|
||||
|
||||
log_debug("/* %s */", __func__);
|
||||
|
||||
assert_se(sd_dhcp6_client_new(&client) >= 0);
|
||||
assert_se(sd_dhcp6_client_set_iaid(client, 0xcc59117b) >= 0);
|
||||
assert_se(sd_dhcp6_client_set_duid(client, 2, duid, sizeof(duid)) >= 0);
|
||||
|
||||
assert_se(dhcp6_lease_new(&lease) >= 0);
|
||||
|
||||
assert_se(client_parse_message(client, (DHCP6Message*) msg, sizeof(msg), lease) >= 0);
|
||||
}
|
||||
|
||||
static uint8_t msg_advertise[198] = {
|
||||
@ -434,7 +476,7 @@ static uint8_t fqdn_wire[16] = {
|
||||
0x05, 'i', 'n', 't', 'r', 'a', 0x00
|
||||
};
|
||||
|
||||
static int test_advertise_option(sd_event *e) {
|
||||
static void test_advertise_option(sd_event *e) {
|
||||
_cleanup_(sd_dhcp6_lease_unrefp) sd_dhcp6_lease *lease = NULL;
|
||||
DHCP6Message *advertise = (DHCP6Message *)msg_advertise;
|
||||
size_t len = sizeof(msg_advertise) - sizeof(DHCP6Message), pos = 0;
|
||||
@ -455,8 +497,7 @@ static int test_advertise_option(sd_event *e) {
|
||||
assert_se(dhcp6_lease_new(&lease) >= 0);
|
||||
|
||||
assert_se(advertise->type == DHCP6_MESSAGE_ADVERTISE);
|
||||
assert_se((be32toh(advertise->transaction_id) & 0x00ffffff) ==
|
||||
0x0fb4e5);
|
||||
assert_se((be32toh(advertise->transaction_id) & 0x00ffffff) == 0x0fb4e5);
|
||||
|
||||
while (pos < len) {
|
||||
DHCP6Option *option = (DHCP6Option *)&advertise->options[pos];
|
||||
@ -495,16 +536,14 @@ static int test_advertise_option(sd_event *e) {
|
||||
assert_se(optval == &msg_advertise[179]);
|
||||
assert_se(!memcmp(optval, &msg_advertise[179], optlen));
|
||||
|
||||
assert_se(dhcp6_lease_set_serverid(lease, optval,
|
||||
optlen) >= 0);
|
||||
assert_se(dhcp6_lease_set_serverid(lease, optval, optlen) >= 0);
|
||||
break;
|
||||
|
||||
case SD_DHCP6_OPTION_PREFERENCE:
|
||||
assert_se(optlen == 1);
|
||||
assert_se(!*optval);
|
||||
|
||||
assert_se(dhcp6_lease_set_preference(lease,
|
||||
*optval) >= 0);
|
||||
assert_se(dhcp6_lease_set_preference(lease, *optval) >= 0);
|
||||
break;
|
||||
|
||||
case SD_DHCP6_OPTION_ELAPSED_TIME:
|
||||
@ -538,26 +577,20 @@ static int test_advertise_option(sd_event *e) {
|
||||
assert_se(opt_clientid);
|
||||
|
||||
sd_dhcp6_lease_reset_address_iter(lease);
|
||||
assert_se(sd_dhcp6_lease_get_address(lease, &addr, <_pref,
|
||||
<_valid) >= 0);
|
||||
assert_se(sd_dhcp6_lease_get_address(lease, &addr, <_pref, <_valid) >= 0);
|
||||
assert_se(!memcmp(&addr, &msg_advertise[42], sizeof(addr)));
|
||||
assert_se(lt_pref == 150);
|
||||
assert_se(lt_valid == 180);
|
||||
assert_se(sd_dhcp6_lease_get_address(lease, &addr, <_pref,
|
||||
<_valid) == -ENOMSG);
|
||||
assert_se(sd_dhcp6_lease_get_address(lease, &addr, <_pref, <_valid) == -ENOMSG);
|
||||
|
||||
sd_dhcp6_lease_reset_address_iter(lease);
|
||||
assert_se(sd_dhcp6_lease_get_address(lease, &addr, <_pref,
|
||||
<_valid) >= 0);
|
||||
assert_se(sd_dhcp6_lease_get_address(lease, &addr, <_pref, <_valid) >= 0);
|
||||
assert_se(!memcmp(&addr, &msg_advertise[42], sizeof(addr)));
|
||||
assert_se(sd_dhcp6_lease_get_address(lease, &addr, <_pref,
|
||||
<_valid) == -ENOMSG);
|
||||
assert_se(sd_dhcp6_lease_get_address(lease, &addr, <_pref, <_valid) == -ENOMSG);
|
||||
sd_dhcp6_lease_reset_address_iter(lease);
|
||||
assert_se(sd_dhcp6_lease_get_address(lease, &addr, <_pref,
|
||||
<_valid) >= 0);
|
||||
assert_se(sd_dhcp6_lease_get_address(lease, &addr, <_pref, <_valid) >= 0);
|
||||
assert_se(!memcmp(&addr, &msg_advertise[42], sizeof(addr)));
|
||||
assert_se(sd_dhcp6_lease_get_address(lease, &addr, <_pref,
|
||||
<_valid) == -ENOMSG);
|
||||
assert_se(sd_dhcp6_lease_get_address(lease, &addr, <_pref, <_valid) == -ENOMSG);
|
||||
|
||||
assert_se(dhcp6_lease_get_serverid(lease, &opt, &len) >= 0);
|
||||
assert_se(len == 14);
|
||||
@ -578,8 +611,6 @@ static int test_advertise_option(sd_event *e) {
|
||||
r = sd_dhcp6_lease_get_ntp_addrs(lease, &addrs);
|
||||
assert_se(r == 1);
|
||||
assert_se(!memcmp(addrs, &msg_advertise[159], r * 16));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int test_check_completed_in_2_seconds(sd_event_source *s, uint64_t usec, void *userdata) {
|
||||
@ -615,7 +646,7 @@ static void test_client_solicit_cb(sd_dhcp6_client *client, int event,
|
||||
sd_event_exit(e, 0);
|
||||
}
|
||||
|
||||
static int test_client_send_reply(DHCP6Message *request) {
|
||||
static void test_client_send_reply(DHCP6Message *request) {
|
||||
DHCP6Message reply;
|
||||
|
||||
log_debug("/* %s */", __func__);
|
||||
@ -629,13 +660,10 @@ static int test_client_send_reply(DHCP6Message *request) {
|
||||
|
||||
memcpy(&msg_reply[44], &test_iaid, sizeof(test_iaid));
|
||||
|
||||
assert_se(write(test_dhcp_fd[1], msg_reply, sizeof(msg_reply))
|
||||
== sizeof(msg_reply));
|
||||
|
||||
return 0;
|
||||
assert_se(write(test_dhcp_fd[1], msg_reply, sizeof(msg_reply)) == sizeof(msg_reply));
|
||||
}
|
||||
|
||||
static int test_client_verify_request(DHCP6Message *request, size_t len) {
|
||||
static void test_client_verify_request(DHCP6Message *request, size_t len) {
|
||||
_cleanup_(sd_dhcp6_lease_unrefp) sd_dhcp6_lease *lease = NULL;
|
||||
bool found_clientid = false, found_iana = false, found_serverid = false,
|
||||
found_elapsed_time = false, found_fqdn = false;
|
||||
@ -714,16 +742,13 @@ static int test_client_verify_request(DHCP6Message *request, size_t len) {
|
||||
pos += sizeof(*option) + optlen;
|
||||
}
|
||||
|
||||
assert_se(found_clientid && found_iana && found_serverid &&
|
||||
found_elapsed_time);
|
||||
assert_se(found_clientid && found_iana && found_serverid && found_elapsed_time);
|
||||
|
||||
sd_dhcp6_lease_reset_address_iter(lease);
|
||||
assert_se(sd_dhcp6_lease_get_address(lease, &addr, <_pref, <_valid) == -ENOMSG);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int test_client_send_advertise(DHCP6Message *solicit) {
|
||||
static void test_client_send_advertise(DHCP6Message *solicit) {
|
||||
DHCP6Message advertise;
|
||||
|
||||
log_debug("/* %s */", __func__);
|
||||
@ -737,13 +762,10 @@ static int test_client_send_advertise(DHCP6Message *solicit) {
|
||||
|
||||
memcpy(&msg_advertise[26], &test_iaid, sizeof(test_iaid));
|
||||
|
||||
assert_se(write(test_dhcp_fd[1], msg_advertise, sizeof(msg_advertise))
|
||||
== sizeof(msg_advertise));
|
||||
|
||||
return 0;
|
||||
assert_se(write(test_dhcp_fd[1], msg_advertise, sizeof(msg_advertise)) == sizeof(msg_advertise));
|
||||
}
|
||||
|
||||
static int test_client_verify_solicit(DHCP6Message *solicit, size_t len) {
|
||||
static void test_client_verify_solicit(DHCP6Message *solicit, size_t len) {
|
||||
bool found_clientid = false, found_iana = false,
|
||||
found_elapsed_time = false, found_fqdn = false;
|
||||
size_t pos = 0;
|
||||
@ -805,12 +827,9 @@ static int test_client_verify_solicit(DHCP6Message *solicit, size_t len) {
|
||||
|
||||
assert_se(pos == len);
|
||||
assert_se(found_clientid && found_iana && found_elapsed_time);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void test_client_information_cb(sd_dhcp6_client *client, int event,
|
||||
void *userdata) {
|
||||
static void test_client_information_cb(sd_dhcp6_client *client, int event, void *userdata) {
|
||||
sd_event *e = userdata;
|
||||
sd_dhcp6_lease *lease;
|
||||
const struct in6_addr *addrs;
|
||||
@ -843,18 +862,14 @@ static void test_client_information_cb(sd_dhcp6_client *client, int event,
|
||||
assert_se(sd_dhcp6_client_stop(client) >= 0);
|
||||
assert_se(sd_dhcp6_client_set_information_request(client, false) >= 0);
|
||||
|
||||
assert_se(sd_dhcp6_client_set_callback(client,
|
||||
test_client_solicit_cb, e) >= 0);
|
||||
assert_se(sd_dhcp6_client_set_callback(client, test_client_solicit_cb, e) >= 0);
|
||||
|
||||
assert_se(sd_dhcp6_client_set_local_address(client, &address) >= 0);
|
||||
|
||||
assert_se(sd_dhcp6_client_start(client) >= 0);
|
||||
|
||||
}
|
||||
|
||||
static int test_client_verify_information_request(DHCP6Message *information_request,
|
||||
size_t len) {
|
||||
|
||||
static void test_client_verify_information_request(DHCP6Message *information_request, size_t len) {
|
||||
_cleanup_(sd_dhcp6_lease_unrefp) sd_dhcp6_lease *lease = NULL;
|
||||
size_t pos = 0;
|
||||
bool found_clientid = false, found_elapsed_time = false;
|
||||
@ -905,16 +920,12 @@ static int test_client_verify_information_request(DHCP6Message *information_requ
|
||||
|
||||
sd_dhcp6_lease_reset_address_iter(lease);
|
||||
|
||||
assert_se(sd_dhcp6_lease_get_address(lease, &addr, <_pref,
|
||||
<_valid) == -ENOMSG);
|
||||
|
||||
return 0;
|
||||
assert_se(sd_dhcp6_lease_get_address(lease, &addr, <_pref, <_valid) == -ENOMSG);
|
||||
}
|
||||
|
||||
int dhcp6_network_send_udp_socket(int s, struct in6_addr *server_address,
|
||||
const void *packet, size_t len) {
|
||||
struct in6_addr mcast =
|
||||
IN6ADDR_ALL_DHCP6_RELAY_AGENTS_AND_SERVERS_INIT;
|
||||
struct in6_addr mcast = IN6ADDR_ALL_DHCP6_RELAY_AGENTS_AND_SERVERS_INIT;
|
||||
DHCP6Message *message;
|
||||
|
||||
log_debug("/* %s */", __func__);
|
||||
@ -955,7 +966,7 @@ int dhcp6_network_bind_udp_socket(int ifindex, struct in6_addr *local_address) {
|
||||
return test_dhcp_fd[0];
|
||||
}
|
||||
|
||||
static int test_client_solicit(sd_event *e) {
|
||||
static void test_client_solicit(sd_event *e) {
|
||||
sd_dhcp6_client *client;
|
||||
struct in6_addr address = { { { 0xfe, 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x01 } } };
|
||||
int val;
|
||||
@ -998,8 +1009,6 @@ static int test_client_solicit(sd_event *e) {
|
||||
assert_se(!sd_dhcp6_client_unref(client));
|
||||
|
||||
test_dhcp_fd[1] = safe_close(test_dhcp_fd[1]);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
@ -1010,11 +1019,12 @@ int main(int argc, char *argv[]) {
|
||||
test_setup_logging(LOG_DEBUG);
|
||||
|
||||
test_client_basic(e);
|
||||
test_option(e);
|
||||
test_option_status(e);
|
||||
test_parse_domain();
|
||||
test_option();
|
||||
test_option_status();
|
||||
test_client_parse_message_issue_22099();
|
||||
test_advertise_option(e);
|
||||
test_client_solicit(e);
|
||||
test_parse_domain(e);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -1392,7 +1392,7 @@ int device_read_db_internal_filename(sd_device *device, const char *filename) {
|
||||
_cleanup_free_ char *db = NULL;
|
||||
const char *value;
|
||||
size_t db_len;
|
||||
char key;
|
||||
char key = '\0'; /* Unnecessary initialization to appease gcc-12.0.0-0.4.fc36 */
|
||||
int r;
|
||||
|
||||
enum {
|
||||
|
@ -2099,14 +2099,35 @@ static void chain_cache_put(
|
||||
ci->last_index = last_index;
|
||||
}
|
||||
|
||||
static int bump_array_index(uint64_t *i, direction_t direction, uint64_t n) {
|
||||
assert(i);
|
||||
|
||||
/* Increase or decrease the specified index, in the right direction. */
|
||||
|
||||
if (direction == DIRECTION_DOWN) {
|
||||
if (*i >= n - 1)
|
||||
return 0;
|
||||
|
||||
(*i)++;
|
||||
} else {
|
||||
if (*i <= 0)
|
||||
return 0;
|
||||
|
||||
(*i)--;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int generic_array_get(
|
||||
JournalFile *f,
|
||||
uint64_t first,
|
||||
uint64_t i,
|
||||
direction_t direction,
|
||||
Object **ret, uint64_t *ret_offset) {
|
||||
|
||||
Object *o;
|
||||
uint64_t p = 0, a, t = 0;
|
||||
Object *o, *e;
|
||||
uint64_t p = 0, a, t = 0, k;
|
||||
int r;
|
||||
ChainCacheItem *ci;
|
||||
|
||||
@ -2123,35 +2144,64 @@ static int generic_array_get(
|
||||
}
|
||||
|
||||
while (a > 0) {
|
||||
uint64_t k;
|
||||
|
||||
r = journal_file_move_to_object(f, OBJECT_ENTRY_ARRAY, a, &o);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
k = journal_file_entry_array_n_items(o);
|
||||
if (i < k) {
|
||||
p = le64toh(o->entry_array.items[i]);
|
||||
goto found;
|
||||
}
|
||||
if (i < k)
|
||||
break;
|
||||
|
||||
i -= k;
|
||||
t += k;
|
||||
a = le64toh(o->entry_array.next_entry_array_offset);
|
||||
}
|
||||
|
||||
/* If we've found the right location, now look for the first non-corrupt entry object (in the right
|
||||
* direction). */
|
||||
|
||||
while (a > 0) {
|
||||
/* In the first iteration of the while loop, we reuse i, k and o from the previous while
|
||||
* loop. */
|
||||
if (i == UINT64_MAX) {
|
||||
r = journal_file_move_to_object(f, OBJECT_ENTRY_ARRAY, a, &o);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
k = journal_file_entry_array_n_items(o);
|
||||
if (k == 0)
|
||||
break;
|
||||
|
||||
i = direction == DIRECTION_DOWN ? 0 : k - 1;
|
||||
}
|
||||
|
||||
do {
|
||||
p = le64toh(o->entry_array.items[i]);
|
||||
|
||||
r = journal_file_move_to_object(f, OBJECT_ENTRY, p, &e);
|
||||
if (r >= 0)
|
||||
goto found;
|
||||
if (!IN_SET(r, -EADDRNOTAVAIL, -EBADMSG))
|
||||
return r;
|
||||
|
||||
/* OK, so this entry is borked. Most likely some entry didn't get synced to
|
||||
* disk properly, let's see if the next one might work for us instead. */
|
||||
log_debug_errno(r, "Entry item %" PRIu64 " is bad, skipping over it.", i);
|
||||
} while (bump_array_index(&i, direction, k) > 0);
|
||||
|
||||
t += k;
|
||||
a = le64toh(o->entry_array.next_entry_array_offset);
|
||||
i = UINT64_MAX;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
found:
|
||||
/* Let's cache this item for the next invocation */
|
||||
chain_cache_put(f->chain_cache, ci, first, a, le64toh(o->entry_array.items[0]), t, i);
|
||||
|
||||
r = journal_file_move_to_object(f, OBJECT_ENTRY, p, &o);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
if (ret)
|
||||
*ret = o;
|
||||
*ret = e;
|
||||
|
||||
if (ret_offset)
|
||||
*ret_offset = p;
|
||||
@ -2164,16 +2214,18 @@ static int generic_array_get_plus_one(
|
||||
uint64_t extra,
|
||||
uint64_t first,
|
||||
uint64_t i,
|
||||
direction_t direction,
|
||||
Object **ret, uint64_t *ret_offset) {
|
||||
|
||||
Object *o;
|
||||
int r;
|
||||
|
||||
assert(f);
|
||||
|
||||
if (i == 0) {
|
||||
int r;
|
||||
|
||||
r = journal_file_move_to_object(f, OBJECT_ENTRY, extra, &o);
|
||||
if (IN_SET(r, -EADDRNOTAVAIL, -EBADMSG))
|
||||
return generic_array_get(f, first, 0, direction, ret, ret_offset);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
@ -2186,7 +2238,7 @@ static int generic_array_get_plus_one(
|
||||
return 1;
|
||||
}
|
||||
|
||||
return generic_array_get(f, first, i-1, ret, ret_offset);
|
||||
return generic_array_get(f, first, i - 1, direction, ret, ret_offset);
|
||||
}
|
||||
|
||||
enum {
|
||||
@ -2710,25 +2762,6 @@ int journal_file_compare_locations(JournalFile *af, JournalFile *bf) {
|
||||
return CMP(af->current_xor_hash, bf->current_xor_hash);
|
||||
}
|
||||
|
||||
static int bump_array_index(uint64_t *i, direction_t direction, uint64_t n) {
|
||||
|
||||
/* Increase or decrease the specified index, in the right direction. */
|
||||
|
||||
if (direction == DIRECTION_DOWN) {
|
||||
if (*i >= n - 1)
|
||||
return 0;
|
||||
|
||||
(*i) ++;
|
||||
} else {
|
||||
if (*i <= 0)
|
||||
return 0;
|
||||
|
||||
(*i) --;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static bool check_properly_ordered(uint64_t new_offset, uint64_t old_offset, direction_t direction) {
|
||||
|
||||
/* Consider it an error if any of the two offsets is uninitialized */
|
||||
@ -2777,24 +2810,9 @@ int journal_file_next_entry(
|
||||
}
|
||||
|
||||
/* And jump to it */
|
||||
for (;;) {
|
||||
r = generic_array_get(f,
|
||||
le64toh(f->header->entry_array_offset),
|
||||
i,
|
||||
ret, &ofs);
|
||||
if (r > 0)
|
||||
break;
|
||||
if (r != -EBADMSG)
|
||||
return r;
|
||||
|
||||
/* OK, so this entry is borked. Most likely some entry didn't get synced to disk properly, let's see if
|
||||
* the next one might work for us instead. */
|
||||
log_debug_errno(r, "Entry item %" PRIu64 " is bad, skipping over it.", i);
|
||||
|
||||
r = bump_array_index(&i, direction, n);
|
||||
if (r <= 0)
|
||||
return r;
|
||||
}
|
||||
r = generic_array_get(f, le64toh(f->header->entry_array_offset), i, direction, ret, &ofs);
|
||||
if (r <= 0)
|
||||
return r;
|
||||
|
||||
/* Ensure our array is properly ordered. */
|
||||
if (p > 0 && !check_properly_ordered(ofs, p, direction))
|
||||
@ -2810,7 +2828,6 @@ int journal_file_next_entry(
|
||||
|
||||
int journal_file_next_entry_for_data(
|
||||
JournalFile *f,
|
||||
Object *o, uint64_t p,
|
||||
uint64_t data_offset,
|
||||
direction_t direction,
|
||||
Object **ret, uint64_t *ret_offset) {
|
||||
@ -2820,7 +2837,6 @@ int journal_file_next_entry_for_data(
|
||||
int r;
|
||||
|
||||
assert(f);
|
||||
assert(p > 0 || !o);
|
||||
|
||||
r = journal_file_move_to_object(f, OBJECT_DATA, data_offset, &d);
|
||||
if (r < 0)
|
||||
@ -2830,53 +2846,16 @@ int journal_file_next_entry_for_data(
|
||||
if (n <= 0)
|
||||
return n;
|
||||
|
||||
if (!o)
|
||||
i = direction == DIRECTION_DOWN ? 0 : n - 1;
|
||||
else {
|
||||
if (o->object.type != OBJECT_ENTRY)
|
||||
return -EINVAL;
|
||||
i = direction == DIRECTION_DOWN ? 0 : n - 1;
|
||||
|
||||
r = generic_array_bisect_plus_one(f,
|
||||
le64toh(d->data.entry_offset),
|
||||
le64toh(d->data.entry_array_offset),
|
||||
le64toh(d->data.n_entries),
|
||||
p,
|
||||
test_object_offset,
|
||||
DIRECTION_DOWN,
|
||||
NULL, NULL,
|
||||
&i);
|
||||
|
||||
if (r <= 0)
|
||||
return r;
|
||||
|
||||
r = bump_array_index(&i, direction, n);
|
||||
if (r <= 0)
|
||||
return r;
|
||||
}
|
||||
|
||||
for (;;) {
|
||||
r = generic_array_get_plus_one(f,
|
||||
le64toh(d->data.entry_offset),
|
||||
le64toh(d->data.entry_array_offset),
|
||||
i,
|
||||
ret, &ofs);
|
||||
if (r > 0)
|
||||
break;
|
||||
if (r != -EBADMSG)
|
||||
return r;
|
||||
|
||||
log_debug_errno(r, "Data entry item %" PRIu64 " is bad, skipping over it.", i);
|
||||
|
||||
r = bump_array_index(&i, direction, n);
|
||||
if (r <= 0)
|
||||
return r;
|
||||
}
|
||||
|
||||
/* Ensure our array is properly ordered. */
|
||||
if (p > 0 && check_properly_ordered(ofs, p, direction))
|
||||
return log_debug_errno(SYNTHETIC_ERRNO(EBADMSG),
|
||||
"%s data entry array not properly ordered at entry %" PRIu64,
|
||||
f->path, i);
|
||||
r = generic_array_get_plus_one(f,
|
||||
le64toh(d->data.entry_offset),
|
||||
le64toh(d->data.entry_array_offset),
|
||||
i,
|
||||
direction,
|
||||
ret, &ofs);
|
||||
if (r <= 0)
|
||||
return r;
|
||||
|
||||
if (ret_offset)
|
||||
*ret_offset = ofs;
|
||||
@ -3819,7 +3798,8 @@ int journal_file_get_cutoff_monotonic_usec(JournalFile *f, sd_id128_t boot_id, u
|
||||
r = generic_array_get_plus_one(f,
|
||||
le64toh(o->data.entry_offset),
|
||||
le64toh(o->data.entry_array_offset),
|
||||
le64toh(o->data.n_entries)-1,
|
||||
le64toh(o->data.n_entries) - 1,
|
||||
DIRECTION_UP,
|
||||
&o, NULL);
|
||||
if (r <= 0)
|
||||
return r;
|
||||
|
@ -214,7 +214,7 @@ void journal_file_save_location(JournalFile *f, Object *o, uint64_t offset);
|
||||
int journal_file_compare_locations(JournalFile *af, JournalFile *bf);
|
||||
int journal_file_next_entry(JournalFile *f, uint64_t p, direction_t direction, Object **ret, uint64_t *offset);
|
||||
|
||||
int journal_file_next_entry_for_data(JournalFile *f, Object *o, uint64_t p, uint64_t data_offset, direction_t direction, Object **ret, uint64_t *offset);
|
||||
int journal_file_next_entry_for_data(JournalFile *f, uint64_t data_offset, direction_t direction, Object **ret, uint64_t *offset);
|
||||
|
||||
int journal_file_move_to_entry_by_seqnum(JournalFile *f, uint64_t seqnum, direction_t direction, Object **ret, uint64_t *offset);
|
||||
int journal_file_move_to_entry_by_realtime(JournalFile *f, uint64_t realtime, direction_t direction, Object **ret, uint64_t *offset);
|
||||
|
@ -611,9 +611,9 @@ static int find_location_for_match(
|
||||
/* FIXME: missing: find by monotonic */
|
||||
|
||||
if (j->current_location.type == LOCATION_HEAD)
|
||||
return journal_file_next_entry_for_data(f, NULL, 0, dp, DIRECTION_DOWN, ret, offset);
|
||||
return journal_file_next_entry_for_data(f, dp, DIRECTION_DOWN, ret, offset);
|
||||
if (j->current_location.type == LOCATION_TAIL)
|
||||
return journal_file_next_entry_for_data(f, NULL, 0, dp, DIRECTION_UP, ret, offset);
|
||||
return journal_file_next_entry_for_data(f, dp, DIRECTION_UP, ret, offset);
|
||||
if (j->current_location.seqnum_set && sd_id128_equal(j->current_location.seqnum_id, f->header->seqnum_id))
|
||||
return journal_file_move_to_entry_by_seqnum_for_data(f, dp, j->current_location.seqnum, direction, ret, offset);
|
||||
if (j->current_location.monotonic_set) {
|
||||
@ -624,7 +624,7 @@ static int find_location_for_match(
|
||||
if (j->current_location.realtime_set)
|
||||
return journal_file_move_to_entry_by_realtime_for_data(f, dp, j->current_location.realtime, direction, ret, offset);
|
||||
|
||||
return journal_file_next_entry_for_data(f, NULL, 0, dp, direction, ret, offset);
|
||||
return journal_file_next_entry_for_data(f, dp, direction, ret, offset);
|
||||
|
||||
} else if (m->type == MATCH_OR_TERM) {
|
||||
uint64_t np = 0;
|
||||
@ -2303,8 +2303,8 @@ _public_ int sd_journal_get_data(sd_journal *j, const char *field, const void **
|
||||
p = le64toh(o->entry.items[i].object_offset);
|
||||
le_hash = o->entry.items[i].hash;
|
||||
r = journal_file_move_to_object(f, OBJECT_DATA, p, &d);
|
||||
if (r == -EBADMSG) {
|
||||
log_debug("Entry item %"PRIu64" data object is bad, skipping over it.", i);
|
||||
if (IN_SET(r, -EADDRNOTAVAIL, -EBADMSG)) {
|
||||
log_debug_errno(r, "Entry item %"PRIu64" data object is bad, skipping over it: %m", i);
|
||||
continue;
|
||||
}
|
||||
if (r < 0)
|
||||
@ -2448,8 +2448,8 @@ _public_ int sd_journal_enumerate_data(sd_journal *j, const void **data, size_t
|
||||
p = le64toh(o->entry.items[j->current_field].object_offset);
|
||||
le_hash = o->entry.items[j->current_field].hash;
|
||||
r = journal_file_move_to_object(f, OBJECT_DATA, p, &o);
|
||||
if (r == -EBADMSG) {
|
||||
log_debug("Entry item %"PRIu64" data object is bad, skipping over it.", j->current_field);
|
||||
if (IN_SET(r, -EADDRNOTAVAIL, -EBADMSG)) {
|
||||
log_debug_errno(r, "Entry item %"PRIu64" data object is bad, skipping over it: %m", j->current_field);
|
||||
continue;
|
||||
}
|
||||
if (r < 0)
|
||||
|
@ -16,7 +16,7 @@
|
||||
<policyconfig>
|
||||
|
||||
<vendor>The systemd Project</vendor>
|
||||
<vendor_url>http://www.freedesktop.org/wiki/Software/systemd</vendor_url>
|
||||
<vendor_url>https://systemd.io</vendor_url>
|
||||
|
||||
<action id="org.freedesktop.locale1.set-locale">
|
||||
<description gettext-domain="systemd">Set system locale</description>
|
||||
|
@ -16,7 +16,7 @@
|
||||
<policyconfig>
|
||||
|
||||
<vendor>The systemd Project</vendor>
|
||||
<vendor_url>http://www.freedesktop.org/wiki/Software/systemd</vendor_url>
|
||||
<vendor_url>https://systemd.io</vendor_url>
|
||||
|
||||
<action id="org.freedesktop.login1.inhibit-block-shutdown">
|
||||
<description gettext-domain="systemd">Allow applications to inhibit system shutdown</description>
|
||||
|
@ -16,7 +16,7 @@
|
||||
<policyconfig>
|
||||
|
||||
<vendor>The systemd Project</vendor>
|
||||
<vendor_url>http://www.freedesktop.org/wiki/Software/systemd</vendor_url>
|
||||
<vendor_url>https://systemd.io</vendor_url>
|
||||
|
||||
<action id="org.freedesktop.machine1.login">
|
||||
<description gettext-domain="systemd">Log into a local container</description>
|
||||
|
@ -895,13 +895,8 @@ int config_parse_wireguard_route_table(
|
||||
assert(data);
|
||||
assert(userdata);
|
||||
|
||||
if (isempty(rvalue)) {
|
||||
*table = RT_TABLE_MAIN;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (streq(rvalue, "off")) {
|
||||
*table = 0;
|
||||
if (isempty(rvalue) || parse_boolean(rvalue) == 0) {
|
||||
*table = 0; /* Disabled. */
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -952,7 +947,7 @@ int config_parse_wireguard_peer_route_table(
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (streq(rvalue, "off")) {
|
||||
if (parse_boolean(rvalue) == 0) {
|
||||
peer->route_table = 0; /* Disabled. */
|
||||
peer->route_table_set = true;
|
||||
TAKE_PTR(peer);
|
||||
@ -1061,7 +1056,6 @@ static void wireguard_init(NetDev *netdev) {
|
||||
assert(w);
|
||||
|
||||
w->flags = WGDEVICE_F_REPLACE_PEERS;
|
||||
w->route_table = RT_TABLE_MAIN;
|
||||
}
|
||||
|
||||
static void wireguard_done(NetDev *netdev) {
|
||||
|
@ -16,7 +16,7 @@
|
||||
<policyconfig>
|
||||
|
||||
<vendor>The systemd Project</vendor>
|
||||
<vendor_url>http://www.freedesktop.org/wiki/Software/systemd</vendor_url>
|
||||
<vendor_url>https://systemd.io</vendor_url>
|
||||
|
||||
<action id="org.freedesktop.network1.set-ntp-servers">
|
||||
<description gettext-domain="systemd">Set NTP servers</description>
|
||||
|
@ -22,14 +22,9 @@
|
||||
#include "signal-util.h"
|
||||
#include "string-util.h"
|
||||
|
||||
static void setup_logging(void) {
|
||||
/* We need a dummy function because log_parse_environment is a macro. */
|
||||
log_parse_environment();
|
||||
}
|
||||
|
||||
static void setup_logging_once(void) {
|
||||
static pthread_once_t once = PTHREAD_ONCE_INIT;
|
||||
assert_se(pthread_once(&once, setup_logging) == 0);
|
||||
assert_se(pthread_once(&once, log_parse_environment_variables) == 0);
|
||||
}
|
||||
|
||||
#define NSS_ENTRYPOINT_BEGIN \
|
||||
|
@ -22,7 +22,7 @@
|
||||
static JsonDispatchFlags json_dispatch_flags = 0;
|
||||
|
||||
static void setup_logging(void) {
|
||||
log_parse_environment();
|
||||
log_parse_environment_variables();
|
||||
|
||||
if (DEBUG_LOGGING)
|
||||
json_dispatch_flags = JSON_LOG;
|
||||
|
@ -116,14 +116,9 @@ static GetentData getsgent_data = {
|
||||
.mutex = PTHREAD_MUTEX_INITIALIZER,
|
||||
};
|
||||
|
||||
static void setup_logging(void) {
|
||||
/* We need a dummy function because log_parse_environment is a macro. */
|
||||
log_parse_environment();
|
||||
}
|
||||
|
||||
static void setup_logging_once(void) {
|
||||
static pthread_once_t once = PTHREAD_ONCE_INIT;
|
||||
assert_se(pthread_once(&once, setup_logging) == 0);
|
||||
assert_se(pthread_once(&once, log_parse_environment_variables) == 0);
|
||||
}
|
||||
|
||||
#define NSS_ENTRYPOINT_BEGIN \
|
||||
|
@ -7,7 +7,7 @@
|
||||
<policyconfig>
|
||||
|
||||
<vendor>The systemd Project</vendor>
|
||||
<vendor_url>http://www.freedesktop.org/wiki/Software/systemd</vendor_url>
|
||||
<vendor_url>https://systemd.io</vendor_url>
|
||||
|
||||
<action id="org.freedesktop.portable1.inspect-images">
|
||||
<description gettext-domain="systemd">Inspect a portable service image</description>
|
||||
|
@ -16,7 +16,7 @@
|
||||
<policyconfig>
|
||||
|
||||
<vendor>The systemd Project</vendor>
|
||||
<vendor_url>http://www.freedesktop.org/wiki/Software/systemd</vendor_url>
|
||||
<vendor_url>https://systemd.io</vendor_url>
|
||||
|
||||
<action id="org.freedesktop.resolve1.register-service">
|
||||
<description gettext-domain="systemd">Register a DNS-SD service</description>
|
||||
|
@ -89,7 +89,6 @@ static int show_cgroup_one_by_path(
|
||||
_cleanup_fclose_ FILE *f = NULL;
|
||||
_cleanup_free_ char *p = NULL;
|
||||
size_t n = 0;
|
||||
pid_t pid;
|
||||
char *fn;
|
||||
int r;
|
||||
|
||||
@ -102,7 +101,18 @@ static int show_cgroup_one_by_path(
|
||||
if (!f)
|
||||
return -errno;
|
||||
|
||||
while ((r = cg_read_pid(f, &pid)) > 0) {
|
||||
for (;;) {
|
||||
pid_t pid;
|
||||
|
||||
/* libvirt / qemu uses threaded mode and cgroup.procs cannot be read at the lower levels.
|
||||
* From https://www.kernel.org/doc/html/latest/admin-guide/cgroup-v2.html#threads,
|
||||
* “cgroup.procs” in a threaded domain cgroup contains the PIDs of all processes in
|
||||
* the subtree and is not readable in the subtree proper. */
|
||||
r = cg_read_pid(f, &pid);
|
||||
if (IN_SET(r, 0, -EOPNOTSUPP))
|
||||
break;
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
if (!(flags & OUTPUT_KERNEL_THREADS) && is_kernel_thread(pid) > 0)
|
||||
continue;
|
||||
@ -113,9 +123,6 @@ static int show_cgroup_one_by_path(
|
||||
pids[n++] = pid;
|
||||
}
|
||||
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
show_pid_array(pids, n, prefix, n_columns, false, more, flags);
|
||||
|
||||
return 0;
|
||||
|
@ -28,7 +28,7 @@ static bool arg_user = false;
|
||||
static int help(void) {
|
||||
|
||||
printf("%s [OPTIONS...]\n\n"
|
||||
"STDIO or socket-activatable proxy to a given DBus endpoint.\n\n"
|
||||
"Forward messages between two D-Bus busses via a pipe or socket.\n\n"
|
||||
" -h --help Show this help\n"
|
||||
" --version Show package version\n"
|
||||
" -p --bus-path=PATH Path to the bus address (default: %s)\n"
|
||||
@ -125,7 +125,7 @@ static int run(int argc, char *argv[]) {
|
||||
in_fd = SD_LISTEN_FDS_START;
|
||||
out_fd = SD_LISTEN_FDS_START;
|
||||
} else
|
||||
return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "Illegal number of file descriptors passed.");
|
||||
return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "More than one file descriptor was passed.");
|
||||
|
||||
is_unix =
|
||||
sd_is_socket(in_fd, AF_UNIX, 0, 0) > 0 &&
|
||||
|
@ -166,33 +166,33 @@ TEST(cellescape) {
|
||||
assert_se(streq(cellescape(buf, 1, "\020"), ""));
|
||||
assert_se(streq(cellescape(buf, 2, "\020"), "."));
|
||||
assert_se(streq(cellescape(buf, 3, "\020"), ".."));
|
||||
assert_se(streq(cellescape(buf, 4, "\020"), "…"));
|
||||
assert_se(streq(cellescape(buf, 4, "\020"), is_locale_utf8() ? "…" : "..."));
|
||||
assert_se(streq(cellescape(buf, 5, "\020"), "\\020"));
|
||||
|
||||
assert_se(streq(cellescape(buf, 5, "1234\020"), "1…"));
|
||||
assert_se(streq(cellescape(buf, 6, "1234\020"), "12…"));
|
||||
assert_se(streq(cellescape(buf, 7, "1234\020"), "123…"));
|
||||
assert_se(streq(cellescape(buf, 8, "1234\020"), "1234…"));
|
||||
assert_se(streq(cellescape(buf, 5, "1234\020"), is_locale_utf8() ? "1…" : "1..."));
|
||||
assert_se(streq(cellescape(buf, 6, "1234\020"), is_locale_utf8() ? "12…" : "12..."));
|
||||
assert_se(streq(cellescape(buf, 7, "1234\020"), is_locale_utf8() ? "123…" : "123..."));
|
||||
assert_se(streq(cellescape(buf, 8, "1234\020"), is_locale_utf8() ? "1234…" : "1234..."));
|
||||
assert_se(streq(cellescape(buf, 9, "1234\020"), "1234\\020"));
|
||||
|
||||
assert_se(streq(cellescape(buf, 1, "\t\n"), ""));
|
||||
assert_se(streq(cellescape(buf, 2, "\t\n"), "."));
|
||||
assert_se(streq(cellescape(buf, 3, "\t\n"), ".."));
|
||||
assert_se(streq(cellescape(buf, 4, "\t\n"), "…"));
|
||||
assert_se(streq(cellescape(buf, 4, "\t\n"), is_locale_utf8() ? "…" : "..."));
|
||||
assert_se(streq(cellescape(buf, 5, "\t\n"), "\\t\\n"));
|
||||
|
||||
assert_se(streq(cellescape(buf, 5, "1234\t\n"), "1…"));
|
||||
assert_se(streq(cellescape(buf, 6, "1234\t\n"), "12…"));
|
||||
assert_se(streq(cellescape(buf, 7, "1234\t\n"), "123…"));
|
||||
assert_se(streq(cellescape(buf, 8, "1234\t\n"), "1234…"));
|
||||
assert_se(streq(cellescape(buf, 5, "1234\t\n"), is_locale_utf8() ? "1…" : "1..."));
|
||||
assert_se(streq(cellescape(buf, 6, "1234\t\n"), is_locale_utf8() ? "12…" : "12..."));
|
||||
assert_se(streq(cellescape(buf, 7, "1234\t\n"), is_locale_utf8() ? "123…" : "123..."));
|
||||
assert_se(streq(cellescape(buf, 8, "1234\t\n"), is_locale_utf8() ? "1234…" : "1234..."));
|
||||
assert_se(streq(cellescape(buf, 9, "1234\t\n"), "1234\\t\\n"));
|
||||
|
||||
assert_se(streq(cellescape(buf, 4, "x\t\020\n"), "…"));
|
||||
assert_se(streq(cellescape(buf, 5, "x\t\020\n"), "x…"));
|
||||
assert_se(streq(cellescape(buf, 6, "x\t\020\n"), "x…"));
|
||||
assert_se(streq(cellescape(buf, 7, "x\t\020\n"), "x\\t…"));
|
||||
assert_se(streq(cellescape(buf, 8, "x\t\020\n"), "x\\t…"));
|
||||
assert_se(streq(cellescape(buf, 9, "x\t\020\n"), "x\\t…"));
|
||||
assert_se(streq(cellescape(buf, 4, "x\t\020\n"), is_locale_utf8() ? "…" : "..."));
|
||||
assert_se(streq(cellescape(buf, 5, "x\t\020\n"), is_locale_utf8() ? "x…" : "x..."));
|
||||
assert_se(streq(cellescape(buf, 6, "x\t\020\n"), is_locale_utf8() ? "x…" : "x..."));
|
||||
assert_se(streq(cellescape(buf, 7, "x\t\020\n"), is_locale_utf8() ? "x\\t…" : "x\\t..."));
|
||||
assert_se(streq(cellescape(buf, 8, "x\t\020\n"), is_locale_utf8() ? "x\\t…" : "x\\t..."));
|
||||
assert_se(streq(cellescape(buf, 9, "x\t\020\n"), is_locale_utf8() ? "x\\t…" : "x\\t..."));
|
||||
assert_se(streq(cellescape(buf, 10, "x\t\020\n"), "x\\t\\020\\n"));
|
||||
|
||||
assert_se(streq(cellescape(buf, 6, "1\011"), "1\\t"));
|
||||
|
@ -16,7 +16,7 @@
|
||||
<policyconfig>
|
||||
|
||||
<vendor>The systemd Project</vendor>
|
||||
<vendor_url>http://www.freedesktop.org/wiki/Software/systemd</vendor_url>
|
||||
<vendor_url>https://systemd.io</vendor_url>
|
||||
|
||||
<action id="org.freedesktop.timedate1.set-time">
|
||||
<description gettext-domain="systemd">Set system time</description>
|
||||
|
@ -485,7 +485,7 @@ static int xdg_autostart_generate_desktop_condition(
|
||||
log_full_errno(r == -ENOENT ? LOG_DEBUG : LOG_WARNING, r,
|
||||
"%s not found: %m", test_binary);
|
||||
fprintf(f, "# ExecCondition using %s skipped due to missing binary.\n", test_binary);
|
||||
return r;
|
||||
return 0;
|
||||
}
|
||||
|
||||
e_autostart_condition = cescape(condition);
|
||||
|
Loading…
Reference in New Issue
Block a user