]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
network: nexthop: unset gateway when an empty string is assigned
authorYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 3 Feb 2021 07:58:29 +0000 (16:58 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 17 Feb 2021 06:55:37 +0000 (15:55 +0900)
src/network/networkd-nexthop.c

index 6143de11f3b49da4a2b434e58f763e9c74f3041c..a05026db4066d3488afe77cf1d0b3c1cb055f746 100644 (file)
@@ -519,6 +519,14 @@ int config_parse_nexthop_gateway(
         if (r < 0)
                 return log_oom();
 
+        if (isempty(rvalue)) {
+                n->family = AF_UNSPEC;
+                n->gw = IN_ADDR_NULL;
+
+                TAKE_PTR(n);
+                return 0;
+        }
+
         r = in_addr_from_string_auto(rvalue, &n->family, &n->gw);
         if (r < 0) {
                 log_syntax(unit, LOG_WARNING, filename, line, r,