summaryrefslogtreecommitdiff
path: root/src/network/networkd-dhcp4.c
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2019-07-15 00:35:49 +0900
committerYu Watanabe <watanabe.yu+github@gmail.com>2019-07-15 21:52:06 +0900
commit4ff296b02411bb4f0dc38f48cbab06f8645d2a08 (patch)
treec2a6711e50df7eb96553f8cd3723abdb4a1eaf44 /src/network/networkd-dhcp4.c
parent8eb0cafeb0aa6687e02f45e92e60fdbad7c485c0 (diff)
downloadsystemd-4ff296b02411bb4f0dc38f48cbab06f8645d2a08.tar.gz
systemd-4ff296b02411bb4f0dc38f48cbab06f8645d2a08.tar.bz2
systemd-4ff296b02411bb4f0dc38f48cbab06f8645d2a08.zip
network: make link enter failed state when a configuration fails
Some path of configuring address, route or etc., go to failed state, but some do not. E.g., failure in address configuration which is provided by DHCPv4 goes to failed state, but static address does not. This is just for consistency. This should not change anything if everything is fine. This also voidify manager_rtnl_process_address().
Diffstat (limited to 'src/network/networkd-dhcp4.c')
-rw-r--r--src/network/networkd-dhcp4.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/network/networkd-dhcp4.c b/src/network/networkd-dhcp4.c
index 5ada9f0d01..8a987e84a3 100644
--- a/src/network/networkd-dhcp4.c
+++ b/src/network/networkd-dhcp4.c
@@ -459,9 +459,8 @@ static int dhcp4_address_handler(sd_netlink *rtnl, sd_netlink_message *m, Link *
log_link_error_errno(link, r, "Could not set DHCPv4 address: %m");
link_enter_failed(link);
return 1;
- }
- if (r >= 0)
- manager_rtnl_process_address(rtnl, m, link->manager);
+ } else if (r >= 0)
+ (void) manager_rtnl_process_address(rtnl, m, link->manager);
r = link_set_dhcp_routes(link);
if (r < 0) {
@@ -470,7 +469,11 @@ static int dhcp4_address_handler(sd_netlink *rtnl, sd_netlink_message *m, Link *
}
/* Add back static routes since kernel removes while DHCPv4 address is removed from when lease expires */
- link_request_set_routes(link);
+ r = link_request_set_routes(link);
+ if (r < 0) {
+ link_enter_failed(link);
+ return 1;
+ }
if (link->dhcp4_messages == 0) {
link->dhcp4_configured = true;