Compare commits

..

No commits in common. "ecb040643d948a6cab878e6cbff1f3c57cab9281" and "9667e10b1a997ad12c8c472f4d7996d6985df1dc" have entirely different histories.

14 changed files with 42 additions and 51 deletions

2
TODO
View File

@ -37,6 +37,8 @@ Features:
waitid() only on the children with the highest priority until one is waitable
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
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

View File

@ -1007,10 +1007,12 @@
</listitem>
</varlistentry>
<varlistentry>
<term><varname>AddPrefixRoute=</varname></term>
<term><varname>PrefixRoute=</varname></term>
<listitem>
<para>Takes a boolean. When true, the prefix route for the address is automatically added.
Defaults to true.</para>
<para>Takes a boolean. When adding or modifying an IPv6 address, the userspace
application needs a way to suppress adding a prefix route. This is for example relevant
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>
</varlistentry>
<varlistentry>

View File

@ -102,7 +102,6 @@ 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_SPEED_METER_INACTIVE, EOPNOTSUPP),
SD_BUS_ERROR_MAP(BUS_ERROR_UNMANAGED_INTERFACE, EOPNOTSUPP),
SD_BUS_ERROR_MAP_END

View File

@ -81,7 +81,6 @@
#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"
BUS_ERROR_MAP_ELF_USE(bus_common_errors);

View File

@ -115,9 +115,6 @@ struct sd_event {
unsigned n_sources;
struct epoll_event *event_queue;
size_t event_queue_allocated;
LIST_HEAD(sd_event_source, sources);
usec_t last_run, last_log;
@ -289,8 +286,6 @@ static sd_event *event_free(sd_event *e) {
hashmap_free(e->child_sources);
set_free(e->post_sources);
free(e->event_queue);
return mfree(e);
}
@ -3482,7 +3477,8 @@ pending:
}
_public_ int sd_event_wait(sd_event *e, uint64_t timeout) {
size_t event_queue_max;
struct epoll_event *ev_queue;
unsigned ev_queue_max;
int r, m, i;
assert_return(e, -EINVAL);
@ -3496,15 +3492,14 @@ _public_ int sd_event_wait(sd_event *e, uint64_t timeout) {
return 1;
}
event_queue_max = MAX(e->n_sources, 1u);
if (!GREEDY_REALLOC(e->event_queue, e->event_queue_allocated, event_queue_max))
return -ENOMEM;
ev_queue_max = MAX(e->n_sources, 1u);
ev_queue = newa(struct epoll_event, ev_queue_max);
/* If we still have inotify data buffered, then query the other fds, but don't wait on it */
if (e->inotify_data_buffered)
timeout = 0;
m = epoll_wait(e->epoll_fd, e->event_queue, event_queue_max,
m = epoll_wait(e->epoll_fd, ev_queue, ev_queue_max,
timeout == (uint64_t) -1 ? -1 : (int) DIV_ROUND_UP(timeout, USEC_PER_MSEC));
if (m < 0) {
if (errno == EINTR) {
@ -3520,26 +3515,26 @@ _public_ int sd_event_wait(sd_event *e, uint64_t timeout) {
for (i = 0; i < m; i++) {
if (e->event_queue[i].data.ptr == INT_TO_PTR(SOURCE_WATCHDOG))
r = flush_timer(e, e->watchdog_fd, e->event_queue[i].events, NULL);
if (ev_queue[i].data.ptr == INT_TO_PTR(SOURCE_WATCHDOG))
r = flush_timer(e, e->watchdog_fd, ev_queue[i].events, NULL);
else {
WakeupType *t = e->event_queue[i].data.ptr;
WakeupType *t = ev_queue[i].data.ptr;
switch (*t) {
case WAKEUP_EVENT_SOURCE: {
sd_event_source *s = e->event_queue[i].data.ptr;
sd_event_source *s = ev_queue[i].data.ptr;
assert(s);
switch (s->type) {
case SOURCE_IO:
r = process_io(e, s, e->event_queue[i].events);
r = process_io(e, s, ev_queue[i].events);
break;
case SOURCE_CHILD:
r = process_pidfd(e, s, e->event_queue[i].events);
r = process_pidfd(e, s, ev_queue[i].events);
break;
default:
@ -3550,20 +3545,20 @@ _public_ int sd_event_wait(sd_event *e, uint64_t timeout) {
}
case WAKEUP_CLOCK_DATA: {
struct clock_data *d = e->event_queue[i].data.ptr;
struct clock_data *d = ev_queue[i].data.ptr;
assert(d);
r = flush_timer(e, d->fd, e->event_queue[i].events, &d->next);
r = flush_timer(e, d->fd, ev_queue[i].events, &d->next);
break;
}
case WAKEUP_SIGNAL_DATA:
r = process_signal(e, e->event_queue[i].data.ptr, e->event_queue[i].events);
r = process_signal(e, ev_queue[i].data.ptr, ev_queue[i].events);
break;
case WAKEUP_INOTIFY_DATA:
r = event_inotify_data_read(e, e->event_queue[i].data.ptr, e->event_queue[i].events);
r = event_inotify_data_read(e, ev_queue[i].data.ptr, ev_queue[i].events);
break;
default:

View File

@ -366,8 +366,7 @@ static int acquire_link_bitrates(sd_bus *bus, LinkInfo *link) {
"org.freedesktop.network1.Link",
"BitRates");
if (r < 0) {
bool quiet = sd_bus_error_has_name(&error, SD_BUS_ERROR_UNKNOWN_PROPERTY) ||
sd_bus_error_has_name(&error, BUS_ERROR_SPEED_METER_INACTIVE);
bool quiet = sd_bus_error_has_name(&error, SD_BUS_ERROR_UNKNOWN_PROPERTY);
return log_full_errno(quiet ? LOG_DEBUG : LOG_WARNING,
r, "Failed to query link bit rates: %s", bus_error_message(&error, r));

View File

@ -33,7 +33,6 @@ int address_new(Address **ret) {
.cinfo.ifa_prefered = CACHE_INFO_INFINITY_LIFE_TIME,
.cinfo.ifa_valid = CACHE_INFO_INFINITY_LIFE_TIME,
.duplicate_address_detection = ADDRESS_FAMILY_IPV6,
.prefix_route = true,
};
*ret = TAKE_PTR(address);
@ -597,7 +596,7 @@ int address_configure(
if (address->manage_temporary_address)
address->flags |= IFA_F_MANAGETEMPADDR;
if (!address->prefix_route)
if (address->prefix_route)
address->flags |= IFA_F_NOPREFIXROUTE;
if (address->autojoin)
@ -1002,8 +1001,6 @@ int config_parse_address_flags(const char *unit,
else if (streq(lvalue, "ManageTemporaryAddress"))
n->manage_temporary_address = r;
else if (streq(lvalue, "PrefixRoute"))
n->prefix_route = !r;
else if (streq(lvalue, "AddPrefixRoute"))
n->prefix_route = r;
else if (streq(lvalue, "AutoJoin"))
n->autojoin = r;

View File

@ -111,10 +111,10 @@ static int route_scope_from_address(const Route *route, const struct in_addr *se
return RT_SCOPE_UNIVERSE;
}
static bool link_prefixroute(Link *link) {
return !link->network->dhcp_route_table_set ||
link->network->dhcp_route_table == RT_TABLE_MAIN ||
link->manager->dhcp4_prefix_root_cannot_set_table;
static bool link_noprefixroute(Link *link) {
return link->network->dhcp_route_table_set &&
link->network->dhcp_route_table != RT_TABLE_MAIN &&
!link->manager->dhcp4_prefix_root_cannot_set_table;
}
static int dhcp_route_configure(Route **route, Link *link) {
@ -254,7 +254,7 @@ static int link_set_dhcp_routes(Link *link) {
if (r < 0)
return log_link_warning_errno(link, r, "DHCP error: could not get address: %m");
if (!link_prefixroute(link)) {
if (link_noprefixroute(link)) {
_cleanup_(route_freep) Route *prefix_route = NULL;
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);
}
if (!link_prefixroute(link)) {
if (link_noprefixroute(link)) {
_cleanup_(route_freep) Route *prefix_route = NULL;
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->prefixlen = prefixlen;
addr->broadcast.s_addr = address->s_addr | ~netmask->s_addr;
addr->prefix_route = link_prefixroute(link);
addr->prefix_route = link_noprefixroute(link);
/* allow reusing an existing address and simply update its lifetime
* in case it already exists */

View File

@ -106,8 +106,7 @@ Address.Label, config_parse_label,
Address.PreferredLifetime, config_parse_lifetime, 0, 0
Address.HomeAddress, config_parse_address_flags, 0, 0
Address.ManageTemporaryAddress, config_parse_address_flags, 0, 0
Address.PrefixRoute, config_parse_address_flags, 0, 0 /* deprecated */
Address.AddPrefixRoute, config_parse_address_flags, 0, 0
Address.PrefixRoute, config_parse_address_flags, 0, 0
Address.AutoJoin, config_parse_address_flags, 0, 0
Address.DuplicateAddressDetection, config_parse_duplicate_address_detection, 0, 0
Address.Scope, config_parse_address_scope, 0, 0

View File

@ -29,7 +29,7 @@ static void cleanup_clear_loop_close(int *fd) {
}
}
int loop_device_make(
int loop_device_make_full(
int fd,
int open_flags,
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)
return -errno;
return loop_device_make(fd, open_flags, 0, 0, loop_flags, ret);
return loop_device_make_full(fd, open_flags, 0, 0, loop_flags, ret);
}
LoopDevice* loop_device_unref(LoopDevice *d) {

View File

@ -14,7 +14,7 @@ struct LoopDevice {
bool relinquished;
};
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_full(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_open(const char *loop_path, int open_flags, LoopDevice **ret);

View File

@ -1,12 +1,9 @@
/* SPDX-License-Identifier: LGPL-2.1+ */
#pragma once
#if HAVE_OPENSSL
#include <openssl/pem.h>
DEFINE_TRIVIAL_CLEANUP_FUNC(X509*, X509_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_CIPHER_CTX*, EVP_CIPHER_CTX_free);
#endif

View File

@ -6,10 +6,13 @@
#if HAVE_P11KIT
#include <p11-kit/p11-kit.h>
#include <p11-kit/uri.h>
#if HAVE_OPENSSL
#include <openssl/pem.h>
#endif
#endif
#include "macro.h"
#include "openssl-util.h"
#include "time-util.h"
bool pkcs11_uri_valid(const char *uri);

View File

@ -202,7 +202,6 @@ Address=
Scope=
HomeAddress=
PrefixRoute=
AddPrefixRoute=
ManageTemporaryAddress=
Broadcast=
Peer=