network/route-nexthop: always reset gateway address when _dhcp or friends is specified to Gateway=

Just for safety.
This commit is contained in:
Yu Watanabe
2024-01-12 16:03:37 +09:00
parent 4207f6c05d
commit ffad01c81e
+6 -2
View 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;
}