Compare commits
No commits in common. "cf3317f63a24c17ca06a5c277171550c28ed7ef2" and "1283366a90e8aa8713af449a0e3a0096c90648e3" have entirely different histories.
cf3317f63a
...
1283366a90
|
@ -26,7 +26,3 @@ indent_size = 4
|
|||
[meson.build]
|
||||
indent_style = space
|
||||
indent_size = 8
|
||||
|
||||
[man/*.xml]
|
||||
indent_size = 2
|
||||
indent_style = space
|
||||
|
|
|
@ -49,11 +49,9 @@ BuildPackages=
|
|||
python3-lxml
|
||||
qrencode-devel
|
||||
system-user-nobody
|
||||
systemd-sysvinit
|
||||
zlib-devel
|
||||
# to satisfy tests
|
||||
acl
|
||||
diffutils
|
||||
glibc-locale
|
||||
system-group-obsolete
|
||||
system-user-bin
|
||||
|
@ -64,15 +62,3 @@ BuildPackages=
|
|||
Packages=
|
||||
# brought in via meson->python3
|
||||
libp11-kit0
|
||||
# --bootable=no
|
||||
dbus-1
|
||||
libapparmor1
|
||||
libcrypt1
|
||||
libcryptsetup12
|
||||
libkmod2
|
||||
liblz4-1
|
||||
libmount1
|
||||
libqrencode4
|
||||
libseccomp2
|
||||
pam
|
||||
util-linux
|
||||
|
|
8
TODO
8
TODO
|
@ -4,6 +4,9 @@ Bugfixes:
|
|||
manager or system manager can be always set. It would be better to reject
|
||||
them when parsing config.
|
||||
|
||||
* busctl prints errors to stdout:
|
||||
busctl tree org.freedesktop.systemd1 /org/freedesktop/systemd1
|
||||
|
||||
External:
|
||||
|
||||
* Fedora: add an rpmlint check that verifies that all unit files in the RPM are listed in %systemd_post macros.
|
||||
|
@ -19,9 +22,6 @@ Janitorial Clean-ups:
|
|||
|
||||
Features:
|
||||
|
||||
* build short web pages out of each catalog entry, build them along with man
|
||||
pages, and include hyperlinks to them in the journal output
|
||||
|
||||
* machined: add API to acquire UID range. add API to mount/dissect loopback
|
||||
file. Both protected by PK. Then make nspawn use these APIs to run
|
||||
unprivileged containers. i.e. push the truly privileged bits into machined,
|
||||
|
@ -1227,8 +1227,6 @@ Features:
|
|||
- duplicate address check for static IPs (like ARPCHECK in network-scripts)
|
||||
- whenever uplink info changes, make DHCP server send out FORCERENEW
|
||||
|
||||
* Figure out how to do unittests of networkd's state serialization
|
||||
|
||||
* dhcp:
|
||||
- figure out how much we can increase Maximum Message Size
|
||||
|
||||
|
|
|
@ -217,16 +217,6 @@
|
|||
automatically used.</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><varname>UUID=</varname></term>
|
||||
|
||||
<listitem><para>The UUID to assign to the partition if none is assigned yet. Note that this
|
||||
setting is not used for matching. It is also not used when a UUID is already set for an existing
|
||||
partition. It is thus only used when a partition is newly created or when an existing one had a
|
||||
all-zero UUID set. If not specified a UUID derived from the partition type is automatically
|
||||
used.</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><varname>Priority=</varname></term>
|
||||
|
||||
|
|
|
@ -267,12 +267,6 @@ manpages = [
|
|||
['sd_bus_get_n_queued_read', '3', ['sd_bus_get_n_queued_write'], ''],
|
||||
['sd_bus_get_name_creds', '3', ['sd_bus_get_owner_creds'], ''],
|
||||
['sd_bus_get_name_machine_id', '3', [], ''],
|
||||
['sd_bus_interface_name_is_valid',
|
||||
'3',
|
||||
['sd_bus_member_name_is_valid',
|
||||
'sd_bus_object_path_is_valid',
|
||||
'sd_bus_service_name_is_valid'],
|
||||
''],
|
||||
['sd_bus_is_open', '3', ['sd_bus_is_ready'], ''],
|
||||
['sd_bus_list_names', '3', [], ''],
|
||||
['sd_bus_message_append', '3', ['sd_bus_message_appendv'], ''],
|
||||
|
|
|
@ -89,7 +89,6 @@
|
|||
<citerefentry><refentrytitle>sd_bus_get_scope</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
|
||||
<citerefentry><refentrytitle>sd_bus_get_tid</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
|
||||
<citerefentry><refentrytitle>sd_bus_get_unique_name</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
|
||||
<citerefentry><refentrytitle>sd_bus_interface_name_is_valid</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
|
||||
<citerefentry><refentrytitle>sd_bus_is_monitor</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
|
||||
<citerefentry><refentrytitle>sd_bus_is_bus_client</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
|
||||
<citerefentry><refentrytitle>sd_bus_is_server</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
|
||||
|
|
|
@ -1,98 +0,0 @@
|
|||
<?xml version='1.0'?>
|
||||
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
|
||||
"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
|
||||
<!-- SPDX-License-Identifier: LGPL-2.1+ -->
|
||||
|
||||
<refentry id="sd_bus_interface_name_is_valid" xmlns:xi="http://www.w3.org/2001/XInclude">
|
||||
<refentryinfo>
|
||||
<title>sd_bus_interface_name_is_valid</title>
|
||||
<productname>systemd</productname>
|
||||
</refentryinfo>
|
||||
|
||||
<refmeta>
|
||||
<refentrytitle>sd_bus_interface_name_is_valid</refentrytitle>
|
||||
<manvolnum>3</manvolnum>
|
||||
</refmeta>
|
||||
|
||||
<refnamediv>
|
||||
<refname>sd_bus_interface_name_is_valid</refname>
|
||||
<refname>sd_bus_service_name_is_valid</refname>
|
||||
<refname>sd_bus_member_name_is_valid</refname>
|
||||
<refname>sd_bus_object_path_is_valid</refname>
|
||||
|
||||
<refpurpose>Check if a string is a valid bus name or object path</refpurpose>
|
||||
</refnamediv>
|
||||
|
||||
<refsynopsisdiv>
|
||||
<funcsynopsis>
|
||||
<funcsynopsisinfo>#include <systemd/sd-bus.h></funcsynopsisinfo>
|
||||
|
||||
<funcprototype>
|
||||
<funcdef>int <function>sd_bus_interface_name_is_valid</function></funcdef>
|
||||
<paramdef>const char* <parameter>p</parameter></paramdef>
|
||||
</funcprototype>
|
||||
|
||||
<funcprototype>
|
||||
<funcdef>int <function>sd_bus_service_name_is_valid</function></funcdef>
|
||||
<paramdef>const char* <parameter>p</parameter></paramdef>
|
||||
</funcprototype>
|
||||
|
||||
<funcprototype>
|
||||
<funcdef>int <function>sd_bus_member_name_is_valid</function></funcdef>
|
||||
<paramdef>const char* <parameter>p</parameter></paramdef>
|
||||
</funcprototype>
|
||||
|
||||
<funcprototype>
|
||||
<funcdef>int <function>sd_bus_object_path_is_valid</function></funcdef>
|
||||
<paramdef>const char* <parameter>p</parameter></paramdef>
|
||||
</funcprototype>
|
||||
</funcsynopsis>
|
||||
</refsynopsisdiv>
|
||||
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
|
||||
<para><function>sd_bus_interface_name_is_valid()</function> checks if a given string
|
||||
<parameter>p</parameter> is a syntactically valid bus interface name. Similarly,
|
||||
<function>sd_bus_service_name_is_valid()</function> checks if the argument is a valid bus service name,
|
||||
<function>sd_bus_member_name_is_valid()</function> checks if the argument is a valid bus interface member
|
||||
name, and <function>sd_bus_object_path_is_valid()</function> checks if the argument is a valid bus object
|
||||
path. Those functions generally check that only allowed characters are used and that the length of the
|
||||
string is within limits.</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1>
|
||||
<title>Return Value</title>
|
||||
|
||||
<para>Those functions return 1 if the argument is a valid interface / service / member name or object
|
||||
path, and 0 if it is not. If the argument is NULL, an error is returned.</para>
|
||||
|
||||
<refsect2>
|
||||
<title>Errors</title>
|
||||
|
||||
<para>Returned errors may indicate the following problems:</para>
|
||||
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><constant>-EINVAL</constant></term>
|
||||
|
||||
<listitem><para>The <parameter>p</parameter> parameter is
|
||||
<constant>NULL</constant>.</para></listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</refsect2>
|
||||
</refsect1>
|
||||
|
||||
<xi:include href="libsystemd-pkgconfig.xml" />
|
||||
|
||||
<refsect1>
|
||||
<title>See Also</title>
|
||||
|
||||
<para>
|
||||
<citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
|
||||
<citerefentry><refentrytitle>sd-bus</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
|
||||
<citerefentry><refentrytitle>sd_bus_message_call_method</refentrytitle><manvolnum>3</manvolnum></citerefentry>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
</refentry>
|
|
@ -2189,8 +2189,7 @@ if conf.get('ENABLE_HOMED') == 1
|
|||
endif
|
||||
endif
|
||||
|
||||
foreach alias : (['halt', 'poweroff', 'reboot', 'shutdown'] +
|
||||
(conf.get('HAVE_SYSV_COMPAT') == 1 ? ['runlevel', 'telinit'] : []))
|
||||
foreach alias : ['halt', 'poweroff', 'reboot', 'runlevel', 'shutdown', 'telinit']
|
||||
meson.add_install_script(meson_make_symlink,
|
||||
join_paths(rootbindir, 'systemctl'),
|
||||
join_paths(rootsbindir, alias))
|
||||
|
@ -2852,7 +2851,7 @@ executable(
|
|||
include_directories : includes,
|
||||
link_with : [libshared],
|
||||
install_rpath : rootlibexecdir,
|
||||
install : (conf.get('HAVE_SYSV_COMPAT') == 1),
|
||||
install : true,
|
||||
install_dir : rootlibexecdir)
|
||||
|
||||
public_programs += executable(
|
||||
|
|
|
@ -84,14 +84,6 @@
|
|||
#define _variable_no_sanitize_address_
|
||||
#endif
|
||||
|
||||
/* Apparently there's no has_feature() call defined to check for ubsan, hence let's define this
|
||||
* unconditionally on llvm */
|
||||
#if defined(__clang__)
|
||||
#define _function_no_sanitize_float_cast_overflow_ __attribute__((no_sanitize("float-cast-overflow")))
|
||||
#else
|
||||
#define _function_no_sanitize_float_cast_overflow_
|
||||
#endif
|
||||
|
||||
/* Temporarily disable some warnings */
|
||||
#define DISABLE_WARNING_FORMAT_NONLITERAL \
|
||||
_Pragma("GCC diagnostic push"); \
|
||||
|
@ -122,14 +114,6 @@
|
|||
_Pragma("GCC diagnostic push")
|
||||
#endif
|
||||
|
||||
#define DISABLE_WARNING_FLOAT_EQUAL \
|
||||
_Pragma("GCC diagnostic push"); \
|
||||
_Pragma("GCC diagnostic ignored \"-Wfloat-equal\"")
|
||||
|
||||
#define DISABLE_WARNING_TYPE_LIMITS \
|
||||
_Pragma("GCC diagnostic push"); \
|
||||
_Pragma("GCC diagnostic ignored \"-Wtype-limits\"")
|
||||
|
||||
#define REENABLE_WARNING \
|
||||
_Pragma("GCC diagnostic pop")
|
||||
|
||||
|
|
|
@ -110,10 +110,13 @@ static int acquire_bus(bool set_monitor, sd_bus **ret) {
|
|||
switch (arg_transport) {
|
||||
|
||||
case BUS_TRANSPORT_LOCAL:
|
||||
if (arg_user)
|
||||
if (arg_user) {
|
||||
bus->is_user = true;
|
||||
r = bus_set_address_user(bus);
|
||||
else
|
||||
} else {
|
||||
bus->is_system = true;
|
||||
r = bus_set_address_system(bus);
|
||||
}
|
||||
break;
|
||||
|
||||
case BUS_TRANSPORT_REMOTE:
|
||||
|
@ -424,15 +427,29 @@ static void print_subtree(const char *prefix, const char *path, char **l) {
|
|||
}
|
||||
}
|
||||
|
||||
static void print_tree(char **l) {
|
||||
if (arg_list)
|
||||
strv_print(l);
|
||||
else if (strv_isempty(l))
|
||||
static void print_tree(const char *prefix, char **l) {
|
||||
|
||||
prefix = strempty(prefix);
|
||||
|
||||
if (arg_list) {
|
||||
char **i;
|
||||
|
||||
STRV_FOREACH(i, l)
|
||||
printf("%s%s\n", prefix, *i);
|
||||
return;
|
||||
}
|
||||
|
||||
if (strv_isempty(l)) {
|
||||
printf("No objects discovered.\n");
|
||||
else if (streq(l[0], "/") && !l[1])
|
||||
return;
|
||||
}
|
||||
|
||||
if (streq(l[0], "/") && !l[1]) {
|
||||
printf("Only root object discovered.\n");
|
||||
else
|
||||
print_subtree("", "/", l);
|
||||
return;
|
||||
}
|
||||
|
||||
print_subtree(prefix, "/", l);
|
||||
}
|
||||
|
||||
static int on_path(const char *path, void *userdata) {
|
||||
|
@ -448,7 +465,7 @@ static int on_path(const char *path, void *userdata) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int find_nodes(sd_bus *bus, const char *service, const char *path, Set *paths) {
|
||||
static int find_nodes(sd_bus *bus, const char *service, const char *path, Set *paths, bool many) {
|
||||
static const XMLIntrospectOps ops = {
|
||||
.on_path = on_path,
|
||||
};
|
||||
|
@ -462,10 +479,12 @@ static int find_nodes(sd_bus *bus, const char *service, const char *path, Set *p
|
|||
"org.freedesktop.DBus.Introspectable", "Introspect",
|
||||
&error, &reply, "");
|
||||
if (r < 0) {
|
||||
printf("%sFailed to introspect object %s of service %s: %s%s\n",
|
||||
ansi_highlight_red(),
|
||||
path, service, bus_error_message(&error, r),
|
||||
ansi_normal());
|
||||
if (many)
|
||||
printf("Failed to introspect object %s of service %s: %s\n",
|
||||
path, service, bus_error_message(&error, r));
|
||||
else
|
||||
log_error_errno(r, "Failed to introspect object %s of service %s: %s",
|
||||
path, service, bus_error_message(&error, r));
|
||||
return r;
|
||||
}
|
||||
|
||||
|
@ -476,23 +495,34 @@ static int find_nodes(sd_bus *bus, const char *service, const char *path, Set *p
|
|||
return parse_xml_introspect(path, xml, &ops, paths);
|
||||
}
|
||||
|
||||
static int tree_one(sd_bus *bus, const char *service) {
|
||||
_cleanup_set_free_ Set *paths = NULL, *done = NULL, *failed = NULL;
|
||||
static int tree_one(sd_bus *bus, const char *service, const char *prefix, bool many) {
|
||||
_cleanup_set_free_free_ Set *paths = NULL, *done = NULL, *failed = NULL;
|
||||
_cleanup_free_ char **l = NULL;
|
||||
char *m;
|
||||
int r;
|
||||
|
||||
r = set_put_strdup(&paths, "/");
|
||||
if (r < 0)
|
||||
paths = set_new(&string_hash_ops);
|
||||
if (!paths)
|
||||
return log_oom();
|
||||
|
||||
done = set_new(&string_hash_ops_free);
|
||||
done = set_new(&string_hash_ops);
|
||||
if (!done)
|
||||
return log_oom();
|
||||
|
||||
failed = set_new(&string_hash_ops_free);
|
||||
failed = set_new(&string_hash_ops);
|
||||
if (!failed)
|
||||
return log_oom();
|
||||
|
||||
m = strdup("/");
|
||||
if (!m)
|
||||
return log_oom();
|
||||
|
||||
r = set_put(paths, m);
|
||||
if (r < 0) {
|
||||
free(m);
|
||||
return log_oom();
|
||||
}
|
||||
|
||||
for (;;) {
|
||||
_cleanup_free_ char *p = NULL;
|
||||
int q;
|
||||
|
@ -505,14 +535,20 @@ static int tree_one(sd_bus *bus, const char *service) {
|
|||
set_contains(failed, p))
|
||||
continue;
|
||||
|
||||
q = find_nodes(bus, service, p, paths);
|
||||
if (q < 0 && r >= 0)
|
||||
q = find_nodes(bus, service, p, paths, many);
|
||||
if (q < 0) {
|
||||
if (r >= 0)
|
||||
r = q;
|
||||
|
||||
q = set_consume(q < 0 ? failed : done, TAKE_PTR(p));
|
||||
assert(q != 0);
|
||||
q = set_put(failed, p);
|
||||
} else
|
||||
q = set_put(done, p);
|
||||
|
||||
if (q < 0)
|
||||
return log_oom();
|
||||
|
||||
assert(q != 0);
|
||||
p = NULL;
|
||||
}
|
||||
|
||||
(void) pager_open(arg_pager_flags);
|
||||
|
@ -522,7 +558,7 @@ static int tree_one(sd_bus *bus, const char *service) {
|
|||
return log_oom();
|
||||
|
||||
strv_sort(l);
|
||||
print_tree(l);
|
||||
print_tree(prefix, l);
|
||||
|
||||
fflush(stdout);
|
||||
|
||||
|
@ -534,12 +570,6 @@ static int tree(int argc, char **argv, void *userdata) {
|
|||
char **i;
|
||||
int r = 0;
|
||||
|
||||
/* Do superficial verification of arguments before even opening the bus */
|
||||
STRV_FOREACH(i, strv_skip(argv, 1))
|
||||
if (!sd_bus_service_name_is_valid(*i))
|
||||
return log_error_errno(SYNTHETIC_ERRNO(EINVAL),
|
||||
"Invalid bus service name: %s", *i);
|
||||
|
||||
if (!arg_unique && !arg_acquired)
|
||||
arg_acquired = true;
|
||||
|
||||
|
@ -571,14 +601,14 @@ static int tree(int argc, char **argv, void *userdata) {
|
|||
|
||||
printf("Service %s%s%s:\n", ansi_highlight(), *i, ansi_normal());
|
||||
|
||||
q = tree_one(bus, *i);
|
||||
q = tree_one(bus, *i, NULL, true);
|
||||
if (q < 0 && r >= 0)
|
||||
r = q;
|
||||
|
||||
not_first = true;
|
||||
}
|
||||
} else
|
||||
STRV_FOREACH(i, strv_skip(argv, 1)) {
|
||||
} else {
|
||||
STRV_FOREACH(i, argv+1) {
|
||||
int q;
|
||||
|
||||
if (i > argv+1)
|
||||
|
@ -589,10 +619,11 @@ static int tree(int argc, char **argv, void *userdata) {
|
|||
printf("Service %s%s%s:\n", ansi_highlight(), *i, ansi_normal());
|
||||
}
|
||||
|
||||
q = tree_one(bus, *i);
|
||||
q = tree_one(bus, *i, NULL, !!argv[2]);
|
||||
if (q < 0 && r >= 0)
|
||||
r = q;
|
||||
}
|
||||
}
|
||||
|
||||
return r;
|
||||
}
|
||||
|
@ -1260,7 +1291,7 @@ static int monitor(int argc, char **argv, int (*dump)(sd_bus_message *m, FILE *f
|
|||
STRV_FOREACH(i, argv+1) {
|
||||
_cleanup_free_ char *m = NULL;
|
||||
|
||||
if (!sd_bus_service_name_is_valid(*i))
|
||||
if (!service_name_is_valid(*i))
|
||||
return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "Invalid service name '%s'", *i);
|
||||
|
||||
m = strjoin("sender='", *i, "'");
|
||||
|
@ -2577,6 +2608,7 @@ static int parse_argv(int argc, char *argv[]) {
|
|||
}
|
||||
|
||||
static int busctl_main(int argc, char *argv[]) {
|
||||
|
||||
static const Verb verbs[] = {
|
||||
{ "list", VERB_ANY, 1, VERB_DEFAULT, list_bus_names },
|
||||
{ "status", VERB_ANY, 2, 0, status },
|
||||
|
|
|
@ -707,7 +707,8 @@ static int bus_cgroup_set_boolean(
|
|||
return 1; \
|
||||
}
|
||||
|
||||
DISABLE_WARNING_TYPE_LIMITS;
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wtype-limits"
|
||||
BUS_DEFINE_SET_CGROUP_WEIGHT(cpu_weight, CGROUP_MASK_CPU, CGROUP_WEIGHT_IS_OK, CGROUP_WEIGHT_INVALID);
|
||||
BUS_DEFINE_SET_CGROUP_WEIGHT(cpu_shares, CGROUP_MASK_CPU, CGROUP_CPU_SHARES_IS_OK, CGROUP_CPU_SHARES_INVALID);
|
||||
BUS_DEFINE_SET_CGROUP_WEIGHT(io_weight, CGROUP_MASK_IO, CGROUP_WEIGHT_IS_OK, CGROUP_WEIGHT_INVALID);
|
||||
|
@ -715,7 +716,7 @@ BUS_DEFINE_SET_CGROUP_WEIGHT(blockio_weight, CGROUP_MASK_BLKIO, CGROUP_BLKIO_WEI
|
|||
BUS_DEFINE_SET_CGROUP_LIMIT(memory, CGROUP_MASK_MEMORY, physical_memory_scale, 1);
|
||||
BUS_DEFINE_SET_CGROUP_LIMIT(memory_protection, CGROUP_MASK_MEMORY, physical_memory_scale, 0);
|
||||
BUS_DEFINE_SET_CGROUP_LIMIT(swap, CGROUP_MASK_MEMORY, physical_memory_scale, 0);
|
||||
REENABLE_WARNING;
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
static int bus_cgroup_set_tasks_max(
|
||||
Unit *u,
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
#include "alloc-util.h"
|
||||
#include "bus-common-errors.h"
|
||||
#include "bus-internal.h"
|
||||
#include "bus-util.h"
|
||||
#include "dbus-cgroup.h"
|
||||
#include "dbus-kill.h"
|
||||
|
@ -139,7 +140,7 @@ static int bus_scope_set_transient_property(
|
|||
if (r < 0)
|
||||
return r;
|
||||
|
||||
if (!isempty(controller) && !sd_bus_service_name_is_valid(controller))
|
||||
if (!isempty(controller) && !service_name_is_valid(controller))
|
||||
return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Controller '%s' is not a valid bus name.", controller);
|
||||
|
||||
if (!UNIT_WRITE_FLAGS_NOOP(flags)) {
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
#include "alloc-util.h"
|
||||
#include "async.h"
|
||||
#include "bus-internal.h"
|
||||
#include "bus-util.h"
|
||||
#include "dbus-cgroup.h"
|
||||
#include "dbus-execute.h"
|
||||
|
@ -257,7 +258,7 @@ static BUS_DEFINE_SET_TRANSIENT_PARSE(notify_access, NotifyAccess, notify_access
|
|||
static BUS_DEFINE_SET_TRANSIENT_PARSE(service_type, ServiceType, service_type_from_string);
|
||||
static BUS_DEFINE_SET_TRANSIENT_PARSE(service_restart, ServiceRestart, service_restart_from_string);
|
||||
static BUS_DEFINE_SET_TRANSIENT_PARSE(oom_policy, OOMPolicy, oom_policy_from_string);
|
||||
static BUS_DEFINE_SET_TRANSIENT_STRING_WITH_CHECK(bus_name, sd_bus_service_name_is_valid);
|
||||
static BUS_DEFINE_SET_TRANSIENT_STRING_WITH_CHECK(bus_name, service_name_is_valid);
|
||||
|
||||
static int bus_service_set_transient_property(
|
||||
Service *s,
|
||||
|
|
|
@ -1948,7 +1948,7 @@ int config_parse_bus_name(
|
|||
return 0;
|
||||
}
|
||||
|
||||
if (!sd_bus_service_name_is_valid(k)) {
|
||||
if (!service_name_is_valid(k)) {
|
||||
log_syntax(unit, LOG_ERR, filename, line, 0, "Invalid bus name, ignoring: %s", k);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -123,12 +123,12 @@ _printf_(2, 3) static int log_callback(int type, const char *fmt, ...) {
|
|||
fmt2 = strjoina("selinux: ", fmt);
|
||||
|
||||
va_start(ap, fmt);
|
||||
|
||||
DISABLE_WARNING_FORMAT_NONLITERAL;
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wformat-nonliteral"
|
||||
log_internalv(LOG_AUTH | callback_type_to_priority(type),
|
||||
0, PROJECT_FILE, __LINE__, __FUNCTION__,
|
||||
fmt2, ap);
|
||||
REENABLE_WARNING;
|
||||
#pragma GCC diagnostic pop
|
||||
va_end(ap);
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -263,10 +263,10 @@ static int write_dependency(
|
|||
res = strv_join(units, " ");
|
||||
if (!res)
|
||||
return log_oom();
|
||||
|
||||
DISABLE_WARNING_FORMAT_NONLITERAL;
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wformat-nonliteral"
|
||||
fprintf(f, format, res);
|
||||
REENABLE_WARNING;
|
||||
#pragma GCC diagnostic pop
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -78,9 +78,10 @@ int mhd_respondf(struct MHD_Connection *connection,
|
|||
errno = -error;
|
||||
fmt = strjoina(format, "\n");
|
||||
va_start(ap, format);
|
||||
DISABLE_WARNING_FORMAT_NONLITERAL;
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wformat-nonliteral"
|
||||
r = vasprintf(&m, fmt, ap);
|
||||
REENABLE_WARNING;
|
||||
#pragma GCC diagnostic pop
|
||||
va_end(ap);
|
||||
|
||||
if (r < 0)
|
||||
|
|
|
@ -656,27 +656,27 @@ int config_parse_bridge_port_priority(
|
|||
size_t serialize_in_addrs(FILE *f,
|
||||
const struct in_addr *addresses,
|
||||
size_t size,
|
||||
bool *with_leading_space,
|
||||
bool with_leading_space,
|
||||
bool (*predicate)(const struct in_addr *addr)) {
|
||||
size_t count;
|
||||
size_t i;
|
||||
|
||||
assert(f);
|
||||
assert(addresses);
|
||||
|
||||
size_t count = 0;
|
||||
bool _space = false;
|
||||
if (!with_leading_space)
|
||||
with_leading_space = &_space;
|
||||
count = 0;
|
||||
|
||||
for (size_t i = 0; i < size; i++) {
|
||||
for (i = 0; i < size; i++) {
|
||||
char sbuf[INET_ADDRSTRLEN];
|
||||
|
||||
if (predicate && !predicate(&addresses[i]))
|
||||
continue;
|
||||
|
||||
if (*with_leading_space)
|
||||
if (with_leading_space)
|
||||
fputc(' ', f);
|
||||
else
|
||||
with_leading_space = true;
|
||||
fputs(inet_ntop(AF_INET, &addresses[i], sbuf, sizeof(sbuf)), f);
|
||||
count++;
|
||||
*with_leading_space = true;
|
||||
}
|
||||
|
||||
return count;
|
||||
|
@ -718,22 +718,20 @@ int deserialize_in_addrs(struct in_addr **ret, const char *string) {
|
|||
return size;
|
||||
}
|
||||
|
||||
void serialize_in6_addrs(FILE *f, const struct in6_addr *addresses, size_t size, bool *with_leading_space) {
|
||||
void serialize_in6_addrs(FILE *f, const struct in6_addr *addresses, size_t size) {
|
||||
unsigned i;
|
||||
|
||||
assert(f);
|
||||
assert(addresses);
|
||||
assert(size);
|
||||
|
||||
bool _space = false;
|
||||
if (!with_leading_space)
|
||||
with_leading_space = &_space;
|
||||
|
||||
for (size_t i = 0; i < size; i++) {
|
||||
for (i = 0; i < size; i++) {
|
||||
char buffer[INET6_ADDRSTRLEN];
|
||||
|
||||
if (*with_leading_space)
|
||||
fputc(' ', f);
|
||||
fputs(inet_ntop(AF_INET6, addresses+i, buffer, sizeof(buffer)), f);
|
||||
*with_leading_space = true;
|
||||
|
||||
if (i < size - 1)
|
||||
fputc(' ', f);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -774,6 +772,8 @@ int deserialize_in6_addrs(struct in6_addr **ret, const char *string) {
|
|||
}
|
||||
|
||||
void serialize_dhcp_routes(FILE *f, const char *key, sd_dhcp_route **routes, size_t size) {
|
||||
unsigned i;
|
||||
|
||||
assert(f);
|
||||
assert(key);
|
||||
assert(routes);
|
||||
|
@ -781,7 +781,7 @@ void serialize_dhcp_routes(FILE *f, const char *key, sd_dhcp_route **routes, siz
|
|||
|
||||
fprintf(f, "%s=", key);
|
||||
|
||||
for (size_t i = 0; i < size; i++) {
|
||||
for (i = 0; i < size; i++) {
|
||||
char sbuf[INET_ADDRSTRLEN];
|
||||
struct in_addr dest, gw;
|
||||
uint8_t length;
|
||||
|
@ -790,8 +790,8 @@ void serialize_dhcp_routes(FILE *f, const char *key, sd_dhcp_route **routes, siz
|
|||
assert_se(sd_dhcp_route_get_gateway(routes[i], &gw) >= 0);
|
||||
assert_se(sd_dhcp_route_get_destination_prefix_length(routes[i], &length) >= 0);
|
||||
|
||||
fprintf(f, "%s/%" PRIu8, inet_ntop(AF_INET, &dest, sbuf, sizeof sbuf), length);
|
||||
fprintf(f, ",%s%s", inet_ntop(AF_INET, &gw, sbuf, sizeof sbuf), i < size - 1 ? " ": "");
|
||||
fprintf(f, "%s/%" PRIu8, inet_ntop(AF_INET, &dest, sbuf, sizeof(sbuf)), length);
|
||||
fprintf(f, ",%s%s", inet_ntop(AF_INET, &gw, sbuf, sizeof(sbuf)), (i < (size - 1)) ? " ": "");
|
||||
}
|
||||
|
||||
fputs("\n", f);
|
||||
|
|
|
@ -50,12 +50,11 @@ const char *net_get_name_persistent(sd_device *device);
|
|||
size_t serialize_in_addrs(FILE *f,
|
||||
const struct in_addr *addresses,
|
||||
size_t size,
|
||||
bool *with_leading_space,
|
||||
bool with_leading_space,
|
||||
bool (*predicate)(const struct in_addr *addr));
|
||||
int deserialize_in_addrs(struct in_addr **addresses, const char *string);
|
||||
void serialize_in6_addrs(FILE *f, const struct in6_addr *addresses,
|
||||
size_t size,
|
||||
bool *with_leading_space);
|
||||
size_t size);
|
||||
int deserialize_in6_addrs(struct in6_addr **addresses, const char *string);
|
||||
|
||||
/* don't include "dhcp-lease-internal.h" as it causes conflicts between netinet/ip.h and linux/ip.h */
|
||||
|
|
|
@ -213,7 +213,7 @@ int dhcp6_lease_set_dns(sd_dhcp6_lease *lease, uint8_t *optval, size_t optlen) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
int sd_dhcp6_lease_get_dns(sd_dhcp6_lease *lease, const struct in6_addr **addrs) {
|
||||
int sd_dhcp6_lease_get_dns(sd_dhcp6_lease *lease, struct in6_addr **addrs) {
|
||||
assert_return(lease, -EINVAL);
|
||||
assert_return(addrs, -EINVAL);
|
||||
|
||||
|
@ -341,7 +341,7 @@ int dhcp6_lease_set_sntp(sd_dhcp6_lease *lease, uint8_t *optval, size_t optlen)
|
|||
}
|
||||
|
||||
int sd_dhcp6_lease_get_ntp_addrs(sd_dhcp6_lease *lease,
|
||||
const struct in6_addr **addrs) {
|
||||
struct in6_addr **addrs) {
|
||||
assert_return(lease, -EINVAL);
|
||||
assert_return(addrs, -EINVAL);
|
||||
|
||||
|
|
|
@ -371,7 +371,7 @@ static int test_advertise_option(sd_event *e) {
|
|||
int r;
|
||||
uint8_t *opt;
|
||||
bool opt_clientid = false;
|
||||
const struct in6_addr *addrs;
|
||||
struct in6_addr *addrs;
|
||||
char **domains;
|
||||
|
||||
log_debug("/* %s */", __func__);
|
||||
|
@ -518,7 +518,7 @@ static void test_client_solicit_cb(sd_dhcp6_client *client, int event,
|
|||
void *userdata) {
|
||||
sd_event *e = userdata;
|
||||
sd_dhcp6_lease *lease;
|
||||
const struct in6_addr *addrs;
|
||||
struct in6_addr *addrs;
|
||||
char **domains;
|
||||
|
||||
log_debug("/* %s */", __func__);
|
||||
|
@ -744,7 +744,7 @@ static void test_client_information_cb(sd_dhcp6_client *client, int event,
|
|||
void *userdata) {
|
||||
sd_event *e = userdata;
|
||||
sd_dhcp6_lease *lease;
|
||||
const struct in6_addr *addrs;
|
||||
struct in6_addr *addrs;
|
||||
struct in6_addr address = { { { 0xfe, 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x01 } } };
|
||||
char **domains;
|
||||
|
||||
|
|
|
@ -700,11 +700,6 @@ global:
|
|||
|
||||
LIBSYSTEMD_246 {
|
||||
global:
|
||||
sd_bus_interface_name_is_valid;
|
||||
sd_bus_service_name_is_valid;
|
||||
sd_bus_member_name_is_valid;
|
||||
sd_bus_object_path_is_valid;
|
||||
|
||||
sd_bus_call_methodv;
|
||||
sd_bus_call_method_asyncv;
|
||||
sd_bus_emit_signalv;
|
||||
|
@ -712,7 +707,6 @@ global:
|
|||
sd_bus_reply_method_errorfv;
|
||||
sd_bus_reply_method_returnv;
|
||||
sd_bus_set_propertyv;
|
||||
|
||||
sd_path_lookup;
|
||||
sd_path_lookup_strv;
|
||||
} LIBSYSTEMD_245;
|
||||
|
|
|
@ -354,7 +354,6 @@ bool interface_name_is_valid(const char *p) _pure_;
|
|||
bool service_name_is_valid(const char *p) _pure_;
|
||||
bool member_name_is_valid(const char *p) _pure_;
|
||||
bool object_path_is_valid(const char *p) _pure_;
|
||||
|
||||
char *object_path_startswith(const char *a, const char *b) _pure_;
|
||||
|
||||
bool namespace_complex_pattern(const char *pattern, const char *value) _pure_;
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
|
||||
#include "sd-bus.h"
|
||||
|
||||
#include "bus-internal.h"
|
||||
#include "bus-type.h"
|
||||
|
||||
bool bus_type_is_valid(char c) {
|
||||
|
@ -136,27 +135,3 @@ int bus_type_get_size(char c) {
|
|||
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
_public_ int sd_bus_interface_name_is_valid(const char *p) {
|
||||
assert_return(p, -EINVAL);
|
||||
|
||||
return interface_name_is_valid(p);
|
||||
}
|
||||
|
||||
_public_ int sd_bus_service_name_is_valid(const char *p) {
|
||||
assert_return(p, -EINVAL);
|
||||
|
||||
return service_name_is_valid(p);
|
||||
}
|
||||
|
||||
_public_ int sd_bus_member_name_is_valid(const char *p) {
|
||||
assert_return(p, -EINVAL);
|
||||
|
||||
return member_name_is_valid(p);
|
||||
}
|
||||
|
||||
_public_ int sd_bus_object_path_is_valid(const char *p) {
|
||||
assert_return(p, -EINVAL);
|
||||
|
||||
return object_path_is_valid(p);
|
||||
}
|
||||
|
|
|
@ -1266,16 +1266,10 @@ _public_ int sd_bus_open(sd_bus **ret) {
|
|||
|
||||
int bus_set_address_system(sd_bus *b) {
|
||||
const char *e;
|
||||
int r;
|
||||
|
||||
assert(b);
|
||||
|
||||
e = secure_getenv("DBUS_SYSTEM_BUS_ADDRESS");
|
||||
|
||||
r = sd_bus_set_address(b, e ?: DEFAULT_SYSTEM_BUS_ADDRESS);
|
||||
if (r >= 0)
|
||||
b->is_system = true;
|
||||
return r;
|
||||
return sd_bus_set_address(b, e ?: DEFAULT_SYSTEM_BUS_ADDRESS);
|
||||
}
|
||||
|
||||
_public_ int sd_bus_open_system_with_description(sd_bus **ret, const char *description) {
|
||||
|
@ -1299,6 +1293,7 @@ _public_ int sd_bus_open_system_with_description(sd_bus **ret, const char *descr
|
|||
return r;
|
||||
|
||||
b->bus_client = true;
|
||||
b->is_system = true;
|
||||
|
||||
/* Let's do per-method access control on the system bus. We
|
||||
* need the caller's UID and capability set for that. */
|
||||
|
@ -1321,7 +1316,6 @@ _public_ int sd_bus_open_system(sd_bus **ret) {
|
|||
int bus_set_address_user(sd_bus *b) {
|
||||
const char *a;
|
||||
_cleanup_free_ char *_a = NULL;
|
||||
int r;
|
||||
|
||||
assert(b);
|
||||
|
||||
|
@ -1343,10 +1337,7 @@ int bus_set_address_user(sd_bus *b) {
|
|||
a = _a;
|
||||
}
|
||||
|
||||
r = sd_bus_set_address(b, a);
|
||||
if (r >= 0)
|
||||
b->is_user = true;
|
||||
return r;
|
||||
return sd_bus_set_address(b, a);
|
||||
}
|
||||
|
||||
_public_ int sd_bus_open_user_with_description(sd_bus **ret, const char *description) {
|
||||
|
@ -1370,6 +1361,7 @@ _public_ int sd_bus_open_user_with_description(sd_bus **ret, const char *descrip
|
|||
return r;
|
||||
|
||||
b->bus_client = true;
|
||||
b->is_user = true;
|
||||
|
||||
/* We don't do any per-method access control on the user bus. */
|
||||
b->trusted = true;
|
||||
|
|
|
@ -499,9 +499,10 @@ static void log_xkb(struct xkb_context *ctx, enum xkb_log_level lvl, const char
|
|||
const char *fmt;
|
||||
|
||||
fmt = strjoina("libxkbcommon: ", format);
|
||||
DISABLE_WARNING_FORMAT_NONLITERAL;
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wformat-nonliteral"
|
||||
log_internalv(LOG_DEBUG, 0, __FILE__, __LINE__, __func__, fmt, args);
|
||||
REENABLE_WARNING;
|
||||
#pragma GCC diagnostic pop
|
||||
}
|
||||
|
||||
#define LOAD_SYMBOL(symbol, dl, name) \
|
||||
|
|
|
@ -3988,10 +3988,12 @@ static void print_link_hashmap(FILE *f, const char *prefix, Hashmap* h) {
|
|||
}
|
||||
|
||||
static void link_save_dns(FILE *f, struct in_addr_data *dns, unsigned n_dns, bool *space) {
|
||||
for (unsigned j = 0; j < n_dns; j++) {
|
||||
_cleanup_free_ char *b = NULL;
|
||||
unsigned j;
|
||||
int r;
|
||||
|
||||
for (j = 0; j < n_dns; j++) {
|
||||
_cleanup_free_ char *b = NULL;
|
||||
|
||||
r = in_addr_to_string(dns[j].family, &dns[j].address, &b);
|
||||
if (r < 0) {
|
||||
log_debug_errno(r, "Failed to format address, ignoring: %m");
|
||||
|
@ -4005,56 +4007,6 @@ static void link_save_dns(FILE *f, struct in_addr_data *dns, unsigned n_dns, boo
|
|||
}
|
||||
}
|
||||
|
||||
static void serialize_addresses(
|
||||
FILE *f,
|
||||
const char *lvalue,
|
||||
bool *space,
|
||||
char **addresses,
|
||||
sd_dhcp_lease *lease,
|
||||
bool conditional,
|
||||
sd_dhcp_lease_info what,
|
||||
sd_dhcp6_lease *lease6,
|
||||
bool conditional6,
|
||||
int (*lease6_get_addr)(sd_dhcp6_lease*, const struct in6_addr**),
|
||||
int (*lease6_get_fqdn)(sd_dhcp6_lease*, char ***)) {
|
||||
int r;
|
||||
|
||||
bool _space = false;
|
||||
if (!space)
|
||||
space = &_space;
|
||||
|
||||
if (lvalue)
|
||||
fprintf(f, "%s=", lvalue);
|
||||
fputstrv(f, addresses, NULL, space);
|
||||
|
||||
if (lease && conditional) {
|
||||
const struct in_addr *lease_addresses;
|
||||
|
||||
r = sd_dhcp_lease_get_servers(lease, what, &lease_addresses);
|
||||
if (r > 0)
|
||||
serialize_in_addrs(f, lease_addresses, r, space, in4_addr_is_non_local);
|
||||
}
|
||||
|
||||
if (lease6 && conditional6 && lease6_get_addr) {
|
||||
const struct in6_addr *in6_addrs;
|
||||
|
||||
r = lease6_get_addr(lease6, &in6_addrs);
|
||||
if (r > 0)
|
||||
serialize_in6_addrs(f, in6_addrs, r, space);
|
||||
}
|
||||
|
||||
if (lease6 && conditional6 && lease6_get_fqdn) {
|
||||
char **in6_hosts;
|
||||
|
||||
r = lease6_get_fqdn(lease6, &in6_hosts);
|
||||
if (r > 0)
|
||||
fputstrv(f, in6_hosts, NULL, space);
|
||||
}
|
||||
|
||||
if (lvalue)
|
||||
fputc('\n', f);
|
||||
}
|
||||
|
||||
int link_save(Link *link) {
|
||||
const char *admin_state, *oper_state, *carrier_state, *address_state;
|
||||
_cleanup_free_ char *temp_path = NULL;
|
||||
|
@ -4111,38 +4063,52 @@ int link_save(Link *link) {
|
|||
fprintf(f, "REQUIRED_FOR_ONLINE=%s\n",
|
||||
yes_no(link->network->required_for_online));
|
||||
|
||||
LinkOperationalStateRange st = link->network->required_operstate_for_online;
|
||||
fprintf(f, "REQUIRED_OPER_STATE_FOR_ONLINE=%s%s%s\n",
|
||||
strempty(link_operstate_to_string(st.min)),
|
||||
st.max != LINK_OPERSTATE_RANGE_DEFAULT.max ? ":" : "",
|
||||
st.max != LINK_OPERSTATE_RANGE_DEFAULT.max ? strempty(link_operstate_to_string(st.max)) : "");
|
||||
fprintf(f, "REQUIRED_OPER_STATE_FOR_ONLINE=%s",
|
||||
strempty(link_operstate_to_string(link->network->required_operstate_for_online.min)));
|
||||
|
||||
if (link->network->required_operstate_for_online.max != LINK_OPERSTATE_RANGE_DEFAULT.max)
|
||||
fprintf(f, ":%s",
|
||||
strempty(link_operstate_to_string(link->network->required_operstate_for_online.max)));
|
||||
|
||||
fprintf(f, "\n");
|
||||
|
||||
if (link->dhcp6_client) {
|
||||
r = sd_dhcp6_client_get_lease(link->dhcp6_client, &dhcp6_lease);
|
||||
if (r < 0 && r != -ENOMSG)
|
||||
log_link_debug_errno(link, r, "Failed to get DHCPv6 lease: %m");
|
||||
log_link_debug(link, "No DHCPv6 lease");
|
||||
}
|
||||
|
||||
fprintf(f, "NETWORK_FILE=%s\n", link->network->filename);
|
||||
|
||||
/************************************************************/
|
||||
|
||||
fputs("DNS=", f);
|
||||
space = false;
|
||||
|
||||
if (link->n_dns != (unsigned) -1)
|
||||
link_save_dns(f, link->dns, link->n_dns, &space);
|
||||
else
|
||||
link_save_dns(f, link->network->dns, link->network->n_dns, &space);
|
||||
|
||||
serialize_addresses(f, NULL, &space,
|
||||
NULL,
|
||||
link->dhcp_lease,
|
||||
link->network->dhcp_use_dns,
|
||||
SD_DHCP_LEASE_DNS_SERVERS,
|
||||
dhcp6_lease,
|
||||
link->network->dhcp6_use_dns,
|
||||
sd_dhcp6_lease_get_dns,
|
||||
NULL);
|
||||
if (link->network->dhcp_use_dns &&
|
||||
link->dhcp_lease) {
|
||||
const struct in_addr *addresses;
|
||||
|
||||
r = sd_dhcp_lease_get_dns(link->dhcp_lease, &addresses);
|
||||
if (r > 0)
|
||||
if (serialize_in_addrs(f, addresses, r, space, in4_addr_is_non_local) > 0)
|
||||
space = true;
|
||||
}
|
||||
|
||||
if (link->network->dhcp6_use_dns && dhcp6_lease) {
|
||||
struct in6_addr *in6_addrs;
|
||||
|
||||
r = sd_dhcp6_lease_get_dns(dhcp6_lease, &in6_addrs);
|
||||
if (r > 0) {
|
||||
if (space)
|
||||
fputc(' ', f);
|
||||
serialize_in6_addrs(f, in6_addrs, r);
|
||||
space = true;
|
||||
}
|
||||
}
|
||||
|
||||
/* Make sure to flush out old entries before we use the NDISC data */
|
||||
ndisc_vacuum(link);
|
||||
|
@ -4150,53 +4116,111 @@ int link_save(Link *link) {
|
|||
if (link->network->ipv6_accept_ra_use_dns && link->ndisc_rdnss) {
|
||||
NDiscRDNSS *dd;
|
||||
|
||||
SET_FOREACH(dd, link->ndisc_rdnss, i)
|
||||
serialize_in6_addrs(f, &dd->address, 1, &space);
|
||||
SET_FOREACH(dd, link->ndisc_rdnss, i) {
|
||||
if (space)
|
||||
fputc(' ', f);
|
||||
|
||||
serialize_in6_addrs(f, &dd->address, 1);
|
||||
space = true;
|
||||
}
|
||||
}
|
||||
|
||||
fputc('\n', f);
|
||||
|
||||
/************************************************************/
|
||||
fputs("NTP=", f);
|
||||
space = false;
|
||||
fputstrv(f, link->ntp ?: link->network->ntp, NULL, &space);
|
||||
|
||||
serialize_addresses(f, "NTP", NULL,
|
||||
link->ntp ?: link->network->ntp,
|
||||
link->dhcp_lease,
|
||||
link->network->dhcp_use_ntp,
|
||||
SD_DHCP_LEASE_NTP_SERVERS,
|
||||
dhcp6_lease,
|
||||
link->network->dhcp6_use_ntp,
|
||||
sd_dhcp6_lease_get_ntp_addrs,
|
||||
sd_dhcp6_lease_get_ntp_fqdn);
|
||||
if (link->network->dhcp_use_ntp &&
|
||||
link->dhcp_lease) {
|
||||
const struct in_addr *addresses;
|
||||
|
||||
serialize_addresses(f, "SIP", NULL,
|
||||
link->network->sip,
|
||||
link->dhcp_lease,
|
||||
link->network->dhcp_use_sip,
|
||||
SD_DHCP_LEASE_SIP_SERVERS,
|
||||
false, NULL, NULL, NULL);
|
||||
r = sd_dhcp_lease_get_ntp(link->dhcp_lease, &addresses);
|
||||
if (r > 0)
|
||||
if (serialize_in_addrs(f, addresses, r, space, in4_addr_is_non_local) > 0)
|
||||
space = true;
|
||||
}
|
||||
|
||||
serialize_addresses(f, "POP3_SERVERS", NULL,
|
||||
link->network->pop3,
|
||||
link->dhcp_lease,
|
||||
true,
|
||||
SD_DHCP_LEASE_POP3_SERVERS,
|
||||
false, NULL, NULL, NULL);
|
||||
fputc('\n', f);
|
||||
|
||||
serialize_addresses(f, "SMTP_SERVERS", NULL,
|
||||
link->network->smtp,
|
||||
link->dhcp_lease,
|
||||
true,
|
||||
SD_DHCP_LEASE_SMTP_SERVERS,
|
||||
false, NULL, NULL, NULL);
|
||||
fputs("SIP=", f);
|
||||
space = false;
|
||||
fputstrv(f, link->network->sip, NULL, &space);
|
||||
|
||||
serialize_addresses(f, "LPR_SERVERS", NULL,
|
||||
link->network->lpr,
|
||||
link->dhcp_lease,
|
||||
true,
|
||||
SD_DHCP_LEASE_LPR_SERVERS,
|
||||
false, NULL, NULL, NULL);
|
||||
if (link->network->dhcp_use_sip &&
|
||||
link->dhcp_lease) {
|
||||
const struct in_addr *addresses;
|
||||
|
||||
/************************************************************/
|
||||
r = sd_dhcp_lease_get_sip(link->dhcp_lease, &addresses);
|
||||
if (r > 0)
|
||||
if (serialize_in_addrs(f, addresses, r, space, in4_addr_is_non_local) > 0)
|
||||
space = true;
|
||||
}
|
||||
|
||||
fputc('\n', f);
|
||||
|
||||
fputs("POP3_SERVERS=", f);
|
||||
space = false;
|
||||
fputstrv(f, link->network->pop3, NULL, &space);
|
||||
|
||||
fputc('\n', f);
|
||||
|
||||
fputs("SMTP_SERVERS=", f);
|
||||
space = false;
|
||||
fputstrv(f, link->network->smtp, NULL, &space);
|
||||
|
||||
fputc('\n', f);
|
||||
|
||||
fputs("LPR_SERVERS=", f);
|
||||
space = false;
|
||||
fputstrv(f, link->network->lpr, NULL, &space);
|
||||
|
||||
if (link->dhcp_lease) {
|
||||
const struct in_addr *addresses;
|
||||
|
||||
r = sd_dhcp_lease_get_pop3_server(link->dhcp_lease, &addresses);
|
||||
if (r > 0)
|
||||
if (serialize_in_addrs(f, addresses, r, space, in4_addr_is_non_local) > 0)
|
||||
space = true;
|
||||
}
|
||||
|
||||
if (link->dhcp_lease) {
|
||||
const struct in_addr *addresses;
|
||||
|
||||
r = sd_dhcp_lease_get_smtp_server(link->dhcp_lease, &addresses);
|
||||
if (r > 0)
|
||||
if (serialize_in_addrs(f, addresses, r, space, in4_addr_is_non_local) > 0)
|
||||
space = true;
|
||||
}
|
||||
|
||||
if (link->dhcp_lease) {
|
||||
const struct in_addr *addresses;
|
||||
|
||||
r = sd_dhcp_lease_get_lpr_servers(link->dhcp_lease, &addresses);
|
||||
if (r > 0)
|
||||
if (serialize_in_addrs(f, addresses, r, space, in4_addr_is_non_local) > 0)
|
||||
space = true;
|
||||
}
|
||||
|
||||
if (link->network->dhcp6_use_ntp && dhcp6_lease) {
|
||||
struct in6_addr *in6_addrs;
|
||||
char **hosts;
|
||||
|
||||
r = sd_dhcp6_lease_get_ntp_addrs(dhcp6_lease,
|
||||
&in6_addrs);
|
||||
if (r > 0) {
|
||||
if (space)
|
||||
fputc(' ', f);
|
||||
serialize_in6_addrs(f, in6_addrs, r);
|
||||
space = true;
|
||||
}
|
||||
|
||||
r = sd_dhcp6_lease_get_ntp_fqdn(dhcp6_lease, &hosts);
|
||||
if (r > 0)
|
||||
fputstrv(f, hosts, NULL, &space);
|
||||
}
|
||||
|
||||
fputc('\n', f);
|
||||
|
||||
if (link->network->dhcp_use_domains != DHCP_USE_DOMAINS_NO) {
|
||||
if (link->dhcp_lease) {
|
||||
|
@ -4230,8 +4254,6 @@ int link_save(Link *link) {
|
|||
|
||||
fputc('\n', f);
|
||||
|
||||
/************************************************************/
|
||||
|
||||
fputs("ROUTE_DOMAINS=", f);
|
||||
space = false;
|
||||
ORDERED_SET_FOREACH(p, link->route_domains ?: link->network->route_domains, i)
|
||||
|
@ -4255,58 +4277,47 @@ int link_save(Link *link) {
|
|||
|
||||
fputc('\n', f);
|
||||
|
||||
/************************************************************/
|
||||
|
||||
fprintf(f, "LLMNR=%s\n",
|
||||
resolve_support_to_string(link->llmnr >= 0 ? link->llmnr : link->network->llmnr));
|
||||
|
||||
/************************************************************/
|
||||
|
||||
fprintf(f, "MDNS=%s\n",
|
||||
resolve_support_to_string(link->mdns >= 0 ? link->mdns : link->network->mdns));
|
||||
if (link->dns_default_route >= 0)
|
||||
fprintf(f, "DNS_DEFAULT_ROUTE=%s\n", yes_no(link->dns_default_route));
|
||||
else if (link->network->dns_default_route >= 0)
|
||||
fprintf(f, "DNS_DEFAULT_ROUTE=%s\n", yes_no(link->network->dns_default_route));
|
||||
|
||||
/************************************************************/
|
||||
if (link->dns_over_tls_mode != _DNS_OVER_TLS_MODE_INVALID)
|
||||
fprintf(f, "DNS_OVER_TLS=%s\n",
|
||||
dns_over_tls_mode_to_string(link->dns_over_tls_mode));
|
||||
else if (link->network->dns_over_tls_mode != _DNS_OVER_TLS_MODE_INVALID)
|
||||
fprintf(f, "DNS_OVER_TLS=%s\n",
|
||||
dns_over_tls_mode_to_string(link->network->dns_over_tls_mode));
|
||||
|
||||
int dns_default_route =
|
||||
link->dns_default_route >= 0 ? link->dns_default_route :
|
||||
link->network->dns_default_route;
|
||||
if (dns_default_route >= 0)
|
||||
fprintf(f, "DNS_DEFAULT_ROUTE=%s\n", yes_no(dns_default_route));
|
||||
if (link->dnssec_mode != _DNSSEC_MODE_INVALID)
|
||||
fprintf(f, "DNSSEC=%s\n",
|
||||
dnssec_mode_to_string(link->dnssec_mode));
|
||||
else if (link->network->dnssec_mode != _DNSSEC_MODE_INVALID)
|
||||
fprintf(f, "DNSSEC=%s\n",
|
||||
dnssec_mode_to_string(link->network->dnssec_mode));
|
||||
|
||||
/************************************************************/
|
||||
|
||||
DnsOverTlsMode dns_over_tls_mode =
|
||||
link->dns_over_tls_mode != _DNS_OVER_TLS_MODE_INVALID ? link->dns_over_tls_mode :
|
||||
link->network->dns_over_tls_mode;
|
||||
if (dns_over_tls_mode != _DNS_OVER_TLS_MODE_INVALID)
|
||||
fprintf(f, "DNS_OVER_TLS=%s\n", dns_over_tls_mode_to_string(dns_over_tls_mode));
|
||||
|
||||
/************************************************************/
|
||||
|
||||
DnssecMode dnssec_mode =
|
||||
link->dnssec_mode != _DNSSEC_MODE_INVALID ? link->dnssec_mode :
|
||||
link->network->dnssec_mode;
|
||||
if (dnssec_mode != _DNSSEC_MODE_INVALID)
|
||||
fprintf(f, "DNSSEC=%s\n", dnssec_mode_to_string(dnssec_mode));
|
||||
|
||||
/************************************************************/
|
||||
|
||||
Set *nta_anchors = link->dnssec_negative_trust_anchors;
|
||||
if (set_isempty(nta_anchors))
|
||||
nta_anchors = link->network->dnssec_negative_trust_anchors;
|
||||
|
||||
if (!set_isempty(nta_anchors)) {
|
||||
if (!set_isempty(link->dnssec_negative_trust_anchors)) {
|
||||
const char *n;
|
||||
|
||||
fputs("DNSSEC_NTA=", f);
|
||||
space = false;
|
||||
SET_FOREACH(n, nta_anchors, i)
|
||||
SET_FOREACH(n, link->dnssec_negative_trust_anchors, i)
|
||||
fputs_with_space(f, n, NULL, &space);
|
||||
fputc('\n', f);
|
||||
} else if (!set_isempty(link->network->dnssec_negative_trust_anchors)) {
|
||||
const char *n;
|
||||
|
||||
fputs("DNSSEC_NTA=", f);
|
||||
space = false;
|
||||
SET_FOREACH(n, link->network->dnssec_negative_trust_anchors, i)
|
||||
fputs_with_space(f, n, NULL, &space);
|
||||
fputc('\n', f);
|
||||
}
|
||||
|
||||
/************************************************************/
|
||||
|
||||
fputs("ADDRESSES=", f);
|
||||
space = false;
|
||||
SET_FOREACH(a, link->addresses, i) {
|
||||
|
@ -4321,8 +4332,6 @@ int link_save(Link *link) {
|
|||
}
|
||||
fputc('\n', f);
|
||||
|
||||
/************************************************************/
|
||||
|
||||
fputs("ROUTES=", f);
|
||||
space = false;
|
||||
SET_FOREACH(route, link->routes, i) {
|
||||
|
@ -4357,7 +4366,7 @@ int link_save(Link *link) {
|
|||
r = sd_dhcp_lease_get_address(link->dhcp_lease, &address);
|
||||
if (r >= 0) {
|
||||
fputs("DHCP4_ADDRESS=", f);
|
||||
serialize_in_addrs(f, &address, 1, NULL, NULL);
|
||||
serialize_in_addrs(f, &address, 1, false, NULL);
|
||||
fputc('\n', f);
|
||||
}
|
||||
|
||||
|
|
|
@ -295,6 +295,35 @@ int config_parse_capability(
|
|||
return 0;
|
||||
}
|
||||
|
||||
int config_parse_id128(
|
||||
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) {
|
||||
|
||||
sd_id128_t t, *result = data;
|
||||
int r;
|
||||
|
||||
assert(filename);
|
||||
assert(lvalue);
|
||||
assert(rvalue);
|
||||
|
||||
r = sd_id128_from_string(rvalue, &t);
|
||||
if (r < 0) {
|
||||
log_syntax(unit, LOG_ERR, filename, line, r, "Failed to parse 128bit ID/UUID, ignoring: %s", rvalue);
|
||||
return 0;
|
||||
}
|
||||
|
||||
*result = t;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int config_parse_pivot_root(
|
||||
const char *unit,
|
||||
const char *filename,
|
||||
|
|
|
@ -234,6 +234,7 @@ DEFINE_TRIVIAL_CLEANUP_FUNC(Settings*, settings_free);
|
|||
const struct ConfigPerfItem* nspawn_gperf_lookup(const char *key, GPERF_LEN_TYPE length);
|
||||
|
||||
CONFIG_PARSER_PROTOTYPE(config_parse_capability);
|
||||
CONFIG_PARSER_PROTOTYPE(config_parse_id128);
|
||||
CONFIG_PARSER_PROTOTYPE(config_parse_expose_port);
|
||||
CONFIG_PARSER_PROTOTYPE(config_parse_volatile_mode);
|
||||
CONFIG_PARSER_PROTOTYPE(config_parse_pivot_root);
|
||||
|
|
|
@ -963,7 +963,6 @@ static int partition_read_definition(Partition *p, const char *path) {
|
|||
ConfigTableItem table[] = {
|
||||
{ "Partition", "Type", config_parse_type, 0, &p->type_uuid },
|
||||
{ "Partition", "Label", config_parse_label, 0, &p->new_label },
|
||||
{ "Partition", "UUID", config_parse_id128, 0, &p->new_uuid },
|
||||
{ "Partition", "Priority", config_parse_int32, 0, &p->priority },
|
||||
{ "Partition", "Weight", config_parse_weight, 0, &p->weight },
|
||||
{ "Partition", "PaddingWeight", config_parse_weight, 0, &p->padding_weight },
|
||||
|
@ -2233,12 +2232,13 @@ static int context_acquire_partition_uuids_and_labels(Context *context) {
|
|||
assert(context);
|
||||
|
||||
LIST_FOREACH(partitions, p, context->partitions) {
|
||||
assert(sd_id128_is_null(p->new_uuid));
|
||||
|
||||
/* Never touch foreign partitions */
|
||||
if (PARTITION_IS_FOREIGN(p)) {
|
||||
p->new_uuid = p->current_uuid;
|
||||
|
||||
if (p->current_label) {
|
||||
free(p->new_label);
|
||||
p->new_label = strdup(p->current_label);
|
||||
if (!p->new_label)
|
||||
return log_oom();
|
||||
|
@ -2249,21 +2249,20 @@ static int context_acquire_partition_uuids_and_labels(Context *context) {
|
|||
|
||||
if (!sd_id128_is_null(p->current_uuid))
|
||||
p->new_uuid = p->current_uuid; /* Never change initialized UUIDs */
|
||||
else if (sd_id128_is_null(p->new_uuid)) {
|
||||
/* Not explicitly set by user! */
|
||||
else {
|
||||
r = partition_acquire_uuid(context, p, &p->new_uuid);
|
||||
if (r < 0)
|
||||
return r;
|
||||
}
|
||||
|
||||
if (p->new_label) /* Explicitly set by user? */
|
||||
continue;
|
||||
|
||||
if (!isempty(p->current_label)) {
|
||||
free(p->new_label);
|
||||
p->new_label = strdup(p->current_label); /* never change initialized labels */
|
||||
if (!p->new_label)
|
||||
return log_oom();
|
||||
} else if (!p->new_label) {
|
||||
/* Not explicitly set by user! */
|
||||
|
||||
} else {
|
||||
r = partition_acquire_label(context, p, &p->new_label);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
|
|
@ -68,13 +68,8 @@ EOF
|
|||
cat >$D/definitions/extra.conf <<EOF
|
||||
[Partition]
|
||||
Type=linux-generic
|
||||
Label=custom_label
|
||||
UUID=a0a1a2a3a4a5a6a7a8a9aaabacadaeaf
|
||||
EOF
|
||||
|
||||
echo "Label=ignored_label" >> $D/definitions/home.conf
|
||||
echo "UUID=b0b1b2b3b4b5b6b7b8b9babbbcbdbebf" >> $D/definitions/home.conf
|
||||
|
||||
$repart $D/zzz --dry-run=no --seed=$SEED --definitions=$D/definitions
|
||||
|
||||
sfdisk -d $D/zzz | grep -v -e 'sector-size' -e '^$' >$D/populated2
|
||||
|
@ -90,7 +85,7 @@ $D/zzz1 : start= 2048, size= 591856, type=933AC7E1-2EB4-4F13-B844-0E
|
|||
$D/zzz2 : start= 593904, size= 591856, type=4F68BCE3-E8CD-4DB1-96E7-FBCAF984B709, uuid=CE9C76EB-A8F1-40FF-813C-11DCA6C0A55B, name="root-x86-64"
|
||||
$D/zzz3 : start= 1185760, size= 591864, type=4F68BCE3-E8CD-4DB1-96E7-FBCAF984B709, uuid=AC60A837-550C-43BD-B5C4-9CB73B884E79, name="root-x86-64-2"
|
||||
$D/zzz4 : start= 1777624, size= 131072, type=0657FD6D-A4AB-43C4-84E5-0933C84B4F4F, uuid=2AA78CDB-59C7-4173-AF11-C7453737A5D1, name="swap"
|
||||
$D/zzz5 : start= 1908696, size= 188416, type=0FC63DAF-8483-4772-8E79-3D69D8477DE4, uuid=A0A1A2A3-A4A5-A6A7-A8A9-AAABACADAEAF, name="custom_label"
|
||||
$D/zzz5 : start= 1908696, size= 188416, type=0FC63DAF-8483-4772-8E79-3D69D8477DE4, uuid=03477476-06AD-44E8-9EF4-BC2BD7771289, name="linux-generic"
|
||||
EOF
|
||||
|
||||
$repart $D/zzz --size=2G --dry-run=no --seed=$SEED --definitions=$D/definitions
|
||||
|
@ -108,5 +103,5 @@ $D/zzz1 : start= 2048, size= 591856, type=933AC7E1-2EB4-4F13-B844-0E
|
|||
$D/zzz2 : start= 593904, size= 591856, type=4F68BCE3-E8CD-4DB1-96E7-FBCAF984B709, uuid=CE9C76EB-A8F1-40FF-813C-11DCA6C0A55B, name="root-x86-64"
|
||||
$D/zzz3 : start= 1185760, size= 591864, type=4F68BCE3-E8CD-4DB1-96E7-FBCAF984B709, uuid=AC60A837-550C-43BD-B5C4-9CB73B884E79, name="root-x86-64-2"
|
||||
$D/zzz4 : start= 1777624, size= 131072, type=0657FD6D-A4AB-43C4-84E5-0933C84B4F4F, uuid=2AA78CDB-59C7-4173-AF11-C7453737A5D1, name="swap"
|
||||
$D/zzz5 : start= 1908696, size= 2285568, type=0FC63DAF-8483-4772-8E79-3D69D8477DE4, uuid=A0A1A2A3-A4A5-A6A7-A8A9-AAABACADAEAF, name="custom_label"
|
||||
$D/zzz5 : start= 1908696, size= 2285568, type=0FC63DAF-8483-4772-8E79-3D69D8477DE4, uuid=03477476-06AD-44E8-9EF4-BC2BD7771289, name="linux-generic"
|
||||
EOF
|
||||
|
|
|
@ -1156,7 +1156,7 @@ int bus_path_encode_unique(sd_bus *b, const char *prefix, const char *sender_id,
|
|||
int r;
|
||||
|
||||
assert_return(b || (sender_id && external_id), -EINVAL);
|
||||
assert_return(sd_bus_object_path_is_valid(prefix), -EINVAL);
|
||||
assert_return(object_path_is_valid(prefix), -EINVAL);
|
||||
assert_return(ret_path, -EINVAL);
|
||||
|
||||
if (!sender_id) {
|
||||
|
@ -1208,8 +1208,8 @@ int bus_path_decode_unique(const char *path, const char *prefix, char **ret_send
|
|||
const char *p, *q;
|
||||
char *sender, *external;
|
||||
|
||||
assert(sd_bus_object_path_is_valid(path));
|
||||
assert(sd_bus_object_path_is_valid(prefix));
|
||||
assert(object_path_is_valid(path));
|
||||
assert(object_path_is_valid(prefix));
|
||||
assert(ret_sender);
|
||||
assert(ret_external);
|
||||
|
||||
|
@ -1670,7 +1670,7 @@ int bus_introspect_implementations(
|
|||
}
|
||||
|
||||
struct introspect intro = {};
|
||||
bool is_interface = sd_bus_interface_name_is_valid(pattern);
|
||||
bool is_interface = interface_name_is_valid(pattern);
|
||||
|
||||
impl = find_implementation(pattern, bus_objects);
|
||||
if (!impl)
|
||||
|
|
|
@ -23,7 +23,6 @@
|
|||
#include "path-util.h"
|
||||
#include "process-util.h"
|
||||
#include "rlimit-util.h"
|
||||
#include "sd-id128.h"
|
||||
#include "signal-util.h"
|
||||
#include "socket-util.h"
|
||||
#include "string-util.h"
|
||||
|
@ -649,35 +648,6 @@ int config_parse_bool(const char* unit,
|
|||
return 0;
|
||||
}
|
||||
|
||||
int config_parse_id128(
|
||||
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) {
|
||||
|
||||
sd_id128_t t, *result = data;
|
||||
int r;
|
||||
|
||||
assert(filename);
|
||||
assert(lvalue);
|
||||
assert(rvalue);
|
||||
|
||||
r = sd_id128_from_string(rvalue, &t);
|
||||
if (r < 0)
|
||||
log_syntax(unit, LOG_ERR, filename, line, r, "Failed to parse 128bit ID/UUID, ignoring: %s", rvalue);
|
||||
else if (sd_id128_is_null(t))
|
||||
log_syntax(unit, LOG_ERR, filename, line, 0, "128bit ID/UUID is all 0, ignoring: %s", rvalue);
|
||||
|
||||
*result = t;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int config_parse_tristate(
|
||||
const char* unit,
|
||||
const char *filename,
|
||||
|
|
|
@ -122,7 +122,6 @@ 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_bool);
|
||||
CONFIG_PARSER_PROTOTYPE(config_parse_id128);
|
||||
CONFIG_PARSER_PROTOTYPE(config_parse_tristate);
|
||||
CONFIG_PARSER_PROTOTYPE(config_parse_string);
|
||||
CONFIG_PARSER_PROTOTYPE(config_parse_path);
|
||||
|
|
|
@ -253,9 +253,10 @@ static JsonVariant *json_variant_formalize(JsonVariant *v) {
|
|||
return json_variant_unsigned(v) == 0 ? JSON_VARIANT_MAGIC_ZERO_UNSIGNED : v;
|
||||
|
||||
case JSON_VARIANT_REAL:
|
||||
DISABLE_WARNING_FLOAT_EQUAL;
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wfloat-equal"
|
||||
return json_variant_real(v) == 0.0 ? JSON_VARIANT_MAGIC_ZERO_REAL : v;
|
||||
REENABLE_WARNING;
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
case JSON_VARIANT_STRING:
|
||||
return isempty(json_variant_string(v)) ? JSON_VARIANT_MAGIC_EMPTY_STRING : v;
|
||||
|
@ -352,12 +353,13 @@ int json_variant_new_real(JsonVariant **ret, long double d) {
|
|||
|
||||
assert_return(ret, -EINVAL);
|
||||
|
||||
DISABLE_WARNING_FLOAT_EQUAL;
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wfloat-equal"
|
||||
if (d == 0.0) {
|
||||
#pragma GCC diagnostic pop
|
||||
*ret = JSON_VARIANT_MAGIC_ZERO_REAL;
|
||||
return 0;
|
||||
}
|
||||
REENABLE_WARNING;
|
||||
|
||||
r = json_variant_new(&v, JSON_VARIANT_REAL, sizeof(d));
|
||||
if (r < 0)
|
||||
|
@ -894,10 +896,11 @@ intmax_t json_variant_integer(JsonVariant *v) {
|
|||
|
||||
converted = (intmax_t) v->value.real;
|
||||
|
||||
DISABLE_WARNING_FLOAT_EQUAL;
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wfloat-equal"
|
||||
if ((long double) converted == v->value.real)
|
||||
#pragma GCC diagnostic pop
|
||||
return converted;
|
||||
REENABLE_WARNING;
|
||||
|
||||
log_debug("Real %Lg requested as integer, and cannot be converted losslessly, returning 0.", v->value.real);
|
||||
return 0;
|
||||
|
@ -941,10 +944,11 @@ uintmax_t json_variant_unsigned(JsonVariant *v) {
|
|||
|
||||
converted = (uintmax_t) v->value.real;
|
||||
|
||||
DISABLE_WARNING_FLOAT_EQUAL;
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wfloat-equal"
|
||||
if ((long double) converted == v->value.real)
|
||||
#pragma GCC diagnostic pop
|
||||
return converted;
|
||||
REENABLE_WARNING;
|
||||
|
||||
log_debug("Real %Lg requested as unsigned integer, and cannot be converted losslessly, returning 0.", v->value.real);
|
||||
return 0;
|
||||
|
@ -1093,12 +1097,9 @@ JsonVariantType json_variant_type(JsonVariant *v) {
|
|||
return v->type;
|
||||
}
|
||||
|
||||
_function_no_sanitize_float_cast_overflow_ bool json_variant_has_type(JsonVariant *v, JsonVariantType type) {
|
||||
bool json_variant_has_type(JsonVariant *v, JsonVariantType type) {
|
||||
JsonVariantType rt;
|
||||
|
||||
/* Note: we turn off ubsan float cast overflo detection for this function, since it would complain
|
||||
* about our float casts but we do them explicitly to detect conversion errors. */
|
||||
|
||||
v = json_variant_dereference(v);
|
||||
if (!v)
|
||||
return false;
|
||||
|
@ -1136,15 +1137,14 @@ _function_no_sanitize_float_cast_overflow_ bool json_variant_has_type(JsonVarian
|
|||
if (rt == JSON_VARIANT_UNSIGNED && type == JSON_VARIANT_REAL)
|
||||
return (uintmax_t) (long double) v->value.unsig == v->value.unsig;
|
||||
|
||||
DISABLE_WARNING_FLOAT_EQUAL;
|
||||
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wfloat-equal"
|
||||
/* Any real that can be converted losslessly to an integer and back may also be considered an integer */
|
||||
if (rt == JSON_VARIANT_REAL && type == JSON_VARIANT_INTEGER)
|
||||
return (long double) (intmax_t) v->value.real == v->value.real;
|
||||
if (rt == JSON_VARIANT_REAL && type == JSON_VARIANT_UNSIGNED)
|
||||
return (long double) (uintmax_t) v->value.real == v->value.real;
|
||||
|
||||
REENABLE_WARNING;
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
return false;
|
||||
}
|
||||
|
@ -1298,9 +1298,10 @@ bool json_variant_equal(JsonVariant *a, JsonVariant *b) {
|
|||
return json_variant_unsigned(a) == json_variant_unsigned(b);
|
||||
|
||||
case JSON_VARIANT_REAL:
|
||||
DISABLE_WARNING_FLOAT_EQUAL;
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wfloat-equal"
|
||||
return json_variant_real(a) == json_variant_real(b);
|
||||
REENABLE_WARNING;
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
case JSON_VARIANT_BOOLEAN:
|
||||
return json_variant_boolean(a) == json_variant_boolean(b);
|
||||
|
@ -4094,9 +4095,10 @@ int json_dispatch_uid_gid(const char *name, JsonVariant *variant, JsonDispatchFl
|
|||
assert_cc(sizeof(uid_t) == sizeof(uint32_t));
|
||||
assert_cc(sizeof(gid_t) == sizeof(uint32_t));
|
||||
|
||||
DISABLE_WARNING_TYPE_LIMITS;
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wtype-limits"
|
||||
assert_cc(((uid_t) -1 < (uid_t) 0) == ((gid_t) -1 < (gid_t) 0));
|
||||
REENABLE_WARNING;
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
if (json_variant_is_null(variant)) {
|
||||
*uid = UID_INVALID;
|
||||
|
|
|
@ -124,13 +124,6 @@ typedef _sd_destroy_t sd_bus_destroy_t;
|
|||
#include "sd-bus-protocol.h"
|
||||
#include "sd-bus-vtable.h"
|
||||
|
||||
/* Naming */
|
||||
|
||||
int sd_bus_interface_name_is_valid(const char *p);
|
||||
int sd_bus_service_name_is_valid(const char *p);
|
||||
int sd_bus_member_name_is_valid(const char *p);
|
||||
int sd_bus_object_path_is_valid(const char *p);
|
||||
|
||||
/* Connections */
|
||||
|
||||
int sd_bus_default(sd_bus **ret);
|
||||
|
|
|
@ -39,9 +39,10 @@ int sd_dhcp6_lease_get_pd(sd_dhcp6_lease *lease, struct in6_addr *prefix,
|
|||
uint32_t *lifetime_preferred,
|
||||
uint32_t *lifetime_valid);
|
||||
|
||||
int sd_dhcp6_lease_get_dns(sd_dhcp6_lease *lease, const struct in6_addr **addrs);
|
||||
int sd_dhcp6_lease_get_dns(sd_dhcp6_lease *lease, struct in6_addr **addrs);
|
||||
int sd_dhcp6_lease_get_domains(sd_dhcp6_lease *lease, char ***domains);
|
||||
int sd_dhcp6_lease_get_ntp_addrs(sd_dhcp6_lease *lease, const struct in6_addr **addrs);
|
||||
int sd_dhcp6_lease_get_ntp_addrs(sd_dhcp6_lease *lease,
|
||||
struct in6_addr **addrs);
|
||||
int sd_dhcp6_lease_get_ntp_fqdn(sd_dhcp6_lease *lease, char ***ntp_fqdn);
|
||||
|
||||
sd_dhcp6_lease *sd_dhcp6_lease_ref(sd_dhcp6_lease *lease);
|
||||
|
|
|
@ -633,7 +633,8 @@ static void test_tempfn(void) {
|
|||
static const char chars[] =
|
||||
"Aąę„”\n루\377";
|
||||
|
||||
DISABLE_WARNING_TYPE_LIMITS;
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wtype-limits"
|
||||
|
||||
static void test_fgetc(void) {
|
||||
_cleanup_fclose_ FILE *f = NULL;
|
||||
|
@ -664,7 +665,7 @@ static void test_fgetc(void) {
|
|||
assert_se(safe_fgetc(f, &c) == 0);
|
||||
}
|
||||
|
||||
REENABLE_WARNING;
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
static const char buffer[] =
|
||||
"Some test data\n"
|
||||
|
|
|
@ -231,9 +231,10 @@ static void test_zeroes(JsonVariant *v) {
|
|||
assert_se(json_variant_integer(w) == 0);
|
||||
assert_se(json_variant_unsigned(w) == 0U);
|
||||
|
||||
DISABLE_WARNING_FLOAT_EQUAL;
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wfloat-equal"
|
||||
assert_se(json_variant_real(w) == 0.0L);
|
||||
REENABLE_WARNING;
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
assert_se(json_variant_is_integer(w));
|
||||
assert_se(json_variant_is_unsigned(w));
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
/* Print information about various types. Useful when diagnosing
|
||||
* gcc diagnostics on an unfamiliar architecture. */
|
||||
|
||||
DISABLE_WARNING_TYPE_LIMITS;
|
||||
#pragma GCC diagnostic ignored "-Wtype-limits"
|
||||
|
||||
#define info(t) \
|
||||
printf("%s → %zu bits%s, %zu byte alignment\n", STRINGIFY(t), \
|
||||
|
|
|
@ -363,9 +363,10 @@ static const char * const ntp_leap_table[4] = {
|
|||
[3] = "not synchronized",
|
||||
};
|
||||
|
||||
DISABLE_WARNING_TYPE_LIMITS;
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wtype-limits"
|
||||
DEFINE_PRIVATE_STRING_TABLE_LOOKUP_TO_STRING(ntp_leap, uint32_t);
|
||||
REENABLE_WARNING;
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
static int print_ntp_status_info(NTPStatusInfo *i) {
|
||||
char ts[FORMAT_TIMESPAN_MAX], jitter[FORMAT_TIMESPAN_MAX],
|
||||
|
|
|
@ -449,10 +449,11 @@ static int names_platform(sd_device *dev, struct netnames *names, bool test) {
|
|||
* The Vendor (3 or 4 char), followed by hexdecimal model number : instance id.
|
||||
*/
|
||||
|
||||
DISABLE_WARNING_FORMAT_NONLITERAL;
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wformat-nonliteral"
|
||||
if (sscanf(syspath, pattern, vendor, &model, &instance, ðid) != 4)
|
||||
return -EINVAL;
|
||||
REENABLE_WARNING;
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
if (!in_charset(vendor, validchars))
|
||||
return -ENOENT;
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
[7E73]
|
|
@ -1,7 +1,5 @@
|
|||
# SPDX-License-Identifier: LGPL-2.1+
|
||||
|
||||
with_runlevels = conf.get('HAVE_SYSV_COMPAT') == 1
|
||||
|
||||
units = [
|
||||
['basic.target', ''],
|
||||
['blockdev@.target', ''],
|
||||
|
@ -21,7 +19,7 @@ units = [
|
|||
'multi-user.target.wants/'],
|
||||
['getty-pre.target', ''],
|
||||
['graphical.target', '',
|
||||
(with_runlevels ? 'runlevel5.target default.target' : 'default.target')],
|
||||
'runlevel5.target default.target'],
|
||||
['halt.target', ''],
|
||||
['hibernate.target', 'ENABLE_HIBERNATE'],
|
||||
['hybrid-sleep.target', 'ENABLE_HIBERNATE'],
|
||||
|
@ -44,7 +42,7 @@ units = [
|
|||
['machines.target', 'ENABLE_MACHINED'],
|
||||
['modprobe@.service', ''],
|
||||
['multi-user.target', '',
|
||||
(with_runlevels ? 'runlevel2.target runlevel3.target runlevel4.target' : '')],
|
||||
'runlevel2.target runlevel3.target runlevel4.target'],
|
||||
['network-online.target', ''],
|
||||
['network-pre.target', ''],
|
||||
['network.target', ''],
|
||||
|
@ -52,18 +50,18 @@ units = [
|
|||
['nss-user-lookup.target', ''],
|
||||
['paths.target', ''],
|
||||
['poweroff.target', '',
|
||||
(with_runlevels ? 'runlevel0.target' : '')],
|
||||
'runlevel0.target'],
|
||||
['printer.target', ''],
|
||||
['proc-sys-fs-binfmt_misc.automount', 'ENABLE_BINFMT',
|
||||
'sysinit.target.wants/'],
|
||||
['proc-sys-fs-binfmt_misc.mount', 'ENABLE_BINFMT'],
|
||||
['reboot.target', '',
|
||||
(with_runlevels ? 'runlevel6.target ctrl-alt-del.target' : 'ctrl-alt-del.target')],
|
||||
'runlevel6.target ctrl-alt-del.target'],
|
||||
['remote-cryptsetup.target', 'HAVE_LIBCRYPTSETUP'],
|
||||
['remote-fs-pre.target', ''],
|
||||
['remote-fs.target', ''],
|
||||
['rescue.target', '',
|
||||
(with_runlevels ? 'runlevel1.target' : '')],
|
||||
'runlevel1.target'],
|
||||
['rpcbind.target', ''],
|
||||
['shutdown.target', ''],
|
||||
['sigpwr.target', ''],
|
||||
|
@ -102,7 +100,7 @@ units = [
|
|||
['systemd-firstboot.service', 'ENABLE_FIRSTBOOT',
|
||||
'sysinit.target.wants/'],
|
||||
['systemd-halt.service', ''],
|
||||
['systemd-initctl.socket', 'HAVE_SYSV_COMPAT',
|
||||
['systemd-initctl.socket', '',
|
||||
'sockets.target.wants/'],
|
||||
['systemd-journal-catalog-update.service', '',
|
||||
'sysinit.target.wants/'],
|
||||
|
|
Loading…
Reference in New Issue