summaryrefslogtreecommitdiff
path: root/src/devices
diff options
context:
space:
mode:
authorLubomir Rintel <lkundrak@v3.sk>2016-02-24 13:12:24 +0100
committerLubomir Rintel <lkundrak@v3.sk>2016-04-01 23:48:22 +0200
commit747c4dff2ff3ce15b8a428308f3b36a242c29388 (patch)
tree6cac8e72e3ef47e7f564bcd5edc234407c08467e /src/devices
parent21c98f5da9b18764819669a2635ab674e912b14b (diff)
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 7d1709d7f6495b242943bd1ef7397dc75b15c055)
Diffstat (limited to 'src/devices')
-rw-r--r--src/devices/nm-device.c41
1 files changed, 29 insertions, 12 deletions
diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c
index 5ee2bad0c0..bc7ebcbe08 100644
--- a/src/devices/nm-device.c
+++ b/src/devices/nm-device.c
@@ -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);