1
0
mirror of https://github.com/systemd/systemd synced 2026-04-07 15:44:49 +02:00

Compare commits

...

20 Commits

Author SHA1 Message Date
Evgeny Vereshchagin
2fd1beb3e2 oss-fuzz: move apt-gets and pips to the systemd repository
to be able to control our dependencies right here without
sending PRs like https://github.com/google/oss-fuzz/pull/5199 and
https://github.com/google/oss-fuzz/pull/5601.

It should also allow us to pin meson to let Dependabot keep track of
it and jump from one version to another without breaking anything
2021-11-19 08:52:28 +00:00
Zbigniew Jędrzejewski-Szmek
39c37ca2d2
Merge pull request #21436 from yuwata/network-bus-introspect
network: add --bus-introspect option
2021-11-19 09:42:46 +01:00
Thomas Blume
6e8791a042 systemd-coredump: allow setting external core size to infinity
Make it compatible to the ulimit setting: unlimited
2021-11-19 09:23:52 +01:00
Lennart Poettering
548614cc9a
Merge pull request #21420 from DaanDeMeyer/journal-enumerate-skip
journal: Skip over corrupt entry items in enumerate_data()
2021-11-19 09:23:17 +01:00
Lennart Poettering
5c9da90d1d
Merge pull request #21411 from poettering/homed-maximize
homed: add concept for "maximizing" home dirs
2021-11-19 09:22:11 +01:00
Yu Watanabe
cc0f820960
Merge pull request #21435 from yuwata/network-cleanups-for-alternative-names
network: cleanups for alternative names
2021-11-19 12:05:04 +09:00
Yu Watanabe
a72d2a7bca network: always try to reconfigure when carrier gained
When networkd detects a wlan interface, the interface may not be
connected to any access point, and may enter the unmanaged state.
After the interface connected to an access point, previously networkd
did not reconfigure the interface. This fixes the issue.
2021-11-19 12:04:42 +09:00
Lennart Poettering
9f5827e01c homectl: parse "min" and "max" as special disk size values 2021-11-19 00:05:53 +01:00
Lennart Poettering
41caad6fcc test: extend homed test to test home dir "maximization"
This moves the backing store to a separate tmpfs which we can nicely put
a size limit on to make sure we can test maximization sanely: if we ask
for the home dir to be grown really large it should effectively only be
grown until the size of the backing tmpfs.

(While we are at it, also set a cheaper KDF so that we don't waste CI
cycles for password hashing that aren#t secure anyway.)
2021-11-19 00:05:53 +01:00
Lennart Poettering
2b02eb0591 homework: also add logic for "maximizing" size of home 2021-11-19 00:05:53 +01:00
Lennart Poettering
34081f6be7 homework: make it safe to invoke home_setup_luks() twice in a row
Being able to invoke the call twice on the same HomeSetup object will
simplify auto-growing/auto-shrinking since we can issue a resize
operatio directly from activate/deactivate
2021-11-19 00:05:53 +01:00
Lennart Poettering
5813fca61f homework: make destroying of HomeSetup optional when resizing
This will be useful when we want to issue a resize operation right when
activating, where the HomeSetup object should be destroyed only after
both activation is done.
2021-11-19 00:05:53 +01:00
Yu Watanabe
558434a4aa man: add new man page org.freedesktop.network1 2021-11-19 07:23:40 +09:00
Yu Watanabe
6b4c1c9f3c network: support --bus-introspect option 2021-11-19 06:50:02 +09:00
Yu Watanabe
6e194652b8 network: use BusObjectImplementation 2021-11-19 06:49:25 +09:00
Daan De Meyer
8a799bed4c journal: Skip corrupt Data objects in sd_journal_get_data()
Similar to the change we made for sd_journal_enumerate_data(), let's
skip corrupt entry items and data objects in sd_journal_get_data().
2021-11-18 21:43:17 +00:00
Daan De Meyer
847c7ee8c3 journal: Use separate variable for Data object in sd_journal_get_data()
A little cleanup to make the next change easier. We're not moving to a
new Entry object in the for loop so there's no danger of changing the
Entry object window.
2021-11-18 21:43:17 +00:00
Daan De Meyer
5a94a2bf2b journal: Skip over corrupt entry items in enumerate_data()
Similar to sd_journal_next(), if trying to access an entry item
offset's data results in EBADMSG, skip to the next entry item so
we handle corruption better.

Fixes #21407
2021-11-18 21:43:15 +00:00
Yu Watanabe
1b345c1e3b network: skip re-generating map from alternative names to link 2021-11-19 06:13:02 +09:00
Yu Watanabe
50df02a705 network: do not clear map from alternative names to link when IFLA_PROP_LIST attribute is not contained
No IFLA_PROP_LIST attribute contained does not means the interface
has no alternative name.
E.g. the message created by inet6_fill_ifinfo() in net/ipv6/addrconf.c
does not contain IFLA_PROP_LIST.
2021-11-19 06:13:02 +09:00
24 changed files with 923 additions and 142 deletions

View File

@ -98,6 +98,8 @@
<listitem><para>The maximum (compressed or uncompressed) size in bytes of a core to be saved. Unit
suffixes are allowed just as in <option>ProcessSizeMax=</option>.</para></listitem>
<para><varname>ExternalSizeMax=infinity</varname> sets the core size to unlimited.</para>
</varlistentry>
<varlistentry>

View File

@ -849,7 +849,11 @@
<literal>xfs</literal> and <literal>btrfs</literal> the home directory may be grown while the user is
logged in, and on the latter also shrunk while the user is logged in. If the
<literal>subvolume</literal>, <literal>directory</literal>, <literal>fscrypt</literal> storage
mechanisms are used, resizing will change file system quota.</para></listitem>
mechanisms are used, resizing will change file system quota. The size parameter may make use of the
usual suffixes B, K, M, G, T (to the base of 1024). The special strings <literal>min</literal> and
<literal>max</literal> may be specified in place of a numeric size value, for minimizing or
maximizing disk space assigned to the home area, taking constraints of the file system, disk usage inside
the home area and on the backing storage into account.</para></listitem>
</varlistentry>
<varlistentry>

View File

@ -0,0 +1,507 @@
<?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" [
<!ENTITY % entities SYSTEM "custom-entities.ent" >
%entities;
]>
<!-- SPDX-License-Identifier: LGPL-2.1-or-later -->
<refentry id="org.freedesktop.network1" conditional='ENABLE_NETWORKD'
xmlns:xi="http://www.w3.org/2001/XInclude">
<refentryinfo>
<title>org.freedesktop.network1</title>
<productname>systemd</productname>
</refentryinfo>
<refmeta>
<refentrytitle>org.freedesktop.network1</refentrytitle>
<manvolnum>5</manvolnum>
</refmeta>
<refnamediv>
<refname>org.freedesktop.network1</refname>
<refpurpose>The D-Bus interface of systemd-networkd</refpurpose>
</refnamediv>
<refsect1>
<title>Introduction</title>
<para>
<citerefentry><refentrytitle>systemd-networkd.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>
is a system service that manages and configures network interfaces. This page describes the D-Bus
interface.</para>
</refsect1>
<refsect1>
<title>The Manager Object</title>
<para>The service exposes the following interfaces on the Manager object on the bus:</para>
<programlisting executable="systemd-networkd" node="/org/freedesktop/network1" interface="org.freedesktop.network1.Manager">
node /org/freedesktop/network1 {
interface org.freedesktop.network1.Manager {
methods:
ListLinks(out a(iso) links);
GetLinkByName(in s name,
out i ifindex,
out o path);
GetLinkByIndex(in i ifindex,
out s name,
out o path);
SetLinkNTP(in i ifindex,
in as servers);
SetLinkDNS(in i ifindex,
in a(iay) addresses);
SetLinkDNSEx(in i ifindex,
in a(iayqs) addresses);
SetLinkDomains(in i ifindex,
in a(sb) domains);
SetLinkDefaultRoute(in i ifindex,
in b enable);
SetLinkLLMNR(in i ifindex,
in s mode);
SetLinkMulticastDNS(in i ifindex,
in s mode);
SetLinkDNSOverTLS(in i ifindex,
in s mode);
SetLinkDNSSEC(in i ifindex,
in s mode);
SetLinkDNSSECNegativeTrustAnchors(in i ifindex,
in as names);
RevertLinkNTP(in i ifindex);
RevertLinkDNS(in i ifindex);
RenewLink(in i ifindex);
ForceRenewLink(in i ifindex);
ReconfigureLink(in i ifindex);
Reload();
DescribeLink(in i ifindex,
out s json);
Describe(out s json);
properties:
readonly s OperationalState = '...';
readonly s CarrierState = '...';
readonly s AddressState = '...';
readonly s IPv4AddressState = '...';
readonly s IPv6AddressState = '...';
readonly s OnlineState = '...';
@org.freedesktop.DBus.Property.EmitsChangedSignal("const")
readonly t NamespaceId = ...;
};
interface org.freedesktop.DBus.Peer { ... };
interface org.freedesktop.DBus.Introspectable { ... };
interface org.freedesktop.DBus.Properties { ... };
};
</programlisting>
<!--method ListLinks is not documented!-->
<!--method GetLinkByName is not documented!-->
<!--method GetLinkByIndex is not documented!-->
<!--method SetLinkNTP is not documented!-->
<!--method SetLinkDNS is not documented!-->
<!--method SetLinkDNSEx is not documented!-->
<!--method SetLinkDomains is not documented!-->
<!--method SetLinkDefaultRoute is not documented!-->
<!--method SetLinkLLMNR is not documented!-->
<!--method SetLinkMulticastDNS is not documented!-->
<!--method SetLinkDNSOverTLS is not documented!-->
<!--method SetLinkDNSSEC is not documented!-->
<!--method SetLinkDNSSECNegativeTrustAnchors is not documented!-->
<!--method RevertLinkNTP is not documented!-->
<!--method RevertLinkDNS is not documented!-->
<!--method RenewLink is not documented!-->
<!--method ForceRenewLink is not documented!-->
<!--method ReconfigureLink is not documented!-->
<!--method Reload is not documented!-->
<!--method DescribeLink is not documented!-->
<!--method Describe is not documented!-->
<!--property OperationalState is not documented!-->
<!--property CarrierState is not documented!-->
<!--property AddressState is not documented!-->
<!--property IPv4AddressState is not documented!-->
<!--property IPv6AddressState is not documented!-->
<!--property OnlineState is not documented!-->
<!--property NamespaceId is not documented!-->
<!--Autogenerated cross-references for systemd.directives, do not edit-->
<variablelist class="dbus-interface" generated="True" extra-ref="org.freedesktop.network1.Manager"/>
<variablelist class="dbus-interface" generated="True" extra-ref="org.freedesktop.network1.Manager"/>
<variablelist class="dbus-method" generated="True" extra-ref="ListLinks()"/>
<variablelist class="dbus-method" generated="True" extra-ref="GetLinkByName()"/>
<variablelist class="dbus-method" generated="True" extra-ref="GetLinkByIndex()"/>
<variablelist class="dbus-method" generated="True" extra-ref="SetLinkNTP()"/>
<variablelist class="dbus-method" generated="True" extra-ref="SetLinkDNS()"/>
<variablelist class="dbus-method" generated="True" extra-ref="SetLinkDNSEx()"/>
<variablelist class="dbus-method" generated="True" extra-ref="SetLinkDomains()"/>
<variablelist class="dbus-method" generated="True" extra-ref="SetLinkDefaultRoute()"/>
<variablelist class="dbus-method" generated="True" extra-ref="SetLinkLLMNR()"/>
<variablelist class="dbus-method" generated="True" extra-ref="SetLinkMulticastDNS()"/>
<variablelist class="dbus-method" generated="True" extra-ref="SetLinkDNSOverTLS()"/>
<variablelist class="dbus-method" generated="True" extra-ref="SetLinkDNSSEC()"/>
<variablelist class="dbus-method" generated="True" extra-ref="SetLinkDNSSECNegativeTrustAnchors()"/>
<variablelist class="dbus-method" generated="True" extra-ref="RevertLinkNTP()"/>
<variablelist class="dbus-method" generated="True" extra-ref="RevertLinkDNS()"/>
<variablelist class="dbus-method" generated="True" extra-ref="RenewLink()"/>
<variablelist class="dbus-method" generated="True" extra-ref="ForceRenewLink()"/>
<variablelist class="dbus-method" generated="True" extra-ref="ReconfigureLink()"/>
<variablelist class="dbus-method" generated="True" extra-ref="Reload()"/>
<variablelist class="dbus-method" generated="True" extra-ref="DescribeLink()"/>
<variablelist class="dbus-method" generated="True" extra-ref="Describe()"/>
<variablelist class="dbus-property" generated="True" extra-ref="OperationalState"/>
<variablelist class="dbus-property" generated="True" extra-ref="CarrierState"/>
<variablelist class="dbus-property" generated="True" extra-ref="AddressState"/>
<variablelist class="dbus-property" generated="True" extra-ref="IPv4AddressState"/>
<variablelist class="dbus-property" generated="True" extra-ref="IPv6AddressState"/>
<variablelist class="dbus-property" generated="True" extra-ref="OnlineState"/>
<variablelist class="dbus-property" generated="True" extra-ref="NamespaceId"/>
<!--End of Autogenerated section-->
<para>
Provides information about the manager.
</para>
</refsect1>
<refsect1>
<title>Link Object</title>
<programlisting executable="systemd-networkd" node="/org/freedesktop/network1/link/_1" interface="org.freedesktop.network1.Link">
node /org/freedesktop/network1/link/_1 {
interface org.freedesktop.network1.Link {
methods:
SetNTP(in as servers);
SetDNS(in a(iay) addresses);
SetDNSEx(in a(iayqs) addresses);
SetDomains(in a(sb) domains);
SetDefaultRoute(in b enable);
SetLLMNR(in s mode);
SetMulticastDNS(in s mode);
SetDNSOverTLS(in s mode);
SetDNSSEC(in s mode);
SetDNSSECNegativeTrustAnchors(in as names);
RevertNTP();
RevertDNS();
Renew();
ForceRenew();
Reconfigure();
Describe(out s json);
properties:
readonly s OperationalState = '...';
readonly s CarrierState = '...';
readonly s AddressState = '...';
readonly s IPv4AddressState = '...';
readonly s IPv6AddressState = '...';
readonly s OnlineState = '...';
readonly s AdministrativeState = '...';
@org.freedesktop.DBus.Property.EmitsChangedSignal("false")
readonly (tt) BitRates = ...;
};
interface org.freedesktop.DBus.Peer { ... };
interface org.freedesktop.DBus.Introspectable { ... };
interface org.freedesktop.DBus.Properties { ... };
interface org.freedesktop.network1.DHCPServer { ... };
};
</programlisting>
<!--method SetNTP is not documented!-->
<!--method SetDNS is not documented!-->
<!--method SetDNSEx is not documented!-->
<!--method SetDomains is not documented!-->
<!--method SetDefaultRoute is not documented!-->
<!--method SetLLMNR is not documented!-->
<!--method SetMulticastDNS is not documented!-->
<!--method SetDNSOverTLS is not documented!-->
<!--method SetDNSSEC is not documented!-->
<!--method SetDNSSECNegativeTrustAnchors is not documented!-->
<!--method RevertNTP is not documented!-->
<!--method RevertDNS is not documented!-->
<!--method Renew is not documented!-->
<!--method ForceRenew is not documented!-->
<!--method Reconfigure is not documented!-->
<!--method Describe is not documented!-->
<!--property OperationalState is not documented!-->
<!--property CarrierState is not documented!-->
<!--property AddressState is not documented!-->
<!--property IPv4AddressState is not documented!-->
<!--property IPv6AddressState is not documented!-->
<!--property OnlineState is not documented!-->
<!--property AdministrativeState is not documented!-->
<!--property BitRates is not documented!-->
<!--Autogenerated cross-references for systemd.directives, do not edit-->
<variablelist class="dbus-interface" generated="True" extra-ref="org.freedesktop.network1.DHCPServer"/>
<variablelist class="dbus-interface" generated="True" extra-ref="org.freedesktop.network1.Link"/>
<variablelist class="dbus-interface" generated="True" extra-ref="org.freedesktop.network1.DHCPServer"/>
<variablelist class="dbus-interface" generated="True" extra-ref="org.freedesktop.network1.Link"/>
<variablelist class="dbus-method" generated="True" extra-ref="SetNTP()"/>
<variablelist class="dbus-method" generated="True" extra-ref="SetDNS()"/>
<variablelist class="dbus-method" generated="True" extra-ref="SetDNSEx()"/>
<variablelist class="dbus-method" generated="True" extra-ref="SetDomains()"/>
<variablelist class="dbus-method" generated="True" extra-ref="SetDefaultRoute()"/>
<variablelist class="dbus-method" generated="True" extra-ref="SetLLMNR()"/>
<variablelist class="dbus-method" generated="True" extra-ref="SetMulticastDNS()"/>
<variablelist class="dbus-method" generated="True" extra-ref="SetDNSOverTLS()"/>
<variablelist class="dbus-method" generated="True" extra-ref="SetDNSSEC()"/>
<variablelist class="dbus-method" generated="True" extra-ref="SetDNSSECNegativeTrustAnchors()"/>
<variablelist class="dbus-method" generated="True" extra-ref="RevertNTP()"/>
<variablelist class="dbus-method" generated="True" extra-ref="RevertDNS()"/>
<variablelist class="dbus-method" generated="True" extra-ref="Renew()"/>
<variablelist class="dbus-method" generated="True" extra-ref="ForceRenew()"/>
<variablelist class="dbus-method" generated="True" extra-ref="Reconfigure()"/>
<variablelist class="dbus-method" generated="True" extra-ref="Describe()"/>
<variablelist class="dbus-property" generated="True" extra-ref="OperationalState"/>
<variablelist class="dbus-property" generated="True" extra-ref="CarrierState"/>
<variablelist class="dbus-property" generated="True" extra-ref="AddressState"/>
<variablelist class="dbus-property" generated="True" extra-ref="IPv4AddressState"/>
<variablelist class="dbus-property" generated="True" extra-ref="IPv6AddressState"/>
<variablelist class="dbus-property" generated="True" extra-ref="OnlineState"/>
<variablelist class="dbus-property" generated="True" extra-ref="AdministrativeState"/>
<variablelist class="dbus-property" generated="True" extra-ref="BitRates"/>
<!--End of Autogenerated section-->
<para>
Provides information about interfaces.
</para>
</refsect1>
<refsect1>
<title>Network Object</title>
<programlisting executable="systemd-networkd" node="/org/freedesktop/network1/network/_1" interface="org.freedesktop.network1.Network">
node /org/freedesktop/network1/network/_1 {
interface org.freedesktop.network1.Network {
properties:
@org.freedesktop.DBus.Property.EmitsChangedSignal("const")
readonly s Description = '...';
@org.freedesktop.DBus.Property.EmitsChangedSignal("const")
readonly s SourcePath = '...';
@org.freedesktop.DBus.Property.EmitsChangedSignal("const")
readonly as MatchMAC = ['...', ...];
@org.freedesktop.DBus.Property.EmitsChangedSignal("const")
readonly as MatchPath = ['...', ...];
@org.freedesktop.DBus.Property.EmitsChangedSignal("const")
readonly as MatchDriver = ['...', ...];
@org.freedesktop.DBus.Property.EmitsChangedSignal("const")
readonly as MatchType = ['...', ...];
@org.freedesktop.DBus.Property.EmitsChangedSignal("const")
readonly as MatchName = ['...', ...];
};
interface org.freedesktop.DBus.Peer { ... };
interface org.freedesktop.DBus.Introspectable { ... };
interface org.freedesktop.DBus.Properties { ... };
};
</programlisting>
<!--property Description is not documented!-->
<!--property SourcePath is not documented!-->
<!--property MatchMAC is not documented!-->
<!--property MatchPath is not documented!-->
<!--property MatchDriver is not documented!-->
<!--property MatchType is not documented!-->
<!--property MatchName is not documented!-->
<!--Autogenerated cross-references for systemd.directives, do not edit-->
<variablelist class="dbus-interface" generated="True" extra-ref="org.freedesktop.network1.Network"/>
<variablelist class="dbus-interface" generated="True" extra-ref="org.freedesktop.network1.Network"/>
<variablelist class="dbus-property" generated="True" extra-ref="Description"/>
<variablelist class="dbus-property" generated="True" extra-ref="SourcePath"/>
<variablelist class="dbus-property" generated="True" extra-ref="MatchMAC"/>
<variablelist class="dbus-property" generated="True" extra-ref="MatchPath"/>
<variablelist class="dbus-property" generated="True" extra-ref="MatchDriver"/>
<variablelist class="dbus-property" generated="True" extra-ref="MatchType"/>
<variablelist class="dbus-property" generated="True" extra-ref="MatchName"/>
<!--End of Autogenerated section-->
<para>
Provides information about .network files.
</para>
</refsect1>
<refsect1>
<title>DHCP Server Object</title>
<programlisting executable="systemd-networkd" node="/org/freedesktop/network1/link/_1" interface="org.freedesktop.network1.DHCPServer">
node /org/freedesktop/network1/link/_1 {
interface org.freedesktop.network1.DHCPServer {
properties:
readonly a(uayayayayt) Leases = [...];
};
interface org.freedesktop.DBus.Peer { ... };
interface org.freedesktop.DBus.Introspectable { ... };
interface org.freedesktop.DBus.Properties { ... };
};
</programlisting>
<!--property Leases is not documented!-->
<!--Autogenerated cross-references for systemd.directives, do not edit-->
<variablelist class="dbus-interface" generated="True" extra-ref="org.freedesktop.network1.DHCPServer"/>
<variablelist class="dbus-interface" generated="True" extra-ref="org.freedesktop.network1.DHCPServer"/>
<variablelist class="dbus-property" generated="True" extra-ref="Leases"/>
<!--End of Autogenerated section-->
<para>
Provides information about leases.
</para>
</refsect1>
<refsect1>
<title>Examples</title>
<example>
<title>Introspect <interfacename>org.freedesktop.network1.Manager</interfacename> on the bus</title>
<programlisting>
$ gdbus introspect --system \
--dest org.freedesktop.network1 \
--object-path /org/freedesktop/network1
</programlisting>
</example>
<example>
<title>Introspect <interfacename>org.freedesktop.network1.Link</interfacename> on the bus</title>
<programlisting>
$ gdbus introspect --system \
--dest org.freedesktop.network1 \
--object-path /org/freedesktop/network1/link/_11
</programlisting>
</example>
</refsect1>
<refsect1>
<title>Versioning</title>
<para>These D-Bus interfaces follow <ulink url="http://0pointer.de/blog/projects/versioning-dbus.html">
the usual interface versioning guidelines</ulink>.</para>
</refsect1>
</refentry>

View File

@ -57,6 +57,7 @@ manpages = [
['org.freedesktop.locale1', '5', [], 'ENABLE_LOCALED'],
['org.freedesktop.login1', '5', [], 'ENABLE_LOGIND'],
['org.freedesktop.machine1', '5', [], 'ENABLE_MACHINED'],
['org.freedesktop.network1', '5', [], 'ENABLE_NETWORKD'],
['org.freedesktop.oom1', '5', [], 'ENABLE_OOMD'],
['org.freedesktop.portable1', '5', [], 'ENABLE_PORTABLED'],
['org.freedesktop.resolve1', '5', [], 'ENABLE_RESOLVE'],

View File

@ -154,13 +154,13 @@ static uint64_t arg_max_use = UINT64_MAX;
static int parse_config(void) {
static const ConfigTableItem items[] = {
{ "Coredump", "Storage", config_parse_coredump_storage, 0, &arg_storage },
{ "Coredump", "Compress", config_parse_bool, 0, &arg_compress },
{ "Coredump", "ProcessSizeMax", config_parse_iec_uint64, 0, &arg_process_size_max },
{ "Coredump", "ExternalSizeMax", config_parse_iec_uint64, 0, &arg_external_size_max },
{ "Coredump", "JournalSizeMax", config_parse_iec_size, 0, &arg_journal_size_max },
{ "Coredump", "KeepFree", config_parse_iec_uint64, 0, &arg_keep_free },
{ "Coredump", "MaxUse", config_parse_iec_uint64, 0, &arg_max_use },
{ "Coredump", "Storage", config_parse_coredump_storage, 0, &arg_storage },
{ "Coredump", "Compress", config_parse_bool, 0, &arg_compress },
{ "Coredump", "ProcessSizeMax", config_parse_iec_uint64, 0, &arg_process_size_max },
{ "Coredump", "ExternalSizeMax", config_parse_iec_uint64_infinity, 0, &arg_external_size_max },
{ "Coredump", "JournalSizeMax", config_parse_iec_size, 0, &arg_journal_size_max },
{ "Coredump", "KeepFree", config_parse_iec_uint64, 0, &arg_keep_free },
{ "Coredump", "MaxUse", config_parse_iec_uint64, 0, &arg_max_use },
{}
};

View File

@ -1763,6 +1763,32 @@ static int passwd_home(int argc, char *argv[], void *userdata) {
return 0;
}
static int parse_disk_size(const char *t, uint64_t *ret) {
int r;
assert(t);
assert(ret);
if (streq(t, "min"))
*ret = 0;
else if (streq(t, "max"))
*ret = UINT64_MAX-1; /* Largest size that isn't UINT64_MAX special marker */
else {
uint64_t ds;
r = parse_size(t, 1024, &ds);
if (r < 0)
return log_error_errno(r, "Failed to parse disk size parameter: %s", t);
if (ds >= UINT64_MAX) /* UINT64_MAX has special meaning for us ("dont change"), refuse */
return log_error_errno(SYNTHETIC_ERRNO(ERANGE), "Disk size out of range: %s", t);
*ret = ds;
}
return 0;
}
static int resize_home(int argc, char *argv[], void *userdata) {
_cleanup_(sd_bus_flush_close_unrefp) sd_bus *bus = NULL;
_cleanup_(user_record_unrefp) UserRecord *secret = NULL;
@ -1781,9 +1807,9 @@ static int resize_home(int argc, char *argv[], void *userdata) {
"Relative disk size specification currently not supported when resizing.");
if (argc > 2) {
r = parse_size(argv[2], 1024, &ds);
r = parse_disk_size(argv[2], &ds);
if (r < 0)
return log_error_errno(r, "Failed to parse disk size parameter: %s", argv[2]);
return r;
}
if (arg_disk_size != UINT64_MAX) {
@ -2907,9 +2933,9 @@ static int parse_argv(int argc, char *argv[]) {
r = parse_permyriad(optarg);
if (r < 0) {
r = parse_size(optarg, 1024, &arg_disk_size);
r = parse_disk_size(optarg, &arg_disk_size);
if (r < 0)
return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "Disk size '%s' not valid.", optarg);
return r;
r = drop_from_identity("diskSizeRelative");
if (r < 0)

View File

@ -1164,55 +1164,67 @@ int home_setup_luks(
PasswordCache *cache,
UserRecord **ret_luks_home) {
sd_id128_t found_partition_uuid, found_luks_uuid, found_fs_uuid;
sd_id128_t found_partition_uuid = SD_ID128_NULL, found_luks_uuid = SD_ID128_NULL, found_fs_uuid = SD_ID128_NULL;
_cleanup_(user_record_unrefp) UserRecord *luks_home = NULL;
_cleanup_(erase_and_freep) void *volume_key = NULL;
size_t volume_key_size = 0;
uint64_t offset, size;
struct stat st;
int r;
assert(h);
assert(setup);
assert(setup->dm_name);
assert(setup->dm_node);
assert(setup->root_fd < 0);
assert(!setup->crypt_device);
assert(!setup->loop);
assert(user_record_storage(h) == USER_LUKS);
r = dlopen_cryptsetup();
if (r < 0)
return r;
r = make_dm_names(h, setup);
if (r < 0)
return r;
/* Reuse the image fd if it has already been opened by an earlier step */
if (setup->image_fd < 0) {
setup->image_fd = open_image_file(h, force_image_path, &st);
if (setup->image_fd < 0)
return setup->image_fd;
} else if (fstat(setup->image_fd, &st) < 0)
return log_error_errno(errno, "Failed to stat image: %m");
if (FLAGS_SET(flags, HOME_SETUP_ALREADY_ACTIVATED)) {
struct loop_info64 info;
const char *n;
r = luks_open(h,
setup,
cache,
&found_luks_uuid,
&volume_key,
&volume_key_size);
if (r < 0)
return r;
if (!setup->crypt_device) {
r = luks_open(h,
setup,
cache,
&found_luks_uuid,
&volume_key,
&volume_key_size);
if (r < 0)
return r;
}
r = luks_validate_home_record(setup->crypt_device, h, volume_key, cache, &luks_home);
if (r < 0)
return r;
if (ret_luks_home) {
r = luks_validate_home_record(setup->crypt_device, h, volume_key, cache, &luks_home);
if (r < 0)
return r;
}
n = sym_crypt_get_device_name(setup->crypt_device);
if (!n)
return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "Failed to determine backing device for DM %s.", setup->dm_name);
r = loop_device_open(n, O_RDWR, &setup->loop);
if (r < 0)
return log_error_errno(r, "Failed to open loopback device %s: %m", n);
if (!setup->loop) {
r = loop_device_open(n, O_RDWR, &setup->loop);
if (r < 0)
return log_error_errno(r, "Failed to open loopback device %s: %m", n);
}
if (ioctl(setup->loop->fd, LOOP_GET_STATUS64, &info) < 0) {
_cleanup_free_ char *sysfs = NULL;
struct stat st;
if (!IN_SET(errno, ENOTTY, EINVAL))
return log_error_errno(errno, "Failed to get block device metrics of %s: %m", n);
@ -1264,14 +1276,20 @@ int home_setup_luks(
log_info("Discovered used loopback device %s.", setup->loop->node);
setup->root_fd = open(user_record_home_directory(h), O_RDONLY|O_CLOEXEC|O_DIRECTORY|O_NOFOLLOW);
if (setup->root_fd < 0)
return log_error_errno(errno, "Failed to open home directory: %m");
if (setup->root_fd < 0) {
setup->root_fd = open(user_record_home_directory(h), O_RDONLY|O_CLOEXEC|O_DIRECTORY|O_NOFOLLOW);
if (setup->root_fd < 0)
return log_error_errno(errno, "Failed to open home directory: %m");
}
} else {
_cleanup_free_ char *fstype = NULL, *subdir = NULL;
bool has_stat = false;
const char *ip;
struct stat st;
/* When we aren't reopening the home directory we are allocating it fresh, hence the relevant
* objects can't be allocated yet. */
assert(setup->root_fd < 0);
assert(!setup->crypt_device);
assert(!setup->loop);
ip = force_image_path ?: user_record_image_path(h);
@ -1279,15 +1297,6 @@ int home_setup_luks(
if (!subdir)
return log_oom();
/* Reuse the image fd if it has already been opened by an earlier step */
if (setup->image_fd < 0) {
setup->image_fd = open_image_file(h, force_image_path, &st);
if (setup->image_fd < 0)
return setup->image_fd;
has_stat = true;
}
r = luks_validate(setup->image_fd, user_record_user_name_and_realm(h), h->partition_uuid, &found_partition_uuid, &offset, &size);
if (r < 0)
return log_error_errno(r, "Failed to validate disk label: %m");
@ -1298,7 +1307,7 @@ int home_setup_luks(
setup->do_mark_clean = true;
if (!user_record_luks_discard(h)) {
r = run_fallocate(setup->image_fd, has_stat ? &st : NULL);
r = run_fallocate(setup->image_fd, &st);
if (r < 0)
return r;
}
@ -1331,9 +1340,11 @@ int home_setup_luks(
setup->undo_dm = true;
r = luks_validate_home_record(setup->crypt_device, h, volume_key, cache, &luks_home);
if (r < 0)
return r;
if (ret_luks_home) {
r = luks_validate_home_record(setup->crypt_device, h, volume_key, cache, &luks_home);
if (r < 0)
return r;
}
r = fs_validate(setup->dm_node, h->file_system_uuid, &fstype, &found_fs_uuid);
if (r < 0)
@ -1359,13 +1370,21 @@ int home_setup_luks(
setup->do_offline_fallocate = !(setup->do_offline_fitrim = user_record_luks_offline_discard(h));
}
setup->found_partition_uuid = found_partition_uuid;
setup->found_luks_uuid = found_luks_uuid;
setup->found_fs_uuid = found_fs_uuid;
if (!sd_id128_is_null(found_partition_uuid))
setup->found_partition_uuid = found_partition_uuid;
if (!sd_id128_is_null(found_luks_uuid))
setup->found_luks_uuid = found_luks_uuid;
if (!sd_id128_is_null(found_fs_uuid))
setup->found_fs_uuid = found_fs_uuid;
setup->partition_offset = offset;
setup->partition_size = size;
setup->volume_key = TAKE_PTR(volume_key);
setup->volume_key_size = volume_key_size;
if (volume_key) {
erase_and_free(setup->volume_key);
setup->volume_key = TAKE_PTR(volume_key);
setup->volume_key_size = volume_key_size;
}
if (ret_luks_home)
*ret_luks_home = TAKE_PTR(luks_home);
@ -1941,7 +1960,6 @@ static int calculate_disk_size(UserRecord *h, const char *parent_dir, uint64_t *
static int home_truncate(
UserRecord *h,
int fd,
const char *path,
uint64_t size) {
bool trunc;
@ -1949,7 +1967,6 @@ static int home_truncate(
assert(h);
assert(fd >= 0);
assert(path);
trunc = user_record_luks_discard(h);
if (!trunc) {
@ -1967,14 +1984,14 @@ static int home_truncate(
if (r < 0) {
if (ERRNO_IS_DISK_SPACE(errno)) {
log_error_errno(errno, "Not enough disk space to allocate home.");
log_debug_errno(errno, "Not enough disk space to allocate home of size %s.", FORMAT_BYTES(size));
return -ENOSPC; /* make recognizable */
}
return log_error_errno(errno, "Failed to truncate home image %s: %m", path);
return log_error_errno(errno, "Failed to truncate home image: %m");
}
return 0;
return !trunc; /* Return == 0 if we managed to truncate, > 0 if we managed to allocate */
}
int home_create_luks(
@ -2156,7 +2173,7 @@ int home_create_luks(
log_full_errno(ERRNO_IS_NOT_SUPPORTED(r) ? LOG_DEBUG : LOG_WARNING, r,
"Failed to set file attributes on %s, ignoring: %m", setup->temporary_image_path);
r = home_truncate(h, setup->image_fd, setup->temporary_image_path, host_size);
r = home_truncate(h, setup->image_fd, host_size);
if (r < 0)
return r;
@ -2745,6 +2762,39 @@ static int get_smallest_fs_size(int fd, uint64_t *ret) {
return 0;
}
static int get_largest_image_size(int fd, const struct stat *st, uint64_t *ret) {
uint64_t used, avail, sum;
struct statfs sfs;
int r;
assert(fd >= 0);
assert(st);
assert(ret);
/* Determines the maximum file size we might be able to grow the image file referenced by the fd to. */
r = stat_verify_regular(st);
if (r < 0)
return log_error_errno(r, "Image file is not a regular file, refusing: %m");
if (syncfs(fd) < 0)
return log_error_errno(errno, "Failed to synchronize file system backing image file: %m");
if (fstatfs(fd, &sfs) < 0)
return log_error_errno(errno, "Failed to statfs() image file: %m");
used = (uint64_t) st->st_blocks * 512;
avail = (uint64_t) sfs.f_bsize * sfs.f_bavail;
if (avail > UINT64_MAX - used)
sum = UINT64_MAX;
else
sum = avail + used;
*ret = DISK_SIZE_ROUND_DOWN(MIN(sum, USER_DISK_SIZE_MAX));
return 0;
}
static int resize_fs_loop(
UserRecord *h,
HomeSetup *setup,
@ -2832,6 +2882,77 @@ static int resize_fs_loop(
return 0;
}
static int resize_image_loop(
UserRecord *h,
HomeSetup *setup,
uint64_t old_image_size,
uint64_t new_image_size,
uint64_t *ret_image_size) {
uint64_t current_image_size;
unsigned n_iterations = 0;
int r;
assert(h);
assert(setup);
assert(setup->image_fd >= 0);
/* A bisection loop trying to find the closest size to what the user asked for. (Well, we bisect like
* this only when we *grow* the image if we shrink the image then there's no need to bisect.) */
current_image_size = old_image_size;
for (uint64_t lower_boundary = old_image_size, upper_boundary = new_image_size, try_image_size = new_image_size;;) {
bool worked;
n_iterations++;
r = home_truncate(h, setup->image_fd, try_image_size);
if (r < 0) {
if (!ERRNO_IS_DISK_SPACE(r) || new_image_size < old_image_size) /* Not a disk space issue? Not trying to grow? */
return r;
log_debug_errno(r, "Growing from %s to %s didn't work, not enough space on backing disk.", FORMAT_BYTES(current_image_size), FORMAT_BYTES(try_image_size));
worked = false;
} else if (r > 0) { /* Success: allocation worked */
log_debug("Resizing from %s to %s via allocation worked successfully.", FORMAT_BYTES(current_image_size), FORMAT_BYTES(try_image_size));
current_image_size = try_image_size;
worked = true;
} else { /* Success, but through truncation, not allocation. */
log_debug("Resizing from %s to %s via truncation worked successfully.", FORMAT_BYTES(old_image_size), FORMAT_BYTES(try_image_size));
current_image_size = try_image_size;
break; /* there's no point in the bisection logic if this was plain truncation and
* not allocation, let's exit immediately. */
}
if (new_image_size < old_image_size) /* If we are shrinking we are done after one iteration */
break;
/* If we are growing then let's adjust our bisection boundaries and try again */
if (worked)
lower_boundary = MAX(lower_boundary, try_image_size);
else
upper_boundary = MIN(upper_boundary, try_image_size);
if (lower_boundary >= upper_boundary) {
log_debug("Image can't be grown further (range to try is empty).");
break;
}
try_image_size = DISK_SIZE_ROUND_DOWN(lower_boundary + (upper_boundary - lower_boundary) / 2);
if (try_image_size <= lower_boundary || try_image_size >= upper_boundary) {
log_debug("Image can't be grown further (remaining range to try too small).");
break;
}
}
log_debug("Bisection loop completed after %u iterations.", n_iterations);
if (ret_image_size)
*ret_image_size = current_image_size;
return 0;
}
int home_resize_luks(
UserRecord *h,
HomeSetupFlags flags,
@ -2969,11 +3090,17 @@ int home_resize_luks(
return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "Old partition doesn't fit in backing storage, refusing.");
if (S_ISREG(st.st_mode)) {
uint64_t partition_table_extra;
uint64_t partition_table_extra, largest_size;
partition_table_extra = old_image_size - setup->partition_size;
if (new_image_size <= partition_table_extra)
r = get_largest_image_size(setup->image_fd, &st, &largest_size);
if (r < 0)
return r;
if (new_image_size > largest_size)
new_image_size = largest_size;
if (new_image_size < partition_table_extra)
new_image_size = partition_table_extra;
new_partition_size = DISK_SIZE_ROUND_DOWN(new_image_size - partition_table_extra);
@ -3090,12 +3217,35 @@ int home_resize_luks(
if (new_fs_size > old_fs_size) { /* → Grow */
if (S_ISREG(st.st_mode)) {
uint64_t resized_image_size;
/* Grow file size */
r = home_truncate(h, image_fd, ip, new_image_size);
r = resize_image_loop(h, setup, old_image_size, new_image_size, &resized_image_size);
if (r < 0)
return r;
log_info("Growing of image file completed.");
if (resized_image_size == old_image_size) {
log_info("Couldn't change image size.");
return 0;
}
assert(resized_image_size > old_image_size);
log_info("Growing of image file from %s to %s completed.", FORMAT_BYTES(old_image_size), FORMAT_BYTES(resized_image_size));
if (resized_image_size < new_image_size) {
uint64_t sub;
/* If the growing we managed to do is smaller than what we wanted we need to
* adjust the partition/file system sizes we are going for, too */
sub = new_image_size - resized_image_size;
assert(new_partition_size >= sub);
new_partition_size -= sub;
assert(new_fs_size >= sub);
new_fs_size -= sub;
}
new_image_size = resized_image_size;
} else {
assert(S_ISBLK(st.st_mode));
assert(new_image_size == old_image_size);
@ -3240,9 +3390,11 @@ int home_resize_luks(
if (r < 0)
return r;
r = home_setup_done(setup);
if (r < 0)
return r;
if (!FLAGS_SET(flags, HOME_SETUP_RESIZE_DONT_UNDO)) {
r = home_setup_done(setup);
if (r < 0)
return r;
}
log_info("Everything completed.");

View File

@ -63,6 +63,7 @@ typedef enum HomeSetupFlags {
HOME_SETUP_RESIZE_MINIMIZE = 1 << 3, /* Shrink to minimal size */
HOME_SETUP_RESIZE_DONT_GROW = 1 << 4, /* If the resize would grow, gracefully terminate operation */
HOME_SETUP_RESIZE_DONT_SHRINK = 1 << 5, /* If the resize would shrink, gracefully terminate operation */
HOME_SETUP_RESIZE_DONT_UNDO = 1 << 6, /* Leave loopback/DM device context open after successful operation */
} HomeSetupFlags;
int home_setup_done(HomeSetup *setup);

View File

@ -2297,6 +2297,7 @@ _public_ int sd_journal_get_data(sd_journal *j, const char *field, const void **
n = journal_file_entry_n_items(o);
for (i = 0; i < n; i++) {
Object *d;
uint64_t p, l;
le64_t le_hash;
size_t t;
@ -2304,20 +2305,26 @@ _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, &o);
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);
continue;
}
if (r < 0)
return r;
if (le_hash != o->data.hash)
return -EBADMSG;
if (le_hash != d->data.hash) {
log_debug("Entry item %"PRIu64" hash is bad, skipping over it.", i);
continue;
}
l = le64toh(o->object.size) - offsetof(Object, data.payload);
l = le64toh(d->object.size) - offsetof(Object, data.payload);
compression = o->object.flags & OBJECT_COMPRESSION_MASK;
compression = d->object.flags & OBJECT_COMPRESSION_MASK;
if (compression) {
#if HAVE_COMPRESSION
r = decompress_startswith(compression,
o->data.payload, l,
d->data.payload, l,
&f->compress_buffer,
field, field_length, '=');
if (r < 0)
@ -2328,7 +2335,7 @@ _public_ int sd_journal_get_data(sd_journal *j, const char *field, const void **
size_t rsize;
r = decompress_blob(compression,
o->data.payload, l,
d->data.payload, l,
&f->compress_buffer, &rsize,
j->data_threshold);
if (r < 0)
@ -2343,23 +2350,19 @@ _public_ int sd_journal_get_data(sd_journal *j, const char *field, const void **
return -EPROTONOSUPPORT;
#endif
} else if (l >= field_length+1 &&
memcmp(o->data.payload, field, field_length) == 0 &&
o->data.payload[field_length] == '=') {
memcmp(d->data.payload, field, field_length) == 0 &&
d->data.payload[field_length] == '=') {
t = (size_t) l;
if ((uint64_t) t != l)
return -E2BIG;
*data = o->data.payload;
*data = d->data.payload;
*size = t;
return 0;
}
r = journal_file_move_to_object(f, OBJECT_ENTRY, f->current_offset, &o);
if (r < 0)
return r;
}
return -ENOENT;
@ -2422,10 +2425,8 @@ static int return_data(
_public_ int sd_journal_enumerate_data(sd_journal *j, const void **data, size_t *size) {
JournalFile *f;
uint64_t p, n;
le64_t le_hash;
int r;
Object *o;
int r;
assert_return(j, -EINVAL);
assert_return(!journal_pid_changed(j), -ECHILD);
@ -2443,26 +2444,39 @@ _public_ int sd_journal_enumerate_data(sd_journal *j, const void **data, size_t
if (r < 0)
return r;
n = journal_file_entry_n_items(o);
if (j->current_field >= n)
return 0;
for (uint64_t n = journal_file_entry_n_items(o); j->current_field < n; j->current_field++) {
uint64_t p;
le64_t le_hash;
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 < 0)
return r;
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);
continue;
}
if (r < 0)
return r;
if (le_hash != o->data.hash)
return -EBADMSG;
if (le_hash != o->data.hash) {
log_debug("Entry item %"PRIu64" hash is bad, skipping over it.", j->current_field);
continue;
}
r = return_data(j, f, o, data, size);
if (r < 0)
return r;
r = return_data(j, f, o, data, size);
if (r == -EBADMSG) {
log_debug("Entry item %"PRIu64" data payload is bad, skipping over it.", j->current_field);
continue;
}
if (r < 0)
return r;
j->current_field++;
j->current_field++;
return 1;
return 1;
}
return 0;
}
_public_ int sd_journal_enumerate_available_data(sd_journal *j, const void **data, size_t *size) {

View File

@ -1,7 +1,5 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#include "sd-dhcp-server.h"
#include "alloc-util.h"
#include "bus-common-errors.h"
#include "bus-util.h"
@ -106,11 +104,17 @@ void dhcp_server_callback(sd_dhcp_server *s, uint64_t event, void *data) {
(void) dhcp_server_emit_changed(l, "Leases", NULL);
}
const sd_bus_vtable dhcp_server_vtable[] = {
static const sd_bus_vtable dhcp_server_vtable[] = {
SD_BUS_VTABLE_START(0),
SD_BUS_PROPERTY("Leases", "a(uayayayayt)", property_get_leases, 0, SD_BUS_VTABLE_PROPERTY_EMITS_CHANGE),
SD_BUS_VTABLE_END
};
const BusObjectImplementation dhcp_server_object = {
"/org/freedesktop/network1/link",
"org.freedesktop.network1.DHCPServer",
.fallback_vtables = BUS_FALLBACK_VTABLES({dhcp_server_vtable, link_object_find}),
.node_enumerator = link_node_enumerator,
};

View File

@ -2,8 +2,10 @@
#pragma once
#include "sd-bus.h"
#include "networkd-link.h"
#include "sd-dhcp-server.h"
extern const sd_bus_vtable dhcp_server_vtable[];
#include "bus-object.h"
extern const BusObjectImplementation dhcp_server_object;
void dhcp_server_callback(sd_dhcp_server *server, uint64_t event, void *data);

View File

@ -709,7 +709,7 @@ int bus_link_method_describe(sd_bus_message *message, void *userdata, sd_bus_err
return sd_bus_send(NULL, reply, NULL);
}
const sd_bus_vtable link_vtable[] = {
static const sd_bus_vtable link_vtable[] = {
SD_BUS_VTABLE_START(0),
SD_BUS_PROPERTY("OperationalState", "s", property_get_operational_state, offsetof(Link, operstate), SD_BUS_VTABLE_PROPERTY_EMITS_CHANGE),
@ -914,3 +914,10 @@ int link_send_changed(Link *link, const char *property, ...) {
return link_send_changed_strv(link, properties);
}
const BusObjectImplementation link_object = {
"/org/freedesktop/network1/link",
"org.freedesktop.network1.Link",
.fallback_vtables = BUS_FALLBACK_VTABLES({link_vtable, link_object_find}),
.node_enumerator = link_node_enumerator,
};

View File

@ -3,11 +3,12 @@
#include "sd-bus.h"
#include "bus-object.h"
#include "macro.h"
typedef struct Link Link;
extern const sd_bus_vtable link_vtable[];
extern const BusObjectImplementation link_object;
char *link_bus_path(Link *link);
int link_node_enumerator(sd_bus *bus, const char *path, void *userdata, char ***nodes, sd_bus_error *error);

View File

@ -1603,7 +1603,7 @@ static int link_carrier_gained(Link *link) {
force_reconfigure = !streq_ptr(link->previous_ssid, link->ssid);
link->previous_ssid = mfree(link->previous_ssid);
if (IN_SET(link->state, LINK_STATE_CONFIGURING, LINK_STATE_CONFIGURED)) {
if (!IN_SET(link->state, LINK_STATE_PENDING, LINK_STATE_FAILED, LINK_STATE_LINGER)) {
/* At this stage, both wlan and link information should be up-to-date. Hence,
* it is not necessary to call RTM_GETLINK, NL80211_CMD_GET_INTERFACE, or
* NL80211_CMD_GET_STATION commands, and simply call link_reconfigure_impl().
@ -2231,9 +2231,16 @@ static int link_update_alternative_names(Link *link, sd_netlink_message *message
assert(message);
r = sd_netlink_message_read_strv(message, IFLA_PROP_LIST, IFLA_ALT_IFNAME, &altnames);
if (r < 0 && r != -ENODATA)
if (r == -ENODATA)
/* The message does not have IFLA_PROP_LIST container attribute. It does not means the
* interface has no alternative name. */
return 0;
if (r < 0)
return log_link_debug_errno(link, r, "rtnl: failed to read alternative names: %m");
if (strv_equal(altnames, link->alternative_names))
return 0;
STRV_FOREACH(n, link->alternative_names)
hashmap_remove(link->manager->links_by_name, *n);

View File

@ -8,11 +8,13 @@
#include "bus-common-errors.h"
#include "bus-message-util.h"
#include "bus-polkit.h"
#include "networkd-dhcp-server-bus.h"
#include "networkd-json.h"
#include "networkd-link-bus.h"
#include "networkd-link.h"
#include "networkd-manager-bus.h"
#include "networkd-manager.h"
#include "networkd-network-bus.h"
#include "path-util.h"
#include "strv.h"
#include "user-util.h"
@ -285,7 +287,7 @@ static int property_get_namespace_id(
return sd_bus_message_append(reply, "t", id);
}
const sd_bus_vtable manager_vtable[] = {
static const sd_bus_vtable manager_vtable[] = {
SD_BUS_VTABLE_START(0),
SD_BUS_PROPERTY("OperationalState", "s", property_get_operational_state, offsetof(Manager, operational_state), SD_BUS_VTABLE_PROPERTY_EMITS_CHANGE),
@ -418,3 +420,10 @@ int manager_send_changed_strv(Manager *manager, char **properties) {
"org.freedesktop.network1.Manager",
properties);
}
const BusObjectImplementation manager_object = {
"/org/freedesktop/network1",
"org.freedesktop.network1.Manager",
.vtables = BUS_VTABLES(manager_vtable),
.children = BUS_IMPLEMENTATIONS(&dhcp_server_object, &link_object, &network_object),
};

View File

@ -3,8 +3,10 @@
#include "sd-bus.h"
#include "bus-object.h"
typedef struct Manager Manager;
extern const sd_bus_vtable manager_vtable[];
extern const BusObjectImplementation manager_object;
int manager_send_changed_strv(Manager *m, char **properties);

View File

@ -123,29 +123,9 @@ static int manager_connect_bus(Manager *m) {
if (r < 0)
return log_error_errno(r, "Failed to connect to bus: %m");
r = sd_bus_add_object_vtable(m->bus, NULL, "/org/freedesktop/network1", "org.freedesktop.network1.Manager", manager_vtable, m);
r = bus_add_implementation(m->bus, &manager_object, m);
if (r < 0)
return log_error_errno(r, "Failed to add manager object vtable: %m");
r = sd_bus_add_fallback_vtable(m->bus, NULL, "/org/freedesktop/network1/link", "org.freedesktop.network1.Link", link_vtable, link_object_find, m);
if (r < 0)
return log_error_errno(r, "Failed to add link object vtable: %m");
r = sd_bus_add_fallback_vtable(m->bus, NULL, "/org/freedesktop/network1/link", "org.freedesktop.network1.DHCPServer", dhcp_server_vtable, link_object_find, m);
if (r < 0)
return log_error_errno(r, "Failed to add link object vtable: %m");
r = sd_bus_add_node_enumerator(m->bus, NULL, "/org/freedesktop/network1/link", link_node_enumerator, m);
if (r < 0)
return log_error_errno(r, "Failed to add link enumerator: %m");
r = sd_bus_add_fallback_vtable(m->bus, NULL, "/org/freedesktop/network1/network", "org.freedesktop.network1.Network", network_vtable, network_object_find, m);
if (r < 0)
return log_error_errno(r, "Failed to add network object vtable: %m");
r = sd_bus_add_node_enumerator(m->bus, NULL, "/org/freedesktop/network1/network", network_node_enumerator, m);
if (r < 0)
return log_error_errno(r, "Failed to add network enumerator: %m");
return r;
r = bus_log_control_api_register(m->bus);
if (r < 0)

View File

@ -39,7 +39,7 @@ static int property_get_ether_addrs(
return sd_bus_message_close_container(reply);
}
const sd_bus_vtable network_vtable[] = {
static const sd_bus_vtable network_vtable[] = {
SD_BUS_VTABLE_START(0),
SD_BUS_PROPERTY("Description", "s", NULL, offsetof(Network, description), SD_BUS_VTABLE_PROPERTY_CONST),
@ -134,3 +134,10 @@ int network_object_find(sd_bus *bus, const char *path, const char *interface, vo
return 1;
}
const BusObjectImplementation network_object = {
"/org/freedesktop/network1/network",
"org.freedesktop.network1.Network",
.fallback_vtables = BUS_FALLBACK_VTABLES({network_vtable, network_object_find}),
.node_enumerator = network_node_enumerator,
};

View File

@ -3,9 +3,11 @@
#include "sd-bus.h"
#include "bus-object.h"
typedef struct Link Link;
extern const sd_bus_vtable network_vtable[];
extern const BusObjectImplementation network_object;
int network_node_enumerator(sd_bus *bus, const char *path, void *userdata, char ***nodes, sd_bus_error *error);
int network_object_find(sd_bus *bus, const char *path, const char *interface, void *userdata, void **found, sd_bus_error *error);

View File

@ -7,13 +7,16 @@
#include "sd-daemon.h"
#include "sd-event.h"
#include "bus-log-control-api.h"
#include "capability-util.h"
#include "daemon-util.h"
#include "firewall-util.h"
#include "main-func.h"
#include "mkdir-label.h"
#include "networkd-conf.h"
#include "networkd-manager-bus.h"
#include "networkd-manager.h"
#include "service-util.h"
#include "signal-util.h"
#include "user-util.h"
@ -24,6 +27,13 @@ static int run(int argc, char *argv[]) {
log_setup();
r = service_parse_argv("systemd-networkd.service",
"Manage and configure network devices, create virtual network devices",
BUS_IMPLEMENTATIONS(&manager_object, &log_control_object),
argc, argv);
if (r <= 0)
return r;
umask(0022);
if (argc != 1)

View File

@ -677,6 +677,31 @@ int config_parse_iec_uint64(
return 0;
}
int config_parse_iec_uint64_infinity(
const char* unit,
const char *filename,
unsigned line,
const char *section,
unsigned section_line,
const char *lvalue,
int ltype,
const char *rvalue,
void *data,
void *userdata) {
uint64_t *bytes = data;
assert(rvalue);
assert(data);
if (streq(rvalue, "infinity")) {
*bytes = UINT64_MAX;
return 0;
}
return config_parse_iec_uint64(unit, filename, line, section, section_line, lvalue, ltype, rvalue, data, userdata);
}
int config_parse_bool(
const char* unit,
const char *filename,

View File

@ -126,6 +126,7 @@ CONFIG_PARSER_PROTOTYPE(config_parse_double);
CONFIG_PARSER_PROTOTYPE(config_parse_iec_size);
CONFIG_PARSER_PROTOTYPE(config_parse_si_uint64);
CONFIG_PARSER_PROTOTYPE(config_parse_iec_uint64);
CONFIG_PARSER_PROTOTYPE(config_parse_iec_uint64_infinity);
CONFIG_PARSER_PROTOTYPE(config_parse_bool);
CONFIG_PARSER_PROTOTYPE(config_parse_id128);
CONFIG_PARSER_PROTOTYPE(config_parse_tristate);

View File

@ -27,9 +27,19 @@ inspect() {
systemd-analyze log-level debug
systemd-analyze log-target console
# Create a tmpfs to use as backing store for the home dir. That way we can enforce a size limit nicely.
mkdir -p /home-pool
mount -t tmpfs tmpfs /home-pool -o size=290M
# we enable --luks-discard= since we run our tests in a tight VM, hence don't
# needlessly pressure for storage
NEWPASSWORD=xEhErW0ndafV4s homectl create test-user --disk-size=256M --luks-discard=yes
# needlessly pressure for storage. We also set the cheapest KDF, since we don't
# want to waste CI CPU cycles on it.
NEWPASSWORD=xEhErW0ndafV4s homectl create test-user \
--disk-size=256M \
--luks-discard=yes \
--image-path=/home-pool/test-user.home \
--luks-pbkdf-type=pbkdf2 \
--luks-pbkdf-time-cost=1ms
inspect test-user
PASSWORD=xEhErW0ndafV4s homectl authenticate test-user
@ -77,14 +87,14 @@ if ! systemd-detect-virt -cq ; then
inspect test-user
# minimize while inactive
PASSWORD=xEhErW0ndafV4s homectl resize test-user 0
PASSWORD=xEhErW0ndafV4s homectl resize test-user min
inspect test-user
PASSWORD=xEhErW0ndafV4s homectl activate test-user
inspect test-user
# grow while active
PASSWORD=xEhErW0ndafV4s homectl resize test-user 300M
PASSWORD=xEhErW0ndafV4s homectl resize test-user max
inspect test-user
# minimize while active

View File

@ -31,6 +31,13 @@ if [ -z "$FUZZING_ENGINE" ]; then
fuzzflag="llvm-fuzz=true"
else
fuzzflag="oss-fuzz=true"
apt-get update
apt-get install -y gperf m4 gettext python3-pip \
libcap-dev libmount-dev libkmod-dev \
pkg-config wget
pip3 install meson ninja jinja2
if [[ "$SANITIZER" == undefined ]]; then
UBSAN_FLAGS="-fsanitize=pointer-overflow -fno-sanitize-recover=pointer-overflow"
CFLAGS="$CFLAGS $UBSAN_FLAGS"