Compare commits

..

13 Commits

Author SHA1 Message Date
Frantisek Sumsal a25457f5b7 systemctl: skip non-existent units in the 'cat' verb
When processing list of units (either provided manually or as a
wildcard), let's skip units for which we don't have an on-disk
counterpart, but note the -ENOENT error code and propagate it back to
the user.

Fixes: #14082
2020-01-02 15:27:25 +01:00
Lennart Poettering 49d418d4ab
Merge pull request #14444 from yuwata/network-codel-more
network: more CoDel settings
2020-01-02 14:51:55 +01:00
Topi Miettinen 412a6c646c systemd.exec: document the file system for EnvironmentFile paths
Files specified with EnvironmentFile are read from PID1 mount namespace, before
any file system operations like RootImage or BindPaths are in effect.
2020-01-02 14:21:16 +01:00
Lennart Poettering cb68406c6a
Merge pull request #14441 from GothAck/gothack_type.d_dropin_test_master
Fix type.d drop-in ordering for #14439 - duplicate against master
2020-01-02 13:41:16 +01:00
Rafa Couto 85f04a2161 hwdb: 60-sensor.hwdb Chuwi Hi10 CWI515 accelerometer orientation. 2020-01-02 13:37:23 +01:00
Fran Dieguez 736eadf028 Update Galician translations 2020-01-02 13:36:04 +01:00
Tobias Stoeckmann be78e0f07b systemd-analyze: fixed typo in documentation
The example shows the output of critical-chain, which means
that the title is wrong.
2020-01-02 13:35:34 +01:00
Frantisek Sumsal e514aa1eea tree-wide: yet another batch of coccinelle recommendations
Prettify certain parts of the codebase using coccinelle transformations
(no functional changes).
2020-01-02 13:32:55 +01:00
Yu Watanabe 48d0248e6d network: bump netlink receive buffer size to 128M
Prompted by #14417.
2020-01-02 10:29:41 +01:00
Yu Watanabe a3d3565451 test-network: add a test case for CoDel 2019-12-28 22:25:49 +09:00
Yu Watanabe b078e52855 network: add more settings for CoDel 2019-12-28 22:25:12 +09:00
Greg "GothAck" Miell e6627f2392 unit drop-in: Fix ordering of special type.d drop-ins 2019-12-27 15:10:24 +00:00
Greg "GothAck" Miell f5dd6e50a7 Add failing test to show service.d global drop-in does not get overridden by more specific dropins 2019-12-27 14:53:32 +00:00
21 changed files with 720 additions and 187 deletions

View File

@ -166,6 +166,10 @@ sensor:modalias:acpi:BMA250E*:dmi:bvnINSYDECorp.:bvrG1D_S165*:svnilife:pnS165:*
sensor:modalias:acpi:BOSC0200*:dmi:*:svnHampoo:pnX1D3_C806N:*
ACCEL_MOUNT_MATRIX=0, -1, 0; -1, 0, 0; 0, 0, 1
# Chuwi Hi10 (CWI515)
sensor:modalias:acpi:BOSC0200*:dmi:bvnAmericanMegatrendsInc.:bvr5.11:*:svnDefaultstring:pnDefaultstring:*
ACCEL_MOUNT_MATRIX=0, -1, 0; -1, 0, 0; 0, 0, 1
# Chuwi Hi10 (CWI1515)
sensor:modalias:acpi:BOSC0200*:dmi:bvnAmericanMegatrendsInc.:bvrP02A_C106.60E:*:svnDefaultstring:pnDefaultstring:*
ACCEL_MOUNT_MATRIX=0, -1, 0; -1, 0, 0; 0, 0, 1

View File

@ -203,7 +203,7 @@ multi-user.target reached after 47.820s in userspace
jobs (and in particular not jobs that timed out).</para>
<example>
<title><command>systemd-analyze time</command></title>
<title><command>systemd-analyze critical-chain</command></title>
<programlisting>$ systemd-analyze critical-chain
multi-user.target @47.820s

View File

@ -1908,7 +1908,8 @@ SystemCallErrorNumber=EPERM</programlisting>
<para>The files listed with this directive will be read shortly before the process is executed (more
specifically, after all processes from a previous unit state terminated. This means you can generate these
files in one unit state, and read it with this option in the next).</para>
files in one unit state, and read it with this option in the next. The files are read from the file
system of the service manager, before any file system changes like bind mounts take place).</para>
<para>Settings from these files override settings made with <varname>Environment=</varname>. If the same
variable is set twice from these files, the files will be read in the order they are specified and the later

View File

@ -2465,6 +2465,38 @@
</listitem>
</varlistentry>
<varlistentry>
<term><varname>ControlledDelayTargetSec=</varname></term>
<listitem>
<para>Takes a timespan. Specifies the acceptable minimum standing/persistent queue delay.
Defaults to unset and kernel's default is used.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><varname>ControlledDelayIntervalSec=</varname></term>
<listitem>
<para>Takes a timespan. This is used to ensure that the measured minimum delay does not
become too stale. Defaults to unset and kernel's default is used.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><varname>ControlledDelayECN=</varname></term>
<listitem>
<para>Takes a boolean. This can be used to mark packets instead of dropping them. Defaults to
unset and kernel's default is used.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><varname>ControlledDelayCEThresholdSec=</varname></term>
<listitem>
<para>Takes a timespan. This sets a threshold above which all packets are marked with ECN
Congestion Experienced (CE). Defaults to unset and kernel's default is used.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><varname>FairQueuingControlledDelayPacketLimit=</varname></term>
<listitem>

605
po/gl.po

File diff suppressed because it is too large Load Diff

View File

@ -7,6 +7,7 @@
#include <string.h>
#include <sys/types.h>
#include "alloc-util.h"
#include "macro.h"
size_t page_size(void) _pure_;
@ -88,9 +89,7 @@ static inline void* erase_and_free(void *p) {
l = malloc_usable_size(p);
explicit_bzero_safe(p, l);
free(p);
return NULL;
return mfree(p);
}
static inline void erase_and_freep(void *p) {

View File

@ -621,7 +621,7 @@ int unit_name_mangle_with_suffix(const char *name, const char *operation, UnitNa
goto good;
log_full(flags & UNIT_NAME_MANGLE_WARN ? LOG_NOTICE : LOG_DEBUG,
"Glob pattern passed%s%s, but globs are not supported for this.",
operation ? " " : "", operation ?: "");
operation ? " " : "", strempty(operation));
suggest_escape = false;
}

View File

@ -455,10 +455,10 @@ static int attach_tcrypt(
assert(name);
assert(key_file || (passwords && passwords[0]));
if (arg_pkcs11_uri) {
log_error("Sorry, but tcrypt devices are currently not supported in conjunction with pkcs11 support.");
return -EAGAIN; /* Ask for a regular password */
}
if (arg_pkcs11_uri)
/* Ask for a regular password */
return log_error_errno(SYNTHETIC_ERRNO(EAGAIN),
"Sorry, but tcrypt devices are currently not supported in conjunction with pkcs11 support.");
if (arg_tcrypt_hidden)
params.flags |= CRYPT_TCRYPT_HIDDEN_HEADER;

View File

@ -828,9 +828,7 @@ static void source_disconnect(sd_event_source *s) {
if (s->prepare)
prioq_remove(s->event->prepare, s, &s->prepare_index);
event = s->event;
s->event = NULL;
event = TAKE_PTR(s->event);
LIST_REMOVE(sources, event->sources, s);
event->n_sources--;

View File

@ -746,7 +746,11 @@ static const NLTypeSystem rtnl_nexthop_type_system = {
};
static const NLType rtnl_tca_option_data_codel_types[] = {
[TCA_CODEL_TARGET] = { .type = NETLINK_TYPE_U32 },
[TCA_CODEL_LIMIT] = { .type = NETLINK_TYPE_U32 },
[TCA_CODEL_INTERVAL] = { .type = NETLINK_TYPE_U32 },
[TCA_CODEL_ECN] = { .type = NETLINK_TYPE_U32 },
[TCA_CODEL_CE_THRESHOLD] = { .type = NETLINK_TYPE_U32 },
};
static const NLType rtnl_tca_option_data_fq_types[] = {

View File

@ -38,8 +38,8 @@
#include "udev-util.h"
#include "virt.h"
/* use 8 MB for receive socket kernel queue. */
#define RCVBUF_SIZE (8*1024*1024)
/* use 128 MB for receive socket kernel queue. */
#define RCVBUF_SIZE (128*1024*1024)
static int log_message_warning_errno(sd_netlink_message *m, int err, const char *msg) {
const char *err_msg = NULL;

View File

@ -279,6 +279,10 @@ TrafficControlQueueingDiscipline.FairQueueTrafficPolicingOrphanMask, con
TrafficControlQueueingDiscipline.FairQueueTrafficPolicingPacing, config_parse_tc_fair_queue_traffic_policing_bool, 0, 0
TrafficControlQueueingDiscipline.FairQueueTrafficPolicingCEThresholdSec, config_parse_tc_fair_queue_traffic_policing_usec, 0, 0
TrafficControlQueueingDiscipline.ControlledDelayPacketLimit, config_parse_tc_controlled_delay_u32, 0, 0
TrafficControlQueueingDiscipline.ControlledDelayTargetSec, config_parse_tc_controlled_delay_usec, 0, 0
TrafficControlQueueingDiscipline.ControlledDelayIntervalSec, config_parse_tc_controlled_delay_usec, 0, 0
TrafficControlQueueingDiscipline.ControlledDelayCEThresholdSec, config_parse_tc_controlled_delay_usec, 0, 0
TrafficControlQueueingDiscipline.ControlledDelayECN, config_parse_tc_controlled_delay_bool, 0, 0
/* backwards compatibility: do not add new entries to this section */
Network.IPv4LL, config_parse_ipv4ll, 0, offsetof(Network, link_local)
DHCP.ClientIdentifier, config_parse_dhcp_client_identifier, 0, offsetof(Network, dhcp_client_identifier)

View File

@ -10,6 +10,19 @@
#include "qdisc.h"
#include "string-util.h"
static int controlled_delay_init(QDisc *qdisc) {
ControlledDelay *cd;
assert(qdisc);
cd = CODEL(qdisc);
cd->ce_threshold_usec = USEC_INFINITY;
cd->ecn = -1;
return 0;
}
static int controlled_delay_fill_message(Link *link, QDisc *qdisc, sd_netlink_message *req) {
ControlledDelay *cd;
int r;
@ -30,6 +43,30 @@ static int controlled_delay_fill_message(Link *link, QDisc *qdisc, sd_netlink_me
return log_link_error_errno(link, r, "Could not append TCA_CODEL_LIMIT attribute: %m");
}
if (cd->interval_usec > 0) {
r = sd_netlink_message_append_u32(req, TCA_CODEL_INTERVAL, cd->interval_usec);
if (r < 0)
return log_link_error_errno(link, r, "Could not append TCA_CODEL_INTERVAL attribute: %m");
}
if (cd->target_usec > 0) {
r = sd_netlink_message_append_u32(req, TCA_CODEL_TARGET, cd->target_usec);
if (r < 0)
return log_link_error_errno(link, r, "Could not append TCA_CODEL_TARGET attribute: %m");
}
if (cd->ecn >= 0) {
r = sd_netlink_message_append_u32(req, TCA_CODEL_ECN, cd->ecn);
if (r < 0)
return log_link_error_errno(link, r, "Could not append TCA_CODEL_ECN attribute: %m");
}
if (cd->ce_threshold_usec != USEC_INFINITY) {
r = sd_netlink_message_append_u32(req, TCA_CODEL_CE_THRESHOLD, cd->ce_threshold_usec);
if (r < 0)
return log_link_error_errno(link, r, "Could not append TCA_CODEL_CE_THRESHOLD attribute: %m");
}
r = sd_netlink_message_close_container(req);
if (r < 0)
return log_link_error_errno(link, r, "Could not close container TCA_OPTIONS: %m");
@ -88,8 +125,125 @@ int config_parse_tc_controlled_delay_u32(
return 0;
}
int config_parse_tc_controlled_delay_usec(
const char *unit,
const char *filename,
unsigned line,
const char *section,
unsigned section_line,
const char *lvalue,
int ltype,
const char *rvalue,
void *data,
void *userdata) {
_cleanup_(qdisc_free_or_set_invalidp) QDisc *qdisc = NULL;
ControlledDelay *cd;
Network *network = data;
usec_t *p;
int r;
assert(filename);
assert(lvalue);
assert(rvalue);
assert(data);
r = qdisc_new_static(QDISC_KIND_CODEL, network, filename, section_line, &qdisc);
if (r == -ENOMEM)
return log_oom();
if (r < 0)
return log_syntax(unit, LOG_ERR, filename, line, r,
"More than one kind of queueing discipline, ignoring assignment: %m");
cd = CODEL(qdisc);
if (streq(lvalue, "ControlledDelayTargetSec"))
p = &cd->target_usec;
else if (streq(lvalue, "ControlledDelayIntervalSec"))
p = &cd->interval_usec;
else if (streq(lvalue, "ControlledDelayCEThresholdSec"))
p = &cd->ce_threshold_usec;
else
assert_not_reached("Invalid lvalue");
if (isempty(rvalue)) {
if (streq(lvalue, "ControlledDelayCEThresholdSec"))
*p = USEC_INFINITY;
else
*p = 0;
qdisc = NULL;
return 0;
}
r = parse_sec(rvalue, p);
if (r < 0) {
log_syntax(unit, LOG_ERR, filename, line, r,
"Failed to parse '%s=', ignoring assignment: %s",
lvalue, rvalue);
return 0;
}
qdisc = NULL;
return 0;
}
int config_parse_tc_controlled_delay_bool(
const char *unit,
const char *filename,
unsigned line,
const char *section,
unsigned section_line,
const char *lvalue,
int ltype,
const char *rvalue,
void *data,
void *userdata) {
_cleanup_(qdisc_free_or_set_invalidp) QDisc *qdisc = NULL;
ControlledDelay *cd;
Network *network = data;
int r;
assert(filename);
assert(lvalue);
assert(rvalue);
assert(data);
r = qdisc_new_static(QDISC_KIND_CODEL, network, filename, section_line, &qdisc);
if (r == -ENOMEM)
return log_oom();
if (r < 0)
return log_syntax(unit, LOG_ERR, filename, line, r,
"More than one kind of queueing discipline, ignoring assignment: %m");
cd = CODEL(qdisc);
if (isempty(rvalue)) {
cd->ecn = -1;
qdisc = NULL;
return 0;
}
r = parse_boolean(rvalue);
if (r < 0) {
log_syntax(unit, LOG_ERR, filename, line, r,
"Failed to parse '%s=', ignoring assignment: %s",
lvalue, rvalue);
return 0;
}
cd->ecn = r;
qdisc = NULL;
return 0;
}
const QDiscVTable codel_vtable = {
.object_size = sizeof(ControlledDelay),
.tca_kind = "codel",
.init = controlled_delay_init,
.fill_message = controlled_delay_fill_message,
};

View File

@ -10,10 +10,15 @@ typedef struct ControlledDelay {
QDisc meta;
uint32_t packet_limit;
usec_t interval_usec;
usec_t target_usec;
usec_t ce_threshold_usec;
int ecn;
} ControlledDelay;
DEFINE_QDISC_CAST(CODEL, ControlledDelay);
extern const QDiscVTable codel_vtable;
CONFIG_PARSER_PROTOTYPE(config_parse_tc_controlled_delay_u32);
CONFIG_PARSER_PROTOTYPE(config_parse_tc_controlled_delay_usec);
CONFIG_PARSER_PROTOTYPE(config_parse_tc_controlled_delay_bool);

View File

@ -236,6 +236,10 @@ int unit_file_find_dropin_paths(
assert(ret);
SET_FOREACH(name, names, i)
STRV_FOREACH(p, lookup_path)
(void) unit_file_find_dirs(original_root, unit_path_cache, *p, name, dir_suffix, &dirs);
/* All the names in the unit are of the same type so just grab one. */
name = (char*) set_first(names);
if (name) {
@ -247,7 +251,7 @@ int unit_file_find_dropin_paths(
"Failed to to derive unit type from unit name: %s",
name);
/* Special top level drop in for "<unit type>.<suffix>". Add this first as it's the most generic
/* Special top level drop in for "<unit type>.<suffix>". Add this last as it's the most generic
* and should be able to be overridden by more specific drop-ins. */
STRV_FOREACH(p, lookup_path)
(void) unit_file_find_dirs(original_root,
@ -258,10 +262,6 @@ int unit_file_find_dropin_paths(
&dirs);
}
SET_FOREACH(name, names, i)
STRV_FOREACH(p, lookup_path)
(void) unit_file_find_dirs(original_root, unit_path_cache, *p, name, dir_suffix, &dirs);
if (strv_isempty(dirs)) {
*ret = NULL;
return 0;

View File

@ -5937,7 +5937,7 @@ static int cat(int argc, char *argv[], void *userdata) {
char **name;
sd_bus *bus;
bool first = true;
int r;
int r, rc = 0;
/* Include all units by default — i.e. continue as if the --all
* option was used */
@ -5982,8 +5982,12 @@ static int cat(int argc, char *argv[], void *userdata) {
}
if (r < 0)
return r;
if (r == 0)
return -ENOENT;
if (r == 0) {
/* Skip units which have no on-disk counterpart, but
* propagate the error to the user */
rc = -ENOENT;
continue;
}
if (first)
first = false;
@ -6009,7 +6013,7 @@ static int cat(int argc, char *argv[], void *userdata) {
return r;
}
return 0;
return rc;
}
static int set_property(int argc, char *argv[], void *userdata) {

View File

@ -117,6 +117,30 @@ EOF
clear_services a b c
}
test_hierarchical_dropins () {
echo "Testing hierarchical dropins..."
echo "*** test service.d/ top level drop-in"
create_services a-b-c
check_ko a-b-c ExecCondition "/bin/echo service.d"
check_ko a-b-c ExecCondition "/bin/echo a-.service.d"
check_ko a-b-c ExecCondition "/bin/echo a-b-.service.d"
check_ko a-b-c ExecCondition "/bin/echo a-b-c.service.d"
for dropin in service.d a-.service.d a-b-.service.d a-b-c.service.d; do
mkdir -p /usr/lib/systemd/system/$dropin
echo "
[Service]
ExecCondition=/bin/echo $dropin
" > /usr/lib/systemd/system/$dropin/override.conf
check_ok a-b-c ExecCondition "/bin/echo $dropin"
done
for dropin in service.d a-.service.d a-b-.service.d a-b-c.service.d; do
rm -rf /usr/lib/systemd/system/$dropin
done
clear_services a-b-c
}
test_template_dropins () {
echo "Testing template dropins..."
@ -433,6 +457,7 @@ test_invalid_dropins () {
}
test_basic_dropins
test_hierarchical_dropins
test_template_dropins
test_alias_dropins
test_masked_dropins

View File

@ -299,3 +299,7 @@ FairQueueTrafficPolicingOrphanMask=
FairQueueTrafficPolicingPacing=
FairQueueTrafficPolicingCEThresholdSec=
ControlledDelayPacketLimit=
ControlledDelayTargetSec=
ControlledDelayIntervalSec=
ControlledDelayCEThresholdSec=
ControlledDelayECN=

View File

@ -16,3 +16,11 @@ FairQueueTrafficPolicingBuckets=512
FairQueueTrafficPolicingOrphanMask=511
FairQueueTrafficPolicingPacing=yes
FairQueueTrafficPolicingCEThresholdSec=100ms
[TrafficControlQueueingDiscipline]
Parent=clsact
ControlledDelayPacketLimit=2000
ControlledDelayTargetSec=10ms
ControlledDelayIntervalSec=50ms
ControlledDelayECN=yes
ControlledDelayCEThresholdSec=100ms

View File

@ -1562,7 +1562,7 @@ class NetworkdNetworkTests(unittest.TestCase, Utilities):
'25-neighbor-ip-dummy.network',
'25-neighbor-ip.network',
'25-nexthop.network',
'25-qdisc-fq.network',
'25-qdisc-fq-codel.network',
'25-qdisc-netem-and-fqcodel.network',
'25-qdisc-tbf-and-sfq.network',
'25-route-ipv6-src.network',
@ -2157,7 +2157,7 @@ class NetworkdNetworkTests(unittest.TestCase, Utilities):
self.assertRegex(output, 'perturb 5sec')
def test_qdisc2(self):
copy_unit_to_networkd_unit_path('25-qdisc-fq.network', '12-dummy.netdev')
copy_unit_to_networkd_unit_path('25-qdisc-fq-codel.network', '12-dummy.netdev')
start_networkd()
self.wait_online(['dummy98:routable'])
@ -2166,6 +2166,8 @@ class NetworkdNetworkTests(unittest.TestCase, Utilities):
print(output)
self.assertRegex(output, 'qdisc fq')
self.assertRegex(output, 'limit 1000p flow_limit 200p buckets 512 orphan_mask 511 quantum 1500 initial_quantum 13000 maxrate 1Mbit')
self.assertRegex(output, 'qdisc codel')
self.assertRegex(output, 'limit 2000p target 10.0ms ce_threshold 100.0ms interval 50.0ms ecn')
class NetworkdStateFileTests(unittest.TestCase, Utilities):
links = [

View File

@ -15,7 +15,7 @@ DefaultDependencies=no
Before=sockets.target
[Socket]
ReceiveBuffer=8M
ReceiveBuffer=128M
ListenNetlink=route 1361
PassCredentials=yes