]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
network/route-nexthop: make GatewayOnLink= support an empty string
authorYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 9 Jan 2024 03:20:41 +0000 (12:20 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Fri, 12 Jan 2024 00:44:03 +0000 (09:44 +0900)
And invalidate the route section if an invalid string is specified.

src/network/networkd-route-nexthop.c
src/shared/conf-parser.c

index 3b1da1801f06cbb191b03bc836eb18000a41b62a..c1b191b3ef68dbcde8dd381891fac148a392702b 100644 (file)
@@ -124,14 +124,10 @@ int config_parse_route_gateway_onlink(
                 return 0;
         }
 
-        r = parse_boolean(rvalue);
-        if (r < 0) {
-                log_syntax(unit, LOG_WARNING, filename, line, r,
-                           "Could not parse %s=\"%s\", ignoring assignment: %m", lvalue, rvalue);
-                return 0;
-        }
-
-        route->gateway_onlink = r;
+        r = config_parse_tristate(unit, filename, line, section, section_line, lvalue, ltype, rvalue,
+                                  &route->gateway_onlink, network);
+        if (r <= 0)
+                return r;
 
         TAKE_PTR(route);
         return 0;
index e34ebcca6eacbebefe35e779f91427bb3d71affa..f5efc7618a819b98b96bd05df1acadfdeb4f53f7 100644 (file)
@@ -1064,7 +1064,7 @@ int config_parse_tristate(
 
         if (isempty(rvalue)) {
                 *t = -1;
-                return 0;
+                return 1;
         }
 
         r = parse_tristate(rvalue, t);
@@ -1074,7 +1074,7 @@ int config_parse_tristate(
                 return 0;
         }
 
-        return 0;
+        return 1;
 }
 
 int config_parse_string(