]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
network/route-nexthop: use log_syntax_parse_error()
authorYu Watanabe <watanabe.yu+github@gmail.com>
Sun, 22 Sep 2024 20:40:55 +0000 (05:40 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Fri, 11 Oct 2024 18:26:06 +0000 (03:26 +0900)
src/network/networkd-route-nexthop.c

index ee837d73fa589f45ddd91cbc808029e5865863d0..c0c77c02f540e08c4a494f65f5d5a0e1147f3b60 100644 (file)
@@ -1006,11 +1006,8 @@ int config_parse_gateway(
         }
 
         r = in_addr_from_string_auto(rvalue, &route->nexthop.family, &route->nexthop.gw);
-        if (r < 0) {
-                log_syntax(unit, LOG_WARNING, filename, line, r,
-                           "Invalid %s='%s', ignoring assignment: %m", lvalue, rvalue);
-                return 0;
-        }
+        if (r < 0)
+                return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue);
 
         route->gateway_from_dhcp_or_ra = false;
         TAKE_PTR(route);
@@ -1096,10 +1093,8 @@ int config_parse_route_nexthop(
         }
 
         r = safe_atou32(rvalue, &id);
-        if (r < 0) {
-                log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse nexthop ID, ignoring assignment: %s", rvalue);
-                return 0;
-        }
+        if (r < 0)
+                return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue);
         if (id == 0) {
                 log_syntax(unit, LOG_WARNING, filename, line, 0, "Invalid nexthop ID, ignoring assignment: %s", rvalue);
                 return 0;
@@ -1157,13 +1152,8 @@ int config_parse_multipath_route(
 
         p = rvalue;
         r = extract_first_word(&p, &word, NULL, 0);
-        if (r == -ENOMEM)
-                return log_oom();
-        if (r <= 0) {
-                log_syntax(unit, LOG_WARNING, filename, line, r,
-                           "Invalid multipath route option, ignoring assignment: %s", rvalue);
-                return 0;
-        }
+        if (r <= 0)
+                return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue);
 
         dev = strchr(word, '@');
         if (dev) {