tree-wide: use log_syntax_parse_error() for config parse error logging

Replace open-coded "Failed to parse ..." log_syntax() calls in config
parser callbacks with the log_syntax_parse_error() /
log_syntax_parse_error_full() helper, which emits a uniform message and
handles the return value and ENOMEM consistently. As the helper already
treats -ENOMEM as critical and routes it through log_oom(), the now
redundant "if (r == -ENOMEM) return log_oom();" guards right before it are
dropped.

Settings that carry secret values (WakeOnLanPassword=, the MACsec key and
the WireGuard keys) log a "(secret)" placeholder instead of the actual
value.

Addresses https://github.com/systemd/systemd/pull/44629#discussion_r4463122734.
This commit is contained in:
Yu Watanabe committed 2026-11-04 17:01:29 +09:00
1 parent 7ad370b36f
commit 289f03b077
65 files changed
+381 -1001

No files matched your search

+59 -131
View File
@@ -750,7 +750,7 @@ int config_parse_exec_nice(
if (r == -ERANGE)
log_syntax(unit, LOG_WARNING, filename, line, r, "Nice priority out of range, ignoring: %s", rvalue);
else
log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse nice priority '%s', ignoring: %m", rvalue);
log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue);
return 0;
}
@@ -789,7 +789,7 @@ int config_parse_exec_oom_score_adjust(
if (r == -ERANGE)
log_syntax(unit, LOG_WARNING, filename, line, r, "OOM score adjust value out of range, ignoring: %s", rvalue);
else
log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse the OOM score adjust value '%s', ignoring: %m", rvalue);
log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue);
return 0;
}
@@ -826,11 +826,8 @@ int config_parse_exec_coredump_filter(
uint64_t f;
r = coredump_filter_mask_from_string(rvalue, &f);
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r,
"Failed to parse the CoredumpFilter=%s, ignoring: %m", rvalue);
return 0;
}
if (r < 0)
return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue);
c->coredump_filter |= f;
c->coredump_filter_set = true;
@@ -862,11 +859,8 @@ int config_parse_kill_mode(
}
m = kill_mode_from_string(rvalue);
if (m < 0) {
log_syntax(unit, LOG_WARNING, filename, line, m,
"Failed to parse kill mode specification, ignoring: %s", rvalue);
return 0;
}
if (m < 0)
return log_syntax_parse_error(unit, filename, line, m, lvalue, rvalue);
if (m == KILL_NONE)
log_syntax(unit, LOG_WARNING, filename, line, 0,
@@ -1195,10 +1189,8 @@ int config_parse_exec_input(
} else {
ei = exec_input_from_string(rvalue);
if (ei < 0) {
log_syntax(unit, LOG_WARNING, filename, line, ei, "Failed to parse input specifier, ignoring: %s", rvalue);
return 0;
}
if (ei < 0)
return log_syntax_parse_error(unit, filename, line, ei, lvalue, rvalue);
}
c->std_input = ei;
@@ -1419,10 +1411,8 @@ int config_parse_exec_output(
eo = EXEC_OUTPUT_FILE_TRUNCATE;
} else {
eo = exec_output_from_string(rvalue);
if (eo < 0) {
log_syntax(unit, LOG_WARNING, filename, line, eo, "Failed to parse output specifier, ignoring: %s", rvalue);
return 0;
}
if (eo < 0)
return log_syntax_parse_error(unit, filename, line, eo, lvalue, rvalue);
}
if (obsolete)
@@ -1478,10 +1468,8 @@ int config_parse_exec_io_class(
}
x = ioprio_class_from_string(rvalue);
if (x < 0) {
log_syntax(unit, LOG_WARNING, filename, line, x, "Failed to parse IO scheduling class, ignoring: %s", rvalue);
return 0;
}
if (x < 0)
return log_syntax_parse_error(unit, filename, line, x, lvalue, rvalue);
c->ioprio = ioprio_normalize(ioprio_prio_value(x, ioprio_prio_data(c->ioprio)));
c->ioprio_is_set = true;
@@ -1515,10 +1503,8 @@ int config_parse_exec_io_priority(
}
r = ioprio_parse_priority(rvalue, &i);
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse IO priority, ignoring: %s", rvalue);
return 0;
}
if (r < 0)
return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue);
c->ioprio = ioprio_normalize(ioprio_prio_value(ioprio_prio_class(c->ioprio), i));
c->ioprio_is_set = true;
@@ -1553,10 +1539,8 @@ int config_parse_exec_cpu_sched_policy(
}
x = sched_policy_from_string(rvalue);
if (x < 0) {
log_syntax(unit, LOG_WARNING, filename, line, x, "Failed to parse CPU scheduling policy, ignoring: %s", rvalue);
return 0;
}
if (x < 0)
return log_syntax_parse_error(unit, filename, line, x, lvalue, rvalue);
if (!sched_policy_supported(x))
log_syntax(unit, LOG_WARNING, filename, line, 0, "Unsupported CPU scheduling policy: %s", rvalue);
@@ -1627,10 +1611,8 @@ int config_parse_exec_cpu_sched_prio(
assert(rvalue);
r = safe_atoi(rvalue, &i);
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse CPU scheduling priority, ignoring: %s", rvalue);
return 0;
}
if (r < 0)
return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue);
/* On Linux RR/FIFO range from 1 to 99 and OTHER/BATCH may only be 0. Policy might be set later so
* we do not check the precise range, but only the generic outer bounds. */
@@ -1673,12 +1655,8 @@ int config_parse_root_image_options(
}
r = strv_split_colon_pairs(&l, rvalue);
if (r == -ENOMEM)
return log_oom();
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse %s, ignoring: %s", lvalue, rvalue);
return 0;
}
if (r < 0)
return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue);
STRV_FOREACH_PAIR(first, second, l) {
_cleanup_free_ char *mount_options_resolved = NULL;
@@ -1885,10 +1863,8 @@ int config_parse_capability_set(
uint64_t initial = streq(lvalue, "CapabilityBoundingSet") ? CAP_MASK_ALL : 0;
r = parse_capability_set(rvalue, initial, capability_set);
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse %s= specifier '%s', ignoring: %m", lvalue, rvalue);
return 0;
}
if (r < 0)
return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue);
if (*capability_set == CAP_MASK_UNSET)
*capability_set = 0;
@@ -2293,10 +2269,8 @@ int config_parse_xattr(
_cleanup_free_ char *name = NULL, *value = NULL;
r = split_pair(rvalue, "=", &name, &value);
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse extended attribute expression, ignoring: %s", rvalue);
return 0;
}
if (r < 0)
return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue);
_cleanup_free_ char *expanded_name = NULL;
r = unit_full_printf(u, name, &expanded_name);
@@ -2478,10 +2452,8 @@ int config_parse_service_timeout(
* immediately, hence fix this to become USEC_INFINITY instead. This is in-line with how we internally handle
* all other timeouts. */
r = parse_sec_fix_0(rvalue, &usec);
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse %s= parameter, ignoring: %s", lvalue, rvalue);
return 0;
}
if (r < 0)
return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue);
s->start_timeout_defined = true;
s->timeout_start_usec = usec;
@@ -3527,10 +3499,8 @@ int config_parse_syscall_errno(
}
e = parse_errno(rvalue);
if (e < 0) {
log_syntax(unit, LOG_WARNING, filename, line, e, "Failed to parse error number, ignoring: %s", rvalue);
return 0;
}
if (e < 0)
return log_syntax_parse_error(unit, filename, line, e, lvalue, rvalue);
if (e == 0) {
log_syntax(unit, LOG_WARNING, filename, line, 0, "Invalid error number, ignoring: %s", rvalue);
return 0;
@@ -3564,13 +3534,8 @@ int config_parse_address_families(
/* Copy back unconditionally: parse_address_families() may have partially populated
* c->address_families before failing, so keep is_allowlist in sync with that state. */
c->address_families_allow_list = is_allowlist;
if (r == -ENOMEM)
return log_oom();
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r,
"Failed to parse address family, ignoring: %s", rvalue);
return 0;
}
if (r < 0)
return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue);
return 0;
}
@@ -3620,10 +3585,8 @@ int config_parse_namespace_flags(
/* Not a boolean argument, in this case it's a list of namespace types. */
r = namespace_flags_from_string(rvalue, &f);
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse namespace type string, ignoring: %s", rvalue);
return 0;
}
if (r < 0)
return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue);
if (*flags == NAMESPACE_FLAGS_INITIAL)
/* Initial assignment. Just set the value. */
@@ -4121,10 +4084,8 @@ int config_parse_managed_oom_mem_pressure_limit(
}
r = parse_permyriad(rvalue);
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse memory pressure limit value, ignoring: %s", rvalue);
return 0;
}
if (r < 0)
return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue);
/* Normalize to 2^32-1 == 100% */
*limit = UINT32_SCALE_FROM_PERMYRIAD(r);
@@ -4544,10 +4505,8 @@ int config_parse_job_mode_isolate(
assert(rvalue);
r = parse_boolean(rvalue);
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse boolean, ignoring: %s", rvalue);
return 0;
}
if (r < 0)
return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue);
log_notice("%s is deprecated. Please use OnFailureJobMode= instead", lvalue);
@@ -4692,10 +4651,8 @@ int config_parse_exec_quota(
r = parse_permyriad(rvalue);
if (r < 0) {
r = parse_size(rvalue, 1024, &quota_absolute);
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse disk quota value, ignoring: %s", rvalue);
return 0;
}
if (r < 0)
return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue);
} else
/* Normalize to 2^32-1 == 100% */
quota_scale = UINT32_SCALE_FROM_PERMYRIAD(r);
@@ -5004,13 +4961,8 @@ int config_parse_set_status(
Bitmap *bitmap;
r = extract_first_word(&p, &word, /* separators= */ NULL, /* flags= */ 0);
if (r == -ENOMEM)
return log_oom();
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r,
"Failed to parse %s=%s, ignoring: %m", lvalue, rvalue);
return 0;
}
if (r < 0)
return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue);
if (r == 0)
return 0;
@@ -5219,12 +5171,8 @@ int config_parse_bind_paths(
bool rbind = true, ignore_enoent = false;
r = extract_first_word(&p, &tuple, /* separators= */ NULL, EXTRACT_UNQUOTE|EXTRACT_RETAIN_ESCAPE);
if (r == -ENOMEM)
return log_oom();
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse %s, ignoring: %s", lvalue, rvalue);
return 0;
}
if (r < 0)
return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue);
if (r == 0)
break;
@@ -5612,10 +5560,8 @@ int config_parse_job_timeout_sec(
assert(rvalue);
r = parse_sec_fix_0(rvalue, &usec);
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse JobTimeoutSec= parameter, ignoring: %s", rvalue);
return 0;
}
if (r < 0)
return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue);
/* If the user explicitly changed JobTimeoutSec= also change JobRunningTimeoutSec=, for compatibility with old
* versions. If JobRunningTimeoutSec= was explicitly set, avoid this however as whatever the user picked should
@@ -5650,10 +5596,8 @@ int config_parse_job_running_timeout_sec(
assert(rvalue);
r = parse_sec_fix_0(rvalue, &usec);
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse JobRunningTimeoutSec= parameter, ignoring: %s", rvalue);
return 0;
}
if (r < 0)
return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue);
u->job_running_timeout = usec;
u->job_running_timeout_set = true;
@@ -5693,8 +5637,7 @@ int config_parse_emergency_action(
"%s= specified as %s mode action, ignoring: %s",
lvalue, runtime_scope_to_string(runtime_scope), rvalue);
else if (r < 0)
log_syntax(unit, LOG_WARNING, filename, line, r,
"Failed to parse %s=, ignoring: %s", lvalue, rvalue);
log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue);
return 0;
}
@@ -5775,10 +5718,8 @@ int config_parse_exit_status(
}
r = safe_atou8(rvalue, &u);
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse exit status '%s', ignoring: %m", rvalue);
return 0;
}
if (r < 0)
return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue);
*exit_status = u;
return 0;
@@ -5903,12 +5844,8 @@ int config_parse_bpf_foreign_program(
}
r = extract_first_word(&p, &word, ":", /* flags= */ 0);
if (r == -ENOMEM)
return log_oom();
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse foreign BPF program, ignoring: %s", rvalue);
return 0;
}
if (r < 0)
return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue);
if (r == 0 || isempty(p)) {
log_syntax(unit, LOG_WARNING, filename, line, 0, "Invalid syntax in %s=, ignoring: %s", lvalue, rvalue);
return 0;
@@ -6508,7 +6445,7 @@ int config_parse_show_status(
k = parse_show_status(rvalue, b);
if (k < 0)
log_syntax(unit, LOG_WARNING, filename, line, k, "Failed to parse show status setting, ignoring: %s", rvalue);
log_syntax_parse_error(unit, filename, line, k, lvalue, rvalue);
return 0;
}
@@ -6540,10 +6477,8 @@ int config_parse_output_restricted(
obsolete = true;
} else {
t = exec_output_from_string(rvalue);
if (t < 0) {
log_syntax(unit, LOG_WARNING, filename, line, t, "Failed to parse output type, ignoring: %s", rvalue);
return 0;
}
if (t < 0)
return log_syntax_parse_error(unit, filename, line, t, lvalue, rvalue);
if (IN_SET(t, EXEC_OUTPUT_SOCKET, EXEC_OUTPUT_NAMED_FD) || exec_output_is_file(t) || exec_output_is_broker(t)) {
log_syntax(unit, LOG_WARNING, filename, line, 0, "Standard output types socket, fd:, file:, append:, truncate:, broker, broker-log are not supported as defaults, ignoring: %s", rvalue);
@@ -6581,7 +6516,7 @@ int config_parse_crash_chvt(
r = parse_crash_chvt(rvalue, data);
if (r < 0)
log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse CrashChangeVT= setting, ignoring: %s", rvalue);
log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue);
return 0;
}
@@ -6766,10 +6701,8 @@ int config_parse_open_file(
}
r = open_file_parse(rvalue, &of);
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse OpenFile= setting, ignoring: %s", rvalue);
return 0;
}
if (r < 0)
return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue);
LIST_APPEND(open_files, *head, TAKE_PTR(of));
@@ -6872,13 +6805,8 @@ int config_parse_luo_sessions(
int r;
r = extract_first_word(&p, &word, /* separators= */ NULL, /* flags= */ 0);
if (r == -ENOMEM)
return log_oom();
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r,
"Failed to parse LUOSession= value, ignoring: %s", rvalue);
return 0;
}
if (r < 0)
return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue);
if (r == 0) {
strv_sort(*sessions);
return 0;
+2 -5
View File
@@ -526,11 +526,8 @@ int config_parse_n_autovts(
assert(rvalue);
r = safe_atou(rvalue, &o);
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r,
"Failed to parse number of autovts, ignoring: %s", rvalue);
return 0;
}
if (r < 0)
return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue);
if (o > 15) {
log_syntax(unit, LOG_WARNING, filename, line, 0,
+2 -4
View File
@@ -1140,10 +1140,8 @@ int config_parse_tmpfs_size(
r = parse_size(rvalue, 1024, &k);
if (r >= 0 && (k <= 0 || (uint64_t) (size_t) k != k))
r = -ERANGE;
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse size value '%s', ignoring: %m", rvalue);
return 0;
}
if (r < 0)
return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue);
*sz = PAGE_ALIGN((size_t) k);
}
+2 -6
View File
@@ -71,12 +71,8 @@ int config_parse_badadv_bandwidth (
assert(rvalue);
r = parse_size(rvalue, 1000, &k);
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r,
"Failed to parse '%s=', ignoring assignment: %s",
lvalue, rvalue);
return 0;
}
if (r < 0)
return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue);
if (k/1000/100 > UINT32_MAX) {
log_syntax(unit, LOG_WARNING, filename, line, 0,
+2 -8
View File
@@ -278,14 +278,8 @@ int config_parse_arp_ip_target_address(
union in_addr_union ip;
r = extract_first_word(&p, &n, /* separators= */ NULL, /* flags= */ 0);
if (r == -ENOMEM)
return log_oom();
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r,
"Failed to parse Bond ARP IP target address, ignoring assignment: %s",
rvalue);
return 0;
}
if (r < 0)
return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue);
if (r == 0)
return 0;
+2 -4
View File
@@ -184,10 +184,8 @@ int config_parse_geneve_flow_label(
int r;
r = safe_atou32(rvalue, &f);
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse Geneve flow label '%s'.", rvalue);
return 0;
}
if (r < 0)
return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue);
if (f & ~GENEVE_FLOW_LABEL_MAX_MASK) {
log_syntax(unit, LOG_WARNING, filename, line, 0,
+2 -6
View File
@@ -122,12 +122,8 @@ int config_parse_ipoib_pkey(
}
r = safe_atou16(rvalue, &u);
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r,
"Failed to parse IPoIB pkey '%s', ignoring assignment: %m",
rvalue);
return 0;
}
if (r < 0)
return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue);
if (IN_SET(u, 0, 0x8000)) {
log_syntax(unit, LOG_WARNING, filename, line, 0,
"IPoIB pkey cannot be 0 nor 0x8000, ignoring assignment: %s",
+2 -5
View File
@@ -712,11 +712,8 @@ int config_parse_l2tp_session_l2spec(
return log_oom();
spec = l2tp_l2spec_type_from_string(rvalue);
if (spec < 0) {
log_syntax(unit, LOG_WARNING, filename, line, spec,
"Failed to parse layer2 specific header type. Ignoring assignment: %s", rvalue);
return 0;
}
if (spec < 0)
return log_syntax_parse_error(unit, filename, line, spec, lvalue, rvalue);
session->l2tp_l2spec_type = spec;
+14 -42
View File
@@ -597,12 +597,8 @@ int config_parse_macsec_port(
}
r = parse_ip_port(rvalue, &port);
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r,
"Failed to parse port '%s' for secure channel identifier. Ignoring assignment: %m",
rvalue);
return 0;
}
if (r < 0)
return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue);
unaligned_write_be16(dest, port);
@@ -643,12 +639,8 @@ int config_parse_macsec_hw_address(
return log_oom();
r = parse_ether_addr(rvalue, b ? &b->sci.mac : &c->sci.mac);
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r,
"Failed to parse MAC address for secure channel identifier. "
"Ignoring assignment: %s", rvalue);
return 0;
}
if (r < 0)
return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue);
TAKE_PTR(b);
TAKE_PTR(c);
@@ -690,11 +682,8 @@ int config_parse_macsec_packet_number(
dest = a ? &a->sa.packet_number : &b->sa.packet_number;
r = safe_atou32(rvalue, &val);
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r,
"Failed to parse packet number. Ignoring assignment: %s", rvalue);
return 0;
}
if (r < 0)
return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue);
if (streq(section, "MACsecTransmitAssociation") && val == 0) {
log_syntax(unit, LOG_WARNING, filename, line, 0,
"Invalid packet number. Ignoring assignment: %s", rvalue);
@@ -746,10 +735,8 @@ int config_parse_macsec_key(
dest = a ? &a->sa : &b->sa;
r = unhexmem_full(rvalue, SIZE_MAX, /* secure= */ true, &p, &l);
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse key. Ignoring assignment: %m");
return 0;
}
if (r < 0)
return log_syntax_parse_error(unit, filename, line, r, lvalue, "(secret)");
if (l != 16) {
/* See DEFAULT_SAK_LEN in drivers/net/macsec.c */
@@ -854,13 +841,8 @@ int config_parse_macsec_key_id(
return log_oom();
r = unhexmem(rvalue, &p, &l);
if (r == -ENOMEM)
return log_oom();
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r,
"Failed to parse KeyId=%s, ignoring assignment: %m", rvalue);
return 0;
}
if (r < 0)
return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue);
if (l > MACSEC_KEYID_LEN) {
log_syntax(unit, LOG_WARNING, filename, line, 0,
"Specified KeyId= is larger then the allowed maximum (%zu > %i), ignoring: %s",
@@ -911,14 +893,8 @@ int config_parse_macsec_sa_activate(
dest = a ? &a->sa.activate : &b->sa.activate;
r = parse_tristate(rvalue, dest);
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r,
"Failed to parse activation mode of %s security association. "
"Ignoring assignment: %s",
streq(section, "MACsecTransmitAssociation") ? "transmit" : "receive",
rvalue);
return 0;
}
if (r < 0)
return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue);
TAKE_PTR(a);
TAKE_PTR(b);
@@ -959,12 +935,8 @@ int config_parse_macsec_use_for_encoding(
}
r = parse_tristate(rvalue, &a->sa.use_for_encoding);
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r,
"Failed to parse %s= setting. Ignoring assignment: %s",
lvalue, rvalue);
return 0;
}
if (r < 0)
return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue);
if (a->sa.use_for_encoding > 0)
a->sa.activate = true;
+2 -6
View File
@@ -140,12 +140,8 @@ int config_parse_macvlan_broadcast_queue_threshold(
}
r = safe_atoi32(rvalue, &v);
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r,
"Failed to parse %s=, ignoring assignment: %s",
lvalue, rvalue);
return 0;
}
if (r < 0)
return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue);
if (v < 0) {
log_syntax(unit, LOG_WARNING, filename, line, 0,
"Invalid %s= value specified, ignoring assignment: %s",
+2 -4
View File
@@ -1244,10 +1244,8 @@ int config_parse_netdev_kind(
assert(rvalue);
k = netdev_kind_from_string(rvalue);
if (k < 0) {
log_syntax(unit, LOG_WARNING, filename, line, k, "Failed to parse netdev kind, ignoring assignment: %s", rvalue);
return 0;
}
if (k < 0)
return log_syntax_parse_error(unit, filename, line, k, lvalue, rvalue);
if (*kind != _NETDEV_KIND_INVALID && *kind != k) {
log_syntax(unit, LOG_WARNING, filename, line, 0,
+4 -9
View File
@@ -892,11 +892,8 @@ int config_parse_tunnel_key(
r = in_addr_from_string(AF_INET, rvalue, &buffer);
if (r < 0) {
r = safe_atou32(rvalue, &k);
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r,
"Failed to parse tunnel key ignoring assignment: %s", rvalue);
return 0;
}
if (r < 0)
return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue);
} else
k = be32toh(buffer.in.s_addr);
@@ -998,10 +995,8 @@ int config_parse_6rd_prefix(
assert(rvalue);
r = in_addr_prefix_from_string(rvalue, AF_INET6, &p, &l);
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse 6rd prefix \"%s\", ignoring: %m", rvalue);
return 0;
}
if (r < 0)
return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue);
if (l == 0) {
log_syntax(unit, LOG_WARNING, filename, line, 0, "6rd prefix length of \"%s\" must be greater than zero, ignoring", rvalue);
return 0;
+2 -6
View File
@@ -147,12 +147,8 @@ int config_parse_vlan_qos_maps(
unsigned from, to;
r = extract_first_word(&p, &w, /* separators= */ NULL, EXTRACT_CUNESCAPE|EXTRACT_UNQUOTE);
if (r == -ENOMEM)
return log_oom();
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse %s, ignoring: %s", lvalue, rvalue);
return 0;
}
if (r < 0)
return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue);
if (r == 0)
return 0;
+2 -6
View File
@@ -28,12 +28,8 @@ int config_parse_vrf_table(
assert(rvalue);
r = manager_get_route_table_from_string(vrf->meta.manager, rvalue, table);
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r,
"Failed to parse %s=, ignoring assignment: %s",
lvalue, rvalue);
return 0;
}
if (r < 0)
return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue);
return 0;
}
+5 -11
View File
@@ -266,11 +266,8 @@ int config_parse_vxlan_address(
}
r = in_addr_from_string_auto(rvalue, &f, &buffer);
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r,
"Failed to parse %s=, ignoring assignment: %s", lvalue, rvalue);
return 0;
}
if (r < 0)
return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue);
r = in_addr_is_multicast(f, &buffer);
@@ -318,8 +315,7 @@ int config_parse_port_range(
r = parse_ip_port_range(rvalue, &v->port_range.low, &v->port_range.high, /* allow_zero= */ false);
if (r < 0)
log_syntax(unit, LOG_WARNING, filename, line, r,
"Failed to parse VXLAN port range '%s'. Port should be greater than 0 and less than 65535.", rvalue);
return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue);
return 0;
}
@@ -345,10 +341,8 @@ int config_parse_flow_label(
assert(data);
r = safe_atou(rvalue, &f);
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse VXLAN flow label '%s'.", rvalue);
return 0;
}
if (r < 0)
return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue);
if (f & ~VXLAN_FLOW_LABEL_MAX_MASK) {
log_syntax(unit, LOG_WARNING, filename, line, r,
+8 -25
View File
@@ -525,13 +525,8 @@ static int wireguard_decode_key_and_warn(
(void) warn_file_is_world_accessible(filename, /* st= */ NULL, unit, line);
r = unbase64mem_full(cred ?: rvalue, SIZE_MAX, /* secure= */ true, &key, &len);
if (r == -ENOMEM)
return log_oom();
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r,
"Failed to decode wireguard key provided by %s=, ignoring assignment: %m", lvalue);
return 0;
}
if (r < 0)
return log_syntax_parse_error(unit, filename, line, r, lvalue, "(secret)");
if (len != WG_KEY_LEN) {
log_syntax(unit, LOG_WARNING, filename, line, 0,
"Wireguard key provided by %s= has invalid length (%zu bytes), ignoring assignment.",
@@ -888,12 +883,8 @@ int config_parse_wireguard_keepalive(
keepalive = 0;
else {
r = safe_atou16(rvalue, &keepalive);
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r,
"Failed to parse \"%s\" as keepalive interval (range 0–65535), ignoring assignment: %m",
rvalue);
return 0;
}
if (r < 0)
return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue);
}
peer->persistent_keepalive_interval = keepalive;
@@ -928,12 +919,8 @@ int config_parse_wireguard_route_table(
}
r = manager_get_route_table_from_string(netdev->manager, rvalue, table);
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r,
"Failed to parse %s=, ignoring assignment: %s",
lvalue, rvalue);
return 0;
}
if (r < 0)
return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue);
return 0;
}
@@ -977,12 +964,8 @@ int config_parse_wireguard_peer_route_table(
}
r = manager_get_route_table_from_string(NETDEV(w)->manager, rvalue, &peer->route_table);
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r,
"Failed to parse %s=, ignoring assignment: %s",
lvalue, rvalue);
return 0;
}
if (r < 0)
return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue);
peer->route_table_set = true;
TAKE_PTR(peer);
+2 -6
View File
@@ -206,12 +206,8 @@ int config_parse_wlan_iftype(
t = nl80211_iftype_from_string(rvalue);
/* We reuse the kernel provided enum which does not contain negative value. So, the cast
* below is mandatory. Otherwise, the check below always passes. */
if ((int) t < 0) {
log_syntax(unit, LOG_WARNING, filename, line, t,
"Failed to parse wlan interface type, ignoring assignment: %s",
rvalue);
return 0;
}
if ((int) t < 0)
return log_syntax_parse_error(unit, filename, line, t, lvalue, rvalue);
*iftype = t;
return 0;
+2 -6
View File
@@ -507,12 +507,8 @@ int config_parse_address_generation_type(
if (addr) {
r = in_addr_from_string(AF_INET6, addr, &buffer);
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r,
"Failed to parse IP address in %s=, ignoring assignment: %s",
lvalue, rvalue);
return 0;
}
if (r < 0)
return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue);
}
switch (type) {
+2 -6
View File
@@ -412,12 +412,8 @@ int config_parse_fdb_vxlan_vni(
return log_oom();
r = safe_atou32(rvalue, &vni);
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r,
"Failed to parse VXLAN Network Identifier (VNI), ignoring assignment: %s",
rvalue);
return 0;
}
if (r < 0)
return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue);
if (vni > VXLAN_VID_MAX) {
log_syntax(unit, LOG_WARNING, filename, line, 0,
+4 -12
View File
@@ -369,12 +369,8 @@ int config_parse_bridge_vlan_id(
}
r = parse_vlanid(rvalue, &v);
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r,
"Failed to parse %s=, ignoring: %s",
lvalue, rvalue);
return 0;
}
if (r < 0)
return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue);
*id = v;
return 0;
@@ -407,12 +403,8 @@ int config_parse_bridge_vlan_id_range(
}
r = parse_vid_range(rvalue, &vid, &vid_end);
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r,
"Failed to parse %s=, ignoring: %s",
lvalue, rvalue);
return 0;
}
if (r < 0)
return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue);
for (; vid <= vid_end; vid++)
set_bit(vid, bitmap);
+10 -25
View File
@@ -152,11 +152,8 @@ int config_parse_can_bitrate(
assert(rvalue);
r = parse_size(rvalue, 1000, &sz);
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r,
"Failed to parse can bitrate '%s', ignoring: %m", rvalue);
return 0;
}
if (r < 0)
return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue);
/* Linux uses __u32 for bitrates, so the value should not exceed that. */
if (sz <= 0 || sz > UINT32_MAX) {
@@ -190,11 +187,8 @@ int config_parse_can_time_quanta(
assert(rvalue);
r = parse_nsec(rvalue, &val);
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r,
"Failed to parse can time quanta '%s', ignoring: %m", rvalue);
return 0;
}
if (r < 0)
return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue);
/* Linux uses __u32 for bitrates, so the value should not exceed that. */
if (val <= 0 || val > UINT32_MAX) {
@@ -227,11 +221,8 @@ int config_parse_can_restart_usec(
assert(rvalue);
r = parse_sec(rvalue, &usec);
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r,
"Failed to parse CAN restart sec '%s', ignoring: %m", rvalue);
return 0;
}
if (r < 0)
return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue);
if (usec != USEC_INFINITY &&
DIV_ROUND_UP(usec, USEC_PER_MSEC) > UINT32_MAX) {
@@ -272,11 +263,8 @@ int config_parse_can_control_mode(
}
r = parse_boolean(rvalue);
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r,
"Failed to parse CAN control mode '%s', ignoring: %s", lvalue, rvalue);
return 0;
}
if (r < 0)
return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue);
network->can_control_mode_mask |= mask;
SET_FLAG(network->can_control_mode_flags, mask, r);
@@ -316,11 +304,8 @@ int config_parse_can_termination(
r = safe_atou16(rvalue, &network->can_termination);
if (r < 0) {
r = parse_boolean(rvalue);
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r,
"Failed to parse CAN termination value, ignoring: %s", rvalue);
return 0;
}
if (r < 0)
return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue);
network->can_termination = r ? CAN_TERMINATION_DEFAULT_OHM_VALUE : 0;
}
+14 -38
View File
@@ -382,11 +382,8 @@ int config_parse_dhcp(
* support its values for compatibility. */
s = dhcp_deprecated_address_family_from_string(rvalue);
if (s < 0) {
log_syntax(unit, LOG_WARNING, filename, line, s,
"Failed to parse DHCP option, ignoring: %s", rvalue);
return 0;
}
if (s < 0)
return log_syntax_parse_error(unit, filename, line, s, lvalue, rvalue);
log_syntax(unit, LOG_WARNING, filename, line, 0,
"DHCP=%s is deprecated, please use DHCP=%s instead.",
@@ -420,11 +417,8 @@ int config_parse_dhcp_route_metric(
assert(data);
r = safe_atou32(rvalue, &metric);
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r,
"Failed to parse %s=%s, ignoring assignment: %m", lvalue, rvalue);
return 0;
}
if (r < 0)
return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue);
switch (ltype) {
case AF_INET:
@@ -476,20 +470,14 @@ int config_parse_ndisc_route_metric(
r = extract_many_words(&p, ":", EXTRACT_DONT_COALESCE_SEPARATORS, &high, &medium, &low);
if (r == -ENOMEM)
return log_oom();
if (r != 3 || !isempty(p)) {
log_syntax(unit, LOG_WARNING, filename, line, r < 0 ? r : 0,
"Failed to parse %s=%s, ignoring assignment: %m", lvalue, rvalue);
return 0;
}
if (r != 3 || !isempty(p))
return log_syntax_parse_error(unit, filename, line, r < 0 ? r : 0, lvalue, rvalue);
r = safe_atou32(high, &metric_high);
RET_GATHER(r, safe_atou32(medium, &metric_medium));
RET_GATHER(r, safe_atou32(low, &metric_low));
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r,
"Failed to parse %s=%s, ignoring assignment: %m", lvalue, rvalue);
return 0;
}
if (r < 0)
return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue);
if (metric_high >= metric_medium || metric_medium >= metric_low) {
log_syntax(unit, LOG_WARNING, filename, line, 0,
@@ -528,11 +516,8 @@ int config_parse_dhcp_send_hostname(
assert(data);
r = parse_boolean(rvalue);
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r,
"Failed to parse %s=%s, ignoring assignment: %m", lvalue, rvalue);
return 0;
}
if (r < 0)
return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue);
switch (ltype) {
case AF_INET:
@@ -579,11 +564,8 @@ int config_parse_dhcp_or_ra_route_table(
assert(rvalue);
r = manager_get_route_table_from_string(network->manager, rvalue, &rt);
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r,
"Failed to parse %s=%s, ignoring assignment: %m", lvalue, rvalue);
return 0;
}
if (r < 0)
return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue);
switch (ltype) {
case NETWORK_CONFIG_SOURCE_DHCP4:
@@ -1141,14 +1123,8 @@ int config_parse_dhcp_request_options(
uint32_t i;
r = extract_first_word(&p, &n, /* separators= */ NULL, /* flags= */ 0);
if (r == -ENOMEM)
return log_oom();
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r,
"Failed to parse DHCP request option, ignoring assignment: %s",
rvalue);
return 0;
}
if (r < 0)
return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue);
if (r == 0)
return 0;
+4 -12
View File
@@ -1451,12 +1451,8 @@ int config_parse_dhcp_pd_subnet_id(
}
r = safe_atoux64(rvalue, &t);
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r,
"Failed to parse %s=, ignoring assignment: %s",
lvalue, rvalue);
return 0;
}
if (r < 0)
return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue);
if (t > INT64_MAX) {
log_syntax(unit, LOG_WARNING, filename, line, 0,
"Invalid subnet id '%s', ignoring assignment.",
@@ -1499,12 +1495,8 @@ int config_parse_dhcp_pd_prefix_route_type(
}
r = route_type_from_string(rvalue);
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r,
"Failed to parse %s=, ignoring assignment: %s",
lvalue, rvalue);
return 0;
}
if (r < 0)
return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue);
if (!route_type_is_reject(r)) {
log_syntax(unit, LOG_WARNING, filename, line, 0,
@@ -183,11 +183,8 @@ int config_parse_dhcp_static_lease_address(
}
r = in_addr_from_string(AF_INET, rvalue, &addr);
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r,
"Failed to parse IPv4 address for DHCPv4 static lease, ignoring assignment: %s", rvalue);
return 0;
}
if (r < 0)
return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue);
if (in4_addr_is_null(&addr.in)) {
log_syntax(unit, LOG_WARNING, filename, line, 0,
"IPv4 address for DHCPv4 static lease cannot be the ANY address, ignoring assignment: %s", rvalue);
@@ -232,11 +229,8 @@ int config_parse_dhcp_static_lease_hwaddr(
}
r = parse_ether_addr(rvalue, &hwaddr);
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r,
"Failed to parse MAC address for DHCPv4 static lease, ignoring assignment: %s", rvalue);
return 0;
}
if (r < 0)
return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue);
if (ether_addr_is_null(&hwaddr) || (hwaddr.ether_addr_octet[0] & 0x01)) {
log_syntax(unit, LOG_WARNING, filename, line, 0,
"MAC address for DHCPv4 static lease cannot be null or multicast, ignoring assignment: %s", rvalue);
+4 -10
View File
@@ -914,11 +914,8 @@ int config_parse_dhcp_server_address(
}
r = in_addr_prefix_from_string(rvalue, AF_INET, &a, &prefixlen);
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r,
"Failed to parse %s=, ignoring assignment: %s", lvalue, rvalue);
return 0;
}
if (r < 0)
return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue);
if (in4_addr_is_localhost(&a.in) || in4_addr_is_link_local(&a.in)) {
log_syntax(unit, LOG_WARNING, filename, line, 0,
"DHCP server address cannot be a localhost or link-local address, "
@@ -957,11 +954,8 @@ int config_parse_dhcp_server_ipv6_only_preferred(
}
r = parse_sec(rvalue, &t);
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r,
"Failed to parse [%s] %s=, ignoring assignment: %s", section, lvalue, rvalue);
return 0;
}
if (r < 0)
return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue);
if (t < MIN_V6ONLY_WAIT_USEC && !network_test_mode_enabled()) {
log_syntax(unit, LOG_WARNING, filename, line, 0,
+5 -12
View File
@@ -2007,11 +2007,8 @@ int config_parse_dhcp_max_attempts(
}
r = safe_atou64(rvalue, &a);
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r,
"Failed to parse DHCP maximum attempts, ignoring: %s", rvalue);
return 0;
}
if (r < 0)
return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue);
if (a == 0) {
log_syntax(unit, LOG_WARNING, filename, line, 0,
@@ -2051,8 +2048,7 @@ int config_parse_dhcp_ip_service_type(
else if (streq(rvalue, "CS6"))
*tos = IPTOS_CLASS_CS6;
else
log_syntax(unit, LOG_WARNING, filename, line, 0,
"Failed to parse %s=, ignoring assignment: %s", lvalue, rvalue);
log_syntax_parse_error(unit, filename, line, 0, lvalue, rvalue);
return 0;
}
@@ -2080,11 +2076,8 @@ int config_parse_dhcp_socket_priority(
}
r = safe_atoi(rvalue, &a);
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r,
"Failed to parse socket priority, ignoring: %s", rvalue);
return 0;
}
if (r < 0)
return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue);
if (a < 0 || a > TC_PRIO_MAX) {
log_syntax(unit, LOG_WARNING, filename, line, 0,
"Invalid socket priority, must be in 0…%i, ignoring: %i", TC_PRIO_MAX, a);
+2 -5
View File
@@ -1066,11 +1066,8 @@ int config_parse_dhcp6_pd_prefix_hint(
assert(rvalue);
r = in_addr_prefix_from_string(rvalue, AF_INET6, &u, &prefixlen);
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r,
"Failed to parse %s=%s, ignoring assignment.", lvalue, rvalue);
return 0;
}
if (r < 0)
return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue);
if (prefixlen < 1 || prefixlen > 128) {
log_syntax(unit, LOG_WARNING, filename, line, 0,
+4 -12
View File
@@ -369,13 +369,8 @@ int config_parse_ipv4ll(
* applies only to IPv4 */
r = parse_boolean(rvalue);
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r,
"Failed to parse %s=%s, ignoring assignment. "
"Note that the setting %s= is deprecated, please use LinkLocalAddressing= instead.",
lvalue, rvalue, lvalue);
return 0;
}
if (r < 0)
return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue);
SET_FLAG(*link_local, ADDRESS_FAMILY_IPV4, r);
@@ -412,11 +407,8 @@ int config_parse_ipv4ll_address(
}
r = in_addr_from_string(AF_INET, rvalue, &a);
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r,
"Failed to parse %s=, ignoring assignment: %s", lvalue, rvalue);
return 0;
}
if (r < 0)
return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue);
if (!in4_addr_is_link_local_dynamic(&a.in)) {
log_syntax(unit, LOG_WARNING, filename, line, 0,
"Specified address cannot be used as an IPv4 link local address, ignoring assignment: %s",
+2 -5
View File
@@ -163,11 +163,8 @@ int config_parse_lldp_multicast_mode(
}
m = lldp_multicast_mode_from_string(rvalue);
if (m < 0) {
log_syntax(unit, LOG_WARNING, filename, line, m,
"Failed to parse %s=, ignoring assignment: %s", lvalue, rvalue);
return 0;
}
if (m < 0)
return log_syntax_parse_error(unit, filename, line, m, lvalue, rvalue);
*mode = m;
return 0;
+6 -16
View File
@@ -1035,12 +1035,8 @@ int config_parse_required_for_online(
r = parse_operational_state_range(rvalue, &network->required_operstate_for_online);
if (r < 0) {
r = parse_boolean(rvalue);
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r,
"Failed to parse %s= setting, ignoring assignment: %s",
lvalue, rvalue);
return 0;
}
if (r < 0)
return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue);
network->required_for_online = r;
network->required_operstate_for_online = LINK_OPERSTATE_RANGE_DEFAULT;
@@ -1077,11 +1073,8 @@ int config_parse_link_group(
}
r = safe_atoi32(rvalue, &group);
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r,
"Failed to parse Group=, ignoring assignment: %s", rvalue);
return 0;
}
if (r < 0)
return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue);
if (group < 0) {
log_syntax(unit, LOG_WARNING, filename, line, 0,
@@ -1126,11 +1119,8 @@ int config_parse_ignore_carrier_loss(
}
r = parse_sec(rvalue, &usec);
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r,
"Failed to parse %s=, ignoring assignment: %s", lvalue, rvalue);
return 0;
}
if (r < 0)
return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue);
network->ignore_carrier_loss_set = true;
network->ignore_carrier_loss_usec = usec;
+10 -26
View File
@@ -935,11 +935,8 @@ int config_parse_prefix_boolean(
return log_oom();
r = parse_boolean(rvalue);
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r,
"Failed to parse %s=, ignoring assignment: %s", lvalue, rvalue);
return 0;
}
if (r < 0)
return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue);
if (ltype != 0)
SET_FLAG(p->prefix.flags, ltype, r);
@@ -1028,12 +1025,8 @@ int config_parse_prefix_metric(
return log_oom();
r = safe_atou32(rvalue, &p->route_metric);
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r,
"Failed to parse %s=, ignoring assignment: %s",
lvalue, rvalue);
return 0;
}
if (r < 0)
return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue);
TAKE_PTR(p);
return 0;
@@ -1486,11 +1479,8 @@ int config_parse_router_lifetime(
}
r = parse_sec(rvalue, &usec);
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r,
"Failed to parse router lifetime, ignoring assignment: %s", rvalue);
return 0;
}
if (r < 0)
return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue);
if (usec > 0) {
if (usec < RADV_MIN_ROUTER_LIFETIME_USEC) {
log_syntax(unit, LOG_WARNING, filename, line, 0,
@@ -1537,11 +1527,8 @@ int config_parse_router_uint32_msec_usec(
}
r = parse_sec(rvalue, &usec);
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r,
"Failed to parse %s=, ignoring assignment: %s", lvalue, rvalue);
return 0;
}
if (r < 0)
return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue);
if (usec != USEC_INFINITY &&
usec > RADV_MAX_UINT32_MSEC_USEC) {
@@ -1606,11 +1593,8 @@ int config_parse_router_home_agent_lifetime(
}
r = parse_sec(rvalue, &usec);
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r,
"Failed to parse %s=, ignoring assignment: %s", lvalue, rvalue);
return 0;
}
if (r < 0)
return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue);
if (!timestamp_is_set(usec) ||
usec > RADV_HOME_AGENT_MAX_LIFETIME_USEC) {
+10 -21
View File
@@ -1351,10 +1351,8 @@ static int config_parse_routing_policy_rule_priority(
}
r = safe_atou32(rvalue, &rule->priority);
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse RPDB rule priority, ignoring: %s", rvalue);
return 0;
}
if (r < 0)
return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue);
rule->priority_set = true;
return 1;
@@ -1380,10 +1378,8 @@ static int config_parse_routing_policy_rule_goto(
assert(rvalue);
r = safe_atou32(rvalue, &priority);
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse %s=%s, ignoring assignment: %m", lvalue, rvalue);
return 0;
}
if (r < 0)
return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue);
if (priority <= 0) {
log_syntax(unit, LOG_WARNING, filename, line, 0, "Invalid goto target priority, ignoring assignment.");
return 0;
@@ -1441,10 +1437,8 @@ static int config_parse_routing_policy_rule_fwmark(
assert(rvalue);
r = parse_fwmark_fwmask(rvalue, &rule->fwmark, &rule->fwmask);
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse RPDB rule firewall mark or mask, ignoring: %s", rvalue);
return 0;
}
if (r < 0)
return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue);
return 1;
}
@@ -1467,10 +1461,8 @@ static int config_parse_routing_policy_rule_port_range(
assert(rvalue);
r = parse_ip_port_range(rvalue, &p->start, &p->end, /* allow_zero= */ false);
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse routing policy rule port range '%s'", rvalue);
return 0;
}
if (r < 0)
return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue);
return 1;
}
@@ -1530,11 +1522,8 @@ static int config_parse_routing_policy_rule_suppress(
}
r = safe_atoi32(rvalue, &val);
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r,
"Failed to parse %s=%s, ignoring assignment: %m", lvalue, rvalue);
return 0;
}
if (r < 0)
return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue);
if (val < 0 || val > ltype) {
log_syntax(unit, LOG_WARNING, filename, line, 0,
"Invalid value specified to %s=, ignoring assignment: %s", lvalue, rvalue);
+2 -5
View File
@@ -186,11 +186,8 @@ int config_parse_ip_masquerade(
}
a = ip_masquerade_address_family_from_string(rvalue);
if (a < 0) {
log_syntax(unit, LOG_WARNING, filename, line, a,
"Failed to parse IPMasquerade= setting, ignoring assignment: %s", rvalue);
return 0;
}
if (a < 0)
return log_syntax_parse_error(unit, filename, line, a, lvalue, rvalue);
*ret = a;
return 0;
+20 -60
View File
@@ -179,12 +179,8 @@ int config_parse_cake_bandwidth(
}
r = parse_size(rvalue, 1000, &k);
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r,
"Failed to parse '%s=', ignoring assignment: %s",
lvalue, rvalue);
return 0;
}
if (r < 0)
return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue);
c->bandwidth = k/8;
TAKE_PTR(qdisc);
@@ -232,12 +228,8 @@ int config_parse_cake_overhead(
}
r = safe_atoi32(rvalue, &v);
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r,
"Failed to parse '%s=', ignoring assignment: %s",
lvalue, rvalue);
return 0;
}
if (r < 0)
return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue);
if (v < -64 || v > 256) {
log_syntax(unit, LOG_WARNING, filename, line, 0,
"Invalid '%s=', ignoring assignment: %s",
@@ -291,12 +283,8 @@ int config_parse_cake_mpu(
}
r = safe_atou32(rvalue, &v);
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r,
"Failed to parse '%s=', ignoring assignment: %s",
lvalue, rvalue);
return 0;
}
if (r < 0)
return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue);
if (v <= 0 || v > 256) {
log_syntax(unit, LOG_WARNING, filename, line, 0,
"Invalid '%s=', ignoring assignment: %s",
@@ -355,12 +343,8 @@ int config_parse_cake_tristate(
assert_not_reached();
r = parse_tristate(rvalue, dest);
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r,
"Failed to parse '%s=', ignoring assignment: %s",
lvalue, rvalue);
return 0;
}
if (r < 0)
return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue);
TAKE_PTR(qdisc);
return 0;
@@ -414,12 +398,8 @@ int config_parse_cake_compensation_mode(
}
mode = cake_compensation_mode_from_string(rvalue);
if (mode < 0) {
log_syntax(unit, LOG_WARNING, filename, line, mode,
"Failed to parse '%s=', ignoring assignment: %s",
lvalue, rvalue);
return 0;
}
if (mode < 0)
return log_syntax_parse_error(unit, filename, line, mode, lvalue, rvalue);
c->compensation_mode = mode;
TAKE_PTR(qdisc);
@@ -479,12 +459,8 @@ int config_parse_cake_flow_isolation_mode(
}
mode = cake_flow_isolation_mode_from_string(rvalue);
if (mode < 0) {
log_syntax(unit, LOG_WARNING, filename, line, mode,
"Failed to parse '%s=', ignoring assignment: %s",
lvalue, rvalue);
return 0;
}
if (mode < 0)
return log_syntax_parse_error(unit, filename, line, mode, lvalue, rvalue);
c->flow_isolation_mode = mode;
TAKE_PTR(qdisc);
@@ -541,12 +517,8 @@ int config_parse_cake_priority_queueing_preset(
}
preset = cake_priority_queueing_preset_from_string(rvalue);
if (preset < 0) {
log_syntax(unit, LOG_WARNING, filename, line, preset,
"Failed to parse '%s=', ignoring assignment: %s",
lvalue, rvalue);
return 0;
}
if (preset < 0)
return log_syntax_parse_error(unit, filename, line, preset, lvalue, rvalue);
c->preset = preset;
TAKE_PTR(qdisc);
@@ -593,12 +565,8 @@ int config_parse_cake_fwmark(
}
r = safe_atou32(rvalue, &fwmark);
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r,
"Failed to parse '%s=', ignoring assignment: %s",
lvalue, rvalue);
return 0;
}
if (r < 0)
return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue);
if (fwmark <= 0) {
log_syntax(unit, LOG_WARNING, filename, line, 0,
"Invalid '%s=', ignoring assignment: %s",
@@ -651,12 +619,8 @@ int config_parse_cake_rtt(
}
r = parse_sec(rvalue, &t);
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r,
"Failed to parse '%s=', ignoring assignment: %s",
lvalue, rvalue);
return 0;
}
if (r < 0)
return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue);
if (t <= 0 || t > UINT32_MAX) {
log_syntax(unit, LOG_WARNING, filename, line, 0,
"Invalid '%s=', ignoring assignment: %s",
@@ -717,12 +681,8 @@ int config_parse_cake_ack_filter(
}
ack_filter = cake_ack_filter_from_string(rvalue);
if (ack_filter < 0) {
log_syntax(unit, LOG_WARNING, filename, line, ack_filter,
"Failed to parse '%s=', ignoring assignment: %s",
lvalue, rvalue);
return 0;
}
if (ack_filter < 0)
return log_syntax_parse_error(unit, filename, line, ack_filter, lvalue, rvalue);
c->ack_filter = ack_filter;
TAKE_PTR(qdisc);
+6 -18
View File
@@ -114,12 +114,8 @@ int config_parse_codel_u32(
}
r = safe_atou32(rvalue, &cd->packet_limit);
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r,
"Failed to parse '%s=', ignoring assignment: %s",
lvalue, rvalue);
return 0;
}
if (r < 0)
return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue);
qdisc = NULL;
@@ -179,12 +175,8 @@ int config_parse_codel_usec(
}
r = parse_sec(rvalue, p);
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r,
"Failed to parse '%s=', ignoring assignment: %s",
lvalue, rvalue);
return 0;
}
if (r < 0)
return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue);
qdisc = NULL;
@@ -224,12 +216,8 @@ int config_parse_codel_bool(
cd = CODEL(qdisc);
r = parse_tristate(rvalue, &cd->ecn);
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r,
"Failed to parse '%s=', ignoring assignment: %s",
lvalue, rvalue);
return 0;
}
if (r < 0)
return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue);
TAKE_PTR(qdisc);
+2 -6
View File
@@ -83,12 +83,8 @@ int config_parse_drr_size(
}
r = parse_size(rvalue, 1024, &u);
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r,
"Failed to parse '%s=', ignoring assignment: %s",
lvalue, rvalue);
return 0;
}
if (r < 0)
return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue);
if (u > UINT32_MAX) {
log_syntax(unit, LOG_WARNING, filename, line, 0, "Invalid '%s=', ignoring assignment: %s",
lvalue, rvalue);
+2 -6
View File
@@ -122,12 +122,8 @@ int config_parse_ets_u8(
}
r = safe_atou8(rvalue, &v);
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r,
"Failed to parse '%s=', ignoring assignment: %s",
lvalue, rvalue);
return 0;
}
if (r < 0)
return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue);
if (v > TCQ_ETS_MAX_BANDS) {
log_syntax(unit, LOG_WARNING, filename, line, 0,
"Invalid '%s='. The value must be <= %d, ignoring assignment: %s",
+4 -12
View File
@@ -89,12 +89,8 @@ int config_parse_pfifo_size(
}
r = safe_atou32(rvalue, &fifo->limit);
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r,
"Failed to parse '%s=', ignoring assignment: %s",
lvalue, rvalue);
return 0;
}
if (r < 0)
return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue);
TAKE_PTR(qdisc);
return 0;
@@ -141,12 +137,8 @@ int config_parse_bfifo_size(
}
r = parse_size(rvalue, 1024, &u);
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r,
"Failed to parse '%s=', ignoring assignment: %s",
lvalue, rvalue);
return 0;
}
if (r < 0)
return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue);
if (u > UINT32_MAX) {
log_syntax(unit, LOG_WARNING, filename, line, 0, "Invalid '%s=', ignoring assignment: %s",
lvalue, rvalue);
+8 -24
View File
@@ -142,12 +142,8 @@ int config_parse_fq_codel_u32(
}
r = safe_atou32(rvalue, p);
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r,
"Failed to parse '%s=', ignoring assignment: %s",
lvalue, rvalue);
return 0;
}
if (r < 0)
return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue);
TAKE_PTR(qdisc);
@@ -207,12 +203,8 @@ int config_parse_fq_codel_usec(
}
r = parse_sec(rvalue, p);
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r,
"Failed to parse '%s=', ignoring assignment: %s",
lvalue, rvalue);
return 0;
}
if (r < 0)
return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue);
TAKE_PTR(qdisc);
@@ -252,12 +244,8 @@ int config_parse_fq_codel_bool(
fqcd = FQ_CODEL(qdisc);
r = parse_tristate(rvalue, &fqcd->ecn);
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r,
"Failed to parse '%s=', ignoring assignment: %s",
lvalue, rvalue);
return 0;
}
if (r < 0)
return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue);
TAKE_PTR(qdisc);
@@ -316,12 +304,8 @@ int config_parse_fq_codel_size(
}
r = parse_size(rvalue, 1024, &sz);
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r,
"Failed to parse '%s=', ignoring assignment: %s",
lvalue, rvalue);
return 0;
}
if (r < 0)
return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue);
if (sz >= UINT32_MAX) {
log_syntax(unit, LOG_WARNING, filename, line, 0,
"Specified '%s=' is too large, ignoring assignment: %s",
+2 -6
View File
@@ -76,12 +76,8 @@ int config_parse_fq_pie_packet_limit(
}
r = safe_atou32(rvalue, &val);
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r,
"Failed to parse '%s=', ignoring assignment: %s",
lvalue, rvalue);
return 0;
}
if (r < 0)
return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue);
if (val == 0) {
log_syntax(unit, LOG_WARNING, filename, line, 0,
"Invalid '%s=', ignoring assignment: %s",
+10 -30
View File
@@ -155,12 +155,8 @@ int config_parse_fq_u32(
}
r = safe_atou32(rvalue, p);
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r,
"Failed to parse '%s=', ignoring assignment: %s",
lvalue, rvalue);
return 0;
}
if (r < 0)
return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue);
qdisc = NULL;
@@ -216,12 +212,8 @@ int config_parse_fq_size(
}
r = parse_size(rvalue, 1024, &sz);
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r,
"Failed to parse '%s=', ignoring assignment: %s",
lvalue, rvalue);
return 0;
}
if (r < 0)
return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue);
if (sz > UINT32_MAX) {
log_syntax(unit, LOG_WARNING, filename, line, 0,
"Specified '%s=' is too large, ignoring assignment: %s",
@@ -268,12 +260,8 @@ int config_parse_fq_bool(
fq = FQ(qdisc);
r = parse_tristate(rvalue, &fq->pacing);
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r,
"Failed to parse '%s=', ignoring assignment: %s",
lvalue, rvalue);
return 0;
}
if (r < 0)
return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue);
TAKE_PTR(qdisc);
@@ -321,12 +309,8 @@ int config_parse_fq_usec(
}
r = parse_sec(rvalue, &sec);
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r,
"Failed to parse '%s=', ignoring assignment: %s",
lvalue, rvalue);
return 0;
}
if (r < 0)
return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue);
if (sec > UINT32_MAX) {
log_syntax(unit, LOG_WARNING, filename, line, 0,
"Specified '%s=' is too large, ignoring assignment: %s",
@@ -381,12 +365,8 @@ int config_parse_fq_max_rate(
}
r = parse_size(rvalue, 1000, &sz);
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r,
"Failed to parse '%s=', ignoring assignment: %s",
lvalue, rvalue);
return 0;
}
if (r < 0)
return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue);
if (sz / 8 > UINT32_MAX) {
log_syntax(unit, LOG_WARNING, filename, line, 0,
"Specified '%s=' is too large, ignoring assignment: %s",
+4 -12
View File
@@ -114,12 +114,8 @@ int config_parse_gred_u32(
}
r = safe_atou32(rvalue, &v);
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r,
"Failed to parse '%s=', ignoring assignment: %s",
lvalue, rvalue);
return 0;
}
if (r < 0)
return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue);
if (v > MAX_DPs) {
log_syntax(unit, LOG_WARNING, filename, line, 0,
@@ -166,12 +162,8 @@ int config_parse_gred_bool(
gred = GRED(qdisc);
r = parse_tristate(rvalue, &gred->grio);
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r,
"Failed to parse '%s=', ignoring assignment: %s",
lvalue, rvalue);
return 0;
}
if (r < 0)
return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue);
TAKE_PTR(qdisc);
+2 -6
View File
@@ -77,12 +77,8 @@ int config_parse_hhf_packet_limit(
}
r = safe_atou32(rvalue, &hhf->packet_limit);
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r,
"Failed to parse '%s=', ignoring assignment: %s",
lvalue, rvalue);
return 0;
}
if (r < 0)
return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue);
TAKE_PTR(qdisc);
+10 -30
View File
@@ -85,12 +85,8 @@ int config_parse_htb_default_class(
}
r = safe_atou32_full(rvalue, 16, &htb->default_class);
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r,
"Failed to parse '%s=', ignoring assignment: %s",
lvalue, rvalue);
return 0;
}
if (r < 0)
return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue);
TAKE_PTR(qdisc);
@@ -137,12 +133,8 @@ int config_parse_htb_u32(
}
r = safe_atou32(rvalue, &htb->rate_to_quantum);
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r,
"Failed to parse '%s=', ignoring assignment: %s",
lvalue, rvalue);
return 0;
}
if (r < 0)
return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue);
TAKE_PTR(qdisc);
@@ -279,12 +271,8 @@ int config_parse_htb_class_u32(
}
r = safe_atou32(rvalue, &v);
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r,
"Failed to parse '%s=', ignoring assignment: %s",
lvalue, rvalue);
return 0;
}
if (r < 0)
return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue);
htb->priority = v;
tclass = NULL;
@@ -344,12 +332,8 @@ int config_parse_htb_class_size(
}
r = parse_size(rvalue, 1024, &v);
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r,
"Failed to parse '%s=', ignoring assignment: %s",
lvalue, rvalue);
return 0;
}
if (r < 0)
return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue);
if ((streq(lvalue, "OverheadBytes") && v > UINT16_MAX) || v > UINT32_MAX) {
log_syntax(unit, LOG_WARNING, filename, line, 0,
"Invalid '%s=', ignoring assignment: %s",
@@ -422,12 +406,8 @@ int config_parse_htb_class_rate(
}
r = parse_size(rvalue, 1000, v);
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r,
"Failed to parse '%s=', ignoring assignment: %s",
lvalue, rvalue);
return 0;
}
if (r < 0)
return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue);
*v /= 8;
tclass = NULL;
+6 -18
View File
@@ -92,12 +92,8 @@ int config_parse_netem_delay(
}
r = parse_sec(rvalue, &u);
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r,
"Failed to parse '%s=', ignoring assignment: %s",
lvalue, rvalue);
return 0;
}
if (r < 0)
return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue);
if (STR_IN_SET(lvalue, "DelaySec", "NetworkEmulatorDelaySec"))
ne->delay = u;
@@ -153,12 +149,8 @@ int config_parse_netem_rate(
}
r = parse_tc_percent(rvalue, &rate);
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r,
"Failed to parse '%s=', ignoring assignment: %s",
lvalue, rvalue);
return 0;
}
if (r < 0)
return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue);
if (STR_IN_SET(lvalue, "LossRate", "NetworkEmulatorLossRate"))
ne->loss = rate;
@@ -209,12 +201,8 @@ int config_parse_netem_packet_limit(
}
r = safe_atou(rvalue, &ne->limit);
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r,
"Failed to parse '%s=', ignoring assignment: %s",
lvalue, rvalue);
return 0;
}
if (r < 0)
return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue);
TAKE_PTR(qdisc);
return 0;
+2 -6
View File
@@ -77,12 +77,8 @@ int config_parse_pie_packet_limit(
}
r = safe_atou32(rvalue, &pie->packet_limit);
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r,
"Failed to parse '%s=', ignoring assignment: %s",
lvalue, rvalue);
return 0;
}
if (r < 0)
return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue);
TAKE_PTR(qdisc);
+4 -12
View File
@@ -774,12 +774,8 @@ int config_parse_qdisc_parent(
qdisc->handle = TC_H_MAKE(TC_H_INGRESS, 0);
} else {
r = parse_handle(rvalue, &qdisc->parent);
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r,
"Failed to parse 'Parent=', ignoring assignment: %s",
rvalue);
return 0;
}
if (r < 0)
return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue);
}
if (STR_IN_SET(rvalue, "clsact", "ingress")) {
@@ -831,12 +827,8 @@ int config_parse_qdisc_handle(
}
r = safe_atou16_full(rvalue, 16, &n);
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r,
"Failed to parse 'Handle=', ignoring assignment: %s",
rvalue);
return 0;
}
if (r < 0)
return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue);
qdisc->handle = (uint32_t) n << 16;
TAKE_PTR(qdisc);
+4 -12
View File
@@ -92,12 +92,8 @@ int config_parse_qfq_weight(
}
r = safe_atou32(rvalue, &v);
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r,
"Failed to parse '%s=', ignoring assignment: %s",
lvalue, rvalue);
return 0;
}
if (r < 0)
return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue);
if (v == 0 || v > QFQ_MAX_WEIGHT) {
log_syntax(unit, LOG_WARNING, filename, line, 0,
@@ -152,12 +148,8 @@ int config_parse_qfq_max_packet(
}
r = parse_size(rvalue, 1024, &v);
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r,
"Failed to parse '%s=', ignoring assignment: %s",
lvalue, rvalue);
return 0;
}
if (r < 0)
return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue);
if (v < QFQ_MIN_MAX_PACKET || v > QFQ_MAX_MAX_PACKET) {
log_syntax(unit, LOG_WARNING, filename, line, 0,
+2 -6
View File
@@ -87,12 +87,8 @@ int config_parse_sfb_u32(
}
r = safe_atou32(rvalue, &sfb->packet_limit);
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r,
"Failed to parse '%s=', ignoring assignment: %s",
lvalue, rvalue);
return 0;
}
if (r < 0)
return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue);
TAKE_PTR(qdisc);
+2 -6
View File
@@ -70,12 +70,8 @@ int config_parse_sfq_perturb_period(
}
r = parse_sec(rvalue, &sfq->perturb_period);
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r,
"Failed to parse '%s=', ignoring assignment: %s",
lvalue, rvalue);
return 0;
}
if (r < 0)
return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue);
TAKE_PTR(qdisc);
+6 -18
View File
@@ -158,12 +158,8 @@ int config_parse_tbf_size(
}
r = parse_size(rvalue, 1024, &k);
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r,
"Failed to parse '%s=', ignoring assignment: %s",
lvalue, rvalue);
return 0;
}
if (r < 0)
return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue);
if (STR_IN_SET(lvalue, "BurstBytes", "Burst"))
tbf->burst = k;
@@ -228,12 +224,8 @@ int config_parse_tbf_rate(
}
r = parse_size(rvalue, 1000, &k);
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r,
"Failed to parse '%s=', ignoring assignment: %s",
lvalue, rvalue);
return 0;
}
if (r < 0)
return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue);
*p = k / 8;
@@ -283,12 +275,8 @@ int config_parse_tbf_latency(
}
r = parse_sec(rvalue, &u);
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r,
"Failed to parse '%s=', ignoring assignment: %s",
lvalue, rvalue);
return 0;
}
if (r < 0)
return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue);
tbf->latency = u;
+4 -12
View File
@@ -685,12 +685,8 @@ int config_parse_tclass_parent(
tclass->parent = TC_H_ROOT;
else {
r = parse_handle(rvalue, &tclass->parent);
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r,
"Failed to parse 'Parent=', ignoring assignment: %s",
rvalue);
return 0;
}
if (r < 0)
return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue);
}
TAKE_PTR(tclass);
@@ -734,12 +730,8 @@ int config_parse_tclass_classid(
}
r = parse_handle(rvalue, &tclass->classid);
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r,
"Failed to parse 'ClassId=', ignoring assignment: %s",
rvalue);
return 0;
}
if (r < 0)
return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue);
TAKE_PTR(tclass);
+2 -6
View File
@@ -82,12 +82,8 @@ int config_parse_teql_id(
}
r = safe_atou(rvalue, &id);
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r,
"Failed to parse '%s=', ignoring assignment: %s",
lvalue, rvalue);
return 0;
}
if (r < 0)
return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue);
if (id > INT_MAX) {
log_syntax(unit, LOG_WARNING, filename, line, 0,
"'%s=' is too large, ignoring assignment: %s",
+18 -44
View File
@@ -274,7 +274,7 @@ int config_parse_expose_port(
if (r == -EEXIST)
log_syntax(unit, LOG_WARNING, filename, line, r, "Duplicate port specification, ignoring: %s", rvalue);
else if (r < 0)
log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse host port %s: %m", rvalue);
return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue);
return 0;
}
@@ -595,10 +595,8 @@ int config_parse_boot(
assert(rvalue);
r = parse_boolean(rvalue);
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse Boot= parameter %s, ignoring: %m", rvalue);
return 0;
}
if (r < 0)
return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue);
if (r) {
if (settings->start_mode == START_PID2)
@@ -640,10 +638,8 @@ int config_parse_pid2(
assert(rvalue);
r = parse_boolean(rvalue);
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse ProcessTwo= parameter %s, ignoring: %m", rvalue);
return 0;
}
if (r < 0)
return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue);
if (r) {
if (settings->start_mode == START_BOOT)
@@ -778,13 +774,8 @@ int config_parse_syscall_filter(
r = extract_first_word(&items, &word, /* separators= */ WHITESPACE ",", /* flags= */ 0);
if (r == 0)
return 0;
if (r == -ENOMEM)
return log_oom();
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r,
"Failed to parse SystemCallFilter= parameter %s, ignoring: %m", rvalue);
return 0;
}
if (r < 0)
return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue);
if (negative)
r = strv_extend(&settings->syscall_deny_list, word);
@@ -822,10 +813,8 @@ int config_parse_oom_score_adjust(
log_syntax(unit, LOG_WARNING, filename, line, r, "OOM score adjust value out of range, ignoring: %s", rvalue);
return 0;
}
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse the OOM score adjust value, ignoring: %s", rvalue);
return 0;
}
if (r < 0)
return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue);
settings->oom_score_adjust = oa;
settings->oom_score_adjust_set = true;
@@ -910,7 +899,7 @@ int config_parse_link_journal(
r = parse_link_journal(rvalue, &settings->link_journal, &settings->link_journal_try);
if (r < 0)
log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse link journal mode, ignoring: %s", rvalue);
log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue);
return 0;
}
@@ -973,10 +962,8 @@ int config_parse_userns_chown(
/* Compatibility support for UserNamespaceChown=, whose job has been taken over by UserNamespaceOwnership= */
r = parse_boolean(rvalue);
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse user namespace ownership mode, ignoring: %s", rvalue);
return 0;
}
if (r < 0)
return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue);
*ownership = r ? USER_NAMESPACE_OWNERSHIP_CHOWN : USER_NAMESPACE_OWNERSHIP_OFF;
return 0;
@@ -1008,12 +995,8 @@ int config_parse_bind_user(
_cleanup_free_ char *word = NULL;
r = extract_first_word(&p, &word, /* separators= */ NULL, /* flags= */ 0);
if (r == -ENOMEM)
return log_oom();
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse BindUser= list, ignoring: %s", rvalue);
return 0;
}
if (r < 0)
return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue);
if (r == 0)
break;
@@ -1057,12 +1040,8 @@ int config_parse_bind_user_shell(
}
r = parse_user_shell(rvalue, &sh, &copy);
if (r == -ENOMEM)
return log_oom();
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse BindUserShell= value, ignoring: %s", rvalue);
return 0;
}
if (r < 0)
return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue);
free_and_replace(settings->bind_user_shell, sh);
settings->bind_user_shell_copy = copy;
@@ -1089,13 +1068,8 @@ int config_parse_restrict_address_families(
assert(rvalue);
r = parse_address_families(rvalue, &settings->restrict_address_families, &settings->restrict_address_families_is_allowlist);
if (r == -ENOMEM)
return log_oom();
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r,
"Failed to parse address family, ignoring: %s", rvalue);
return 0;
}
if (r < 0)
return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue);
return 0;
}
+11 -25
View File
@@ -1967,7 +1967,7 @@ static int config_parse_type(
r = gpt_partition_type_from_string(rvalue, type);
if (r < 0)
return log_syntax(unit, LOG_ERR, filename, line, r, "Failed to parse partition type: %s", rvalue);
return log_syntax_parse_error_full(unit, filename, line, r, /* critical= */ true, lvalue, rvalue);
if (arg_architecture >= 0)
*type = gpt_partition_type_override_architecture(*type, arg_architecture);
@@ -2071,11 +2071,8 @@ static int config_parse_weight(
assert(rvalue);
r = safe_atou32(rvalue, &v);
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r,
"Failed to parse weight value, ignoring: %s", rvalue);
return 0;
}
if (r < 0)
return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue);
if (v > 1000U*1000U) {
log_syntax(unit, LOG_WARNING, filename, line, 0,
@@ -2107,8 +2104,7 @@ static int config_parse_size4096(
r = parse_size(rvalue, 1024, &parsed);
if (r < 0)
return log_syntax(unit, LOG_ERR, filename, line, r,
"Failed to parse size value: %s", rvalue);
return log_syntax_parse_error_full(unit, filename, line, r, /* critical= */ true, lvalue, rvalue);
if (ltype > 0)
*sz = round_up_size(parsed, 4096);
@@ -2143,8 +2139,7 @@ static int config_parse_block_size(
r = parse_size(rvalue, 1024, &parsed);
if (r < 0)
return log_syntax(unit, LOG_ERR, filename, line, r,
"Failed to parse size value: %s", rvalue);
return log_syntax_parse_error_full(unit, filename, line, r, /* critical= */ true, lvalue, rvalue);
if (parsed < 512 || parsed > 4096)
return log_syntax(unit, LOG_ERR, filename, line, SYNTHETIC_ERRNO(EINVAL),
@@ -2182,8 +2177,7 @@ static int config_parse_fs_sector_size(
r = parse_size(rvalue, 1024, &parsed);
if (r < 0)
return log_syntax(unit, LOG_ERR, filename, line, r,
"Failed to parse size value: %s", rvalue);
return log_syntax_parse_error_full(unit, filename, line, r, /* critical= */ true, lvalue, rvalue);
if (!ISPOWEROF2(parsed))
return log_syntax(unit, LOG_ERR, filename, line, SYNTHETIC_ERRNO(EINVAL),
@@ -2681,11 +2675,8 @@ static int config_parse_gpt_flags(
assert(rvalue);
r = safe_atou64(rvalue, gpt_flags);
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r,
"Failed to parse Flags= value, ignoring: %s", rvalue);
return 0;
}
if (r < 0)
return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue);
return 0;
}
@@ -2718,10 +2709,8 @@ static int config_parse_uuid(
}
r = sd_id128_from_string(rvalue, &partition->new_uuid);
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse 128-bit ID/UUID, ignoring: %s", rvalue);
return 0;
}
if (r < 0)
return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue);
partition->new_uuid_is_set = true;
@@ -2908,11 +2897,8 @@ static int config_parse_encrypt_add_token(
/* Extract only type and source; leave the rest of q as the value verbatim.
* This allows ':' in the value (e.g. file paths containing colons). */
r = extract_many_words(&q, ":", EXTRACT_DONT_COALESCE_SEPARATORS, &type, &source);
if (r == -ENOMEM)
return log_oom();
if (r < 0)
return log_syntax(unit, LOG_ERR, filename, line, r,
"Failed to parse %s=: %s", lvalue, rvalue);
return log_syntax_parse_error_full(unit, filename, line, r, /* critical= */ true, lvalue, rvalue);
if (r < 1)
return log_syntax(unit, LOG_ERR, filename, line, SYNTHETIC_ERRNO(EINVAL),
"%s= requires at least a token type name.", lvalue);
+6 -16
View File
@@ -44,11 +44,8 @@ int config_parse_dns_servers(
else {
/* Otherwise, add to the list */
r = manager_parse_dns_server_string_and_warn(m, ltype, rvalue);
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r,
"Failed to parse DNS server string '%s', ignoring.", rvalue);
return 0;
}
if (r < 0)
return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue);
}
/* If we have a manual setting, then we stop reading
@@ -86,11 +83,8 @@ int config_parse_search_domains(
else {
/* Otherwise, add to the list */
r = manager_parse_search_domains_and_warn(m, rvalue);
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r,
"Failed to parse search domains string '%s', ignoring.", rvalue);
return 0;
}
if (r < 0)
return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue);
}
/* If we have a manual setting, then we stop reading
@@ -145,12 +139,8 @@ int config_parse_dns_stub_listener_extra(
}
r = in_addr_port_ifindex_name_from_string_auto(p, &stub->family, &stub->address, &stub->port, /* ret_ifindex= */ NULL, /* ret_server_name= */ NULL);
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r,
"Failed to parse address in %s=%s, ignoring assignment: %m",
lvalue, rvalue);
return 0;
}
if (r < 0)
return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue);
r = ordered_set_ensure_put(&m->dns_extra_stub_listeners, &dns_stub_listener_extra_hash_ops, stub);
if (r == -ENOMEM)
+8 -14
View File
@@ -244,14 +244,11 @@ int config_parse_delegate_dns_servers(
}
/* Otherwise, add to the list */
for (;;) {
for (const char *p = rvalue;;) {
_cleanup_free_ char *word = NULL;
r = extract_first_word(&rvalue, &word, /* separators= */ NULL, /* flags= */ 0);
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r,
"Failed to parse DNS server string '%s', ignoring.", rvalue);
return 0;
}
r = extract_first_word(&p, &word, /* separators= */ NULL, /* flags= */ 0);
if (r < 0)
return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue);
if (r == 0)
break;
@@ -329,14 +326,11 @@ int config_parse_delegate_domains(
}
/* Otherwise, add to the list */
for (;;) {
for (const char *p = rvalue;;) {
_cleanup_free_ char *word = NULL;
r = extract_first_word(&rvalue, &word, /* separators= */ NULL, /* flags= */ 0);
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r,
"Failed to parse search domains string '%s', ignoring.", rvalue);
return 0;
}
r = extract_first_word(&p, &word, /* separators= */ NULL, /* flags= */ 0);
if (r < 0)
return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue);
if (r == 0)
break;
+1 -3
View File
@@ -251,9 +251,7 @@ int config_parse_cpu_set(
if (critical)
return log_debug_errno(r, "Failed to parse CPU set: %s", rvalue);
log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse %s= setting, ignoring assignment: %s",
lvalue, rvalue);
return 0;
return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue);
}
if (r == 0)
break;
+7 -18
View File
@@ -1203,9 +1203,7 @@ int config_parse_mdi(
return 0;
}
log_syntax(unit, LOG_WARNING, filename, line, 0,
"Failed to parse %s= setting, ignoring assignment: %s", lvalue, rvalue);
return 0;
return log_syntax_parse_error(unit, filename, line, 0, lvalue, rvalue);
}
int config_parse_ring_buffer_or_channel(
@@ -1242,11 +1240,8 @@ int config_parse_ring_buffer_or_channel(
}
r = safe_atou32(rvalue, &k);
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r,
"Failed to parse %s=, ignoring: %s", lvalue, rvalue);
return 0;
}
if (r < 0)
return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue);
if (k < 1) {
log_syntax(unit, LOG_WARNING, filename, line, 0,
"Invalid %s= value, ignoring: %s", lvalue, rvalue);
@@ -1346,11 +1341,8 @@ int config_parse_coalesce_u32(
}
r = safe_atou32(rvalue, &k);
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r,
"Failed to parse %s=, ignoring: %s", lvalue, rvalue);
return 0;
}
if (r < 0)
return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue);
dst->value = k;
dst->set = true;
@@ -1380,11 +1372,8 @@ int config_parse_coalesce_sec(
}
r = nsec ? parse_nsec(rvalue, &t) : parse_sec(rvalue, &t);
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r,
"Failed to parse coalesce setting value, ignoring: %s", rvalue);
return 0;
}
if (r < 0)
return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue);
if (t > UINT32_MAX) {
log_syntax(unit, LOG_WARNING, filename, line, 0,
+1 -1
View File
@@ -807,7 +807,7 @@ int config_parse_image_policy(
if (r == -EBADRQC)
return log_syntax(unit, LOG_ERR, filename, line, r, "Unknown partition policy flag in image policy, refusing: %s", rvalue);
if (r < 0)
return log_syntax(unit, LOG_ERR, filename, line, r, "Failed to parse image policy, refusing: %s", rvalue);
return log_syntax_parse_error_full(unit, filename, line, r, /* critical= */ true, lvalue, rvalue);
return free_and_replace_full(*p, np, image_policy_free);
}
+10 -24
View File
@@ -449,11 +449,8 @@ int config_parse_sr_iov_uint32(
}
r = safe_atou32(rvalue, &k);
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r,
"Failed to parse SR-IOV '%s=', ignoring assignment: %s", lvalue, rvalue);
return 0;
}
if (r < 0)
return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue);
if (streq(lvalue, "VLANId")) {
if (k == 0 || k > 4095) {
@@ -554,11 +551,8 @@ int config_parse_sr_iov_link_state(
}
r = parse_boolean(rvalue);
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r,
"Failed to parse SR-IOV '%s=', ignoring assignment: %s", lvalue, rvalue);
return 0;
}
if (r < 0)
return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue);
sr_iov->link_state = r ? SR_IOV_LINK_STATE_ENABLE : SR_IOV_LINK_STATE_DISABLE;
TAKE_PTR(sr_iov);
@@ -604,10 +598,8 @@ int config_parse_sr_iov_boolean(
}
r = parse_boolean(rvalue);
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse '%s=', ignoring: %s", lvalue, rvalue);
return 0;
}
if (r < 0)
return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue);
if (streq(lvalue, "MACSpoofCheck"))
sr_iov->vf_spoof_check_setting = r;
@@ -653,11 +645,8 @@ int config_parse_sr_iov_mac(
}
r = parse_ether_addr(rvalue, &sr_iov->mac);
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r,
"Failed to parse SR-IOV '%s=', ignoring assignment: %s", lvalue, rvalue);
return 0;
}
if (r < 0)
return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue);
TAKE_PTR(sr_iov);
return 0;
@@ -688,11 +677,8 @@ int config_parse_sr_iov_num_vfs(
}
r = safe_atou32(rvalue, &n);
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r,
"Failed to parse %s=, ignoring assignment: %s", lvalue, rvalue);
return 0;
}
if (r < 0)
return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue);
if (n > INT_MAX) {
log_syntax(unit, LOG_WARNING, filename, line, 0,
+2 -5
View File
@@ -91,11 +91,8 @@ int config_parse_vlanid(
"VLAN identifier outside of valid range 0…4094, ignoring: %s", rvalue);
return 0;
}
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r,
"Failed to parse VLAN identifier value, ignoring: %s", rvalue);
return 0;
}
if (r < 0)
return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue);
return 0;
}
+8 -20
View File
@@ -254,11 +254,8 @@ static int config_parse_instances_max(
}
r = safe_atou64(rvalue, &i);
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r,
"Failed to parse InstancesMax= value, ignoring: %s", rvalue);
return 0;
}
if (r < 0)
return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue);
transfer_set_instances_max(instances_max, i, filename, line);
return 0;
@@ -427,11 +424,8 @@ static int config_parse_resource_ptype(
}
r = gpt_partition_type_from_string(rvalue, &rr->partition_type);
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r,
"Failed to parse partition type, ignoring: %s", rvalue);
return 0;
}
if (r < 0)
return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue);
rr->partition_type_set = true;
return 0;
@@ -461,11 +455,8 @@ static int config_parse_partition_uuid(
}
r = sd_id128_from_string(rvalue, &t->partition_uuid);
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r,
"Failed to parse partition UUID, ignoring: %s", rvalue);
return 0;
}
if (r < 0)
return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue);
t->partition_uuid_set = true;
return 0;
@@ -495,11 +486,8 @@ static int config_parse_partition_flags(
}
r = safe_atoux64(rvalue, &t->partition_flags);
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r,
"Failed to parse partition flags, ignoring: %s", rvalue);
return 0;
}
if (r < 0)
return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue);
t->partition_flags_set = true;
return 0;
+2 -5
View File
@@ -95,11 +95,8 @@ int config_parse_servers(
}
r = manager_parse_server_string(m, ltype, rvalue);
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r,
"Failed to parse NTP server string '%s', ignoring: %m", rvalue);
return 0;
}
if (r < 0)
return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue);
return 0;
}
+6 -15
View File
@@ -2000,10 +2000,8 @@ int config_parse_rx_tx_queues(
}
r = safe_atou32(rvalue, &k);
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse %s=, ignoring assignment: %s.", lvalue, rvalue);
return 0;
}
if (r < 0)
return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue);
if (k == 0 || k > 16384) {
log_syntax(unit, LOG_WARNING, filename, line, 0, "Invalid %s=, ignoring assignment: %s.", lvalue, rvalue);
return 0;
@@ -2034,10 +2032,8 @@ int config_parse_txqueuelen(
}
r = safe_atou32(rvalue, &k);
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse %s=, ignoring assignment: %s.", lvalue, rvalue);
return 0;
}
if (r < 0)
return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue);
if (k == UINT32_MAX) {
log_syntax(unit, LOG_WARNING, filename, line, 0, "Invalid %s=, ignoring assignment: %s.", lvalue, rvalue);
return 0;
@@ -2080,13 +2076,8 @@ int config_parse_wol_password(
warn_file_is_world_accessible(filename, /* st= */ NULL, unit, line);
r = link_parse_wol_password(config, rvalue);
if (r == -ENOMEM)
return log_oom();
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r,
"Failed to parse %s=, ignoring assignment: %s.", lvalue, rvalue);
return 0;
}
if (r < 0)
return log_syntax_parse_error(unit, filename, line, r, lvalue, "(secret)");
config->wol_password_file = mfree(config->wol_password_file);
return 0;