summaryrefslogtreecommitdiffstats
path: root/src/network/networkd-routing-policy-rule.c
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2021-05-14 05:08:49 +0200
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2021-05-14 09:38:41 +0200
commit893e3ffe7d25b182713998a42dbcd4d200ab6fcf (patch)
tree104d2ab79bfca7c6077422c58bac5ffdfd26551c /src/network/networkd-routing-policy-rule.c
parentMerge pull request #19592 from yuwata/network-introduce-describe-bus-method (diff)
downloadsystemd-893e3ffe7d25b182713998a42dbcd4d200ab6fcf.tar.xz
systemd-893e3ffe7d25b182713998a42dbcd4d200ab6fcf.zip
network: shorten code a bit and update log message
Diffstat (limited to '')
-rw-r--r--src/network/networkd-routing-policy-rule.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/src/network/networkd-routing-policy-rule.c b/src/network/networkd-routing-policy-rule.c
index b44ee8b627..9b9880d1da 100644
--- a/src/network/networkd-routing-policy-rule.c
+++ b/src/network/networkd-routing-policy-rule.c
@@ -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;