diff options
author | Susant Sahani <145210+ssahani@users.noreply.github.com> | 2017-11-20 23:53:34 +0530 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2017-11-20 19:23:34 +0100 |
commit | 444b01704648c2f1292531f17c3b8c95bf1a9896 (patch) | |
tree | cd638798ec6157f2d4bbaebec8de5aff270d3f1b /src | |
parent | 8c6f6a2f91a28df14944e9567ac0dc14893264d5 (diff) | |
download | systemd-444b01704648c2f1292531f17c3b8c95bf1a9896.tar.gz systemd-444b01704648c2f1292531f17c3b8c95bf1a9896.tar.bz2 systemd-444b01704648c2f1292531f17c3b8c95bf1a9896.zip |
networkd: configure link even if no routes have been received by dhcp (#6886)
Fixes #3752
networkctl
IDX LINK TYPE OPERATIONAL SETUP
1 lo loopback carrier unmanaged
2 eth0 ether no-carrier configuring
5 host ether routable configured <==========
5 links listed.
Diffstat (limited to 'src')
-rw-r--r-- | src/network/networkd-dhcp4.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/src/network/networkd-dhcp4.c b/src/network/networkd-dhcp4.c index 168dc6ead2..bfce641858 100644 --- a/src/network/networkd-dhcp4.c +++ b/src/network/networkd-dhcp4.c @@ -95,8 +95,10 @@ static int link_set_dhcp_routes(Link *link) { return log_link_warning_errno(link, r, "DHCP error: could not get address: %m"); r = sd_dhcp_lease_get_router(link->dhcp_lease, &gateway); - if (r < 0 && r != -ENODATA) - return log_link_warning_errno(link, r, "DHCP error: could not get gateway: %m"); + if (r == -ENODATA) + log_link_info_errno(link, r, "DHCP: No routes received from DHCP server: %m"); + else if (r < 0) + log_link_warning_errno(link, r, "DHCP error: could not get gateway: %m"); if (r >= 0) { _cleanup_route_free_ Route *route = NULL; @@ -148,9 +150,9 @@ static int link_set_dhcp_routes(Link *link) { n = sd_dhcp_lease_get_routes(link->dhcp_lease, &static_routes); if (n == -ENODATA) - return 0; - if (n < 0) - return log_link_warning_errno(link, n, "DHCP error: could not get routes: %m"); + log_link_info_errno(link, n, "DHCP: No routes received from DHCP server: %m"); + else if (n < 0) + log_link_warning_errno(link, n, "DHCP error: could not get routes: %m"); for (i = 0; i < n; i++) { _cleanup_route_free_ Route *route = NULL; @@ -175,6 +177,11 @@ static int link_set_dhcp_routes(Link *link) { link->dhcp4_messages++; } + if (link->dhcp4_messages == 0) { + link->dhcp4_configured = true; + link_check_ready(link); + } + return 0; } |