Compare commits
8 Commits
9667e10b1a
...
ecb040643d
Author | SHA1 | Date |
---|---|---|
Lennart Poettering | ecb040643d | |
Yu Watanabe | de697db05b | |
Lennart Poettering | 0c8e33b6e9 | |
Zbigniew Jędrzejewski-Szmek | b012a1f455 | |
Lennart Poettering | 27b4b3cc92 | |
Lennart Poettering | 5cddd924aa | |
Zbigniew Jędrzejewski-Szmek | 4023637a8a | |
Zbigniew Jędrzejewski-Szmek | 1b49e3e3c4 |
2
TODO
2
TODO
|
@ -37,8 +37,6 @@ Features:
|
||||||
waitid() only on the children with the highest priority until one is waitable
|
waitid() only on the children with the highest priority until one is waitable
|
||||||
and ignore all lower-prio ones from that point on
|
and ignore all lower-prio ones from that point on
|
||||||
|
|
||||||
* sd-event: drop stack allocated epoll_event buffer in sd_event_wait()
|
|
||||||
|
|
||||||
* maybe introduce xattrs that can be set on the root dir of the root fs
|
* maybe introduce xattrs that can be set on the root dir of the root fs
|
||||||
partition that declare the volatility mode to use the image in. Previously I
|
partition that declare the volatility mode to use the image in. Previously I
|
||||||
thought marking this via GPT partition flags but that's not ideal since
|
thought marking this via GPT partition flags but that's not ideal since
|
||||||
|
|
|
@ -1007,12 +1007,10 @@
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term><varname>PrefixRoute=</varname></term>
|
<term><varname>AddPrefixRoute=</varname></term>
|
||||||
<listitem>
|
<listitem>
|
||||||
<para>Takes a boolean. When adding or modifying an IPv6 address, the userspace
|
<para>Takes a boolean. When true, the prefix route for the address is automatically added.
|
||||||
application needs a way to suppress adding a prefix route. This is for example relevant
|
Defaults to true.</para>
|
||||||
together with IFA_F_MANAGERTEMPADDR, where userspace creates autoconf generated addresses,
|
|
||||||
but depending on on-link, no route for the prefix should be added. Defaults to false.</para>
|
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
|
|
|
@ -102,6 +102,7 @@ BUS_ERROR_MAP_ELF_REGISTER const sd_bus_error_map bus_common_errors[] = {
|
||||||
|
|
||||||
SD_BUS_ERROR_MAP(BUS_ERROR_NO_PRODUCT_UUID, EOPNOTSUPP),
|
SD_BUS_ERROR_MAP(BUS_ERROR_NO_PRODUCT_UUID, EOPNOTSUPP),
|
||||||
|
|
||||||
|
SD_BUS_ERROR_MAP(BUS_ERROR_SPEED_METER_INACTIVE, EOPNOTSUPP),
|
||||||
SD_BUS_ERROR_MAP(BUS_ERROR_UNMANAGED_INTERFACE, EOPNOTSUPP),
|
SD_BUS_ERROR_MAP(BUS_ERROR_UNMANAGED_INTERFACE, EOPNOTSUPP),
|
||||||
|
|
||||||
SD_BUS_ERROR_MAP_END
|
SD_BUS_ERROR_MAP_END
|
||||||
|
|
|
@ -81,6 +81,7 @@
|
||||||
|
|
||||||
#define BUS_ERROR_NO_PRODUCT_UUID "org.freedesktop.hostname1.NoProductUUID"
|
#define BUS_ERROR_NO_PRODUCT_UUID "org.freedesktop.hostname1.NoProductUUID"
|
||||||
|
|
||||||
|
#define BUS_ERROR_SPEED_METER_INACTIVE "org.freedesktop.network1.SpeedMeterInactive"
|
||||||
#define BUS_ERROR_UNMANAGED_INTERFACE "org.freedesktop.network1.UnmanagedInterface"
|
#define BUS_ERROR_UNMANAGED_INTERFACE "org.freedesktop.network1.UnmanagedInterface"
|
||||||
|
|
||||||
BUS_ERROR_MAP_ELF_USE(bus_common_errors);
|
BUS_ERROR_MAP_ELF_USE(bus_common_errors);
|
||||||
|
|
|
@ -115,6 +115,9 @@ struct sd_event {
|
||||||
|
|
||||||
unsigned n_sources;
|
unsigned n_sources;
|
||||||
|
|
||||||
|
struct epoll_event *event_queue;
|
||||||
|
size_t event_queue_allocated;
|
||||||
|
|
||||||
LIST_HEAD(sd_event_source, sources);
|
LIST_HEAD(sd_event_source, sources);
|
||||||
|
|
||||||
usec_t last_run, last_log;
|
usec_t last_run, last_log;
|
||||||
|
@ -286,6 +289,8 @@ static sd_event *event_free(sd_event *e) {
|
||||||
hashmap_free(e->child_sources);
|
hashmap_free(e->child_sources);
|
||||||
set_free(e->post_sources);
|
set_free(e->post_sources);
|
||||||
|
|
||||||
|
free(e->event_queue);
|
||||||
|
|
||||||
return mfree(e);
|
return mfree(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3477,8 +3482,7 @@ pending:
|
||||||
}
|
}
|
||||||
|
|
||||||
_public_ int sd_event_wait(sd_event *e, uint64_t timeout) {
|
_public_ int sd_event_wait(sd_event *e, uint64_t timeout) {
|
||||||
struct epoll_event *ev_queue;
|
size_t event_queue_max;
|
||||||
unsigned ev_queue_max;
|
|
||||||
int r, m, i;
|
int r, m, i;
|
||||||
|
|
||||||
assert_return(e, -EINVAL);
|
assert_return(e, -EINVAL);
|
||||||
|
@ -3492,14 +3496,15 @@ _public_ int sd_event_wait(sd_event *e, uint64_t timeout) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
ev_queue_max = MAX(e->n_sources, 1u);
|
event_queue_max = MAX(e->n_sources, 1u);
|
||||||
ev_queue = newa(struct epoll_event, ev_queue_max);
|
if (!GREEDY_REALLOC(e->event_queue, e->event_queue_allocated, event_queue_max))
|
||||||
|
return -ENOMEM;
|
||||||
|
|
||||||
/* If we still have inotify data buffered, then query the other fds, but don't wait on it */
|
/* If we still have inotify data buffered, then query the other fds, but don't wait on it */
|
||||||
if (e->inotify_data_buffered)
|
if (e->inotify_data_buffered)
|
||||||
timeout = 0;
|
timeout = 0;
|
||||||
|
|
||||||
m = epoll_wait(e->epoll_fd, ev_queue, ev_queue_max,
|
m = epoll_wait(e->epoll_fd, e->event_queue, event_queue_max,
|
||||||
timeout == (uint64_t) -1 ? -1 : (int) DIV_ROUND_UP(timeout, USEC_PER_MSEC));
|
timeout == (uint64_t) -1 ? -1 : (int) DIV_ROUND_UP(timeout, USEC_PER_MSEC));
|
||||||
if (m < 0) {
|
if (m < 0) {
|
||||||
if (errno == EINTR) {
|
if (errno == EINTR) {
|
||||||
|
@ -3515,26 +3520,26 @@ _public_ int sd_event_wait(sd_event *e, uint64_t timeout) {
|
||||||
|
|
||||||
for (i = 0; i < m; i++) {
|
for (i = 0; i < m; i++) {
|
||||||
|
|
||||||
if (ev_queue[i].data.ptr == INT_TO_PTR(SOURCE_WATCHDOG))
|
if (e->event_queue[i].data.ptr == INT_TO_PTR(SOURCE_WATCHDOG))
|
||||||
r = flush_timer(e, e->watchdog_fd, ev_queue[i].events, NULL);
|
r = flush_timer(e, e->watchdog_fd, e->event_queue[i].events, NULL);
|
||||||
else {
|
else {
|
||||||
WakeupType *t = ev_queue[i].data.ptr;
|
WakeupType *t = e->event_queue[i].data.ptr;
|
||||||
|
|
||||||
switch (*t) {
|
switch (*t) {
|
||||||
|
|
||||||
case WAKEUP_EVENT_SOURCE: {
|
case WAKEUP_EVENT_SOURCE: {
|
||||||
sd_event_source *s = ev_queue[i].data.ptr;
|
sd_event_source *s = e->event_queue[i].data.ptr;
|
||||||
|
|
||||||
assert(s);
|
assert(s);
|
||||||
|
|
||||||
switch (s->type) {
|
switch (s->type) {
|
||||||
|
|
||||||
case SOURCE_IO:
|
case SOURCE_IO:
|
||||||
r = process_io(e, s, ev_queue[i].events);
|
r = process_io(e, s, e->event_queue[i].events);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SOURCE_CHILD:
|
case SOURCE_CHILD:
|
||||||
r = process_pidfd(e, s, ev_queue[i].events);
|
r = process_pidfd(e, s, e->event_queue[i].events);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -3545,20 +3550,20 @@ _public_ int sd_event_wait(sd_event *e, uint64_t timeout) {
|
||||||
}
|
}
|
||||||
|
|
||||||
case WAKEUP_CLOCK_DATA: {
|
case WAKEUP_CLOCK_DATA: {
|
||||||
struct clock_data *d = ev_queue[i].data.ptr;
|
struct clock_data *d = e->event_queue[i].data.ptr;
|
||||||
|
|
||||||
assert(d);
|
assert(d);
|
||||||
|
|
||||||
r = flush_timer(e, d->fd, ev_queue[i].events, &d->next);
|
r = flush_timer(e, d->fd, e->event_queue[i].events, &d->next);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case WAKEUP_SIGNAL_DATA:
|
case WAKEUP_SIGNAL_DATA:
|
||||||
r = process_signal(e, ev_queue[i].data.ptr, ev_queue[i].events);
|
r = process_signal(e, e->event_queue[i].data.ptr, e->event_queue[i].events);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WAKEUP_INOTIFY_DATA:
|
case WAKEUP_INOTIFY_DATA:
|
||||||
r = event_inotify_data_read(e, ev_queue[i].data.ptr, ev_queue[i].events);
|
r = event_inotify_data_read(e, e->event_queue[i].data.ptr, e->event_queue[i].events);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -366,7 +366,8 @@ static int acquire_link_bitrates(sd_bus *bus, LinkInfo *link) {
|
||||||
"org.freedesktop.network1.Link",
|
"org.freedesktop.network1.Link",
|
||||||
"BitRates");
|
"BitRates");
|
||||||
if (r < 0) {
|
if (r < 0) {
|
||||||
bool quiet = sd_bus_error_has_name(&error, SD_BUS_ERROR_UNKNOWN_PROPERTY);
|
bool quiet = sd_bus_error_has_name(&error, SD_BUS_ERROR_UNKNOWN_PROPERTY) ||
|
||||||
|
sd_bus_error_has_name(&error, BUS_ERROR_SPEED_METER_INACTIVE);
|
||||||
|
|
||||||
return log_full_errno(quiet ? LOG_DEBUG : LOG_WARNING,
|
return log_full_errno(quiet ? LOG_DEBUG : LOG_WARNING,
|
||||||
r, "Failed to query link bit rates: %s", bus_error_message(&error, r));
|
r, "Failed to query link bit rates: %s", bus_error_message(&error, r));
|
||||||
|
|
|
@ -33,6 +33,7 @@ int address_new(Address **ret) {
|
||||||
.cinfo.ifa_prefered = CACHE_INFO_INFINITY_LIFE_TIME,
|
.cinfo.ifa_prefered = CACHE_INFO_INFINITY_LIFE_TIME,
|
||||||
.cinfo.ifa_valid = CACHE_INFO_INFINITY_LIFE_TIME,
|
.cinfo.ifa_valid = CACHE_INFO_INFINITY_LIFE_TIME,
|
||||||
.duplicate_address_detection = ADDRESS_FAMILY_IPV6,
|
.duplicate_address_detection = ADDRESS_FAMILY_IPV6,
|
||||||
|
.prefix_route = true,
|
||||||
};
|
};
|
||||||
|
|
||||||
*ret = TAKE_PTR(address);
|
*ret = TAKE_PTR(address);
|
||||||
|
@ -596,7 +597,7 @@ int address_configure(
|
||||||
if (address->manage_temporary_address)
|
if (address->manage_temporary_address)
|
||||||
address->flags |= IFA_F_MANAGETEMPADDR;
|
address->flags |= IFA_F_MANAGETEMPADDR;
|
||||||
|
|
||||||
if (address->prefix_route)
|
if (!address->prefix_route)
|
||||||
address->flags |= IFA_F_NOPREFIXROUTE;
|
address->flags |= IFA_F_NOPREFIXROUTE;
|
||||||
|
|
||||||
if (address->autojoin)
|
if (address->autojoin)
|
||||||
|
@ -1001,6 +1002,8 @@ int config_parse_address_flags(const char *unit,
|
||||||
else if (streq(lvalue, "ManageTemporaryAddress"))
|
else if (streq(lvalue, "ManageTemporaryAddress"))
|
||||||
n->manage_temporary_address = r;
|
n->manage_temporary_address = r;
|
||||||
else if (streq(lvalue, "PrefixRoute"))
|
else if (streq(lvalue, "PrefixRoute"))
|
||||||
|
n->prefix_route = !r;
|
||||||
|
else if (streq(lvalue, "AddPrefixRoute"))
|
||||||
n->prefix_route = r;
|
n->prefix_route = r;
|
||||||
else if (streq(lvalue, "AutoJoin"))
|
else if (streq(lvalue, "AutoJoin"))
|
||||||
n->autojoin = r;
|
n->autojoin = r;
|
||||||
|
|
|
@ -111,10 +111,10 @@ static int route_scope_from_address(const Route *route, const struct in_addr *se
|
||||||
return RT_SCOPE_UNIVERSE;
|
return RT_SCOPE_UNIVERSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool link_noprefixroute(Link *link) {
|
static bool link_prefixroute(Link *link) {
|
||||||
return link->network->dhcp_route_table_set &&
|
return !link->network->dhcp_route_table_set ||
|
||||||
link->network->dhcp_route_table != RT_TABLE_MAIN &&
|
link->network->dhcp_route_table == RT_TABLE_MAIN ||
|
||||||
!link->manager->dhcp4_prefix_root_cannot_set_table;
|
link->manager->dhcp4_prefix_root_cannot_set_table;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int dhcp_route_configure(Route **route, Link *link) {
|
static int dhcp_route_configure(Route **route, Link *link) {
|
||||||
|
@ -254,7 +254,7 @@ static int link_set_dhcp_routes(Link *link) {
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return log_link_warning_errno(link, r, "DHCP error: could not get address: %m");
|
return log_link_warning_errno(link, r, "DHCP error: could not get address: %m");
|
||||||
|
|
||||||
if (link_noprefixroute(link)) {
|
if (!link_prefixroute(link)) {
|
||||||
_cleanup_(route_freep) Route *prefix_route = NULL;
|
_cleanup_(route_freep) Route *prefix_route = NULL;
|
||||||
|
|
||||||
r = dhcp_prefix_route_from_lease(link->dhcp_lease, table, &address, &prefix_route);
|
r = dhcp_prefix_route_from_lease(link->dhcp_lease, table, &address, &prefix_route);
|
||||||
|
@ -516,7 +516,7 @@ static int dhcp_remove_dns_routes(Link *link, sd_dhcp_lease *lease, const struct
|
||||||
(void) route_remove(route, link, NULL);
|
(void) route_remove(route, link, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (link_noprefixroute(link)) {
|
if (!link_prefixroute(link)) {
|
||||||
_cleanup_(route_freep) Route *prefix_route = NULL;
|
_cleanup_(route_freep) Route *prefix_route = NULL;
|
||||||
|
|
||||||
r = dhcp_prefix_route_from_lease(lease, table, address, &prefix_route);
|
r = dhcp_prefix_route_from_lease(lease, table, address, &prefix_route);
|
||||||
|
@ -719,7 +719,7 @@ static int dhcp4_update_address(Link *link,
|
||||||
addr->cinfo.ifa_valid = lifetime;
|
addr->cinfo.ifa_valid = lifetime;
|
||||||
addr->prefixlen = prefixlen;
|
addr->prefixlen = prefixlen;
|
||||||
addr->broadcast.s_addr = address->s_addr | ~netmask->s_addr;
|
addr->broadcast.s_addr = address->s_addr | ~netmask->s_addr;
|
||||||
addr->prefix_route = link_noprefixroute(link);
|
addr->prefix_route = link_prefixroute(link);
|
||||||
|
|
||||||
/* allow reusing an existing address and simply update its lifetime
|
/* allow reusing an existing address and simply update its lifetime
|
||||||
* in case it already exists */
|
* in case it already exists */
|
||||||
|
|
|
@ -106,7 +106,8 @@ Address.Label, config_parse_label,
|
||||||
Address.PreferredLifetime, config_parse_lifetime, 0, 0
|
Address.PreferredLifetime, config_parse_lifetime, 0, 0
|
||||||
Address.HomeAddress, config_parse_address_flags, 0, 0
|
Address.HomeAddress, config_parse_address_flags, 0, 0
|
||||||
Address.ManageTemporaryAddress, config_parse_address_flags, 0, 0
|
Address.ManageTemporaryAddress, config_parse_address_flags, 0, 0
|
||||||
Address.PrefixRoute, config_parse_address_flags, 0, 0
|
Address.PrefixRoute, config_parse_address_flags, 0, 0 /* deprecated */
|
||||||
|
Address.AddPrefixRoute, config_parse_address_flags, 0, 0
|
||||||
Address.AutoJoin, config_parse_address_flags, 0, 0
|
Address.AutoJoin, config_parse_address_flags, 0, 0
|
||||||
Address.DuplicateAddressDetection, config_parse_duplicate_address_detection, 0, 0
|
Address.DuplicateAddressDetection, config_parse_duplicate_address_detection, 0, 0
|
||||||
Address.Scope, config_parse_address_scope, 0, 0
|
Address.Scope, config_parse_address_scope, 0, 0
|
||||||
|
|
|
@ -29,7 +29,7 @@ static void cleanup_clear_loop_close(int *fd) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int loop_device_make_full(
|
int loop_device_make(
|
||||||
int fd,
|
int fd,
|
||||||
int open_flags,
|
int open_flags,
|
||||||
uint64_t offset,
|
uint64_t offset,
|
||||||
|
@ -166,7 +166,7 @@ int loop_device_make_by_path(const char *path, int open_flags, uint32_t loop_fla
|
||||||
if (fd < 0)
|
if (fd < 0)
|
||||||
return -errno;
|
return -errno;
|
||||||
|
|
||||||
return loop_device_make_full(fd, open_flags, 0, 0, loop_flags, ret);
|
return loop_device_make(fd, open_flags, 0, 0, loop_flags, ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
LoopDevice* loop_device_unref(LoopDevice *d) {
|
LoopDevice* loop_device_unref(LoopDevice *d) {
|
||||||
|
|
|
@ -14,7 +14,7 @@ struct LoopDevice {
|
||||||
bool relinquished;
|
bool relinquished;
|
||||||
};
|
};
|
||||||
|
|
||||||
int loop_device_make_full(int fd, int open_flags, uint64_t offset, uint64_t size, uint32_t loop_flags, LoopDevice **ret);
|
int loop_device_make(int fd, int open_flags, uint64_t offset, uint64_t size, uint32_t loop_flags, LoopDevice **ret);
|
||||||
int loop_device_make_by_path(const char *path, int open_flags, uint32_t loop_flags, LoopDevice **ret);
|
int loop_device_make_by_path(const char *path, int open_flags, uint32_t loop_flags, LoopDevice **ret);
|
||||||
int loop_device_open(const char *loop_path, int open_flags, LoopDevice **ret);
|
int loop_device_open(const char *loop_path, int open_flags, LoopDevice **ret);
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,12 @@
|
||||||
/* SPDX-License-Identifier: LGPL-2.1+ */
|
/* SPDX-License-Identifier: LGPL-2.1+ */
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#if HAVE_OPENSSL
|
||||||
# include <openssl/pem.h>
|
# include <openssl/pem.h>
|
||||||
|
|
||||||
DEFINE_TRIVIAL_CLEANUP_FUNC(X509*, X509_free);
|
DEFINE_TRIVIAL_CLEANUP_FUNC(X509*, X509_free);
|
||||||
DEFINE_TRIVIAL_CLEANUP_FUNC(X509_NAME*, X509_NAME_free);
|
DEFINE_TRIVIAL_CLEANUP_FUNC(X509_NAME*, X509_NAME_free);
|
||||||
DEFINE_TRIVIAL_CLEANUP_FUNC(EVP_PKEY_CTX*, EVP_PKEY_CTX_free);
|
DEFINE_TRIVIAL_CLEANUP_FUNC(EVP_PKEY_CTX*, EVP_PKEY_CTX_free);
|
||||||
DEFINE_TRIVIAL_CLEANUP_FUNC(EVP_CIPHER_CTX*, EVP_CIPHER_CTX_free);
|
DEFINE_TRIVIAL_CLEANUP_FUNC(EVP_CIPHER_CTX*, EVP_CIPHER_CTX_free);
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
|
@ -6,13 +6,10 @@
|
||||||
#if HAVE_P11KIT
|
#if HAVE_P11KIT
|
||||||
# include <p11-kit/p11-kit.h>
|
# include <p11-kit/p11-kit.h>
|
||||||
# include <p11-kit/uri.h>
|
# include <p11-kit/uri.h>
|
||||||
|
|
||||||
#if HAVE_OPENSSL
|
|
||||||
#include <openssl/pem.h>
|
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "macro.h"
|
#include "macro.h"
|
||||||
|
#include "openssl-util.h"
|
||||||
#include "time-util.h"
|
#include "time-util.h"
|
||||||
|
|
||||||
bool pkcs11_uri_valid(const char *uri);
|
bool pkcs11_uri_valid(const char *uri);
|
||||||
|
|
|
@ -202,6 +202,7 @@ Address=
|
||||||
Scope=
|
Scope=
|
||||||
HomeAddress=
|
HomeAddress=
|
||||||
PrefixRoute=
|
PrefixRoute=
|
||||||
|
AddPrefixRoute=
|
||||||
ManageTemporaryAddress=
|
ManageTemporaryAddress=
|
||||||
Broadcast=
|
Broadcast=
|
||||||
Peer=
|
Peer=
|
||||||
|
|
Loading…
Reference in New Issue