Compare commits

..

15 Commits

Author SHA1 Message Date
Zbigniew Jędrzejewski-Szmek c83a5ead31 Merge pull request #15210 from ssahani/networkctl-up-down
Merging by hand because github refuses merging because "Rebasing the commits of
this branch on top of the base branch cannot be performed automatically as this
would create a different result than a regular merge.".
2020-04-02 11:21:25 +02:00
Vito Caputo 935052a8aa sd-bus: add va_list variants of variadic convenience functions
Consumers of the sd-bus convenience API can't make convenience
helpers of their own without va_list variants.

This commit is a mechanical change splitting out the existing function
bodies into bare va_list variants having a 'v' suffixed to the names.

The original functions now simply create the va_list before forwarding
the call on to the va_list variant, and the va_list variants dispense
with those steps.
2020-04-02 10:26:18 +02:00
Zbigniew Jędrzejewski-Szmek c51c6f2f57
Merge pull request #15252 from ssahani/dhcpv6-mud
DHCPv6: Add support to send MUD URL
2020-04-02 10:23:15 +02:00
Zbigniew Jędrzejewski-Szmek 4e561c6200
Merge pull request #15109 from keszybz/units-make-installable
Make homed/userdbd/repart services installable (to allow uninstalling)
2020-04-02 10:21:29 +02:00
Lénaïc Huard 61fd7d6720 udev: Fix SIGSEGV in AlternativeNamesPolicy handling
The function sd_device_get_property_value has some paths where it exits without
touching the n pointer. In those cases, n remained uninitialized until it was
eventually read inside isempty where it caused the segmentation fault.

Fixes #15078
2020-04-02 10:18:56 +02:00
Lennart Poettering e7b0ea5440
Merge pull request #15238 from rpls/canfd
network: can: add support for CAN-FD related properties
2020-04-02 10:13:24 +02:00
Richard Petri 7e025e9cdb network: can: add support for CAN-FD related properties 2020-04-01 20:07:20 +02:00
Richard Petri 74a2726869 network: can: introduce a config parser function for bitrates
For now, this function is nearly equivalent to the si_uint64 parser, except for
an additional range check as Linux only takes 32-bit values as bitrates. In
future, this may also be used to introduce fancier bitrate config formats.
2020-04-01 20:07:20 +02:00
Susant Sahani 3175a8c21b network: DHCPv6 Add support to send MUD URL 2020-04-01 17:01:12 +02:00
Susant Sahani de8d6e5563 sd-dhcpv6: Add support to set request MUD URL 2020-04-01 16:59:29 +02:00
Zbigniew Jędrzejewski-Szmek 20f938ff7f test: print path to build directory on misconfiguration
This way it's easier to see when a wrong $BUILD_DIR was passed.
2020-03-31 15:13:13 +02:00
Zbigniew Jędrzejewski-Szmek ead7af3093 units: make systemd-userdbd.{socket,service} installable
It's lightweight and generally useful, so it should be enabled by default. But
users might want to disable it for whatever reason, and things should be fine
without it, so let's make it installable so it can be disabled if wanted.

Fixes #15175.
2020-03-31 14:55:16 +02:00
Zbigniew Jędrzejewski-Szmek 5ef9eda17f units: make systemd-homed.service installable
Fixes #15083. Users might want to disable homed if not used to save resources.
2020-03-31 14:55:14 +02:00
Zbigniew Jędrzejewski-Szmek 7e1ed1f3b2 units: make systemd-repart.service installable
This essentially adds another layer of configurability:
build disable, this, presence of configuration. The default is
set to enabled, because the service does nothing w/o config.
2020-03-31 14:51:04 +02:00
Susant Sahani c30ffcee9b networkctl: Add support to set link up and down 2020-03-26 19:42:03 +01:00
29 changed files with 542 additions and 59 deletions

View File

@ -259,6 +259,20 @@ s - Service VLAN, m - Two-port MAC Relay (TPMR)
<listitem><para>Deletes virtual netdevs. Takes interface name or index number.</para></listitem> <listitem><para>Deletes virtual netdevs. Takes interface name or index number.</para></listitem>
</varlistentry> </varlistentry>
<varlistentry>
<term>
<command>up</command>
</term>
<listitem><para>Bring devices up. Takes interface name or index number.</para></listitem>
</varlistentry>
<varlistentry>
<term>
<command>down</command>
</term>
<listitem><para>Bring devices down. Takes interface name or index number.</para></listitem>
</varlistentry>
<varlistentry> <varlistentry>
<term> <term>
<command>renew</command> <command>renew</command>

View File

@ -18,7 +18,9 @@
<refnamediv> <refnamediv>
<refname>sd_bus_call_method</refname> <refname>sd_bus_call_method</refname>
<refname>sd_bus_call_methodv</refname>
<refname>sd_bus_call_method_async</refname> <refname>sd_bus_call_method_async</refname>
<refname>sd_bus_call_method_asyncv</refname>
<refpurpose>Initialize a bus message object and invoke the corresponding D-Bus method call <refpurpose>Initialize a bus message object and invoke the corresponding D-Bus method call
</refpurpose> </refpurpose>
@ -41,6 +43,19 @@
<paramdef>...</paramdef> <paramdef>...</paramdef>
</funcprototype> </funcprototype>
<funcprototype>
<funcdef>int <function>sd_bus_call_methodv</function></funcdef>
<paramdef>sd_bus *<parameter>bus</parameter></paramdef>
<paramdef>const char *<parameter>destination</parameter></paramdef>
<paramdef>const char *<parameter>path</parameter></paramdef>
<paramdef>const char *<parameter>interface</parameter></paramdef>
<paramdef>const char *<parameter>member</parameter></paramdef>
<paramdef>sd_bus_error *<parameter>ret_error</parameter></paramdef>
<paramdef>sd_bus_message **<parameter>reply</parameter></paramdef>
<paramdef>const char *<parameter>types</parameter></paramdef>
<paramdef>va_list <parameter>ap</parameter></paramdef>
</funcprototype>
<funcprototype> <funcprototype>
<funcdef>int <function>sd_bus_call_method_async</function></funcdef> <funcdef>int <function>sd_bus_call_method_async</function></funcdef>
<paramdef>sd_bus *<parameter>bus</parameter></paramdef> <paramdef>sd_bus *<parameter>bus</parameter></paramdef>
@ -54,6 +69,20 @@
<paramdef>const char *<parameter>types</parameter></paramdef> <paramdef>const char *<parameter>types</parameter></paramdef>
<paramdef>...</paramdef> <paramdef>...</paramdef>
</funcprototype> </funcprototype>
<funcprototype>
<funcdef>int <function>sd_bus_call_method_asyncv</function></funcdef>
<paramdef>sd_bus *<parameter>bus</parameter></paramdef>
<paramdef>sd_bus_slot **<parameter>slot</parameter></paramdef>
<paramdef>const char *<parameter>destination</parameter></paramdef>
<paramdef>const char *<parameter>path</parameter></paramdef>
<paramdef>const char *<parameter>interface</parameter></paramdef>
<paramdef>const char *<parameter>member</parameter></paramdef>
<paramdef>sd_bus_message_handler_t <parameter>callback</parameter></paramdef>
<paramdef>void *<parameter>userdata</parameter></paramdef>
<paramdef>const char *<parameter>types</parameter></paramdef>
<paramdef>va_list <parameter>ap</parameter></paramdef>
</funcprototype>
</funcsynopsis> </funcsynopsis>
</refsynopsisdiv> </refsynopsisdiv>

View File

@ -19,8 +19,10 @@
<refnamediv> <refnamediv>
<refname>sd_bus_reply_method_error</refname> <refname>sd_bus_reply_method_error</refname>
<refname>sd_bus_reply_method_errorf</refname> <refname>sd_bus_reply_method_errorf</refname>
<refname>sd_bus_reply_method_errorfv</refname>
<refname>sd_bus_reply_method_errno</refname> <refname>sd_bus_reply_method_errno</refname>
<refname>sd_bus_reply_method_errnof</refname> <refname>sd_bus_reply_method_errnof</refname>
<refname>sd_bus_reply_method_errnofv</refname>
<refpurpose>Reply with an error to a D-Bus method call</refpurpose> <refpurpose>Reply with an error to a D-Bus method call</refpurpose>
</refnamediv> </refnamediv>
@ -40,7 +42,15 @@
<paramdef>sd_bus_message *<parameter>call</parameter></paramdef> <paramdef>sd_bus_message *<parameter>call</parameter></paramdef>
<paramdef>const char *<parameter>name</parameter></paramdef> <paramdef>const char *<parameter>name</parameter></paramdef>
<paramdef>const char *<parameter>format</parameter></paramdef> <paramdef>const char *<parameter>format</parameter></paramdef>
<paramdef></paramdef> <paramdef>...</paramdef>
</funcprototype>
<funcprototype>
<funcdef>int sd_bus_reply_method_errorfv</funcdef>
<paramdef>sd_bus_message *<parameter>call</parameter></paramdef>
<paramdef>const char *<parameter>name</parameter></paramdef>
<paramdef>const char *<parameter>format</parameter></paramdef>
<paramdef>va_list <parameter>ap</parameter></paramdef>
</funcprototype> </funcprototype>
<funcprototype> <funcprototype>
@ -55,7 +65,15 @@
<paramdef>sd_bus_message *<parameter>call</parameter></paramdef> <paramdef>sd_bus_message *<parameter>call</parameter></paramdef>
<paramdef>int <parameter>error</parameter></paramdef> <paramdef>int <parameter>error</parameter></paramdef>
<paramdef>const char *<parameter>format</parameter></paramdef> <paramdef>const char *<parameter>format</parameter></paramdef>
<paramdef></paramdef> <paramdef>...</paramdef>
</funcprototype>
<funcprototype>
<funcdef>int sd_bus_reply_method_errnofv</funcdef>
<paramdef>sd_bus_message *<parameter>call</parameter></paramdef>
<paramdef>int <parameter>error</parameter></paramdef>
<paramdef>const char *<parameter>format</parameter></paramdef>
<paramdef>va_list <parameter>ap</parameter></paramdef>
</funcprototype> </funcprototype>
</funcsynopsis> </funcsynopsis>
</refsynopsisdiv> </refsynopsisdiv>

View File

@ -18,6 +18,7 @@
<refnamediv> <refnamediv>
<refname>sd_bus_reply_method_return</refname> <refname>sd_bus_reply_method_return</refname>
<refname>sd_bus_reply_method_returnv</refname>
<refpurpose>Reply to a D-Bus method call</refpurpose> <refpurpose>Reply to a D-Bus method call</refpurpose>
</refnamediv> </refnamediv>
@ -32,6 +33,13 @@
<paramdef>const char *<parameter>types</parameter></paramdef> <paramdef>const char *<parameter>types</parameter></paramdef>
<paramdef>...</paramdef> <paramdef>...</paramdef>
</funcprototype> </funcprototype>
<funcprototype>
<funcdef>int sd_bus_reply_method_returnv</funcdef>
<paramdef>sd_bus_message *<parameter>call</parameter></paramdef>
<paramdef>const char *<parameter>types</parameter></paramdef>
<paramdef>va_list <parameter>ap</parameter></paramdef>
</funcprototype>
</funcsynopsis> </funcsynopsis>
</refsynopsisdiv> </refsynopsisdiv>

View File

@ -1704,6 +1704,16 @@
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry>
<term><varname>MUDURL=</varname></term>
<listitem>
<para>When configured, the Manufacturer Usage Descriptions (MUD) URL will be sent to the DHCPV6 server.
Takes an URL of length up to 255 characters. A superficial verification that the string is a valid URL
will be performed. DHCPv6 clients are intended to have at most one MUD URL associated with them. See
<ulink url="https://tools.ietf.org/html/rfc8520">RFC 8520</ulink>.</para>
</listitem>
</varlistentry>
<varlistentry> <varlistentry>
<term><varname>ForceDHCPv6PDOtherInformation=</varname></term> <term><varname>ForceDHCPv6PDOtherInformation=</varname></term>
<listitem> <listitem>
@ -2350,7 +2360,7 @@
<term><varname>BitRate=</varname></term> <term><varname>BitRate=</varname></term>
<listitem> <listitem>
<para>The bitrate of CAN device in bits per second. The usual SI prefixes (K, M) with the base of 1000 can <para>The bitrate of CAN device in bits per second. The usual SI prefixes (K, M) with the base of 1000 can
be used here.</para> be used here. Takes a number in the range 1..4294967295.</para>
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
@ -2360,6 +2370,29 @@
<literal>87.5%</literal>) or permille (e.g. <literal>875‰</literal>).</para> <literal>87.5%</literal>) or permille (e.g. <literal>875‰</literal>).</para>
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry>
<term><varname>DataBitRate=</varname></term>
<term><varname>DataSamplePoint=</varname></term>
<listitem>
<para>The bitrate and sample point for the data phase, if CAN-FD is used. These settings are
analogous to the <varname>BitRate=</varname> and <varname>SamplePoint=</varname> keys.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><varname>FDMode=</varname></term>
<listitem>
<para>Takes a boolean. When <literal>yes</literal>, CAN-FD mode is enabled for the interface.
Note, that a bitrate and optional sample point should also be set for the CAN-FD data phase using
the <varname>DataBitRate=</varname> and <varname>DataSamplePoint=</varname> keys.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><varname>FDNonISO=</varname></term>
<listitem>
<para>Takes a boolean. When <literal>yes</literal>, non-ISO CAN-FD mode is enabled for the
interface. When unset, the kernel's default will be used.</para>
</listitem>
</varlistentry>
<varlistentry> <varlistentry>
<term><varname>RestartSec=</varname></term> <term><varname>RestartSec=</varname></term>
<listitem> <listitem>

View File

@ -19,6 +19,9 @@ enable getty@.service
enable systemd-timesyncd.service enable systemd-timesyncd.service
enable systemd-networkd.service enable systemd-networkd.service
enable systemd-resolved.service enable systemd-resolved.service
enable systemd-repart.service
enable systemd-homed.service
enable systemd-userdbd.socket
disable console-getty.service disable console-getty.service
disable debug-shell.service disable debug-shell.service

View File

@ -25,6 +25,7 @@
#include "socket-util.h" #include "socket-util.h"
#include "string-table.h" #include "string-table.h"
#include "util.h" #include "util.h"
#include "web-util.h"
#define MAX_MAC_ADDR_LEN INFINIBAND_ALEN #define MAX_MAC_ADDR_LEN INFINIBAND_ALEN
@ -65,6 +66,7 @@ struct sd_dhcp6_client {
size_t req_opts_allocated; size_t req_opts_allocated;
size_t req_opts_len; size_t req_opts_len;
char *fqdn; char *fqdn;
char *mudurl;
sd_event_source *receive_message; sd_event_source *receive_message;
usec_t retransmit_time; usec_t retransmit_time;
uint8_t retransmit_count; uint8_t retransmit_count;
@ -363,6 +365,17 @@ int sd_dhcp6_client_set_request_option(sd_dhcp6_client *client, uint16_t option)
return 0; return 0;
} }
int sd_dhcp6_client_set_request_mud_url(sd_dhcp6_client *client, char *mudurl) {
assert_return(client, -EINVAL);
assert_return(client->state == DHCP6_STATE_STOPPED, -EBUSY);
assert_return(mudurl, -EINVAL);
assert_return(strlen(mudurl) <= 255, -EINVAL);
assert_return(http_url_is_valid(mudurl), -EINVAL);
return free_and_strdup(&client->mudurl, mudurl);
}
int sd_dhcp6_client_get_prefix_delegation(sd_dhcp6_client *client, int *delegation) { int sd_dhcp6_client_get_prefix_delegation(sd_dhcp6_client *client, int *delegation) {
assert_return(client, -EINVAL); assert_return(client, -EINVAL);
assert_return(delegation, -EINVAL); assert_return(delegation, -EINVAL);
@ -484,6 +497,14 @@ static int client_send_message(sd_dhcp6_client *client, usec_t time_now) {
case DHCP6_STATE_INFORMATION_REQUEST: case DHCP6_STATE_INFORMATION_REQUEST:
message->type = DHCP6_INFORMATION_REQUEST; message->type = DHCP6_INFORMATION_REQUEST;
if (client->mudurl) {
r = dhcp6_option_append(&opt, &optlen,
SD_DHCP6_OPTION_MUD_URL, strlen(client->mudurl),
client->mudurl);
if (r < 0)
return r;
}
break; break;
case DHCP6_STATE_SOLICITATION: case DHCP6_STATE_SOLICITATION:
@ -507,6 +528,14 @@ static int client_send_message(sd_dhcp6_client *client, usec_t time_now) {
return r; return r;
} }
if (client->mudurl) {
r = dhcp6_option_append(&opt, &optlen,
SD_DHCP6_OPTION_MUD_URL, strlen(client->mudurl),
client->mudurl);
if (r < 0)
return r;
}
if (FLAGS_SET(client->request, DHCP6_REQUEST_IA_PD)) { if (FLAGS_SET(client->request, DHCP6_REQUEST_IA_PD)) {
r = dhcp6_option_append_pd(opt, optlen, &client->ia_pd, &client->hint_pd_prefix); r = dhcp6_option_append_pd(opt, optlen, &client->ia_pd, &client->hint_pd_prefix);
if (r < 0) if (r < 0)
@ -545,6 +574,14 @@ static int client_send_message(sd_dhcp6_client *client, usec_t time_now) {
return r; return r;
} }
if (client->mudurl) {
r = dhcp6_option_append(&opt, &optlen,
SD_DHCP6_OPTION_MUD_URL, strlen(client->mudurl),
client->mudurl);
if (r < 0)
return r;
}
if (FLAGS_SET(client->request, DHCP6_REQUEST_IA_PD)) { if (FLAGS_SET(client->request, DHCP6_REQUEST_IA_PD)) {
r = dhcp6_option_append_pd(opt, optlen, &client->lease->pd, NULL); r = dhcp6_option_append_pd(opt, optlen, &client->lease->pd, NULL);
if (r < 0) if (r < 0)
@ -571,6 +608,14 @@ static int client_send_message(sd_dhcp6_client *client, usec_t time_now) {
return r; return r;
} }
if (client->mudurl) {
r = dhcp6_option_append(&opt, &optlen,
SD_DHCP6_OPTION_MUD_URL, strlen(client->mudurl),
client->mudurl);
if (r < 0)
return r;
}
if (FLAGS_SET(client->request, DHCP6_REQUEST_IA_PD)) { if (FLAGS_SET(client->request, DHCP6_REQUEST_IA_PD)) {
r = dhcp6_option_append_pd(opt, optlen, &client->lease->pd, NULL); r = dhcp6_option_append_pd(opt, optlen, &client->lease->pd, NULL);
if (r < 0) if (r < 0)
@ -1521,6 +1566,7 @@ static sd_dhcp6_client *dhcp6_client_free(sd_dhcp6_client *client) {
free(client->req_opts); free(client->req_opts);
free(client->fqdn); free(client->fqdn);
free(client->mudurl);
return mfree(client); return mfree(client);
} }

View File

@ -700,6 +700,13 @@ global:
LIBSYSTEMD_246 { LIBSYSTEMD_246 {
global: global:
sd_bus_call_methodv;
sd_bus_call_method_asyncv;
sd_bus_emit_signalv;
sd_bus_reply_method_errnofv;
sd_bus_reply_method_errorfv;
sd_bus_reply_method_returnv;
sd_bus_set_propertyv;
sd_path_lookup; sd_path_lookup;
sd_path_lookup_strv; sd_path_lookup_strv;
} LIBSYSTEMD_245; } LIBSYSTEMD_245;

View File

@ -10,12 +10,12 @@
#include "bus-util.h" #include "bus-util.h"
#include "string-util.h" #include "string-util.h"
_public_ int sd_bus_emit_signal( _public_ int sd_bus_emit_signalv(
sd_bus *bus, sd_bus *bus,
const char *path, const char *path,
const char *interface, const char *interface,
const char *member, const char *member,
const char *types, ...) { const char *types, va_list ap) {
_cleanup_(sd_bus_message_unrefp) sd_bus_message *m = NULL; _cleanup_(sd_bus_message_unrefp) sd_bus_message *m = NULL;
int r; int r;
@ -32,11 +32,7 @@ _public_ int sd_bus_emit_signal(
return r; return r;
if (!isempty(types)) { if (!isempty(types)) {
va_list ap;
va_start(ap, types);
r = sd_bus_message_appendv(m, types, ap); r = sd_bus_message_appendv(m, types, ap);
va_end(ap);
if (r < 0) if (r < 0)
return r; return r;
} }
@ -44,7 +40,24 @@ _public_ int sd_bus_emit_signal(
return sd_bus_send(bus, m, NULL); return sd_bus_send(bus, m, NULL);
} }
_public_ int sd_bus_call_method_async( _public_ int sd_bus_emit_signal(
sd_bus *bus,
const char *path,
const char *interface,
const char *member,
const char *types, ...) {
va_list ap;
int r;
va_start(ap, types);
r = sd_bus_emit_signalv(bus, path, interface, member, types, ap);
va_end(ap);
return r;
}
_public_ int sd_bus_call_method_asyncv(
sd_bus *bus, sd_bus *bus,
sd_bus_slot **slot, sd_bus_slot **slot,
const char *destination, const char *destination,
@ -53,7 +66,7 @@ _public_ int sd_bus_call_method_async(
const char *member, const char *member,
sd_bus_message_handler_t callback, sd_bus_message_handler_t callback,
void *userdata, void *userdata,
const char *types, ...) { const char *types, va_list ap) {
_cleanup_(sd_bus_message_unrefp) sd_bus_message *m = NULL; _cleanup_(sd_bus_message_unrefp) sd_bus_message *m = NULL;
int r; int r;
@ -70,11 +83,7 @@ _public_ int sd_bus_call_method_async(
return r; return r;
if (!isempty(types)) { if (!isempty(types)) {
va_list ap;
va_start(ap, types);
r = sd_bus_message_appendv(m, types, ap); r = sd_bus_message_appendv(m, types, ap);
va_end(ap);
if (r < 0) if (r < 0)
return r; return r;
} }
@ -82,7 +91,28 @@ _public_ int sd_bus_call_method_async(
return sd_bus_call_async(bus, slot, m, callback, userdata, 0); return sd_bus_call_async(bus, slot, m, callback, userdata, 0);
} }
_public_ int sd_bus_call_method( _public_ int sd_bus_call_method_async(
sd_bus *bus,
sd_bus_slot **slot,
const char *destination,
const char *path,
const char *interface,
const char *member,
sd_bus_message_handler_t callback,
void *userdata,
const char *types, ...) {
va_list ap;
int r;
va_start(ap, types);
r = sd_bus_call_method_asyncv(bus, slot, destination, path, interface, member, callback, userdata, types, ap);
va_end(ap);
return r;
}
_public_ int sd_bus_call_methodv(
sd_bus *bus, sd_bus *bus,
const char *destination, const char *destination,
const char *path, const char *path,
@ -90,7 +120,7 @@ _public_ int sd_bus_call_method(
const char *member, const char *member,
sd_bus_error *error, sd_bus_error *error,
sd_bus_message **reply, sd_bus_message **reply,
const char *types, ...) { const char *types, va_list ap) {
_cleanup_(sd_bus_message_unrefp) sd_bus_message *m = NULL; _cleanup_(sd_bus_message_unrefp) sd_bus_message *m = NULL;
int r; int r;
@ -109,11 +139,7 @@ _public_ int sd_bus_call_method(
goto fail; goto fail;
if (!isempty(types)) { if (!isempty(types)) {
va_list ap;
va_start(ap, types);
r = sd_bus_message_appendv(m, types, ap); r = sd_bus_message_appendv(m, types, ap);
va_end(ap);
if (r < 0) if (r < 0)
goto fail; goto fail;
} }
@ -124,10 +150,30 @@ fail:
return sd_bus_error_set_errno(error, r); return sd_bus_error_set_errno(error, r);
} }
_public_ int sd_bus_reply_method_return( _public_ int sd_bus_call_method(
sd_bus_message *call, sd_bus *bus,
const char *destination,
const char *path,
const char *interface,
const char *member,
sd_bus_error *error,
sd_bus_message **reply,
const char *types, ...) { const char *types, ...) {
va_list ap;
int r;
va_start(ap, types);
r = sd_bus_call_methodv(bus, destination, path, interface, member, error, reply, types, ap);
va_end(ap);
return r;
}
_public_ int sd_bus_reply_method_returnv(
sd_bus_message *call,
const char *types, va_list ap) {
_cleanup_(sd_bus_message_unrefp) sd_bus_message *m = NULL; _cleanup_(sd_bus_message_unrefp) sd_bus_message *m = NULL;
int r; int r;
@ -148,11 +194,7 @@ _public_ int sd_bus_reply_method_return(
return r; return r;
if (!isempty(types)) { if (!isempty(types)) {
va_list ap;
va_start(ap, types);
r = sd_bus_message_appendv(m, types, ap); r = sd_bus_message_appendv(m, types, ap);
va_end(ap);
if (r < 0) if (r < 0)
return r; return r;
} }
@ -160,6 +202,20 @@ _public_ int sd_bus_reply_method_return(
return sd_bus_send(call->bus, m, NULL); return sd_bus_send(call->bus, m, NULL);
} }
_public_ int sd_bus_reply_method_return(
sd_bus_message *call,
const char *types, ...) {
va_list ap;
int r;
va_start(ap, types);
r = sd_bus_reply_method_returnv(call, types, ap);
va_end(ap);
return r;
}
_public_ int sd_bus_reply_method_error( _public_ int sd_bus_reply_method_error(
sd_bus_message *call, sd_bus_message *call,
const sd_bus_error *e) { const sd_bus_error *e) {
@ -187,14 +243,13 @@ _public_ int sd_bus_reply_method_error(
return sd_bus_send(call->bus, m, NULL); return sd_bus_send(call->bus, m, NULL);
} }
_public_ int sd_bus_reply_method_errorf( _public_ int sd_bus_reply_method_errorfv(
sd_bus_message *call, sd_bus_message *call,
const char *name, const char *name,
const char *format, const char *format,
...) { va_list ap) {
_cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL; _cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL;
va_list ap;
assert_return(call, -EINVAL); assert_return(call, -EINVAL);
assert_return(call->sealed, -EPERM); assert_return(call->sealed, -EPERM);
@ -208,13 +263,27 @@ _public_ int sd_bus_reply_method_errorf(
if (call->header->flags & BUS_MESSAGE_NO_REPLY_EXPECTED) if (call->header->flags & BUS_MESSAGE_NO_REPLY_EXPECTED)
return 0; return 0;
va_start(ap, format);
bus_error_setfv(&error, name, format, ap); bus_error_setfv(&error, name, format, ap);
va_end(ap);
return sd_bus_reply_method_error(call, &error); return sd_bus_reply_method_error(call, &error);
} }
_public_ int sd_bus_reply_method_errorf(
sd_bus_message *call,
const char *name,
const char *format,
...) {
va_list ap;
int r;
va_start(ap, format);
r = sd_bus_reply_method_errorfv(call, name, format, ap);
va_end(ap);
return r;
}
_public_ int sd_bus_reply_method_errno( _public_ int sd_bus_reply_method_errno(
sd_bus_message *call, sd_bus_message *call,
int error, int error,
@ -242,14 +311,13 @@ _public_ int sd_bus_reply_method_errno(
return sd_bus_reply_method_error(call, &berror); return sd_bus_reply_method_error(call, &berror);
} }
_public_ int sd_bus_reply_method_errnof( _public_ int sd_bus_reply_method_errnofv(
sd_bus_message *call, sd_bus_message *call,
int error, int error,
const char *format, const char *format,
...) { va_list ap) {
_cleanup_(sd_bus_error_free) sd_bus_error berror = SD_BUS_ERROR_NULL; _cleanup_(sd_bus_error_free) sd_bus_error berror = SD_BUS_ERROR_NULL;
va_list ap;
assert_return(call, -EINVAL); assert_return(call, -EINVAL);
assert_return(call->sealed, -EPERM); assert_return(call->sealed, -EPERM);
@ -263,13 +331,27 @@ _public_ int sd_bus_reply_method_errnof(
if (call->header->flags & BUS_MESSAGE_NO_REPLY_EXPECTED) if (call->header->flags & BUS_MESSAGE_NO_REPLY_EXPECTED)
return 0; return 0;
va_start(ap, format);
sd_bus_error_set_errnofv(&berror, error, format, ap); sd_bus_error_set_errnofv(&berror, error, format, ap);
va_end(ap);
return sd_bus_reply_method_error(call, &berror); return sd_bus_reply_method_error(call, &berror);
} }
_public_ int sd_bus_reply_method_errnof(
sd_bus_message *call,
int error,
const char *format,
...) {
va_list ap;
int r;
va_start(ap, format);
r = sd_bus_reply_method_errnofv(call, error, format, ap);
va_end(ap);
return r;
}
_public_ int sd_bus_get_property( _public_ int sd_bus_get_property(
sd_bus *bus, sd_bus *bus,
const char *destination, const char *destination,
@ -452,17 +534,16 @@ fail:
return sd_bus_error_set_errno(error, r); return sd_bus_error_set_errno(error, r);
} }
_public_ int sd_bus_set_property( _public_ int sd_bus_set_propertyv(
sd_bus *bus, sd_bus *bus,
const char *destination, const char *destination,
const char *path, const char *path,
const char *interface, const char *interface,
const char *member, const char *member,
sd_bus_error *error, sd_bus_error *error,
const char *type, ...) { const char *type, va_list ap) {
_cleanup_(sd_bus_message_unrefp) sd_bus_message *m = NULL; _cleanup_(sd_bus_message_unrefp) sd_bus_message *m = NULL;
va_list ap;
int r; int r;
bus_assert_return(bus, -EINVAL, error); bus_assert_return(bus, -EINVAL, error);
@ -489,9 +570,7 @@ _public_ int sd_bus_set_property(
if (r < 0) if (r < 0)
goto fail; goto fail;
va_start(ap, type);
r = sd_bus_message_appendv(m, type, ap); r = sd_bus_message_appendv(m, type, ap);
va_end(ap);
if (r < 0) if (r < 0)
goto fail; goto fail;
@ -505,6 +584,25 @@ fail:
return sd_bus_error_set_errno(error, r); return sd_bus_error_set_errno(error, r);
} }
_public_ int sd_bus_set_property(
sd_bus *bus,
const char *destination,
const char *path,
const char *interface,
const char *member,
sd_bus_error *error,
const char *type, ...) {
va_list ap;
int r;
va_start(ap, type);
r = sd_bus_set_propertyv(bus, destination, path, interface, member, error, type, ap);
va_end(ap);
return r;
}
_public_ int sd_bus_query_sender_creds(sd_bus_message *call, uint64_t mask, sd_bus_creds **creds) { _public_ int sd_bus_query_sender_creds(sd_bus_message *call, uint64_t mask, sd_bus_creds **creds) {
sd_bus_creds *c; sd_bus_creds *c;

View File

@ -2184,6 +2184,69 @@ static int link_delete_send_message(sd_netlink *rtnl, int index) {
return 0; return 0;
} }
static int link_up_down_send_message(sd_netlink *rtnl, char *command, int index) {
_cleanup_(sd_netlink_message_unrefp) sd_netlink_message *req = NULL;
int r;
assert(rtnl);
r = sd_rtnl_message_new_link(rtnl, &req, RTM_SETLINK, index);
if (r < 0)
return rtnl_log_create_error(r);
if (streq(command, "up"))
r = sd_rtnl_message_link_set_flags(req, IFF_UP, IFF_UP);
else
r = sd_rtnl_message_link_set_flags(req, 0, IFF_UP);
if (r < 0)
return log_error_errno(r, "Could not set link flags: %m");
r = sd_netlink_call(rtnl, req, 0, NULL);
if (r < 0)
return r;
return 0;
}
static int link_up_down(int argc, char *argv[], void *userdata) {
_cleanup_(sd_netlink_unrefp) sd_netlink *rtnl = NULL;
_cleanup_set_free_ Set *indexes = NULL;
int index, r, i;
Iterator j;
void *p;
r = sd_netlink_open(&rtnl);
if (r < 0)
return log_error_errno(r, "Failed to connect to netlink: %m");
indexes = set_new(NULL);
if (!indexes)
return log_oom();
for (i = 1; i < argc; i++) {
index = resolve_interface_or_warn(&rtnl, argv[i]);
if (index < 0)
return index;
r = set_put(indexes, INT_TO_PTR(index));
if (r < 0)
return log_oom();
}
SET_FOREACH(p, indexes, j) {
index = PTR_TO_INT(p);
r = link_up_down_send_message(rtnl, argv[0], index);
if (r < 0) {
char ifname[IF_NAMESIZE + 1];
return log_error_errno(r, "Failed to %s interface %s: %m",
argv[1], format_ifname_full(index, ifname, FORMAT_IFNAME_IFINDEX));
}
}
return r;
}
static int link_delete(int argc, char *argv[], void *userdata) { static int link_delete(int argc, char *argv[], void *userdata) {
_cleanup_(sd_netlink_unrefp) sd_netlink *rtnl = NULL; _cleanup_(sd_netlink_unrefp) sd_netlink *rtnl = NULL;
_cleanup_set_free_ Set *indexes = NULL; _cleanup_set_free_ Set *indexes = NULL;
@ -2392,6 +2455,8 @@ static int help(void) {
" lldp [PATTERN...] Show LLDP neighbors\n" " lldp [PATTERN...] Show LLDP neighbors\n"
" label Show current address label entries in the kernel\n" " label Show current address label entries in the kernel\n"
" delete DEVICES... Delete virtual netdevs\n" " delete DEVICES... Delete virtual netdevs\n"
" up DEVICES... Bring devices up\n"
" down DEVICES... Bring devices down\n"
" renew DEVICES... Renew dynamic configurations\n" " renew DEVICES... Renew dynamic configurations\n"
" forcerenew DEVICES... Trigger DHCP reconfiguration of all connected clients\n" " forcerenew DEVICES... Trigger DHCP reconfiguration of all connected clients\n"
" reconfigure DEVICES... Reconfigure interfaces\n" " reconfigure DEVICES... Reconfigure interfaces\n"
@ -2494,6 +2559,8 @@ static int networkctl_main(int argc, char *argv[]) {
{ "lldp", VERB_ANY, VERB_ANY, 0, link_lldp_status }, { "lldp", VERB_ANY, VERB_ANY, 0, link_lldp_status },
{ "label", VERB_ANY, VERB_ANY, 0, list_address_labels }, { "label", VERB_ANY, VERB_ANY, 0, list_address_labels },
{ "delete", 2, VERB_ANY, 0, link_delete }, { "delete", 2, VERB_ANY, 0, link_delete },
{ "up", 2, VERB_ANY, 0, link_up_down },
{ "down", 2, VERB_ANY, 0, link_up_down },
{ "renew", 2, VERB_ANY, 0, link_renew }, { "renew", 2, VERB_ANY, 0, link_renew },
{ "forcerenew", 2, VERB_ANY, 0, link_force_renew }, { "forcerenew", 2, VERB_ANY, 0, link_force_renew },
{ "reconfigure", 2, VERB_ANY, 0, verb_reconfigure }, { "reconfigure", 2, VERB_ANY, 0, verb_reconfigure },

View File

@ -7,10 +7,51 @@
#include "networkd-can.h" #include "networkd-can.h"
#include "networkd-link.h" #include "networkd-link.h"
#include "networkd-manager.h" #include "networkd-manager.h"
#include "parse-util.h"
#include "string-util.h" #include "string-util.h"
#define CAN_TERMINATION_OHM_VALUE 120 #define CAN_TERMINATION_OHM_VALUE 120
int config_parse_can_bitrate(
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) {
uint32_t *br = data;
uint64_t sz;
int r;
assert(filename);
assert(lvalue);
assert(rvalue);
assert(data);
r = parse_size(rvalue, 1000, &sz);
if (r < 0) {
log_syntax(unit, LOG_ERR, filename, line, r,
"Failed to parse can bitrate '%s', ignoring: %m", rvalue);
return 0;
}
/* Linux uses __u32 for bitrates, so the value should not exceed that. */
if (sz <= 0 || sz > UINT32_MAX) {
log_syntax(unit, LOG_ERR, filename, line, 0,
"Bit rate out of permitted range 1...4294967295");
return 0;
}
*br = (uint32_t) sz;
return 0;
}
static int link_up_handler(sd_netlink *rtnl, sd_netlink_message *m, Link *link) { static int link_up_handler(sd_netlink *rtnl, sd_netlink_message *m, Link *link) {
int r; int r;
@ -103,11 +144,6 @@ static int link_set_can(Link *link) {
.sample_point = link->network->can_sample_point, .sample_point = link->network->can_sample_point,
}; };
if (link->network->can_bitrate > UINT32_MAX) {
log_link_error(link, "bitrate (%" PRIu64 ") too big.", link->network->can_bitrate);
return -ERANGE;
}
log_link_debug(link, "Setting bitrate = %d bit/s", bt.bitrate); log_link_debug(link, "Setting bitrate = %d bit/s", bt.bitrate);
if (link->network->can_sample_point > 0) if (link->network->can_sample_point > 0)
log_link_debug(link, "Setting sample point = %d.%d%%", bt.sample_point / 10, bt.sample_point % 10); log_link_debug(link, "Setting sample point = %d.%d%%", bt.sample_point / 10, bt.sample_point % 10);
@ -119,6 +155,35 @@ static int link_set_can(Link *link) {
return log_link_error_errno(link, r, "Could not append IFLA_CAN_BITTIMING attribute: %m"); return log_link_error_errno(link, r, "Could not append IFLA_CAN_BITTIMING attribute: %m");
} }
if (link->network->can_data_bitrate > 0 || link->network->can_data_sample_point > 0) {
struct can_bittiming bt = {
.bitrate = link->network->can_data_bitrate,
.sample_point = link->network->can_data_sample_point,
};
log_link_debug(link, "Setting data bitrate = %d bit/s", bt.bitrate);
if (link->network->can_data_sample_point > 0)
log_link_debug(link, "Setting data sample point = %d.%d%%", bt.sample_point / 10, bt.sample_point % 10);
else
log_link_debug(link, "Using default data sample point");
r = sd_netlink_message_append_data(m, IFLA_CAN_DATA_BITTIMING, &bt, sizeof(bt));
if (r < 0)
return log_link_error_errno(link, r, "Could not append IFLA_CAN_DATA_BITTIMING attribute: %m");
}
if (link->network->can_fd_mode >= 0) {
cm.mask |= CAN_CTRLMODE_FD;
SET_FLAG(cm.flags, CAN_CTRLMODE_FD, link->network->can_fd_mode > 0);
log_link_debug(link, "%sabling FD mode", link->network->can_fd_mode > 0 ? "En" : "Dis");
}
if (link->network->can_non_iso >= 0) {
cm.mask |= CAN_CTRLMODE_FD_NON_ISO;
SET_FLAG(cm.flags, CAN_CTRLMODE_FD_NON_ISO, link->network->can_non_iso > 0);
log_link_debug(link, "%sabling FD non-ISO mode", link->network->can_non_iso > 0 ? "En" : "Dis");
}
if (link->network->can_restart_us > 0) { if (link->network->can_restart_us > 0) {
char time_string[FORMAT_TIMESPAN_MAX]; char time_string[FORMAT_TIMESPAN_MAX];
uint64_t restart_ms; uint64_t restart_ms;

View File

@ -1,6 +1,10 @@
/* SPDX-License-Identifier: LGPL-2.1+ */ /* SPDX-License-Identifier: LGPL-2.1+ */
#pragma once #pragma once
#include "conf-parser.h"
typedef struct Link Link; typedef struct Link Link;
int link_configure_can(Link *link); int link_configure_can(Link *link);
CONFIG_PARSER_PROTOTYPE(config_parse_can_bitrate);

View File

@ -8,6 +8,7 @@
#include "parse-util.h" #include "parse-util.h"
#include "string-table.h" #include "string-table.h"
#include "strv.h" #include "strv.h"
#include "web-util.h"
int config_parse_dhcp( int config_parse_dhcp(
const char* unit, const char* unit,
@ -265,6 +266,48 @@ int config_parse_dhcp6_pd_hint(
return 0; return 0;
} }
int config_parse_dhcp6_mud_url(
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) {
_cleanup_free_ char *unescaped = NULL;
Network *network = data;
int r;
assert(filename);
assert(lvalue);
assert(rvalue);
if (isempty(rvalue)) {
network->dhcp6_mudurl = mfree(network->dhcp6_mudurl);
return 0;
}
r = cunescape(rvalue, 0, &unescaped);
if (r < 0) {
log_syntax(unit, LOG_ERR, filename, line, r,
"Failed to Failed to unescape MUD URL, ignoring: %s", rvalue);
return 0;
}
if (!http_url_is_valid(unescaped) || strlen(unescaped) > 255) {
log_syntax(unit, LOG_ERR, filename, line, 0,
"Failed to parse MUD URL '%s', ignoring: %m", rvalue);
return 0;
}
return free_and_replace(network->dhcp6_mudurl, unescaped);
}
int config_parse_dhcp_send_option( int config_parse_dhcp_send_option(
const char *unit, const char *unit,
const char *filename, const char *filename,

View File

@ -48,4 +48,5 @@ CONFIG_PARSER_PROTOTYPE(config_parse_dhcp_use_sip);
CONFIG_PARSER_PROTOTYPE(config_parse_iaid); CONFIG_PARSER_PROTOTYPE(config_parse_iaid);
CONFIG_PARSER_PROTOTYPE(config_parse_section_route_table); CONFIG_PARSER_PROTOTYPE(config_parse_section_route_table);
CONFIG_PARSER_PROTOTYPE(config_parse_dhcp6_pd_hint); CONFIG_PARSER_PROTOTYPE(config_parse_dhcp6_pd_hint);
CONFIG_PARSER_PROTOTYPE(config_parse_dhcp6_mud_url);
CONFIG_PARSER_PROTOTYPE(config_parse_dhcp_send_option); CONFIG_PARSER_PROTOTYPE(config_parse_dhcp_send_option);

View File

@ -676,6 +676,12 @@ int dhcp6_configure(Link *link) {
return log_link_error_errno(link, r, "DHCP6 CLIENT: Failed to set request flag for rapid commit: %m"); return log_link_error_errno(link, r, "DHCP6 CLIENT: Failed to set request flag for rapid commit: %m");
} }
if (link->network->dhcp6_mudurl) {
r = sd_dhcp6_client_set_request_mud_url(client, link->network->dhcp6_mudurl);
if (r < 0)
return log_link_error_errno(link, r, "DHCP6 CLIENT: Failed to set MUD URL: %m");
}
r = sd_dhcp6_client_set_callback(client, dhcp6_handler, link); r = sd_dhcp6_client_set_callback(client, dhcp6_handler, link);
if (r < 0) if (r < 0)
return log_link_error_errno(link, r, "DHCP6 CLIENT: Failed to set callback: %m"); return log_link_error_errno(link, r, "DHCP6 CLIENT: Failed to set callback: %m");

View File

@ -6,6 +6,7 @@ _Pragma("GCC diagnostic ignored \"-Wimplicit-fallthrough\"")
#include "conf-parser.h" #include "conf-parser.h"
#include "netem.h" #include "netem.h"
#include "network-internal.h" #include "network-internal.h"
#include "networkd-can.h"
#include "networkd-conf.h" #include "networkd-conf.h"
#include "networkd-dhcp-common.h" #include "networkd-dhcp-common.h"
#include "networkd-dhcp-server.h" #include "networkd-dhcp-server.h"
@ -190,6 +191,7 @@ DHCPv4.RouteMTUBytes, config_parse_mtu,
DHCPv6.UseDNS, config_parse_bool, 0, offsetof(Network, dhcp6_use_dns) DHCPv6.UseDNS, config_parse_bool, 0, offsetof(Network, dhcp6_use_dns)
DHCPv6.UseNTP, config_parse_bool, 0, offsetof(Network, dhcp6_use_ntp) DHCPv6.UseNTP, config_parse_bool, 0, offsetof(Network, dhcp6_use_ntp)
DHCPv6.RapidCommit, config_parse_bool, 0, offsetof(Network, rapid_commit) DHCPv6.RapidCommit, config_parse_bool, 0, offsetof(Network, rapid_commit)
DHCPv6.MUDURL, config_parse_dhcp6_mud_url, 0, 0
DHCPv6.ForceDHCPv6PDOtherInformation, config_parse_bool, 0, offsetof(Network, dhcp6_force_pd_other_information) DHCPv6.ForceDHCPv6PDOtherInformation, config_parse_bool, 0, offsetof(Network, dhcp6_force_pd_other_information)
DHCPv6.PrefixDelegationHint, config_parse_dhcp6_pd_hint, 0, 0 DHCPv6.PrefixDelegationHint, config_parse_dhcp6_pd_hint, 0, 0
DHCPv6.WithoutRA, config_parse_bool, 0, offsetof(Network, dhcp6_without_ra) DHCPv6.WithoutRA, config_parse_bool, 0, offsetof(Network, dhcp6_without_ra)
@ -257,8 +259,12 @@ IPv6Prefix.PreferredLifetimeSec, config_parse_prefix_lifetime,
IPv6Prefix.Assign, config_parse_prefix_assign, 0, 0 IPv6Prefix.Assign, config_parse_prefix_assign, 0, 0
IPv6RoutePrefix.Route, config_parse_route_prefix, 0, 0 IPv6RoutePrefix.Route, config_parse_route_prefix, 0, 0
IPv6RoutePrefix.LifetimeSec, config_parse_route_prefix_lifetime, 0, 0 IPv6RoutePrefix.LifetimeSec, config_parse_route_prefix_lifetime, 0, 0
CAN.BitRate, config_parse_si_uint64, 0, offsetof(Network, can_bitrate) CAN.BitRate, config_parse_can_bitrate, 0, offsetof(Network, can_bitrate)
CAN.SamplePoint, config_parse_permille, 0, offsetof(Network, can_sample_point) CAN.SamplePoint, config_parse_permille, 0, offsetof(Network, can_sample_point)
CAN.DataBitRate, config_parse_can_bitrate, 0, offsetof(Network, can_data_bitrate)
CAN.DataSamplePoint, config_parse_permille, 0, offsetof(Network, can_data_sample_point)
CAN.FDMode, config_parse_tristate, 0, offsetof(Network, can_fd_mode)
CAN.FDNonISO, config_parse_tristate, 0, offsetof(Network, can_non_iso)
CAN.RestartSec, config_parse_sec, 0, offsetof(Network, can_restart_us) CAN.RestartSec, config_parse_sec, 0, offsetof(Network, can_restart_us)
CAN.TripleSampling, config_parse_tristate, 0, offsetof(Network, can_triple_sampling) CAN.TripleSampling, config_parse_tristate, 0, offsetof(Network, can_triple_sampling)
CAN.Termination, config_parse_tristate, 0, offsetof(Network, can_termination) CAN.Termination, config_parse_tristate, 0, offsetof(Network, can_termination)

View File

@ -646,6 +646,7 @@ static Network *network_free(Network *network) {
set_free(network->dhcp_black_listed_ip); set_free(network->dhcp_black_listed_ip);
set_free(network->dhcp_request_options); set_free(network->dhcp_request_options);
free(network->mac); free(network->mac);
free(network->dhcp6_mudurl);
if (network->dhcp_acd) if (network->dhcp_acd)
sd_ipv4acd_unref(network->dhcp_acd); sd_ipv4acd_unref(network->dhcp_acd);

View File

@ -131,6 +131,7 @@ struct Network {
bool dhcp6_use_ntp; bool dhcp6_use_ntp;
bool dhcp6_without_ra; bool dhcp6_without_ra;
uint8_t dhcp6_pd_length; uint8_t dhcp6_pd_length;
char *dhcp6_mudurl;
struct in6_addr dhcp6_pd_address; struct in6_addr dhcp6_pd_address;
/* DHCP Server Support */ /* DHCP Server Support */
@ -205,12 +206,16 @@ struct Network {
uint32_t br_untagged_bitmap[BRIDGE_VLAN_BITMAP_LEN]; uint32_t br_untagged_bitmap[BRIDGE_VLAN_BITMAP_LEN];
/* CAN support */ /* CAN support */
uint64_t can_bitrate; uint32_t can_bitrate;
unsigned can_sample_point; unsigned can_sample_point;
uint32_t can_data_bitrate;
unsigned can_data_sample_point;
usec_t can_restart_us; usec_t can_restart_us;
int can_triple_sampling; int can_triple_sampling;
int can_termination; int can_termination;
int can_listen_only; int can_listen_only;
int can_fd_mode;
int can_non_iso;
AddressFamily ip_forward; AddressFamily ip_forward;
bool ip_masquerade; bool ip_masquerade;

View File

@ -352,20 +352,27 @@ int sd_bus_get_name_machine_id(sd_bus *bus, const char *name, sd_id128_t *machin
/* Convenience calls */ /* Convenience calls */
int sd_bus_call_methodv(sd_bus *bus, const char *destination, const char *path, const char *interface, const char *member, sd_bus_error *ret_error, sd_bus_message **reply, const char *types, va_list ap);
int sd_bus_call_method(sd_bus *bus, const char *destination, const char *path, const char *interface, const char *member, sd_bus_error *ret_error, sd_bus_message **reply, const char *types, ...); int sd_bus_call_method(sd_bus *bus, const char *destination, const char *path, const char *interface, const char *member, sd_bus_error *ret_error, sd_bus_message **reply, const char *types, ...);
int sd_bus_call_method_asyncv(sd_bus *bus, sd_bus_slot **slot, const char *destination, const char *path, const char *interface, const char *member, sd_bus_message_handler_t callback, void *userdata, const char *types, va_list ap);
int sd_bus_call_method_async(sd_bus *bus, sd_bus_slot **slot, const char *destination, const char *path, const char *interface, const char *member, sd_bus_message_handler_t callback, void *userdata, const char *types, ...); int sd_bus_call_method_async(sd_bus *bus, sd_bus_slot **slot, const char *destination, const char *path, const char *interface, const char *member, sd_bus_message_handler_t callback, void *userdata, const char *types, ...);
int sd_bus_get_property(sd_bus *bus, const char *destination, const char *path, const char *interface, const char *member, sd_bus_error *ret_error, sd_bus_message **reply, const char *type); int sd_bus_get_property(sd_bus *bus, const char *destination, const char *path, const char *interface, const char *member, sd_bus_error *ret_error, sd_bus_message **reply, const char *type);
int sd_bus_get_property_trivial(sd_bus *bus, const char *destination, const char *path, const char *interface, const char *member, sd_bus_error *ret_error, char type, void *ret_ptr); int sd_bus_get_property_trivial(sd_bus *bus, const char *destination, const char *path, const char *interface, const char *member, sd_bus_error *ret_error, char type, void *ret_ptr);
int sd_bus_get_property_string(sd_bus *bus, const char *destination, const char *path, const char *interface, const char *member, sd_bus_error *ret_error, char **ret); /* free the result! */ int sd_bus_get_property_string(sd_bus *bus, const char *destination, const char *path, const char *interface, const char *member, sd_bus_error *ret_error, char **ret); /* free the result! */
int sd_bus_get_property_strv(sd_bus *bus, const char *destination, const char *path, const char *interface, const char *member, sd_bus_error *ret_error, char ***ret); /* free the result! */ int sd_bus_get_property_strv(sd_bus *bus, const char *destination, const char *path, const char *interface, const char *member, sd_bus_error *ret_error, char ***ret); /* free the result! */
int sd_bus_set_propertyv(sd_bus *bus, const char *destination, const char *path, const char *interface, const char *member, sd_bus_error *ret_error, const char *type, va_list ap);
int sd_bus_set_property(sd_bus *bus, const char *destination, const char *path, const char *interface, const char *member, sd_bus_error *ret_error, const char *type, ...); int sd_bus_set_property(sd_bus *bus, const char *destination, const char *path, const char *interface, const char *member, sd_bus_error *ret_error, const char *type, ...);
int sd_bus_reply_method_returnv(sd_bus_message *call, const char *types, va_list ap);
int sd_bus_reply_method_return(sd_bus_message *call, const char *types, ...); int sd_bus_reply_method_return(sd_bus_message *call, const char *types, ...);
int sd_bus_reply_method_error(sd_bus_message *call, const sd_bus_error *e); int sd_bus_reply_method_error(sd_bus_message *call, const sd_bus_error *e);
int sd_bus_reply_method_errorfv(sd_bus_message *call, const char *name, const char *format, va_list ap) _sd_printf_(3, 0);
int sd_bus_reply_method_errorf(sd_bus_message *call, const char *name, const char *format, ...) _sd_printf_(3, 4); int sd_bus_reply_method_errorf(sd_bus_message *call, const char *name, const char *format, ...) _sd_printf_(3, 4);
int sd_bus_reply_method_errno(sd_bus_message *call, int error, const sd_bus_error *e); int sd_bus_reply_method_errno(sd_bus_message *call, int error, const sd_bus_error *e);
int sd_bus_reply_method_errnofv(sd_bus_message *call, int error, const char *format, va_list ap) _sd_printf_(3, 0);
int sd_bus_reply_method_errnof(sd_bus_message *call, int error, const char *format, ...) _sd_printf_(3, 4); int sd_bus_reply_method_errnof(sd_bus_message *call, int error, const char *format, ...) _sd_printf_(3, 4);
int sd_bus_emit_signalv(sd_bus *bus, const char *path, const char *interface, const char *member, const char *types, va_list ap);
int sd_bus_emit_signal(sd_bus *bus, const char *path, const char *interface, const char *member, const char *types, ...); int sd_bus_emit_signal(sd_bus *bus, const char *path, const char *interface, const char *member, const char *types, ...);
int sd_bus_emit_properties_changed_strv(sd_bus *bus, const char *path, const char *interface, char **names); int sd_bus_emit_properties_changed_strv(sd_bus *bus, const char *path, const char *interface, char **names);

View File

@ -73,6 +73,7 @@ enum {
SD_DHCP6_OPTION_FQDN = 39, /* RFC 4704 */ SD_DHCP6_OPTION_FQDN = 39, /* RFC 4704 */
SD_DHCP6_OPTION_NTP_SERVER = 56, /* RFC 5908 */ SD_DHCP6_OPTION_NTP_SERVER = 56, /* RFC 5908 */
SD_DHCP6_OPTION_MUD_URL = 112, /* RFC 8250 */
/* option codes 89-142 are unassigned */ /* option codes 89-142 are unassigned */
/* option codes 144-65535 are unassigned */ /* option codes 144-65535 are unassigned */
@ -120,6 +121,9 @@ int sd_dhcp6_client_get_information_request(
int sd_dhcp6_client_set_request_option( int sd_dhcp6_client_set_request_option(
sd_dhcp6_client *client, sd_dhcp6_client *client,
uint16_t option); uint16_t option);
int sd_dhcp6_client_set_request_mud_url(
sd_dhcp6_client *client,
char *mudurl);
int sd_dhcp6_client_set_prefix_delegation_hint( int sd_dhcp6_client_set_prefix_delegation_hint(
sd_dhcp6_client *client, sd_dhcp6_client *client,
uint8_t prefixlen, uint8_t prefixlen,

View File

@ -498,7 +498,7 @@ int link_config_apply(link_config_ctx *ctx, link_config *config,
if (config->alternative_names_policy) if (config->alternative_names_policy)
for (NamePolicy *p = config->alternative_names_policy; *p != _NAMEPOLICY_INVALID; p++) { for (NamePolicy *p = config->alternative_names_policy; *p != _NAMEPOLICY_INVALID; p++) {
const char *n; const char *n = NULL;
switch (*p) { switch (*p) {
case NAMEPOLICY_DATABASE: case NAMEPOLICY_DATABASE:

View File

@ -111,6 +111,7 @@ RapidCommit=
ForceDHCPv6PDOtherInformation= ForceDHCPv6PDOtherInformation=
PrefixDelegationHint= PrefixDelegationHint=
WithoutRA= WithoutRA=
MUDURL=
[Route] [Route]
Destination= Destination=
Protocol= Protocol=
@ -201,6 +202,10 @@ PVID=
[CAN] [CAN]
SamplePoint= SamplePoint=
BitRate= BitRate=
DataSamplePoint=
DataBitRate=
FDMode=
FDNonISO=
RestartSec= RestartSec=
TripleSampling= TripleSampling=
Termination= Termination=

View File

@ -1964,7 +1964,7 @@ test_setup() {
if [ ${TEST_REQUIRE_INSTALL_TESTS} -ne 0 ] && \ if [ ${TEST_REQUIRE_INSTALL_TESTS} -ne 0 ] && \
type -P meson >/dev/null && \ type -P meson >/dev/null && \
[[ "$(meson configure $BUILD_DIR | grep install-tests | awk '{ print $2 }')" != "true" ]]; then [[ "$(meson configure $BUILD_DIR | grep install-tests | awk '{ print $2 }')" != "true" ]]; then
dfatal "Needs to be built with -Dinstall-tests=true" dfatal "$BUILD_DIR needs to be built with -Dinstall-tests=true"
exit 1 exit 1
fi fi

View File

@ -1,7 +1,9 @@
[Unit] [Unit]
Description=TEST-46-HOMED Description=TEST-46-HOMED
Before=getty-pre.target
Wants=getty-pre.target Wants=getty-pre.target
Before=getty-pre.target
Wants=systemd-homed.service
After=systemd-homed.service
[Service] [Service]
ExecStartPre=rm -f /failed /testok ExecStartPre=rm -f /failed /testok

View File

@ -139,8 +139,7 @@ units = [
'sysinit.target.wants/'], 'sysinit.target.wants/'],
['systemd-udevd-kernel.socket', '', ['systemd-udevd-kernel.socket', '',
'sockets.target.wants/'], 'sockets.target.wants/'],
['systemd-userdbd.socket', 'ENABLE_USERDB', ['systemd-userdbd.socket', 'ENABLE_USERDB'],
'sockets.target.wants/'],
['time-set.target', ''], ['time-set.target', ''],
['time-sync.target', ''], ['time-sync.target', ''],
['timers.target', ''], ['timers.target', ''],
@ -201,8 +200,7 @@ in_units = [
['systemd-portabled.service', 'ENABLE_PORTABLED', ['systemd-portabled.service', 'ENABLE_PORTABLED',
'dbus-org.freedesktop.portable1.service'], 'dbus-org.freedesktop.portable1.service'],
['systemd-userdbd.service', 'ENABLE_USERDB'], ['systemd-userdbd.service', 'ENABLE_USERDB'],
['systemd-homed.service', 'ENABLE_HOMED', ['systemd-homed.service', 'ENABLE_HOMED'],
'multi-user.target.wants/ dbus-org.freedesktop.home1.service'],
['systemd-quotacheck.service', 'ENABLE_QUOTACHECK'], ['systemd-quotacheck.service', 'ENABLE_QUOTACHECK'],
['systemd-random-seed.service', 'ENABLE_RANDOMSEED', ['systemd-random-seed.service', 'ENABLE_RANDOMSEED',
'sysinit.target.wants/'], 'sysinit.target.wants/'],
@ -228,8 +226,7 @@ in_units = [
'multi-user.target.wants/'], 'multi-user.target.wants/'],
['systemd-vconsole-setup.service', 'ENABLE_VCONSOLE'], ['systemd-vconsole-setup.service', 'ENABLE_VCONSOLE'],
['systemd-volatile-root.service', ''], ['systemd-volatile-root.service', ''],
['systemd-repart.service', 'ENABLE_REPART', ['systemd-repart.service', 'ENABLE_REPART'],
'sysinit.target.wants/ initrd-root-fs.target.wants/'],
['user-runtime-dir@.service', ''], ['user-runtime-dir@.service', ''],
['user@.service', ''], ['user@.service', ''],
] ]

View File

@ -34,3 +34,7 @@ SystemCallArchitectures=native
SystemCallErrorNumber=EPERM SystemCallErrorNumber=EPERM
SystemCallFilter=@system-service @mount SystemCallFilter=@system-service @mount
@SERVICE_WATCHDOG@ @SERVICE_WATCHDOG@
[Install]
WantedBy=multi-user.target
Alias=dbus-org.freedesktop.home1.service

View File

@ -21,5 +21,9 @@ Type=oneshot
RemainAfterExit=yes RemainAfterExit=yes
ExecStart=@rootbindir@/systemd-repart --dry-run=no ExecStart=@rootbindir@/systemd-repart --dry-run=no
# The tool returns 77 if there's no GPT partition table pre-existing # The tool returns 77 if there's no existing GPT partition table
SuccessExitStatus=77 SuccessExitStatus=77
[Install]
WantedBy=sysinit.target
WantedBy=initrd-root-fs.target

View File

@ -39,3 +39,6 @@ SystemCallErrorNumber=EPERM
SystemCallFilter=@system-service SystemCallFilter=@system-service
Type=notify Type=notify
@SERVICE_WATCHDOG@ @SERVICE_WATCHDOG@
[Install]
Also=systemd-userdbd.socket

View File

@ -17,3 +17,6 @@ Before=sockets.target
ListenStream=/run/systemd/userdb/io.systemd.Multiplexer ListenStream=/run/systemd/userdb/io.systemd.Multiplexer
Symlinks=/run/systemd/userdb/io.systemd.NameServiceSwitch Symlinks=/run/systemd/userdb/io.systemd.NameServiceSwitch
SocketMode=0666 SocketMode=0666
[Install]
WantedBy=sockets.target