summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2019-06-07 14:22:13 +0900
committerYu Watanabe <watanabe.yu+github@gmail.com>2019-06-07 16:22:00 +0900
commit448aaf9f4373ba9980b523928d74f7793c139919 (patch)
tree6b845135c17189e9b1e08b5a4b82aeb34dfca1ec /src
parent1590dfa4a0b9d659a905818711256004ed2984bb (diff)
downloadsystemd-448aaf9f4373ba9980b523928d74f7793c139919.tar.gz
systemd-448aaf9f4373ba9980b523928d74f7793c139919.tar.bz2
systemd-448aaf9f4373ba9980b523928d74f7793c139919.zip
network: check earlier the existence of lifetime in lease
Diffstat (limited to 'src')
-rw-r--r--src/network/networkd-dhcp4.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/network/networkd-dhcp4.c b/src/network/networkd-dhcp4.c
index ed196c446a..9f820c1f40 100644
--- a/src/network/networkd-dhcp4.c
+++ b/src/network/networkd-dhcp4.c
@@ -509,6 +509,12 @@ static int dhcp_lease_acquired(sd_dhcp_client *client, Link *link) {
prefixlen = in4_addr_netmask_to_prefixlen(&netmask);
+ if (!FLAGS_SET(link->network->keep_configuration, KEEP_CONFIGURATION_DHCP)) {
+ r = sd_dhcp_lease_get_lifetime(lease, &lifetime);
+ if (r < 0)
+ return log_link_warning_errno(link, r, "DHCP error: no lifetime: %m");
+ }
+
r = sd_dhcp_lease_get_router(lease, &router);
if (r < 0 && r != -ENODATA)
return log_link_error_errno(link, r, "DHCP error: Could not get gateway: %m");
@@ -582,12 +588,6 @@ static int dhcp_lease_acquired(sd_dhcp_client *client, Link *link) {
}
}
- if (!FLAGS_SET(link->network->keep_configuration, KEEP_CONFIGURATION_DHCP)) {
- r = sd_dhcp_lease_get_lifetime(link->dhcp_lease, &lifetime);
- if (r < 0)
- return log_link_warning_errno(link, r, "DHCP error: no lifetime: %m");
- }
-
r = dhcp4_update_address(link, &address, &netmask, lifetime);
if (r < 0) {
log_link_warning_errno(link, r, "Could not update IP address: %m");