]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
network/route-nexthop: always reset gateway address when _dhcp or friends is specifie... 30896/head
authorYu Watanabe <watanabe.yu+github@gmail.com>
Fri, 12 Jan 2024 06:29:11 +0000 (15:29 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Fri, 12 Jan 2024 07:03:37 +0000 (16:03 +0900)
Just for safety.

src/network/networkd-route-nexthop.c

index c1b191b3ef68dbcde8dd381891fac148a392702b..f1d81f2014f255148247465e52ca7b8fd4f4c246 100644 (file)
@@ -62,20 +62,24 @@ int config_parse_gateway(
 
                 if (streq(rvalue, "_dhcp")) {
                         route->gateway_from_dhcp_or_ra = true;
+                        route->gw_family = AF_UNSPEC;
+                        route->gw = IN_ADDR_NULL;
                         TAKE_PTR(route);
                         return 0;
                 }
 
                 if (streq(rvalue, "_dhcp4")) {
-                        route->gw_family = AF_INET;
                         route->gateway_from_dhcp_or_ra = true;
+                        route->gw_family = AF_INET;
+                        route->gw = IN_ADDR_NULL;
                         TAKE_PTR(route);
                         return 0;
                 }
 
                 if (streq(rvalue, "_ipv6ra")) {
-                        route->gw_family = AF_INET6;
                         route->gateway_from_dhcp_or_ra = true;
+                        route->gw_family = AF_INET6;
+                        route->gw = IN_ADDR_NULL;
                         TAKE_PTR(route);
                         return 0;
                 }