1
0
mirror of https://github.com/systemd/systemd.git synced 2024-11-02 19:21:53 +03:00

network: Allow to configure GW even UseRoutes=false

When use UseRoutes=False so the DHCP request itself does not request
for Classless Static Routes option.
As a result, the DHCP server will only respond with a Router option.
In this case since we are using the UseRoutes=False option the gateway
that comes in via the router option does not get configured.
This patch fixes theis behaviour.
This commit is contained in:
Susant Sahani 2020-03-01 05:12:39 +01:00 committed by Yu Watanabe
parent 161bc525bb
commit ad098b14c5

View File

@ -240,9 +240,6 @@ static int link_set_dhcp_routes(Link *link) {
if (!link->network) /* link went down while we configured the IP addresses? */
return 0;
if (!link->network->dhcp_use_routes)
return 0;
if (!link_has_carrier(link) && !link->network->configure_without_carrier)
/* During configuring addresses, the link lost its carrier. As networkd is dropping
* the addresses now, let's not configure the routes either. */
@ -290,6 +287,7 @@ static int link_set_dhcp_routes(Link *link) {
}
}
if (link->network->dhcp_use_routes) {
for (i = 0; i < n; i++) {
_cleanup_(route_freep) Route *route = NULL;
@ -322,6 +320,7 @@ static int link_set_dhcp_routes(Link *link) {
if (r < 0)
return log_link_error_errno(link, r, "Could not set route: %m");
}
}
r = sd_dhcp_lease_get_router(link->dhcp_lease, &router);
if (IN_SET(r, 0, -ENODATA))