Compare commits
1 Commits
089a01fe89
...
35f47caf8d
Author | SHA1 | Date |
---|---|---|
![]() |
35f47caf8d |
3
NEWS
3
NEWS
|
@ -96,9 +96,6 @@ CHANGES WITH 258 in spe:
|
||||||
continue to work, update to xf86-input-evdev >= 2.11.0 and
|
continue to work, update to xf86-input-evdev >= 2.11.0 and
|
||||||
xf86-input-libinput >= 1.5.0 before updating to systemd >= 258.
|
xf86-input-libinput >= 1.5.0 before updating to systemd >= 258.
|
||||||
|
|
||||||
* The meson option 'integration-tests' has been deprecated, and will be
|
|
||||||
removed in a future release.
|
|
||||||
|
|
||||||
— <place>, <date>
|
— <place>, <date>
|
||||||
|
|
||||||
CHANGES WITH 257:
|
CHANGES WITH 257:
|
||||||
|
|
|
@ -383,7 +383,6 @@ evdev:name:gpio-keys:phys:gpio-keys/input0:ev:3:dmi:bvn*:bvr*:bd*:svncube:pni1-T
|
||||||
###########################################################
|
###########################################################
|
||||||
|
|
||||||
evdev:atkbd:dmi:bvn*:bvr*:bd*:svnDell*:pn*:*
|
evdev:atkbd:dmi:bvn*:bvr*:bd*:svnDell*:pn*:*
|
||||||
KEYBOARD_KEY_68=prog2 # G-Mode (Dell-specific)
|
|
||||||
KEYBOARD_KEY_81=playpause # Play/Pause
|
KEYBOARD_KEY_81=playpause # Play/Pause
|
||||||
KEYBOARD_KEY_82=stopcd # Stop
|
KEYBOARD_KEY_82=stopcd # Stop
|
||||||
KEYBOARD_KEY_83=previoussong # Previous song
|
KEYBOARD_KEY_83=previoussong # Previous song
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
|
|
||||||
<refsynopsisdiv>
|
<refsynopsisdiv>
|
||||||
<programlisting>
|
<programlisting>
|
||||||
Host unix/* unix,* vsock/* vsock,* vsock-mux/* vsock-mux,*
|
Host unix/* vsock/* vsock-mux/*
|
||||||
ProxyCommand /usr/lib/systemd/systemd-ssh-proxy %h %p
|
ProxyCommand /usr/lib/systemd/systemd-ssh-proxy %h %p
|
||||||
ProxyUseFdpass yes
|
ProxyUseFdpass yes
|
||||||
</programlisting>
|
</programlisting>
|
||||||
|
@ -46,7 +46,7 @@ Host unix/* unix,* vsock/* vsock,* vsock-mux/* vsock-mux,*
|
||||||
configuration fragment like the following:</para>
|
configuration fragment like the following:</para>
|
||||||
|
|
||||||
<programlisting>
|
<programlisting>
|
||||||
Host unix/* unix,* vsock/* vsock,* vsock-mux/* vsock-mux,*
|
Host unix/* vsock/* vsock-mux/*
|
||||||
ProxyCommand /usr/lib/systemd/systemd-ssh-proxy %h %p
|
ProxyCommand /usr/lib/systemd/systemd-ssh-proxy %h %p
|
||||||
ProxyUseFdpass yes
|
ProxyUseFdpass yes
|
||||||
CheckHostIP no
|
CheckHostIP no
|
||||||
|
@ -69,9 +69,7 @@ Host .host
|
||||||
direct <constant>AF_VSOCK</constant> communication between the host and guests, and provide their own
|
direct <constant>AF_VSOCK</constant> communication between the host and guests, and provide their own
|
||||||
multiplexer over <constant>AF_UNIX</constant> sockets. See
|
multiplexer over <constant>AF_UNIX</constant> sockets. See
|
||||||
<ulink url="https://github.com/cloud-hypervisor/cloud-hypervisor/blob/main/docs/vsock.md">cloud-hypervisor VSOCK support</ulink>
|
<ulink url="https://github.com/cloud-hypervisor/cloud-hypervisor/blob/main/docs/vsock.md">cloud-hypervisor VSOCK support</ulink>
|
||||||
and <ulink url="https://github.com/firecracker-microvm/firecracker/blob/main/docs/vsock.md">Using the Firecracker Virtio-vsock Device</ulink>.
|
and <ulink url="https://github.com/firecracker-microvm/firecracker/blob/main/docs/vsock.md">Using the Firecracker Virtio-vsock Device</ulink>.</para>
|
||||||
Note that <literal>,</literal> can be used as a separator instead of <literal>/</literal> to be
|
|
||||||
compatible with tools like <literal>scp</literal> and <literal>rsync</literal>.</para>
|
|
||||||
|
|
||||||
<para>Moreover, connecting to <literal>.host</literal> will connect to the local host via SSH, without
|
<para>Moreover, connecting to <literal>.host</literal> will connect to the local host via SSH, without
|
||||||
involving networking.</para>
|
involving networking.</para>
|
||||||
|
@ -115,12 +113,6 @@ Host .host
|
||||||
|
|
||||||
<programlisting>ssh unix/run/ssh-unix-local/socket</programlisting>
|
<programlisting>ssh unix/run/ssh-unix-local/socket</programlisting>
|
||||||
</example>
|
</example>
|
||||||
|
|
||||||
<example>
|
|
||||||
<title>Copy local 'foo' file to a local VM with CID 1348</title>
|
|
||||||
|
|
||||||
<programlisting>scp foo vsock,1348:</programlisting>
|
|
||||||
</example>
|
|
||||||
</refsect1>
|
</refsect1>
|
||||||
|
|
||||||
<refsect1>
|
<refsect1>
|
||||||
|
|
|
@ -912,20 +912,24 @@ static void hashmap_free_no_clear(HashmapBase *h) {
|
||||||
free(h);
|
free(h);
|
||||||
}
|
}
|
||||||
|
|
||||||
HashmapBase* _hashmap_free(HashmapBase *h) {
|
HashmapBase* _hashmap_free(HashmapBase *h, free_func_t default_free_key, free_func_t default_free_value) {
|
||||||
if (h) {
|
if (h) {
|
||||||
_hashmap_clear(h);
|
_hashmap_clear(h, default_free_key, default_free_value);
|
||||||
hashmap_free_no_clear(h);
|
hashmap_free_no_clear(h);
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void _hashmap_clear(HashmapBase *h) {
|
void _hashmap_clear(HashmapBase *h, free_func_t default_free_key, free_func_t default_free_value) {
|
||||||
|
free_func_t free_key, free_value;
|
||||||
if (!h)
|
if (!h)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (h->hash_ops->free_key || h->hash_ops->free_value) {
|
free_key = h->hash_ops->free_key ?: default_free_key;
|
||||||
|
free_value = h->hash_ops->free_value ?: default_free_value;
|
||||||
|
|
||||||
|
if (free_key || free_value) {
|
||||||
|
|
||||||
/* If destructor calls are defined, let's destroy things defensively: let's take the item out of the
|
/* If destructor calls are defined, let's destroy things defensively: let's take the item out of the
|
||||||
* hash table, and only then call the destructor functions. If these destructors then try to unregister
|
* hash table, and only then call the destructor functions. If these destructors then try to unregister
|
||||||
|
@ -937,11 +941,11 @@ void _hashmap_clear(HashmapBase *h) {
|
||||||
|
|
||||||
v = _hashmap_first_key_and_value(h, true, &k);
|
v = _hashmap_first_key_and_value(h, true, &k);
|
||||||
|
|
||||||
if (h->hash_ops->free_key)
|
if (free_key)
|
||||||
h->hash_ops->free_key(k);
|
free_key(k);
|
||||||
|
|
||||||
if (h->hash_ops->free_value)
|
if (free_value)
|
||||||
h->hash_ops->free_value(v);
|
free_value(v);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1776,7 +1780,7 @@ HashmapBase* _hashmap_copy(HashmapBase *h HASHMAP_DEBUG_PARAMS) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return _hashmap_free(copy);
|
return _hashmap_free(copy, NULL, NULL);
|
||||||
|
|
||||||
return copy;
|
return copy;
|
||||||
}
|
}
|
||||||
|
|
|
@ -93,12 +93,12 @@ OrderedHashmap* _ordered_hashmap_new(const struct hash_ops *hash_ops HASHMAP_DE
|
||||||
#define ordered_hashmap_free_and_replace(a, b) \
|
#define ordered_hashmap_free_and_replace(a, b) \
|
||||||
free_and_replace_full(a, b, ordered_hashmap_free)
|
free_and_replace_full(a, b, ordered_hashmap_free)
|
||||||
|
|
||||||
HashmapBase* _hashmap_free(HashmapBase *h);
|
HashmapBase* _hashmap_free(HashmapBase *h, free_func_t default_free_key, free_func_t default_free_value);
|
||||||
static inline Hashmap* hashmap_free(Hashmap *h) {
|
static inline Hashmap* hashmap_free(Hashmap *h) {
|
||||||
return (void*) _hashmap_free(HASHMAP_BASE(h));
|
return (void*) _hashmap_free(HASHMAP_BASE(h), NULL, NULL);
|
||||||
}
|
}
|
||||||
static inline OrderedHashmap* ordered_hashmap_free(OrderedHashmap *h) {
|
static inline OrderedHashmap* ordered_hashmap_free(OrderedHashmap *h) {
|
||||||
return (void*) _hashmap_free(HASHMAP_BASE(h));
|
return (void*) _hashmap_free(HASHMAP_BASE(h), NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
IteratedCache* iterated_cache_free(IteratedCache *cache);
|
IteratedCache* iterated_cache_free(IteratedCache *cache);
|
||||||
|
@ -266,12 +266,12 @@ static inline bool ordered_hashmap_iterate(OrderedHashmap *h, Iterator *i, void
|
||||||
return _hashmap_iterate(HASHMAP_BASE(h), i, value, key);
|
return _hashmap_iterate(HASHMAP_BASE(h), i, value, key);
|
||||||
}
|
}
|
||||||
|
|
||||||
void _hashmap_clear(HashmapBase *h);
|
void _hashmap_clear(HashmapBase *h, free_func_t default_free_key, free_func_t default_free_value);
|
||||||
static inline void hashmap_clear(Hashmap *h) {
|
static inline void hashmap_clear(Hashmap *h) {
|
||||||
_hashmap_clear(HASHMAP_BASE(h));
|
_hashmap_clear(HASHMAP_BASE(h), NULL, NULL);
|
||||||
}
|
}
|
||||||
static inline void ordered_hashmap_clear(OrderedHashmap *h) {
|
static inline void ordered_hashmap_clear(OrderedHashmap *h) {
|
||||||
_hashmap_clear(HASHMAP_BASE(h));
|
_hashmap_clear(HASHMAP_BASE(h), NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -331,6 +331,27 @@ static inline void *ordered_hashmap_first_key(OrderedHashmap *h) {
|
||||||
return _hashmap_first_key(HASHMAP_BASE(h), false);
|
return _hashmap_first_key(HASHMAP_BASE(h), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define hashmap_clear_with_destructor(h, f) \
|
||||||
|
({ \
|
||||||
|
Hashmap *_h = (h); \
|
||||||
|
void *_item; \
|
||||||
|
while ((_item = hashmap_steal_first(_h))) \
|
||||||
|
f(_item); \
|
||||||
|
_h; \
|
||||||
|
})
|
||||||
|
#define hashmap_free_with_destructor(h, f) \
|
||||||
|
hashmap_free(hashmap_clear_with_destructor(h, f))
|
||||||
|
#define ordered_hashmap_clear_with_destructor(h, f) \
|
||||||
|
({ \
|
||||||
|
OrderedHashmap *_h = (h); \
|
||||||
|
void *_item; \
|
||||||
|
while ((_item = ordered_hashmap_steal_first(_h))) \
|
||||||
|
f(_item); \
|
||||||
|
_h; \
|
||||||
|
})
|
||||||
|
#define ordered_hashmap_free_with_destructor(h, f) \
|
||||||
|
ordered_hashmap_free(ordered_hashmap_clear_with_destructor(h, f))
|
||||||
|
|
||||||
/* no hashmap_next */
|
/* no hashmap_next */
|
||||||
void* ordered_hashmap_next(OrderedHashmap *h, const void *key);
|
void* ordered_hashmap_next(OrderedHashmap *h, const void *key);
|
||||||
|
|
||||||
|
|
|
@ -83,6 +83,17 @@ void ordered_set_print(FILE *f, const char *field, OrderedSet *s);
|
||||||
#define ORDERED_SET_FOREACH(e, s) \
|
#define ORDERED_SET_FOREACH(e, s) \
|
||||||
_ORDERED_SET_FOREACH(e, s, UNIQ_T(i, UNIQ))
|
_ORDERED_SET_FOREACH(e, s, UNIQ_T(i, UNIQ))
|
||||||
|
|
||||||
|
#define ordered_set_clear_with_destructor(s, f) \
|
||||||
|
({ \
|
||||||
|
OrderedSet *_s = (s); \
|
||||||
|
void *_item; \
|
||||||
|
while ((_item = ordered_set_steal_first(_s))) \
|
||||||
|
f(_item); \
|
||||||
|
_s; \
|
||||||
|
})
|
||||||
|
#define ordered_set_free_with_destructor(s, f) \
|
||||||
|
ordered_set_free(ordered_set_clear_with_destructor(s, f))
|
||||||
|
|
||||||
DEFINE_TRIVIAL_CLEANUP_FUNC(OrderedSet*, ordered_set_free);
|
DEFINE_TRIVIAL_CLEANUP_FUNC(OrderedSet*, ordered_set_free);
|
||||||
|
|
||||||
#define _cleanup_ordered_set_free_ _cleanup_(ordered_set_freep)
|
#define _cleanup_ordered_set_free_ _cleanup_(ordered_set_freep)
|
||||||
|
|
|
@ -12,9 +12,15 @@ Set* _set_new(const struct hash_ops *hash_ops HASHMAP_DEBUG_PARAMS);
|
||||||
#define set_new(ops) _set_new(ops HASHMAP_DEBUG_SRC_ARGS)
|
#define set_new(ops) _set_new(ops HASHMAP_DEBUG_SRC_ARGS)
|
||||||
|
|
||||||
static inline Set* set_free(Set *s) {
|
static inline Set* set_free(Set *s) {
|
||||||
return (Set*) _hashmap_free(HASHMAP_BASE(s));
|
return (Set*) _hashmap_free(HASHMAP_BASE(s), NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline Set* set_free_free(Set *s) {
|
||||||
|
return (Set*) _hashmap_free(HASHMAP_BASE(s), free, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* no set_free_free_free */
|
||||||
|
|
||||||
#define set_copy(s) ((Set*) _hashmap_copy(HASHMAP_BASE(s) HASHMAP_DEBUG_SRC_ARGS))
|
#define set_copy(s) ((Set*) _hashmap_copy(HASHMAP_BASE(s) HASHMAP_DEBUG_SRC_ARGS))
|
||||||
|
|
||||||
int _set_ensure_allocated(Set **s, const struct hash_ops *hash_ops HASHMAP_DEBUG_PARAMS);
|
int _set_ensure_allocated(Set **s, const struct hash_ops *hash_ops HASHMAP_DEBUG_PARAMS);
|
||||||
|
@ -71,13 +77,30 @@ static inline bool set_iterate(const Set *s, Iterator *i, void **value) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void set_clear(Set *s) {
|
static inline void set_clear(Set *s) {
|
||||||
_hashmap_clear(HASHMAP_BASE(s));
|
_hashmap_clear(HASHMAP_BASE(s), NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline void set_clear_free(Set *s) {
|
||||||
|
_hashmap_clear(HASHMAP_BASE(s), free, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* no set_clear_free_free */
|
||||||
|
|
||||||
static inline void *set_steal_first(Set *s) {
|
static inline void *set_steal_first(Set *s) {
|
||||||
return _hashmap_first_key_and_value(HASHMAP_BASE(s), true, NULL);
|
return _hashmap_first_key_and_value(HASHMAP_BASE(s), true, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define set_clear_with_destructor(s, f) \
|
||||||
|
({ \
|
||||||
|
Set *_s = (s); \
|
||||||
|
void *_item; \
|
||||||
|
while ((_item = set_steal_first(_s))) \
|
||||||
|
f(_item); \
|
||||||
|
_s; \
|
||||||
|
})
|
||||||
|
#define set_free_with_destructor(s, f) \
|
||||||
|
set_free(set_clear_with_destructor(s, f))
|
||||||
|
|
||||||
/* no set_steal_first_key */
|
/* no set_steal_first_key */
|
||||||
/* no set_first_key */
|
/* no set_first_key */
|
||||||
|
|
||||||
|
@ -122,8 +145,10 @@ int set_put_strsplit(Set *s, const char *v, const char *separators, ExtractFlags
|
||||||
for (; ({ e = set_first(s); assert_se(!e || set_move_one(d, s, e) >= 0); e; }); )
|
for (; ({ e = set_first(s); assert_se(!e || set_move_one(d, s, e) >= 0); e; }); )
|
||||||
|
|
||||||
DEFINE_TRIVIAL_CLEANUP_FUNC(Set*, set_free);
|
DEFINE_TRIVIAL_CLEANUP_FUNC(Set*, set_free);
|
||||||
|
DEFINE_TRIVIAL_CLEANUP_FUNC(Set*, set_free_free);
|
||||||
|
|
||||||
#define _cleanup_set_free_ _cleanup_(set_freep)
|
#define _cleanup_set_free_ _cleanup_(set_freep)
|
||||||
|
#define _cleanup_set_free_free_ _cleanup_(set_free_freep)
|
||||||
|
|
||||||
int set_strjoin(Set *s, const char *separator, bool wrap_with_separator, char **ret);
|
int set_strjoin(Set *s, const char *separator, bool wrap_with_separator, char **ret);
|
||||||
|
|
||||||
|
|
|
@ -1163,7 +1163,8 @@ int netdev_reload(Manager *manager) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Detach old NetDev objects from Manager.
|
/* Detach old NetDev objects from Manager.
|
||||||
* The same object may be registered with multiple names, and netdev_detach() may drop multiple entries. */
|
* Note, the same object may be registered with multiple names, and netdev_detach() may drop multiple
|
||||||
|
* entries. Hence, hashmap_free_with_destructor() cannot be used. */
|
||||||
for (NetDev *n; (n = hashmap_first(manager->netdevs)); )
|
for (NetDev *n; (n = hashmap_first(manager->netdevs)); )
|
||||||
netdev_detach(n);
|
netdev_detach(n);
|
||||||
|
|
||||||
|
|
|
@ -683,7 +683,8 @@ Manager* manager_free(Manager *m) {
|
||||||
m->dhcp_pd_subnet_ids = set_free(m->dhcp_pd_subnet_ids);
|
m->dhcp_pd_subnet_ids = set_free(m->dhcp_pd_subnet_ids);
|
||||||
m->networks = ordered_hashmap_free(m->networks);
|
m->networks = ordered_hashmap_free(m->networks);
|
||||||
|
|
||||||
/* The same object may be registered with multiple names, and netdev_detach() may drop multiple entries. */
|
/* The same object may be registered with multiple names, and netdev_detach() may drop multiple
|
||||||
|
* entries. Hence, hashmap_free_with_destructor() cannot be used. */
|
||||||
for (NetDev *n; (n = hashmap_first(m->netdevs)); )
|
for (NetDev *n; (n = hashmap_first(m->netdevs)); )
|
||||||
netdev_detach(n);
|
netdev_detach(n);
|
||||||
m->netdevs = hashmap_free(m->netdevs);
|
m->netdevs = hashmap_free(m->netdevs);
|
||||||
|
|
|
@ -1,5 +1,9 @@
|
||||||
# SPDX-License-Identifier: LGPL-2.1-or-later
|
# SPDX-License-Identifier: LGPL-2.1-or-later
|
||||||
|
|
||||||
|
if conf.get('ENABLE_NSPAWN') != 1
|
||||||
|
subdir_done()
|
||||||
|
endif
|
||||||
|
|
||||||
libnspawn_core_sources = files(
|
libnspawn_core_sources = files(
|
||||||
'nspawn-bind-user.c',
|
'nspawn-bind-user.c',
|
||||||
'nspawn-cgroup.c',
|
'nspawn-cgroup.c',
|
||||||
|
@ -48,7 +52,6 @@ executables += [
|
||||||
executable_template + {
|
executable_template + {
|
||||||
'name' : 'systemd-nspawn',
|
'name' : 'systemd-nspawn',
|
||||||
'public' : true,
|
'public' : true,
|
||||||
'conditions' : ['ENABLE_NSPAWN'],
|
|
||||||
'sources' : files('nspawn.c'),
|
'sources' : files('nspawn.c'),
|
||||||
'link_with' : nspawn_libs,
|
'link_with' : nspawn_libs,
|
||||||
'dependencies' : [
|
'dependencies' : [
|
||||||
|
|
|
@ -56,9 +56,6 @@ int notify_push_fd(int fd, const char *name) {
|
||||||
if (!state)
|
if (!state)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
/* Remove existing fds with the same name in fdstore. */
|
|
||||||
(void) notify_remove_fd_warn(name);
|
|
||||||
|
|
||||||
return sd_pid_notify_with_fds(0, /* unset_environment = */ false, state, &fd, 1);
|
return sd_pid_notify_with_fds(0, /* unset_environment = */ false, state, &fd, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@ Host .host machine/.host
|
||||||
# Make sure unix/* and vsock/* can be used to connect to AF_UNIX and AF_VSOCK paths.
|
# Make sure unix/* and vsock/* can be used to connect to AF_UNIX and AF_VSOCK paths.
|
||||||
# Make sure machine/* can be used to connect to local machines registered in machined.
|
# Make sure machine/* can be used to connect to local machines registered in machined.
|
||||||
#
|
#
|
||||||
Host unix/* unix,* vsock/* vsock,* vsock-mux/* vsock-mux,* machine/* machine,*
|
Host unix/* vsock/* vsock-mux/* machine/*
|
||||||
ProxyCommand {{LIBEXECDIR}}/systemd-ssh-proxy %h %p
|
ProxyCommand {{LIBEXECDIR}}/systemd-ssh-proxy %h %p
|
||||||
ProxyUseFdpass yes
|
ProxyUseFdpass yes
|
||||||
CheckHostIP no
|
CheckHostIP no
|
||||||
|
|
|
@ -175,15 +175,6 @@ static int process_machine(const char *machine, const char *port) {
|
||||||
return process_vsock_cid(cid, port);
|
return process_vsock_cid(cid, port);
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *startswith_sep(const char *s, const char *prefix) {
|
|
||||||
const char *p = startswith(s, prefix);
|
|
||||||
|
|
||||||
if (p && IN_SET(*p, '/', ','))
|
|
||||||
return (char*) p + 1;
|
|
||||||
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int run(int argc, char* argv[]) {
|
static int run(int argc, char* argv[]) {
|
||||||
|
|
||||||
log_setup();
|
log_setup();
|
||||||
|
@ -193,19 +184,19 @@ static int run(int argc, char* argv[]) {
|
||||||
|
|
||||||
const char *host = argv[1], *port = argv[2];
|
const char *host = argv[1], *port = argv[2];
|
||||||
|
|
||||||
const char *p = startswith_sep(host, "vsock");
|
const char *p = startswith(host, "vsock/");
|
||||||
if (p)
|
if (p)
|
||||||
return process_vsock_string(p, port);
|
return process_vsock_string(p, port);
|
||||||
|
|
||||||
p = startswith_sep(host, "unix");
|
p = startswith(host, "unix/");
|
||||||
if (p)
|
if (p)
|
||||||
return process_unix(p);
|
return process_unix(p);
|
||||||
|
|
||||||
p = startswith_sep(host, "vsock-mux");
|
p = startswith(host, "vsock-mux/");
|
||||||
if (p)
|
if (p)
|
||||||
return process_vsock_mux(p, port);
|
return process_vsock_mux(p, port);
|
||||||
|
|
||||||
p = startswith_sep(host, "machine");
|
p = startswith(host, "machine/");
|
||||||
if (p)
|
if (p)
|
||||||
return process_machine(p, port);
|
return process_machine(p, port);
|
||||||
|
|
||||||
|
|
|
@ -764,6 +764,29 @@ TEST(hashmap_free) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
typedef struct Item {
|
||||||
|
int seen;
|
||||||
|
} Item;
|
||||||
|
static void item_seen(Item *item) {
|
||||||
|
item->seen++;
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(hashmap_free_with_destructor) {
|
||||||
|
Hashmap *m;
|
||||||
|
struct Item items[4] = {};
|
||||||
|
unsigned i;
|
||||||
|
|
||||||
|
assert_se(m = hashmap_new(NULL));
|
||||||
|
for (i = 0; i < ELEMENTSOF(items) - 1; i++)
|
||||||
|
assert_se(hashmap_put(m, INT_TO_PTR(i), items + i) == 1);
|
||||||
|
|
||||||
|
m = hashmap_free_with_destructor(m, item_seen);
|
||||||
|
assert_se(items[0].seen == 1);
|
||||||
|
assert_se(items[1].seen == 1);
|
||||||
|
assert_se(items[2].seen == 1);
|
||||||
|
assert_se(items[3].seen == 0);
|
||||||
|
}
|
||||||
|
|
||||||
TEST(hashmap_first) {
|
TEST(hashmap_first) {
|
||||||
_cleanup_hashmap_free_ Hashmap *m = NULL;
|
_cleanup_hashmap_free_ Hashmap *m = NULL;
|
||||||
|
|
||||||
|
|
|
@ -110,7 +110,7 @@ TEST(strv_make_nulstr) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(set_make_nulstr) {
|
TEST(set_make_nulstr) {
|
||||||
_cleanup_set_free_ Set *set = NULL;
|
_cleanup_set_free_free_ Set *set = NULL;
|
||||||
size_t len = 0;
|
size_t len = 0;
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
|
@ -130,7 +130,7 @@ TEST(set_make_nulstr) {
|
||||||
static const char expect[] = { 0x00, 0x00 };
|
static const char expect[] = { 0x00, 0x00 };
|
||||||
_cleanup_free_ char *nulstr = NULL;
|
_cleanup_free_ char *nulstr = NULL;
|
||||||
|
|
||||||
set = set_new(&string_hash_ops_free);
|
set = set_new(NULL);
|
||||||
assert_se(set);
|
assert_se(set);
|
||||||
|
|
||||||
r = set_make_nulstr(set, &nulstr, &len);
|
r = set_make_nulstr(set, &nulstr, &len);
|
||||||
|
|
|
@ -227,14 +227,14 @@ TEST(serialize_item_base64mem) {
|
||||||
TEST(serialize_string_set) {
|
TEST(serialize_string_set) {
|
||||||
_cleanup_(unlink_tempfilep) char fn[] = "/tmp/test-serialize.XXXXXX";
|
_cleanup_(unlink_tempfilep) char fn[] = "/tmp/test-serialize.XXXXXX";
|
||||||
_cleanup_fclose_ FILE *f = NULL;
|
_cleanup_fclose_ FILE *f = NULL;
|
||||||
_cleanup_set_free_ Set *s = NULL;
|
_cleanup_set_free_free_ Set *s = NULL;
|
||||||
_cleanup_free_ char *line1 = NULL, *line2 = NULL;
|
_cleanup_free_ char *line1 = NULL, *line2 = NULL;
|
||||||
char *p, *q;
|
char *p, *q;
|
||||||
|
|
||||||
assert_se(fmkostemp_safe(fn, "r+", &f) == 0);
|
assert_se(fmkostemp_safe(fn, "r+", &f) == 0);
|
||||||
log_info("/* %s (%s) */", __func__, fn);
|
log_info("/* %s (%s) */", __func__, fn);
|
||||||
|
|
||||||
assert_se(set_ensure_allocated(&s, &string_hash_ops_free) >= 0);
|
assert_se(set_ensure_allocated(&s, &string_hash_ops) >= 0);
|
||||||
|
|
||||||
assert_se(serialize_string_set(f, "a", s) == 0);
|
assert_se(serialize_string_set(f, "a", s) == 0);
|
||||||
|
|
||||||
|
|
|
@ -32,6 +32,21 @@ static void item_seen(Item *item) {
|
||||||
item->seen++;
|
item->seen++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST(set_free_with_destructor) {
|
||||||
|
Set *m;
|
||||||
|
struct Item items[4] = {};
|
||||||
|
|
||||||
|
assert_se(m = set_new(NULL));
|
||||||
|
FOREACH_ARRAY(item, items, ELEMENTSOF(items) - 1)
|
||||||
|
assert_se(set_put(m, item) == 1);
|
||||||
|
|
||||||
|
m = set_free_with_destructor(m, item_seen);
|
||||||
|
assert_se(items[0].seen == 1);
|
||||||
|
assert_se(items[1].seen == 1);
|
||||||
|
assert_se(items[2].seen == 1);
|
||||||
|
assert_se(items[3].seen == 0);
|
||||||
|
}
|
||||||
|
|
||||||
DEFINE_PRIVATE_HASH_OPS_WITH_VALUE_DESTRUCTOR(item_hash_ops, void, trivial_hash_func, trivial_compare_func, Item, item_seen);
|
DEFINE_PRIVATE_HASH_OPS_WITH_VALUE_DESTRUCTOR(item_hash_ops, void, trivial_hash_func, trivial_compare_func, Item, item_seen);
|
||||||
|
|
||||||
TEST(set_free_with_hash_ops) {
|
TEST(set_free_with_hash_ops) {
|
||||||
|
@ -130,8 +145,9 @@ TEST(set_ensure_allocated) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(set_copy) {
|
TEST(set_copy) {
|
||||||
_cleanup_set_free_ Set *s = NULL, *copy = NULL;
|
_cleanup_set_free_ Set *s = NULL;
|
||||||
_cleanup_free_ char *key1 = NULL, *key2 = NULL, *key3 = NULL, *key4 = NULL;
|
_cleanup_set_free_free_ Set *copy = NULL;
|
||||||
|
char *key1, *key2, *key3, *key4;
|
||||||
|
|
||||||
key1 = strdup("key1");
|
key1 = strdup("key1");
|
||||||
assert_se(key1);
|
assert_se(key1);
|
||||||
|
|
|
@ -553,6 +553,9 @@ int manager_serialize_config(Manager *manager) {
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return log_warning_errno(r, "Failed to finalize serialization file: %m");
|
return log_warning_errno(r, "Failed to finalize serialization file: %m");
|
||||||
|
|
||||||
|
/* Remove the previous serialization to make it replaced with the new one. */
|
||||||
|
(void) notify_remove_fd_warn("config-serialization");
|
||||||
|
|
||||||
r = notify_push_fd(fileno(f), "config-serialization");
|
r = notify_push_fd(fileno(f), "config-serialization");
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return log_warning_errno(r, "Failed to push serialization fd to service manager: %m");
|
return log_warning_errno(r, "Failed to push serialization fd to service manager: %m");
|
||||||
|
|
|
@ -1166,7 +1166,7 @@ static int manager_listen_fds(Manager *manager) {
|
||||||
|
|
||||||
int n = sd_listen_fds_with_names(/* unset_environment = */ true, &names);
|
int n = sd_listen_fds_with_names(/* unset_environment = */ true, &names);
|
||||||
if (n < 0)
|
if (n < 0)
|
||||||
return log_error_errno(n, "Failed to listen on fds: %m");
|
return n;
|
||||||
|
|
||||||
for (int i = 0; i < n; i++) {
|
for (int i = 0; i < n; i++) {
|
||||||
int fd = SD_LISTEN_FDS_START + i;
|
int fd = SD_LISTEN_FDS_START + i;
|
||||||
|
|
|
@ -60,7 +60,7 @@ sanitize_address_undefined = custom_target(
|
||||||
'fuzzers',
|
'fuzzers',
|
||||||
' '.join(fuzz_c_args + '-DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION'),
|
' '.join(fuzz_c_args + '-DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION'),
|
||||||
' '.join(fuzz_cpp_args + '-DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION'),
|
' '.join(fuzz_cpp_args + '-DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION'),
|
||||||
'-Dfuzz-tests=true -Db_lundef=false -Db_sanitize=address,undefined --optimization=@0@ @1@ --auto-features=@2@'.format(
|
'-Dfuzz-tests=true -Db_lundef=false -Db_sanitize=address,undefined -Dnspawn=enabled --optimization=@0@ @1@ --auto-features=@2@'.format(
|
||||||
get_option('optimization'),
|
get_option('optimization'),
|
||||||
get_option('werror') ? '--werror' : '',
|
get_option('werror') ? '--werror' : '',
|
||||||
sanitize_auto_features
|
sanitize_auto_features
|
||||||
|
|
|
@ -61,13 +61,4 @@ ssh -o StrictHostKeyChecking=no -v -i "$ROOTID" machine/.host cat /etc/machine-i
|
||||||
modprobe vsock_loopback ||:
|
modprobe vsock_loopback ||:
|
||||||
if test -e /dev/vsock -a -d /sys/module/vsock_loopback ; then
|
if test -e /dev/vsock -a -d /sys/module/vsock_loopback ; then
|
||||||
ssh -o StrictHostKeyChecking=no -v -i "$ROOTID" vsock/1 cat /etc/machine-id | cmp - /etc/machine-id
|
ssh -o StrictHostKeyChecking=no -v -i "$ROOTID" vsock/1 cat /etc/machine-id | cmp - /etc/machine-id
|
||||||
|
|
||||||
if ! command -v scp &> /dev/null ; then
|
|
||||||
echo "scp not found, skipping subtest" >&2
|
|
||||||
else
|
|
||||||
OUT_FILE=$(mktemp -u)
|
|
||||||
scp -o StrictHostKeyChecking=no -v -i "$ROOTID" vsock,1:/etc/machine-id "$OUT_FILE"
|
|
||||||
cmp "$OUT_FILE" /etc/machine-id
|
|
||||||
rm -f "$OUT_FILE"
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in New Issue