mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-02 04:10:17 +01:00
device: check may_fail when progressing to IP_CHECK
Don't let the device progress to check and then in turn to activated unless all
the required IP configuration is in place.
(cherry picked from commit 7d1709d7f6)
This commit is contained in:
parent
21c98f5da9
commit
747c4dff2f
1 changed files with 29 additions and 12 deletions
|
|
@ -3266,6 +3266,28 @@ dhcp4_cleanup (NMDevice *self, CleanupType cleanup_type, gboolean release)
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* check_ip_done
|
||||
*
|
||||
* Progress the device to ip connectivity check state if IPv4 or IPv6 succeeded
|
||||
*/
|
||||
static void
|
||||
check_ip_done (NMDevice *self)
|
||||
{
|
||||
NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self);
|
||||
|
||||
if (nm_device_get_state (self) != NM_DEVICE_STATE_IP_CONFIG)
|
||||
return;
|
||||
|
||||
if (priv->ip4_state != IP_DONE && !get_ip_config_may_fail (self, AF_INET))
|
||||
return;
|
||||
|
||||
if (priv->ip6_state != IP_DONE && !get_ip_config_may_fail (self, AF_INET6))
|
||||
return;
|
||||
|
||||
nm_device_state_changed (self, NM_DEVICE_STATE_IP_CHECK, NM_DEVICE_STATE_REASON_NONE);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
ip4_config_merge_and_apply (NMDevice *self,
|
||||
NMIP4Config *config,
|
||||
|
|
@ -5309,8 +5331,7 @@ nm_device_activate_stage3_ip6_start (NMDevice *self)
|
|||
} else if (ret == NM_ACT_STAGE_RETURN_FINISH) {
|
||||
/* Early finish, nothing more to do */
|
||||
priv->ip6_state = IP_DONE;
|
||||
if (nm_device_get_state (self) == NM_DEVICE_STATE_IP_CONFIG)
|
||||
nm_device_state_changed (self, NM_DEVICE_STATE_IP_CHECK, NM_DEVICE_STATE_REASON_NONE);
|
||||
check_ip_done (self);
|
||||
} else if (ret == NM_ACT_STAGE_RETURN_WAIT) {
|
||||
/* Wait for something to try IP config again */
|
||||
priv->ip6_state = IP_WAIT;
|
||||
|
|
@ -5894,13 +5915,11 @@ nm_device_activate_ip4_config_commit (gpointer user_data)
|
|||
|
||||
arp_announce (self);
|
||||
|
||||
/* Enter the IP_CHECK state if this is the first method to complete */
|
||||
priv->ip4_state = IP_DONE;
|
||||
|
||||
nm_device_remove_pending_action (self, PENDING_ACTION_DHCP4, FALSE);
|
||||
|
||||
if (nm_device_get_state (self) == NM_DEVICE_STATE_IP_CONFIG)
|
||||
nm_device_state_changed (self, NM_DEVICE_STATE_IP_CHECK, NM_DEVICE_STATE_REASON_NONE);
|
||||
/* Enter the IP_CHECK state if this is the first method to complete */
|
||||
priv->ip4_state = IP_DONE;
|
||||
check_ip_done (self);
|
||||
|
||||
out:
|
||||
_LOGD (LOGD_DEVICE, "Activation: Stage 5 of 5 (IPv4 Commit) complete.");
|
||||
|
|
@ -6001,14 +6020,12 @@ nm_device_activate_ip6_config_commit (gpointer user_data)
|
|||
NULL);
|
||||
}
|
||||
|
||||
/* Enter the IP_CHECK state if this is the first method to complete */
|
||||
priv->ip6_state = IP_DONE;
|
||||
|
||||
nm_device_remove_pending_action (self, PENDING_ACTION_DHCP6, FALSE);
|
||||
nm_device_remove_pending_action (self, PENDING_ACTION_AUTOCONF6, FALSE);
|
||||
|
||||
if (nm_device_get_state (self) == NM_DEVICE_STATE_IP_CONFIG)
|
||||
nm_device_state_changed (self, NM_DEVICE_STATE_IP_CHECK, NM_DEVICE_STATE_REASON_NONE);
|
||||
/* Enter the IP_CHECK state if this is the first method to complete */
|
||||
priv->ip6_state = IP_DONE;
|
||||
check_ip_done (self);
|
||||
} else {
|
||||
_LOGW (LOGD_DEVICE | LOGD_IP6, "Activation: Stage 5 of 5 (IPv6 Commit) failed");
|
||||
nm_device_state_changed (self, NM_DEVICE_STATE_FAILED, reason);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue