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

Compare commits

..

No commits in common. "2fd1beb3e20cbd9c9a2f9d37bf301f596116b475" and "1285252823c9d7766987043ba04eb03cb2b67875" have entirely different histories.

24 changed files with 142 additions and 923 deletions

View File

@ -98,8 +98,6 @@
<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,11 +849,7 @@
<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. 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>
mechanisms are used, resizing will change file system quota.</para></listitem>
</varlistentry>
<varlistentry>

View File

@ -1,507 +0,0 @@
<?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,7 +57,6 @@ 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

@ -157,7 +157,7 @@ static int parse_config(void) {
{ "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", "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 },

View File

@ -1763,32 +1763,6 @@ 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;
@ -1807,9 +1781,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_disk_size(argv[2], &ds);
r = parse_size(argv[2], 1024, &ds);
if (r < 0)
return r;
return log_error_errno(r, "Failed to parse disk size parameter: %s", argv[2]);
}
if (arg_disk_size != UINT64_MAX) {
@ -2933,9 +2907,9 @@ static int parse_argv(int argc, char *argv[]) {
r = parse_permyriad(optarg);
if (r < 0) {
r = parse_disk_size(optarg, &arg_disk_size);
r = parse_size(optarg, 1024, &arg_disk_size);
if (r < 0)
return r;
return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "Disk size '%s' not valid.", optarg);
r = drop_from_identity("diskSizeRelative");
if (r < 0)

View File

@ -1164,39 +1164,31 @@ int home_setup_luks(
PasswordCache *cache,
UserRecord **ret_luks_home) {
sd_id128_t found_partition_uuid = SD_ID128_NULL, found_luks_uuid = SD_ID128_NULL, found_fs_uuid = SD_ID128_NULL;
sd_id128_t found_partition_uuid, found_luks_uuid, found_fs_uuid;
_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;
if (!setup->crypt_device) {
r = luks_open(h,
setup,
cache,
@ -1205,26 +1197,22 @@ int home_setup_luks(
&volume_key_size);
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);
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);
@ -1276,20 +1264,14 @@ int home_setup_luks(
log_info("Discovered used loopback device %s.", setup->loop->node);
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;
/* 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);
struct stat st;
ip = force_image_path ?: user_record_image_path(h);
@ -1297,6 +1279,15 @@ 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");
@ -1307,7 +1298,7 @@ int home_setup_luks(
setup->do_mark_clean = true;
if (!user_record_luks_discard(h)) {
r = run_fallocate(setup->image_fd, &st);
r = run_fallocate(setup->image_fd, has_stat ? &st : NULL);
if (r < 0)
return r;
}
@ -1340,11 +1331,9 @@ int home_setup_luks(
setup->undo_dm = true;
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)
@ -1370,21 +1359,13 @@ int home_setup_luks(
setup->do_offline_fallocate = !(setup->do_offline_fitrim = user_record_luks_offline_discard(h));
}
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;
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);
@ -1960,6 +1941,7 @@ 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;
@ -1967,6 +1949,7 @@ static int home_truncate(
assert(h);
assert(fd >= 0);
assert(path);
trunc = user_record_luks_discard(h);
if (!trunc) {
@ -1984,14 +1967,14 @@ static int home_truncate(
if (r < 0) {
if (ERRNO_IS_DISK_SPACE(errno)) {
log_debug_errno(errno, "Not enough disk space to allocate home of size %s.", FORMAT_BYTES(size));
log_error_errno(errno, "Not enough disk space to allocate home.");
return -ENOSPC; /* make recognizable */
}
return log_error_errno(errno, "Failed to truncate home image: %m");
return log_error_errno(errno, "Failed to truncate home image %s: %m", path);
}
return !trunc; /* Return == 0 if we managed to truncate, > 0 if we managed to allocate */
return 0;
}
int home_create_luks(
@ -2173,7 +2156,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, host_size);
r = home_truncate(h, setup->image_fd, setup->temporary_image_path, host_size);
if (r < 0)
return r;
@ -2762,39 +2745,6 @@ 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,
@ -2882,77 +2832,6 @@ 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,
@ -3090,17 +2969,11 @@ 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, largest_size;
uint64_t partition_table_extra;
partition_table_extra = old_image_size - setup->partition_size;
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)
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);
@ -3217,35 +3090,12 @@ 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 = resize_image_loop(h, setup, old_image_size, new_image_size, &resized_image_size);
r = home_truncate(h, image_fd, ip, new_image_size);
if (r < 0)
return r;
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;
log_info("Growing of image file completed.");
} else {
assert(S_ISBLK(st.st_mode));
assert(new_image_size == old_image_size);
@ -3390,11 +3240,9 @@ int home_resize_luks(
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,7 +63,6 @@ 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,7 +2297,6 @@ _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;
@ -2305,26 +2304,20 @@ _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);
continue;
}
r = journal_file_move_to_object(f, OBJECT_DATA, p, &o);
if (r < 0)
return r;
if (le_hash != d->data.hash) {
log_debug("Entry item %"PRIu64" hash is bad, skipping over it.", i);
continue;
}
if (le_hash != o->data.hash)
return -EBADMSG;
l = le64toh(d->object.size) - offsetof(Object, data.payload);
l = le64toh(o->object.size) - offsetof(Object, data.payload);
compression = d->object.flags & OBJECT_COMPRESSION_MASK;
compression = o->object.flags & OBJECT_COMPRESSION_MASK;
if (compression) {
#if HAVE_COMPRESSION
r = decompress_startswith(compression,
d->data.payload, l,
o->data.payload, l,
&f->compress_buffer,
field, field_length, '=');
if (r < 0)
@ -2335,7 +2328,7 @@ _public_ int sd_journal_get_data(sd_journal *j, const char *field, const void **
size_t rsize;
r = decompress_blob(compression,
d->data.payload, l,
o->data.payload, l,
&f->compress_buffer, &rsize,
j->data_threshold);
if (r < 0)
@ -2350,19 +2343,23 @@ _public_ int sd_journal_get_data(sd_journal *j, const char *field, const void **
return -EPROTONOSUPPORT;
#endif
} else if (l >= field_length+1 &&
memcmp(d->data.payload, field, field_length) == 0 &&
d->data.payload[field_length] == '=') {
memcmp(o->data.payload, field, field_length) == 0 &&
o->data.payload[field_length] == '=') {
t = (size_t) l;
if ((uint64_t) t != l)
return -E2BIG;
*data = d->data.payload;
*data = o->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;
@ -2425,8 +2422,10 @@ static int return_data(
_public_ int sd_journal_enumerate_data(sd_journal *j, const void **data, size_t *size) {
JournalFile *f;
Object *o;
uint64_t p, n;
le64_t le_hash;
int r;
Object *o;
assert_return(j, -EINVAL);
assert_return(!journal_pid_changed(j), -ECHILD);
@ -2444,30 +2443,20 @@ _public_ int sd_journal_enumerate_data(sd_journal *j, const void **data, size_t
if (r < 0)
return r;
for (uint64_t n = journal_file_entry_n_items(o); j->current_field < n; j->current_field++) {
uint64_t p;
le64_t le_hash;
n = journal_file_entry_n_items(o);
if (j->current_field >= n)
return 0;
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) {
log_debug("Entry item %"PRIu64" hash is bad, skipping over it.", j->current_field);
continue;
}
if (le_hash != o->data.hash)
return -EBADMSG;
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;
@ -2476,9 +2465,6 @@ _public_ int sd_journal_enumerate_data(sd_journal *j, const void **data, size_t
return 1;
}
return 0;
}
_public_ int sd_journal_enumerate_available_data(sd_journal *j, const void **data, size_t *size) {
for (;;) {
int r;

View File

@ -1,5 +1,7 @@
/* 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"
@ -104,17 +106,11 @@ void dhcp_server_callback(sd_dhcp_server *s, uint64_t event, void *data) {
(void) dhcp_server_emit_changed(l, "Leases", NULL);
}
static const sd_bus_vtable dhcp_server_vtable[] = {
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,10 +2,8 @@
#pragma once
#include "sd-bus.h"
#include "sd-dhcp-server.h"
#include "networkd-link.h"
#include "bus-object.h"
extern const BusObjectImplementation dhcp_server_object;
extern const sd_bus_vtable dhcp_server_vtable[];
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);
}
static const sd_bus_vtable link_vtable[] = {
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,10 +914,3 @@ 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,12 +3,11 @@
#include "sd-bus.h"
#include "bus-object.h"
#include "macro.h"
typedef struct Link Link;
extern const BusObjectImplementation link_object;
extern const sd_bus_vtable link_vtable[];
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_PENDING, LINK_STATE_FAILED, LINK_STATE_LINGER)) {
if (IN_SET(link->state, LINK_STATE_CONFIGURING, LINK_STATE_CONFIGURED)) {
/* 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,16 +2231,9 @@ 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 == -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)
if (r < 0 && r != -ENODATA)
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,13 +8,11 @@
#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"
@ -287,7 +285,7 @@ static int property_get_namespace_id(
return sd_bus_message_append(reply, "t", id);
}
static const sd_bus_vtable manager_vtable[] = {
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),
@ -420,10 +418,3 @@ 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,10 +3,8 @@
#include "sd-bus.h"
#include "bus-object.h"
typedef struct Manager Manager;
extern const BusObjectImplementation manager_object;
extern const sd_bus_vtable manager_vtable[];
int manager_send_changed_strv(Manager *m, char **properties);

View File

@ -123,9 +123,29 @@ static int manager_connect_bus(Manager *m) {
if (r < 0)
return log_error_errno(r, "Failed to connect to bus: %m");
r = bus_add_implementation(m->bus, &manager_object, m);
r = sd_bus_add_object_vtable(m->bus, NULL, "/org/freedesktop/network1", "org.freedesktop.network1.Manager", manager_vtable, m);
if (r < 0)
return r;
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");
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);
}
static const sd_bus_vtable network_vtable[] = {
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,10 +134,3 @@ 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,11 +3,9 @@
#include "sd-bus.h"
#include "bus-object.h"
typedef struct Link Link;
extern const BusObjectImplementation network_object;
extern const sd_bus_vtable network_vtable[];
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,16 +7,13 @@
#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"
@ -27,13 +24,6 @@ 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,31 +677,6 @@ 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,7 +126,6 @@ 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,19 +27,9 @@ 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. 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
# needlessly pressure for storage
NEWPASSWORD=xEhErW0ndafV4s homectl create test-user --disk-size=256M --luks-discard=yes
inspect test-user
PASSWORD=xEhErW0ndafV4s homectl authenticate test-user
@ -87,14 +77,14 @@ if ! systemd-detect-virt -cq ; then
inspect test-user
# minimize while inactive
PASSWORD=xEhErW0ndafV4s homectl resize test-user min
PASSWORD=xEhErW0ndafV4s homectl resize test-user 0
inspect test-user
PASSWORD=xEhErW0ndafV4s homectl activate test-user
inspect test-user
# grow while active
PASSWORD=xEhErW0ndafV4s homectl resize test-user max
PASSWORD=xEhErW0ndafV4s homectl resize test-user 300M
inspect test-user
# minimize while active

View File

@ -31,13 +31,6 @@ 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"