summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2019-12-21 00:19:25 +0900
committerYu Watanabe <watanabe.yu+github@gmail.com>2019-12-21 00:26:44 +0900
commitc1d3fa29ca9d132c05acbd40c6ee2f34e5663d97 (patch)
tree39a2c682e64ddbaa4d256112a18e8df4e3a38570 /src
parent0f3ff4eae2f3b32616d2c6f85cb99f7faae5cfa6 (diff)
downloadsystemd-c1d3fa29ca9d132c05acbd40c6ee2f34e5663d97.tar.gz
network: link should not become configured state during ACD probing
Diffstat (limited to 'src')
-rw-r--r--src/network/networkd-dhcp4.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/src/network/networkd-dhcp4.c b/src/network/networkd-dhcp4.c
index c000159ec1..fc8f44d6aa 100644
--- a/src/network/networkd-dhcp4.c
+++ b/src/network/networkd-dhcp4.c
@@ -48,6 +48,15 @@ void dhcp4_release_old_lease(Link *link) {
link_dirty(link);
}
+static void dhcp4_check_ready(Link *link) {
+ if (link->dhcp4_messages == 0) {
+ link->dhcp4_configured = true;
+ /* New address and routes are configured now. Let's release old lease. */
+ dhcp4_release_old_lease(link);
+ link_check_ready(link);
+ }
+}
+
static int dhcp4_route_handler(sd_netlink *rtnl, sd_netlink_message *m, Link *link) {
int r;
@@ -89,10 +98,8 @@ static int dhcp4_route_handler(sd_netlink *rtnl, sd_netlink_message *m, Link *li
return 1;
}
- link->dhcp4_configured = true;
- /* New address and routes are configured now. Let's release old lease. */
- dhcp4_release_old_lease(link);
- link_check_ready(link);
+ if (!link->network->dhcp_send_decline)
+ dhcp4_check_ready(link);
}
return 1;
@@ -677,7 +684,7 @@ static void dhcp_address_on_acd(sd_ipv4acd *acd, int event, void *userdata) {
(void) in_addr_to_string(AF_INET, &address, &pretty);
log_link_debug(link, "Successfully claimed DHCP4 address %s", strna(pretty));
}
- link_check_ready(link);
+ dhcp4_check_ready(link);
break;
case SD_IPV4ACD_EVENT_CONFLICT:
@@ -756,14 +763,6 @@ static int dhcp4_address_handler(sd_netlink *rtnl, sd_netlink_message *m, Link *
return 1;
}
- if (link->dhcp4_messages == 0) {
- link->dhcp4_configured = true;
- /* The new address is configured, and no route is requested.
- * Let's drop the old lease. */
- dhcp4_release_old_lease(link);
- link_check_ready(link);
- }
-
if (link->network->dhcp_send_decline) {
union in_addr_union addr;
@@ -787,7 +786,8 @@ static int dhcp4_address_handler(sd_netlink *rtnl, sd_netlink_message *m, Link *
r = sd_ipv4acd_start(link->network->dhcp_acd, true);
if (r < 0)
log_link_warning_errno(link, r, "Failed to start IPv4ACD client, ignoring: %m");
- }
+ } else
+ dhcp4_check_ready(link);
return 1;
}