mirror of
https://github.com/systemd/systemd
synced 2026-03-26 08:44:55 +01:00
Compare commits
No commits in common. "c918b70a4d7b64070d9c5a79d757e67ca8d211a6" and "e447ffe4daca1d0beb57242f079125669e4e1c3c" have entirely different histories.
c918b70a4d
...
e447ffe4da
@ -427,8 +427,7 @@
|
||||
has been unsuccessful for some time. (IPv4 link-local address autoconfiguration will usually
|
||||
happen in parallel with repeated attempts to acquire a DHCPv4 lease).</para>
|
||||
|
||||
<para>Defaults to <option>no</option> when <varname>Bridge=</varname> is set or when the specified
|
||||
<varname>MACVLAN=</varname>/<varname>MACVTAP=</varname> has <varname>Mode=passthru</varname>, or
|
||||
<para>Defaults to <option>no</option> when <varname>Bridge=yes</varname> is set, and
|
||||
<option>ipv6</option> otherwise.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
@ -630,11 +630,7 @@ static int check_x_access(const char *path, int *ret_fd) {
|
||||
return r;
|
||||
|
||||
r = access_fd(fd, X_OK);
|
||||
if (r == -ENOSYS) {
|
||||
/* /proc is not mounted. Fallback to access(). */
|
||||
if (access(path, X_OK) < 0)
|
||||
return -errno;
|
||||
} else if (r < 0)
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
if (ret_fd)
|
||||
@ -643,17 +639,22 @@ static int check_x_access(const char *path, int *ret_fd) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int find_executable_impl(const char *name, const char *root, char **ret_filename, int *ret_fd) {
|
||||
_cleanup_close_ int fd = -1;
|
||||
_cleanup_free_ char *path_name = NULL;
|
||||
int r;
|
||||
int find_executable_full(const char *name, const char *root, bool use_path_envvar, char **ret_filename, int *ret_fd) {
|
||||
int last_error, r;
|
||||
const char *p = NULL;
|
||||
|
||||
assert(name);
|
||||
|
||||
/* Function chase_symlinks() is invoked only when root is not NULL, as using it regardless of
|
||||
* root value would alter the behavior of existing callers for example: /bin/sleep would become
|
||||
* /usr/bin/sleep when find_executables is called. Hence, this function should be invoked when
|
||||
* needed to avoid unforeseen regression or other complicated changes. */
|
||||
if (is_path(name)) {
|
||||
_cleanup_close_ int fd = -1;
|
||||
_cleanup_free_ char *path_name = NULL;
|
||||
|
||||
/* Function chase_symlinks() is invoked only when root is not NULL,
|
||||
* as using it regardless of root value would alter the behavior
|
||||
* of existing callers for example: /bin/sleep would become
|
||||
* /usr/bin/sleep when find_executables is called. Hence, this function
|
||||
* should be invoked when needed to avoid unforeseen regression or other
|
||||
* complicated changes. */
|
||||
if (root) {
|
||||
r = chase_symlinks(name,
|
||||
root,
|
||||
@ -682,15 +683,6 @@ static int find_executable_impl(const char *name, const char *root, char **ret_f
|
||||
return 0;
|
||||
}
|
||||
|
||||
int find_executable_full(const char *name, const char *root, bool use_path_envvar, char **ret_filename, int *ret_fd) {
|
||||
int last_error, r;
|
||||
const char *p = NULL;
|
||||
|
||||
assert(name);
|
||||
|
||||
if (is_path(name))
|
||||
return find_executable_impl(name, root, ret_filename, ret_fd);
|
||||
|
||||
if (use_path_envvar)
|
||||
/* Plain getenv, not secure_getenv, because we want to actually allow the user to pick the
|
||||
* binary. */
|
||||
@ -703,6 +695,7 @@ int find_executable_full(const char *name, const char *root, bool use_path_envva
|
||||
/* Resolve a single-component name to a full path */
|
||||
for (;;) {
|
||||
_cleanup_free_ char *element = NULL;
|
||||
_cleanup_close_ int fd = -1;
|
||||
|
||||
r = extract_first_word(&p, &element, ":", EXTRACT_RELAX|EXTRACT_DONT_COALESCE_SEPARATORS);
|
||||
if (r < 0)
|
||||
@ -716,7 +709,24 @@ int find_executable_full(const char *name, const char *root, bool use_path_envva
|
||||
if (!path_extend(&element, name))
|
||||
return -ENOMEM;
|
||||
|
||||
r = find_executable_impl(element, root, ret_filename, ret_fd);
|
||||
if (root) {
|
||||
char *path_name;
|
||||
|
||||
r = chase_symlinks(element,
|
||||
root,
|
||||
CHASE_PREFIX_ROOT,
|
||||
&path_name,
|
||||
/* ret_fd= */ NULL);
|
||||
if (r < 0) {
|
||||
if (r != -EACCES)
|
||||
last_error = r;
|
||||
continue;
|
||||
}
|
||||
|
||||
free_and_replace(element, path_name);
|
||||
}
|
||||
|
||||
r = check_x_access(element, ret_fd ? &fd : NULL);
|
||||
if (r < 0) {
|
||||
/* PATH entries which we don't have access to are ignored, as per tradition. */
|
||||
if (r != -EACCES)
|
||||
@ -725,6 +735,11 @@ int find_executable_full(const char *name, const char *root, bool use_path_envva
|
||||
}
|
||||
|
||||
/* Found it! */
|
||||
if (ret_filename)
|
||||
*ret_filename = path_simplify(TAKE_PTR(element));
|
||||
if (ret_fd)
|
||||
*ret_fd = TAKE_FD(fd);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@ -813,6 +813,12 @@ static int automount_start(Unit *u) {
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
r = unit_test_start_limit(u);
|
||||
if (r < 0) {
|
||||
automount_enter_dead(a, AUTOMOUNT_FAILURE_START_LIMIT_HIT);
|
||||
return r;
|
||||
}
|
||||
|
||||
r = unit_acquire_invocation_id(u);
|
||||
if (r < 0)
|
||||
return r;
|
||||
@ -1058,21 +1064,6 @@ static bool automount_supported(void) {
|
||||
return supported;
|
||||
}
|
||||
|
||||
static int automount_test_start_limit(Unit *u) {
|
||||
Automount *a = AUTOMOUNT(u);
|
||||
int r;
|
||||
|
||||
assert(a);
|
||||
|
||||
r = unit_test_start_limit(u);
|
||||
if (r < 0) {
|
||||
automount_enter_dead(a, AUTOMOUNT_FAILURE_START_LIMIT_HIT);
|
||||
return r;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const char* const automount_result_table[_AUTOMOUNT_RESULT_MAX] = {
|
||||
[AUTOMOUNT_SUCCESS] = "success",
|
||||
[AUTOMOUNT_FAILURE_RESOURCES] = "resources",
|
||||
@ -1135,6 +1126,4 @@ const UnitVTable automount_vtable = {
|
||||
[JOB_FAILED] = "Failed to unset automount %s.",
|
||||
},
|
||||
},
|
||||
|
||||
.test_start_limit = automount_test_start_limit,
|
||||
};
|
||||
|
||||
@ -1167,6 +1167,12 @@ static int mount_start(Unit *u) {
|
||||
|
||||
assert(IN_SET(m->state, MOUNT_DEAD, MOUNT_FAILED));
|
||||
|
||||
r = unit_test_start_limit(u);
|
||||
if (r < 0) {
|
||||
mount_enter_dead(m, MOUNT_FAILURE_START_LIMIT_HIT);
|
||||
return r;
|
||||
}
|
||||
|
||||
r = unit_acquire_invocation_id(u);
|
||||
if (r < 0)
|
||||
return r;
|
||||
@ -2132,21 +2138,6 @@ static int mount_can_clean(Unit *u, ExecCleanMask *ret) {
|
||||
return exec_context_get_clean_mask(&m->exec_context, ret);
|
||||
}
|
||||
|
||||
static int mount_test_start_limit(Unit *u) {
|
||||
Mount *m = MOUNT(u);
|
||||
int r;
|
||||
|
||||
assert(m);
|
||||
|
||||
r = unit_test_start_limit(u);
|
||||
if (r < 0) {
|
||||
mount_enter_dead(m, MOUNT_FAILURE_START_LIMIT_HIT);
|
||||
return r;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const char* const mount_exec_command_table[_MOUNT_EXEC_COMMAND_MAX] = {
|
||||
[MOUNT_EXEC_MOUNT] = "ExecMount",
|
||||
[MOUNT_EXEC_UNMOUNT] = "ExecUnmount",
|
||||
@ -2244,6 +2235,4 @@ const UnitVTable mount_vtable = {
|
||||
[JOB_TIMEOUT] = "Timed out unmounting %s.",
|
||||
},
|
||||
},
|
||||
|
||||
.test_start_limit = mount_test_start_limit,
|
||||
};
|
||||
|
||||
@ -590,6 +590,12 @@ static int path_start(Unit *u) {
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
r = unit_test_start_limit(u);
|
||||
if (r < 0) {
|
||||
path_enter_dead(p, PATH_FAILURE_START_LIMIT_HIT);
|
||||
return r;
|
||||
}
|
||||
|
||||
r = unit_acquire_invocation_id(u);
|
||||
if (r < 0)
|
||||
return r;
|
||||
@ -806,21 +812,6 @@ static void path_reset_failed(Unit *u) {
|
||||
p->result = PATH_SUCCESS;
|
||||
}
|
||||
|
||||
static int path_test_start_limit(Unit *u) {
|
||||
Path *p = PATH(u);
|
||||
int r;
|
||||
|
||||
assert(p);
|
||||
|
||||
r = unit_test_start_limit(u);
|
||||
if (r < 0) {
|
||||
path_enter_dead(p, PATH_FAILURE_START_LIMIT_HIT);
|
||||
return r;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const char* const path_type_table[_PATH_TYPE_MAX] = {
|
||||
[PATH_EXISTS] = "PathExists",
|
||||
[PATH_EXISTS_GLOB] = "PathExistsGlob",
|
||||
@ -875,6 +866,4 @@ const UnitVTable path_vtable = {
|
||||
.reset_failed = path_reset_failed,
|
||||
|
||||
.bus_set_property = bus_path_set_property,
|
||||
|
||||
.test_start_limit = path_test_start_limit,
|
||||
};
|
||||
|
||||
@ -2436,6 +2436,13 @@ static int service_start(Unit *u) {
|
||||
|
||||
assert(IN_SET(s->state, SERVICE_DEAD, SERVICE_FAILED));
|
||||
|
||||
/* Make sure we don't enter a busy loop of some kind. */
|
||||
r = unit_test_start_limit(u);
|
||||
if (r < 0) {
|
||||
service_enter_dead(s, SERVICE_FAILURE_START_LIMIT_HIT, false);
|
||||
return r;
|
||||
}
|
||||
|
||||
r = unit_acquire_invocation_id(u);
|
||||
if (r < 0)
|
||||
return r;
|
||||
@ -4438,22 +4445,6 @@ static const char *service_finished_job(Unit *u, JobType t, JobResult result) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static int service_test_start_limit(Unit *u) {
|
||||
Service *s = SERVICE(u);
|
||||
int r;
|
||||
|
||||
assert(s);
|
||||
|
||||
/* Make sure we don't enter a busy loop of some kind. */
|
||||
r = unit_test_start_limit(u);
|
||||
if (r < 0) {
|
||||
service_enter_dead(s, SERVICE_FAILURE_START_LIMIT_HIT, false);
|
||||
return r;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const char* const service_restart_table[_SERVICE_RESTART_MAX] = {
|
||||
[SERVICE_RESTART_NO] = "no",
|
||||
[SERVICE_RESTART_ON_SUCCESS] = "on-success",
|
||||
@ -4617,6 +4608,4 @@ const UnitVTable service_vtable = {
|
||||
},
|
||||
.finished_job = service_finished_job,
|
||||
},
|
||||
|
||||
.test_start_limit = service_test_start_limit,
|
||||
};
|
||||
|
||||
@ -34,7 +34,6 @@
|
||||
#include "process-util.h"
|
||||
#include "selinux-util.h"
|
||||
#include "serialize.h"
|
||||
#include "service.h"
|
||||
#include "signal-util.h"
|
||||
#include "smack-util.h"
|
||||
#include "socket.h"
|
||||
@ -2513,6 +2512,12 @@ static int socket_start(Unit *u) {
|
||||
|
||||
assert(IN_SET(s->state, SOCKET_DEAD, SOCKET_FAILED));
|
||||
|
||||
r = unit_test_start_limit(u);
|
||||
if (r < 0) {
|
||||
socket_enter_dead(s, SOCKET_FAILURE_START_LIMIT_HIT);
|
||||
return r;
|
||||
}
|
||||
|
||||
r = unit_acquire_invocation_id(u);
|
||||
if (r < 0)
|
||||
return r;
|
||||
@ -3419,21 +3424,6 @@ static int socket_can_clean(Unit *u, ExecCleanMask *ret) {
|
||||
return exec_context_get_clean_mask(&s->exec_context, ret);
|
||||
}
|
||||
|
||||
static int socket_test_start_limit(Unit *u) {
|
||||
Socket *s = SOCKET(u);
|
||||
int r;
|
||||
|
||||
assert(s);
|
||||
|
||||
r = unit_test_start_limit(u);
|
||||
if (r < 0) {
|
||||
socket_enter_dead(s, SOCKET_FAILURE_START_LIMIT_HIT);
|
||||
return r;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const char* const socket_exec_command_table[_SOCKET_EXEC_COMMAND_MAX] = {
|
||||
[SOCKET_EXEC_START_PRE] = "ExecStartPre",
|
||||
[SOCKET_EXEC_START_CHOWN] = "ExecStartChown",
|
||||
@ -3560,6 +3550,4 @@ const UnitVTable socket_vtable = {
|
||||
[JOB_TIMEOUT] = "Timed out stopping %s.",
|
||||
},
|
||||
},
|
||||
|
||||
.test_start_limit = socket_test_start_limit,
|
||||
};
|
||||
|
||||
@ -5,6 +5,7 @@ typedef struct Socket Socket;
|
||||
typedef struct SocketPeer SocketPeer;
|
||||
|
||||
#include "mount.h"
|
||||
#include "service.h"
|
||||
#include "socket-util.h"
|
||||
#include "unit.h"
|
||||
|
||||
|
||||
@ -932,6 +932,12 @@ static int swap_start(Unit *u) {
|
||||
if (UNIT(other)->job && UNIT(other)->job->state == JOB_RUNNING)
|
||||
return -EAGAIN;
|
||||
|
||||
r = unit_test_start_limit(u);
|
||||
if (r < 0) {
|
||||
swap_enter_dead(s, SWAP_FAILURE_START_LIMIT_HIT);
|
||||
return r;
|
||||
}
|
||||
|
||||
r = unit_acquire_invocation_id(u);
|
||||
if (r < 0)
|
||||
return r;
|
||||
@ -1582,21 +1588,6 @@ static int swap_can_clean(Unit *u, ExecCleanMask *ret) {
|
||||
return exec_context_get_clean_mask(&s->exec_context, ret);
|
||||
}
|
||||
|
||||
static int swap_test_start_limit(Unit *u) {
|
||||
Swap *s = SWAP(u);
|
||||
int r;
|
||||
|
||||
assert(s);
|
||||
|
||||
r = unit_test_start_limit(u);
|
||||
if (r < 0) {
|
||||
swap_enter_dead(s, SWAP_FAILURE_START_LIMIT_HIT);
|
||||
return r;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const char* const swap_exec_command_table[_SWAP_EXEC_COMMAND_MAX] = {
|
||||
[SWAP_EXEC_ACTIVATE] = "ExecActivate",
|
||||
[SWAP_EXEC_DEACTIVATE] = "ExecDeactivate",
|
||||
@ -1692,6 +1683,4 @@ const UnitVTable swap_vtable = {
|
||||
[JOB_TIMEOUT] = "Timed out deactivating swap %s.",
|
||||
},
|
||||
},
|
||||
|
||||
.test_start_limit = swap_test_start_limit,
|
||||
};
|
||||
|
||||
@ -627,6 +627,12 @@ static int timer_start(Unit *u) {
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
r = unit_test_start_limit(u);
|
||||
if (r < 0) {
|
||||
timer_enter_dead(t, TIMER_FAILURE_START_LIMIT_HIT);
|
||||
return r;
|
||||
}
|
||||
|
||||
r = unit_acquire_invocation_id(u);
|
||||
if (r < 0)
|
||||
return r;
|
||||
@ -884,21 +890,6 @@ static int timer_can_clean(Unit *u, ExecCleanMask *ret) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int timer_test_start_limit(Unit *u) {
|
||||
Timer *t = TIMER(u);
|
||||
int r;
|
||||
|
||||
assert(t);
|
||||
|
||||
r = unit_test_start_limit(u);
|
||||
if (r < 0) {
|
||||
timer_enter_dead(t, TIMER_FAILURE_START_LIMIT_HIT);
|
||||
return r;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const char* const timer_base_table[_TIMER_BASE_MAX] = {
|
||||
[TIMER_ACTIVE] = "OnActiveSec",
|
||||
[TIMER_BOOT] = "OnBootSec",
|
||||
@ -958,6 +949,4 @@ const UnitVTable timer_vtable = {
|
||||
.timezone_change = timer_timezone_change,
|
||||
|
||||
.bus_set_property = bus_timer_set_property,
|
||||
|
||||
.test_start_limit = timer_test_start_limit,
|
||||
};
|
||||
|
||||
@ -1857,13 +1857,6 @@ int unit_start(Unit *u) {
|
||||
|
||||
assert(u);
|
||||
|
||||
/* Check start rate limiting early so that failure conditions don't cause us to enter a busy loop. */
|
||||
if (UNIT_VTABLE(u)->test_start_limit) {
|
||||
int r = UNIT_VTABLE(u)->test_start_limit(u);
|
||||
if (r < 0)
|
||||
return r;
|
||||
}
|
||||
|
||||
/* If this is already started, then this will succeed. Note that this will even succeed if this unit
|
||||
* is not startable by the user. This is relied on to detect when we need to wait for units and when
|
||||
* waiting is finished. */
|
||||
|
||||
@ -658,10 +658,6 @@ typedef struct UnitVTable {
|
||||
* of this type will immediately fail. */
|
||||
bool (*supported)(void);
|
||||
|
||||
/* If this function is set, it's invoked first as part of starting a unit to allow start rate
|
||||
* limiting checks to occur before we do anything else. */
|
||||
int (*test_start_limit)(Unit *u);
|
||||
|
||||
/* The strings to print in status messages */
|
||||
UnitStatusMessageFormats status_message_formats;
|
||||
|
||||
|
||||
@ -13,7 +13,6 @@
|
||||
#include "hostname-util.h"
|
||||
#include "in-addr-util.h"
|
||||
#include "net-condition.h"
|
||||
#include "netdev/macvlan.h"
|
||||
#include "networkd-address-label.h"
|
||||
#include "networkd-address.h"
|
||||
#include "networkd-bridge-fdb.h"
|
||||
@ -171,33 +170,8 @@ int network_verify(Network *network) {
|
||||
network->routes_by_section = hashmap_free_with_destructor(network->routes_by_section, route_free);
|
||||
}
|
||||
|
||||
if (network->link_local < 0) {
|
||||
network->link_local = ADDRESS_FAMILY_IPV6;
|
||||
|
||||
if (network->bridge)
|
||||
network->link_local = ADDRESS_FAMILY_NO;
|
||||
else {
|
||||
NetDev *netdev;
|
||||
|
||||
HASHMAP_FOREACH(netdev, network->stacked_netdevs) {
|
||||
MacVlan *m;
|
||||
|
||||
if (netdev->kind == NETDEV_KIND_MACVLAN)
|
||||
m = MACVLAN(netdev);
|
||||
else if (netdev->kind == NETDEV_KIND_MACVTAP)
|
||||
m = MACVTAP(netdev);
|
||||
else
|
||||
continue;
|
||||
|
||||
if (m->mode == NETDEV_MACVLAN_MODE_PASSTHRU)
|
||||
network->link_local = ADDRESS_FAMILY_NO;
|
||||
|
||||
/* There won't be a passthru MACVLAN/MACVTAP if there's already one in another mode */
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (network->link_local < 0)
|
||||
network->link_local = network->bridge ? ADDRESS_FAMILY_NO : ADDRESS_FAMILY_IPV6;
|
||||
if (network->ipv6ll_address_gen_mode == IPV6_LINK_LOCAL_ADDRESSS_GEN_MODE_NONE)
|
||||
SET_FLAG(network->link_local, ADDRESS_FAMILY_IPV6, false);
|
||||
|
||||
|
||||
@ -932,131 +932,6 @@ int ethtool_set_flow_control(int *fd, const char *ifname, int rx, int tx, int au
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ethtool_set_nic_coalesce_settings(int *ethtool_fd, const char *ifname, const netdev_coalesce_param *coalesce) {
|
||||
struct ethtool_coalesce ecmd = {
|
||||
.cmd = ETHTOOL_GCOALESCE,
|
||||
};
|
||||
struct ifreq ifr = {
|
||||
.ifr_data = (void*) &ecmd,
|
||||
};
|
||||
bool need_update = false;
|
||||
int r;
|
||||
|
||||
assert(ethtool_fd);
|
||||
assert(ifname);
|
||||
assert(coalesce);
|
||||
|
||||
if (coalesce->use_adaptive_rx_coalesce < 0 &&
|
||||
coalesce->use_adaptive_tx_coalesce < 0 &&
|
||||
!coalesce->rx_coalesce_usecs.set &&
|
||||
!coalesce->rx_max_coalesced_frames.set &&
|
||||
!coalesce->rx_coalesce_usecs_irq.set &&
|
||||
!coalesce->rx_max_coalesced_frames_irq.set &&
|
||||
!coalesce->tx_coalesce_usecs.set &&
|
||||
!coalesce->tx_max_coalesced_frames.set &&
|
||||
!coalesce->tx_coalesce_usecs_irq.set &&
|
||||
!coalesce->tx_max_coalesced_frames_irq.set &&
|
||||
!coalesce->stats_block_coalesce_usecs.set &&
|
||||
!coalesce->pkt_rate_low.set &&
|
||||
!coalesce->rx_coalesce_usecs_low.set &&
|
||||
!coalesce->rx_max_coalesced_frames_low.set &&
|
||||
!coalesce->tx_coalesce_usecs_low.set &&
|
||||
!coalesce->tx_max_coalesced_frames_low.set &&
|
||||
!coalesce->pkt_rate_high.set &&
|
||||
!coalesce->rx_coalesce_usecs_high.set &&
|
||||
!coalesce->rx_max_coalesced_frames_high.set &&
|
||||
!coalesce->tx_coalesce_usecs_high.set &&
|
||||
!coalesce->tx_max_coalesced_frames_high.set &&
|
||||
!coalesce->rate_sample_interval.set)
|
||||
return 0;
|
||||
|
||||
r = ethtool_connect(ethtool_fd);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
strscpy(ifr.ifr_name, IFNAMSIZ, ifname);
|
||||
|
||||
r = ioctl(*ethtool_fd, SIOCETHTOOL, &ifr);
|
||||
if (r < 0)
|
||||
return -errno;
|
||||
|
||||
if (coalesce->use_adaptive_rx_coalesce >= 0)
|
||||
UPDATE(ecmd.use_adaptive_rx_coalesce, (uint32_t) coalesce->use_adaptive_rx_coalesce, need_update);
|
||||
|
||||
if (coalesce->use_adaptive_tx_coalesce >= 0)
|
||||
UPDATE(ecmd.use_adaptive_tx_coalesce, (uint32_t) coalesce->use_adaptive_tx_coalesce, need_update);
|
||||
|
||||
if (coalesce->rx_coalesce_usecs.set)
|
||||
UPDATE(ecmd.rx_coalesce_usecs, coalesce->rx_coalesce_usecs.value, need_update);
|
||||
|
||||
if (coalesce->rx_max_coalesced_frames.set)
|
||||
UPDATE(ecmd.rx_max_coalesced_frames, coalesce->rx_max_coalesced_frames.value, need_update);
|
||||
|
||||
if (coalesce->rx_coalesce_usecs_irq.set)
|
||||
UPDATE(ecmd.rx_coalesce_usecs_irq, coalesce->rx_coalesce_usecs_irq.value, need_update);
|
||||
|
||||
if (coalesce->rx_max_coalesced_frames_irq.set)
|
||||
UPDATE(ecmd.rx_max_coalesced_frames_irq, coalesce->rx_max_coalesced_frames_irq.value, need_update);
|
||||
|
||||
if (coalesce->tx_coalesce_usecs.set)
|
||||
UPDATE(ecmd.tx_coalesce_usecs, coalesce->tx_coalesce_usecs.value, need_update);
|
||||
|
||||
if (coalesce->tx_max_coalesced_frames.set)
|
||||
UPDATE(ecmd.tx_max_coalesced_frames, coalesce->tx_max_coalesced_frames.value, need_update);
|
||||
|
||||
if (coalesce->tx_coalesce_usecs_irq.set)
|
||||
UPDATE(ecmd.tx_coalesce_usecs_irq, coalesce->tx_coalesce_usecs_irq.value, need_update);
|
||||
|
||||
if (coalesce->tx_max_coalesced_frames_irq.set)
|
||||
UPDATE(ecmd.tx_max_coalesced_frames_irq, coalesce->tx_max_coalesced_frames_irq.value, need_update);
|
||||
|
||||
if (coalesce->stats_block_coalesce_usecs.set)
|
||||
UPDATE(ecmd.stats_block_coalesce_usecs, coalesce->stats_block_coalesce_usecs.value, need_update);
|
||||
|
||||
if (coalesce->pkt_rate_low.set)
|
||||
UPDATE(ecmd.pkt_rate_low, coalesce->pkt_rate_low.value, need_update);
|
||||
|
||||
if (coalesce->rx_coalesce_usecs_low.set)
|
||||
UPDATE(ecmd.rx_coalesce_usecs_low, coalesce->rx_coalesce_usecs_low.value, need_update);
|
||||
|
||||
if (coalesce->rx_max_coalesced_frames_low.set)
|
||||
UPDATE(ecmd.rx_max_coalesced_frames_low, coalesce->rx_max_coalesced_frames_low.value, need_update);
|
||||
|
||||
if (coalesce->tx_coalesce_usecs_low.set)
|
||||
UPDATE(ecmd.tx_coalesce_usecs_low, coalesce->tx_coalesce_usecs_low.value, need_update);
|
||||
|
||||
if (coalesce->tx_max_coalesced_frames_low.set)
|
||||
UPDATE(ecmd.tx_max_coalesced_frames_low, coalesce->tx_max_coalesced_frames_low.value, need_update);
|
||||
|
||||
if (coalesce->pkt_rate_high.set)
|
||||
UPDATE(ecmd.pkt_rate_high, coalesce->pkt_rate_high.value, need_update);
|
||||
|
||||
if (coalesce->rx_coalesce_usecs_high.set)
|
||||
UPDATE(ecmd.rx_coalesce_usecs_high, coalesce->rx_coalesce_usecs_high.value, need_update);
|
||||
|
||||
if (coalesce->rx_max_coalesced_frames_high.set)
|
||||
UPDATE(ecmd.rx_max_coalesced_frames_high, coalesce->rx_max_coalesced_frames_high.value, need_update);
|
||||
|
||||
if (coalesce->tx_coalesce_usecs_high.set)
|
||||
UPDATE(ecmd.tx_coalesce_usecs_high, coalesce->tx_coalesce_usecs_high.value, need_update);
|
||||
|
||||
if (coalesce->tx_max_coalesced_frames_high.set)
|
||||
UPDATE(ecmd.tx_max_coalesced_frames_high, coalesce->tx_max_coalesced_frames_high.value, need_update);
|
||||
|
||||
if (coalesce->rate_sample_interval.set)
|
||||
UPDATE(ecmd.rate_sample_interval, DIV_ROUND_UP(coalesce->rate_sample_interval.value, USEC_PER_SEC), need_update);
|
||||
|
||||
if (!need_update)
|
||||
return 0;
|
||||
|
||||
ecmd.cmd = ETHTOOL_SCOALESCE;
|
||||
r = ioctl(*ethtool_fd, SIOCETHTOOL, &ifr);
|
||||
if (r < 0)
|
||||
return -errno;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int config_parse_advertise(
|
||||
const char *unit,
|
||||
const char *filename,
|
||||
@ -1307,3 +1182,128 @@ int config_parse_coalesce_sec(
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ethtool_set_nic_coalesce_settings(int *ethtool_fd, const char *ifname, const netdev_coalesce_param *coalesce) {
|
||||
struct ethtool_coalesce ecmd = {
|
||||
.cmd = ETHTOOL_GCOALESCE,
|
||||
};
|
||||
struct ifreq ifr = {
|
||||
.ifr_data = (void*) &ecmd,
|
||||
};
|
||||
bool need_update = false;
|
||||
int r;
|
||||
|
||||
assert(ethtool_fd);
|
||||
assert(ifname);
|
||||
assert(coalesce);
|
||||
|
||||
if (coalesce->use_adaptive_rx_coalesce < 0 &&
|
||||
coalesce->use_adaptive_tx_coalesce < 0 &&
|
||||
!coalesce->rx_coalesce_usecs.set &&
|
||||
!coalesce->rx_max_coalesced_frames.set &&
|
||||
!coalesce->rx_coalesce_usecs_irq.set &&
|
||||
!coalesce->rx_max_coalesced_frames_irq.set &&
|
||||
!coalesce->tx_coalesce_usecs.set &&
|
||||
!coalesce->tx_max_coalesced_frames.set &&
|
||||
!coalesce->tx_coalesce_usecs_irq.set &&
|
||||
!coalesce->tx_max_coalesced_frames_irq.set &&
|
||||
!coalesce->stats_block_coalesce_usecs.set &&
|
||||
!coalesce->pkt_rate_low.set &&
|
||||
!coalesce->rx_coalesce_usecs_low.set &&
|
||||
!coalesce->rx_max_coalesced_frames_low.set &&
|
||||
!coalesce->tx_coalesce_usecs_low.set &&
|
||||
!coalesce->tx_max_coalesced_frames_low.set &&
|
||||
!coalesce->pkt_rate_high.set &&
|
||||
!coalesce->rx_coalesce_usecs_high.set &&
|
||||
!coalesce->rx_max_coalesced_frames_high.set &&
|
||||
!coalesce->tx_coalesce_usecs_high.set &&
|
||||
!coalesce->tx_max_coalesced_frames_high.set &&
|
||||
!coalesce->rate_sample_interval.set)
|
||||
return 0;
|
||||
|
||||
r = ethtool_connect(ethtool_fd);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
strscpy(ifr.ifr_name, IFNAMSIZ, ifname);
|
||||
|
||||
r = ioctl(*ethtool_fd, SIOCETHTOOL, &ifr);
|
||||
if (r < 0)
|
||||
return -errno;
|
||||
|
||||
if (coalesce->use_adaptive_rx_coalesce >= 0)
|
||||
UPDATE(ecmd.use_adaptive_rx_coalesce, (uint32_t) coalesce->use_adaptive_rx_coalesce, need_update);
|
||||
|
||||
if (coalesce->use_adaptive_tx_coalesce >= 0)
|
||||
UPDATE(ecmd.use_adaptive_tx_coalesce, (uint32_t) coalesce->use_adaptive_tx_coalesce, need_update);
|
||||
|
||||
if (coalesce->rx_coalesce_usecs.set)
|
||||
UPDATE(ecmd.rx_coalesce_usecs, coalesce->rx_coalesce_usecs.value, need_update);
|
||||
|
||||
if (coalesce->rx_max_coalesced_frames.set)
|
||||
UPDATE(ecmd.rx_max_coalesced_frames, coalesce->rx_max_coalesced_frames.value, need_update);
|
||||
|
||||
if (coalesce->rx_coalesce_usecs_irq.set)
|
||||
UPDATE(ecmd.rx_coalesce_usecs_irq, coalesce->rx_coalesce_usecs_irq.value, need_update);
|
||||
|
||||
if (coalesce->rx_max_coalesced_frames_irq.set)
|
||||
UPDATE(ecmd.rx_max_coalesced_frames_irq, coalesce->rx_max_coalesced_frames_irq.value, need_update);
|
||||
|
||||
if (coalesce->tx_coalesce_usecs.set)
|
||||
UPDATE(ecmd.tx_coalesce_usecs, coalesce->tx_coalesce_usecs.value, need_update);
|
||||
|
||||
if (coalesce->tx_max_coalesced_frames.set)
|
||||
UPDATE(ecmd.tx_max_coalesced_frames, coalesce->tx_max_coalesced_frames.value, need_update);
|
||||
|
||||
if (coalesce->tx_coalesce_usecs_irq.set)
|
||||
UPDATE(ecmd.tx_coalesce_usecs_irq, coalesce->tx_coalesce_usecs_irq.value, need_update);
|
||||
|
||||
if (coalesce->tx_max_coalesced_frames_irq.set)
|
||||
UPDATE(ecmd.tx_max_coalesced_frames_irq, coalesce->tx_max_coalesced_frames_irq.value, need_update);
|
||||
|
||||
if (coalesce->stats_block_coalesce_usecs.set)
|
||||
UPDATE(ecmd.stats_block_coalesce_usecs, coalesce->stats_block_coalesce_usecs.value, need_update);
|
||||
|
||||
if (coalesce->pkt_rate_low.set)
|
||||
UPDATE(ecmd.pkt_rate_low, coalesce->pkt_rate_low.value, need_update);
|
||||
|
||||
if (coalesce->rx_coalesce_usecs_low.set)
|
||||
UPDATE(ecmd.rx_coalesce_usecs_low, coalesce->rx_coalesce_usecs_low.value, need_update);
|
||||
|
||||
if (coalesce->rx_max_coalesced_frames_low.set)
|
||||
UPDATE(ecmd.rx_max_coalesced_frames_low, coalesce->rx_max_coalesced_frames_low.value, need_update);
|
||||
|
||||
if (coalesce->tx_coalesce_usecs_low.set)
|
||||
UPDATE(ecmd.tx_coalesce_usecs_low, coalesce->tx_coalesce_usecs_low.value, need_update);
|
||||
|
||||
if (coalesce->tx_max_coalesced_frames_low.set)
|
||||
UPDATE(ecmd.tx_max_coalesced_frames_low, coalesce->tx_max_coalesced_frames_low.value, need_update);
|
||||
|
||||
if (coalesce->pkt_rate_high.set)
|
||||
UPDATE(ecmd.pkt_rate_high, coalesce->pkt_rate_high.value, need_update);
|
||||
|
||||
if (coalesce->rx_coalesce_usecs_high.set)
|
||||
UPDATE(ecmd.rx_coalesce_usecs_high, coalesce->rx_coalesce_usecs_high.value, need_update);
|
||||
|
||||
if (coalesce->rx_max_coalesced_frames_high.set)
|
||||
UPDATE(ecmd.rx_max_coalesced_frames_high, coalesce->rx_max_coalesced_frames_high.value, need_update);
|
||||
|
||||
if (coalesce->tx_coalesce_usecs_high.set)
|
||||
UPDATE(ecmd.tx_coalesce_usecs_high, coalesce->tx_coalesce_usecs_high.value, need_update);
|
||||
|
||||
if (coalesce->tx_max_coalesced_frames_high.set)
|
||||
UPDATE(ecmd.tx_max_coalesced_frames_high, coalesce->tx_max_coalesced_frames_high.value, need_update);
|
||||
|
||||
if (coalesce->rate_sample_interval.set)
|
||||
UPDATE(ecmd.rate_sample_interval, DIV_ROUND_UP(coalesce->rate_sample_interval.value, USEC_PER_SEC), need_update);
|
||||
|
||||
if (!need_update)
|
||||
return 0;
|
||||
|
||||
ecmd.cmd = ETHTOOL_SCOALESCE;
|
||||
r = ioctl(*ethtool_fd, SIOCETHTOOL, &ifr);
|
||||
if (r < 0)
|
||||
return -errno;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -4,13 +4,9 @@
|
||||
#include <sys/prctl.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include "sd-event.h"
|
||||
|
||||
#include "capability-util.h"
|
||||
#include "cpu-set-util.h"
|
||||
#include "dropin.h"
|
||||
#include "errno-list.h"
|
||||
#include "fd-util.h"
|
||||
#include "fileio.h"
|
||||
#include "fs-util.h"
|
||||
#include "macro.h"
|
||||
@ -18,14 +14,11 @@
|
||||
#include "missing_prctl.h"
|
||||
#include "mkdir.h"
|
||||
#include "path-util.h"
|
||||
#include "process-util.h"
|
||||
#include "rm-rf.h"
|
||||
#if HAVE_SECCOMP
|
||||
#include "seccomp-util.h"
|
||||
#endif
|
||||
#include "service.h"
|
||||
#include "signal-util.h"
|
||||
#include "static-destruct.h"
|
||||
#include "stat-util.h"
|
||||
#include "tests.h"
|
||||
#include "unit.h"
|
||||
@ -33,11 +26,8 @@
|
||||
#include "util.h"
|
||||
#include "virt.h"
|
||||
|
||||
static char *user_runtime_unit_dir = NULL;
|
||||
static bool can_unshare;
|
||||
|
||||
STATIC_DESTRUCTOR_REGISTER(user_runtime_unit_dir, freep);
|
||||
|
||||
typedef void (*test_function_t)(Manager *m);
|
||||
|
||||
static int cld_dumped_to_killed(int code) {
|
||||
@ -89,15 +79,16 @@ static void check_main_result(const char *file, unsigned line, const char *func,
|
||||
exec_status_dump(&service->main_exec_status, stdout, "\t");
|
||||
|
||||
if (cld_dumped_to_killed(service->main_exec_status.code) != cld_dumped_to_killed(code_expected)) {
|
||||
log_error("%s:%u:%s %s: can_unshare=%s: exit code %d, expected %d",
|
||||
file, line, func, unit->id, yes_no(can_unshare),
|
||||
log_error("%s:%u:%s %s: exit code %d, expected %d",
|
||||
file, line, func,
|
||||
unit->id,
|
||||
service->main_exec_status.code, code_expected);
|
||||
abort();
|
||||
}
|
||||
|
||||
if (service->main_exec_status.status != status_expected) {
|
||||
log_error("%s:%u:%s: %s: can_unshare=%s: exit status %d, expected %d",
|
||||
file, line, func, unit->id, yes_no(can_unshare),
|
||||
log_error("%s:%u:%s: %s: exit status %d, expected %d",
|
||||
file, line, func, unit->id,
|
||||
service->main_exec_status.status, status_expected);
|
||||
abort();
|
||||
}
|
||||
@ -115,8 +106,9 @@ static void check_service_result(const char *file, unsigned line, const char *fu
|
||||
service = SERVICE(unit);
|
||||
|
||||
if (service->result != result_expected) {
|
||||
log_error("%s:%u:%s: %s: can_unshare=%s: service end result %s, expected %s",
|
||||
file, line, func, unit->id, yes_no(can_unshare),
|
||||
log_error("%s:%u:%s: %s: service end result %s, expected %s",
|
||||
file, line, func,
|
||||
unit->id,
|
||||
service_result_to_string(service->result),
|
||||
service_result_to_string(result_expected));
|
||||
abort();
|
||||
@ -416,190 +408,6 @@ static void test_exec_inaccessiblepaths(Manager *m) {
|
||||
test(m, "exec-inaccessiblepaths-mount-propagation.service", can_unshare ? 0 : EXIT_FAILURE, CLD_EXITED);
|
||||
}
|
||||
|
||||
static int on_spawn_io(sd_event_source *s, int fd, uint32_t revents, void *userdata) {
|
||||
char **result = userdata;
|
||||
char buf[4096];
|
||||
ssize_t l;
|
||||
|
||||
assert(s);
|
||||
assert(fd >= 0);
|
||||
|
||||
l = read(fd, buf, sizeof(buf) - 1);
|
||||
if (l < 0) {
|
||||
if (errno == EAGAIN)
|
||||
goto reenable;
|
||||
|
||||
return 0;
|
||||
}
|
||||
if (l == 0)
|
||||
return 0;
|
||||
|
||||
buf[l] = '\0';
|
||||
if (result)
|
||||
assert_se(strextend(result, buf));
|
||||
else
|
||||
log_error("ldd: %s", buf);
|
||||
|
||||
reenable:
|
||||
/* Re-enable the event source if we did not encounter EOF */
|
||||
assert_se(sd_event_source_set_enabled(s, SD_EVENT_ONESHOT) >= 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int on_spawn_timeout(sd_event_source *s, uint64_t usec, void *userdata) {
|
||||
pid_t *pid = userdata;
|
||||
|
||||
assert(pid);
|
||||
|
||||
(void) kill(*pid, SIGKILL);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int on_spawn_sigchld(sd_event_source *s, const siginfo_t *si, void *userdata) {
|
||||
int ret = -EIO;
|
||||
|
||||
assert(si);
|
||||
|
||||
if (si->si_code == CLD_EXITED)
|
||||
ret = si->si_status;
|
||||
|
||||
sd_event_exit(sd_event_source_get_event(s), ret);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int find_libraries(const char *exec, char ***ret) {
|
||||
_cleanup_(sd_event_unrefp) sd_event *e = NULL;
|
||||
_cleanup_(sd_event_source_unrefp) sd_event_source *sigchld_source = NULL;
|
||||
_cleanup_(sd_event_source_unrefp) sd_event_source *stdout_source = NULL;
|
||||
_cleanup_(sd_event_source_unrefp) sd_event_source *stderr_source = NULL;
|
||||
_cleanup_close_pair_ int outpipe[2] = {-1, -1}, errpipe[2] = {-1, -1};
|
||||
_cleanup_strv_free_ char **libraries = NULL;
|
||||
_cleanup_free_ char *result = NULL;
|
||||
pid_t pid;
|
||||
int r;
|
||||
|
||||
assert(exec);
|
||||
assert(ret);
|
||||
|
||||
assert_se(sigprocmask_many(SIG_BLOCK, NULL, SIGCHLD, -1) >= 0);
|
||||
|
||||
assert_se(pipe2(outpipe, O_NONBLOCK|O_CLOEXEC) == 0);
|
||||
assert_se(pipe2(errpipe, O_NONBLOCK|O_CLOEXEC) == 0);
|
||||
|
||||
r = safe_fork("(spawn-ldd)", FORK_RESET_SIGNALS|FORK_DEATHSIG|FORK_LOG, &pid);
|
||||
assert_se(r >= 0);
|
||||
if (r == 0) {
|
||||
if (rearrange_stdio(-1, outpipe[1], errpipe[1]) < 0)
|
||||
_exit(EXIT_FAILURE);
|
||||
|
||||
(void) close_all_fds(NULL, 0);
|
||||
|
||||
execlp("ldd", "ldd", exec, NULL);
|
||||
_exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
outpipe[1] = safe_close(outpipe[1]);
|
||||
errpipe[1] = safe_close(errpipe[1]);
|
||||
|
||||
assert_se(sd_event_new(&e) >= 0);
|
||||
|
||||
assert_se(sd_event_add_time_relative(e, NULL, CLOCK_MONOTONIC,
|
||||
10 * USEC_PER_SEC, USEC_PER_SEC, on_spawn_timeout, &pid) >= 0);
|
||||
assert_se(sd_event_add_io(e, &stdout_source, outpipe[0], EPOLLIN, on_spawn_io, &result) >= 0);
|
||||
assert_se(sd_event_source_set_enabled(stdout_source, SD_EVENT_ONESHOT) >= 0);
|
||||
assert_se(sd_event_add_io(e, &stderr_source, errpipe[0], EPOLLIN, on_spawn_io, NULL) >= 0);
|
||||
assert_se(sd_event_source_set_enabled(stderr_source, SD_EVENT_ONESHOT) >= 0);
|
||||
assert_se(sd_event_add_child(e, &sigchld_source, pid, WEXITED, on_spawn_sigchld, NULL) >= 0);
|
||||
/* SIGCHLD should be processed after IO is complete */
|
||||
assert_se(sd_event_source_set_priority(sigchld_source, SD_EVENT_PRIORITY_NORMAL + 1) >= 0);
|
||||
|
||||
assert_se(sd_event_loop(e) >= 0);
|
||||
|
||||
_cleanup_strv_free_ char **v = NULL;
|
||||
assert_se(strv_split_newlines_full(&v, result, 0) >= 0);
|
||||
|
||||
char **q;
|
||||
STRV_FOREACH(q, v) {
|
||||
_cleanup_free_ char *word = NULL;
|
||||
const char *p = *q;
|
||||
|
||||
r = extract_first_word(&p, &word, NULL, 0);
|
||||
assert_se(r >= 0);
|
||||
if (r == 0)
|
||||
continue;
|
||||
|
||||
if (path_is_absolute(word)) {
|
||||
assert_se(strv_consume(&libraries, TAKE_PTR(word)) >= 0);
|
||||
continue;
|
||||
}
|
||||
|
||||
word = mfree(word);
|
||||
r = extract_first_word(&p, &word, NULL, 0);
|
||||
assert_se(r >= 0);
|
||||
if (r == 0)
|
||||
continue;
|
||||
|
||||
if (!streq_ptr(word, "=>"))
|
||||
continue;
|
||||
|
||||
word = mfree(word);
|
||||
r = extract_first_word(&p, &word, NULL, 0);
|
||||
assert_se(r >= 0);
|
||||
if (r == 0)
|
||||
continue;
|
||||
|
||||
if (path_is_absolute(word)) {
|
||||
assert_se(strv_consume(&libraries, TAKE_PTR(word)) >= 0);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
*ret = TAKE_PTR(libraries);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void test_exec_mount_apivfs(Manager *m) {
|
||||
_cleanup_free_ char *fullpath_touch = NULL, *fullpath_test = NULL, *data = NULL;
|
||||
_cleanup_strv_free_ char **libraries = NULL, **libraries_test = NULL;
|
||||
int r;
|
||||
|
||||
assert(user_runtime_unit_dir);
|
||||
|
||||
r = find_executable("touch", &fullpath_touch);
|
||||
if (r < 0) {
|
||||
log_notice_errno(r, "Skipping %s, could not find 'touch' command: %m", __func__);
|
||||
return;
|
||||
}
|
||||
r = find_executable("test", &fullpath_test);
|
||||
if (r < 0) {
|
||||
log_notice_errno(r, "Skipping %s, could not find 'test' command: %m", __func__);
|
||||
return;
|
||||
}
|
||||
|
||||
assert_se(find_libraries(fullpath_touch, &libraries) >= 0);
|
||||
assert_se(find_libraries(fullpath_test, &libraries_test) >= 0);
|
||||
assert_se(strv_extend_strv(&libraries, libraries_test, true) >= 0);
|
||||
|
||||
assert_se(strextend(&data, "[Service]\n"));
|
||||
assert_se(strextend(&data, "ExecStart=", fullpath_touch, " /aaa\n"));
|
||||
assert_se(strextend(&data, "ExecStart=", fullpath_test, " -f /aaa\n"));
|
||||
assert_se(strextend(&data, "BindReadOnlyPaths=", fullpath_touch, "\n"));
|
||||
assert_se(strextend(&data, "BindReadOnlyPaths=", fullpath_test, "\n"));
|
||||
|
||||
char **p;
|
||||
STRV_FOREACH(p, libraries)
|
||||
assert_se(strextend(&data, "BindReadOnlyPaths=", *p, "\n"));
|
||||
|
||||
assert_se(write_drop_in(user_runtime_unit_dir, "exec-mount-apivfs-no.service", 10, "bind-mount", data) >= 0);
|
||||
|
||||
assert_se(mkdir_p("/tmp/test-exec-mount-apivfs-no/root", 0755) >= 0);
|
||||
|
||||
test(m, "exec-mount-apivfs-no.service", can_unshare ? 0 : EXIT_NAMESPACE, CLD_EXITED);
|
||||
|
||||
(void) rm_rf("/tmp/test-exec-mount-apivfs-no/root", REMOVE_ROOT|REMOVE_PHYSICAL);
|
||||
}
|
||||
|
||||
static void test_exec_noexecpaths(Manager *m) {
|
||||
|
||||
test(m, "exec-noexecpaths-simple.service", can_unshare ? 0 : EXIT_FAILURE, CLD_EXITED);
|
||||
@ -1063,7 +871,6 @@ int main(int argc, char *argv[]) {
|
||||
entry(test_exec_ignoresigpipe),
|
||||
entry(test_exec_inaccessiblepaths),
|
||||
entry(test_exec_ioschedulingclass),
|
||||
entry(test_exec_mount_apivfs),
|
||||
entry(test_exec_noexecpaths),
|
||||
entry(test_exec_oomscoreadjust),
|
||||
entry(test_exec_passenvironment),
|
||||
@ -1124,12 +931,10 @@ int main(int argc, char *argv[]) {
|
||||
if (r == -ENOMEDIUM)
|
||||
return log_tests_skipped("cgroupfs not available");
|
||||
|
||||
_cleanup_free_ char *unit_dir = NULL, *unit_paths = NULL;
|
||||
_cleanup_free_ char *unit_dir = NULL;
|
||||
assert_se(get_testdata_dir("test-execute/", &unit_dir) >= 0);
|
||||
assert_se(set_unit_path(unit_dir) >= 0);
|
||||
assert_se(runtime_dir = setup_fake_runtime_dir());
|
||||
assert_se(user_runtime_unit_dir = path_join(runtime_dir, "systemd/user"));
|
||||
assert_se(unit_paths = strjoin(unit_dir, ":", user_runtime_unit_dir));
|
||||
assert_se(set_unit_path(unit_paths) >= 0);
|
||||
|
||||
/* Unset VAR1, VAR2 and VAR3 which are used in the PassEnvironment test
|
||||
* cases, otherwise (and if they are present in the environment),
|
||||
|
||||
@ -142,8 +142,6 @@ int link_load_one(LinkConfigContext *ctx, const char *filename) {
|
||||
.tx_flow_control = -1,
|
||||
.autoneg_flow_control = -1,
|
||||
.txqueuelen = UINT32_MAX,
|
||||
.coalesce.use_adaptive_rx_coalesce = -1,
|
||||
.coalesce.use_adaptive_tx_coalesce = -1,
|
||||
};
|
||||
|
||||
for (i = 0; i < ELEMENTSOF(link->features); i++)
|
||||
|
||||
@ -1 +0,0 @@
|
||||
../TEST-01-BASIC/Makefile
|
||||
@ -1,9 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
|
||||
TEST_DESCRIPTION="https://github.com/systemd/systemd/issues/17433"
|
||||
|
||||
# shellcheck source=test/test-functions
|
||||
. "${TEST_BASE_DIR:?}/test-functions"
|
||||
|
||||
do_test "$@"
|
||||
@ -33,8 +33,6 @@ if install_tests
|
||||
install_dir : testdata_dir)
|
||||
install_subdir('testsuite-52.units',
|
||||
install_dir : testdata_dir)
|
||||
install_subdir('testsuite-63.units',
|
||||
install_dir : testdata_dir)
|
||||
|
||||
testsuite08_dir = testdata_dir + '/testsuite-08.units'
|
||||
install_data('testsuite-08.units/-.mount',
|
||||
|
||||
@ -1,15 +0,0 @@
|
||||
[Unit]
|
||||
Description=Test for find_executable() with MountAPIVFS=no
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
|
||||
MountAPIVFS=false
|
||||
PrivateDevices=false
|
||||
PrivateMounts=true
|
||||
PrivateTmp=false
|
||||
PrivateUsers=false
|
||||
ProtectControlGroups=false
|
||||
ProtectKernelModules=false
|
||||
ProtectKernelTunables=false
|
||||
RootDirectory=/tmp/test-exec-mount-apivfs-no/root
|
||||
@ -148,7 +148,6 @@ BASICTOOLS=(
|
||||
head
|
||||
ionice
|
||||
ip
|
||||
ldd
|
||||
ln
|
||||
loadkeys
|
||||
login
|
||||
|
||||
@ -1155,8 +1155,7 @@ class NetworkdNetDevTests(unittest.TestCase, Utilities):
|
||||
f.write('[MACVTAP]\nMode=' + mode)
|
||||
start_networkd()
|
||||
|
||||
self.wait_online(['macvtap99:degraded',
|
||||
'test1:carrier' if mode == 'passthru' else 'test1:degraded'])
|
||||
self.wait_online(['macvtap99:degraded', 'test1:degraded'])
|
||||
|
||||
output = check_output('ip -d link show macvtap99')
|
||||
print(output)
|
||||
@ -1173,8 +1172,7 @@ class NetworkdNetDevTests(unittest.TestCase, Utilities):
|
||||
f.write('[MACVLAN]\nMode=' + mode)
|
||||
start_networkd()
|
||||
|
||||
self.wait_online(['macvlan99:degraded',
|
||||
'test1:carrier' if mode == 'passthru' else 'test1:degraded'])
|
||||
self.wait_online(['macvlan99:degraded', 'test1:degraded'])
|
||||
|
||||
output = check_output('ip -d link show test1')
|
||||
print(output)
|
||||
@ -1193,8 +1191,7 @@ class NetworkdNetDevTests(unittest.TestCase, Utilities):
|
||||
self.assertEqual(rc, 0)
|
||||
time.sleep(1)
|
||||
|
||||
self.wait_online(['macvlan99:degraded',
|
||||
'test1:carrier' if mode == 'passthru' else 'test1:degraded'])
|
||||
self.wait_online(['macvlan99:degraded', 'test1:degraded'])
|
||||
|
||||
output = check_output('ip -d link show test1')
|
||||
print(output)
|
||||
|
||||
@ -1,9 +1,6 @@
|
||||
[Unit]
|
||||
Requires=test10.socket
|
||||
ConditionPathExistsGlob=/tmp/nonexistent
|
||||
# Make sure we hit the socket trigger limit in the test and not the service start limit.
|
||||
StartLimitInterval=1000
|
||||
StartLimitBurst=1000
|
||||
|
||||
[Service]
|
||||
ExecStart=true
|
||||
|
||||
@ -1,2 +0,0 @@
|
||||
[Path]
|
||||
PathExists=/tmp/test63
|
||||
@ -1,5 +0,0 @@
|
||||
[Unit]
|
||||
ConditionPathExists=!/tmp/nonexistent
|
||||
|
||||
[Service]
|
||||
ExecStart=true
|
||||
@ -1,16 +0,0 @@
|
||||
[Unit]
|
||||
Description=TEST-63-ISSUE-17433
|
||||
|
||||
[Service]
|
||||
ExecStartPre=rm -f /failed /testok
|
||||
Type=oneshot
|
||||
ExecStart=rm -f /tmp/nonexistent
|
||||
ExecStart=systemctl start test63.path
|
||||
ExecStart=touch /tmp/test63
|
||||
# Make sure systemd has sufficient time to hit the start limit for test63.service.
|
||||
ExecStart=sleep 2
|
||||
ExecStart=sh -x -c 'test "$(systemctl show test63.service -P ActiveState)" = failed'
|
||||
ExecStart=sh -x -c 'test "$(systemctl show test63.service -P Result)" = start-limit-hit'
|
||||
ExecStart=sh -x -c 'test "$(systemctl show test63.path -P ActiveState)" = failed'
|
||||
ExecStart=sh -x -c 'test "$(systemctl show test63.path -P Result)" = unit-start-limit-hit'
|
||||
ExecStart=sh -x -c 'echo OK >/testok'
|
||||
Loading…
x
Reference in New Issue
Block a user