]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
network: shorten code a bit and update log message
authorYu Watanabe <watanabe.yu+github@gmail.com>
Fri, 14 May 2021 03:08:49 +0000 (12:08 +0900)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Fri, 14 May 2021 07:38:41 +0000 (09:38 +0200)
src/network/networkd-routing-policy-rule.c

index b44ee8b627bb1441b0c6636b28e238e42ad22c71..9b9880d1da7b2cb871e145775e86106f299355dd 100644 (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;