1
0
mirror of https://github.com/systemd/systemd.git synced 2025-01-11 09:18:07 +03:00

network: shorten code a bit and update log message

This commit is contained in:
Yu Watanabe 2021-05-14 12:08:49 +09:00 committed by Zbigniew Jędrzejewski-Szmek
parent db0a915a2b
commit 893e3ffe7d

View File

@ -1317,19 +1317,14 @@ int config_parse_routing_policy_rule_device(
return log_oom();
if (!ifname_valid(rvalue)) {
log_syntax(unit, LOG_WARNING, filename, line, 0, "Failed to parse '%s' interface name, ignoring: %s", lvalue, rvalue);
log_syntax(unit, LOG_WARNING, filename, line, 0,
"Invalid interface name '%s' in %s=, ignoring assignment.", rvalue, lvalue);
return 0;
}
if (streq(lvalue, "IncomingInterface")) {
r = free_and_strdup(&n->iif, rvalue);
if (r < 0)
return log_oom();
} else {
r = free_and_strdup(&n->oif, rvalue);
if (r < 0)
return log_oom();
}
r = free_and_strdup(streq(lvalue, "IncomingInterface") ? &n->iif : &n->oif, rvalue);
if (r < 0)
return log_oom();
TAKE_PTR(n);
return 0;
@ -1346,6 +1341,7 @@ int config_parse_routing_policy_rule_port_range(
const char *rvalue,
void *data,
void *userdata) {
_cleanup_(routing_policy_rule_free_or_set_invalidp) RoutingPolicyRule *n = NULL;
Network *network = userdata;
uint16_t low, high;