summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLubomir Rintel <lkundrak@v3.sk>2017-10-23 11:59:23 +0200
committerLubomir Rintel <lkundrak@v3.sk>2017-10-26 20:23:02 +0200
commit5b669fc09774dd972f2eb04ed297b685dbb63360 (patch)
tree4ca748ad9dfddce6a942274e48a7bea334f7d73a
parenta67e869073e85662f37eae70c4c0e9e153a9a82a (diff)
downloadNetworkManager-5b669fc09774dd972f2eb04ed297b685dbb63360.tar.gz
device: don't progress from ip-config state when we're enslaved
We now can be enslaved and have L3 configuration at the same time. This also reduces some unnecessary complexity, because the decision to progress to IP_CHECK or SECONDARIES now happens in a single place, in the check_ip_state() routine.
-rw-r--r--src/devices/nm-device.c46
1 files changed, 7 insertions, 39 deletions
diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c
index b182b8d8e0..53b7c390be 100644
--- a/src/devices/nm-device.c
+++ b/src/devices/nm-device.c
@@ -3928,6 +3928,12 @@ check_ip_state (NMDevice *self, gboolean may_fail)
if (nm_device_get_state (self) != NM_DEVICE_STATE_IP_CONFIG)
return;
+ /* Don't progress into IP_CHECK or SECONDARIES if we're waiting for the
+ * master to enslave us. */
+ if ( nm_active_connection_get_master (NM_ACTIVE_CONNECTION (priv->act_request))
+ && !priv->is_enslaved)
+ return;
+
s_ip4 = (NMSettingIPConfig *) nm_device_get_applied_setting (self, NM_TYPE_SETTING_IP4_CONFIG);
if (s_ip4 && nm_streq0 (nm_setting_ip_config_get_method (s_ip4),
NM_SETTING_IP4_CONFIG_METHOD_DISABLED))
@@ -4022,10 +4028,8 @@ nm_device_slave_notify_enslave (NMDevice *self, gboolean success)
}
if (activating) {
- _set_ip_state (self, AF_INET, IP_DONE);
- _set_ip_state (self, AF_INET6, IP_DONE);
if (success)
- nm_device_queue_state (self, NM_DEVICE_STATE_SECONDARIES, NM_DEVICE_STATE_REASON_NONE);
+ check_ip_state (self, FALSE);
else
nm_device_queue_state (self, NM_DEVICE_STATE_FAILED, NM_DEVICE_STATE_REASON_UNKNOWN);
} else
@@ -8009,12 +8013,6 @@ nm_device_activate_stage3_ip4_start (NMDevice *self)
g_assert (priv->ip4_state == IP_WAIT);
- /* Slaves stay in IP_CONFIG state until master is ready, and then
- * they go directly to SECONDARIES without configuring IPv4.
- */
- if (nm_active_connection_get_master (NM_ACTIVE_CONNECTION (priv->act_request)))
- return TRUE;
-
_set_ip_state (self, AF_INET, IP_CONF);
ret = NM_DEVICE_GET_CLASS (self)->act_stage3_ip4_config_start (self, &ip4_config, &failure_reason);
if (ret == NM_ACT_STAGE_RETURN_SUCCESS) {
@@ -8056,12 +8054,6 @@ nm_device_activate_stage3_ip6_start (NMDevice *self)
g_assert (priv->ip6_state == IP_WAIT);
- /* Slaves stay in IP_CONFIG state until master is ready, and then
- * they go directly to SECONDARIES without configuring IPv6.
- */
- if (nm_active_connection_get_master (NM_ACTIVE_CONNECTION (priv->act_request)))
- return TRUE;
-
_set_ip_state (self, AF_INET6, IP_CONF);
ret = NM_DEVICE_GET_CLASS (self)->act_stage3_ip6_config_start (self, &ip6_config, &failure_reason);
if (ret == NM_ACT_STAGE_RETURN_SUCCESS) {
@@ -8100,10 +8092,6 @@ nm_device_activate_stage3_ip6_start (NMDevice *self)
static void
activate_stage3_ip_config_start (NMDevice *self)
{
- NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self);
- NMActiveConnection *master;
- NMDevice *master_device;
-
_set_ip_state (self, AF_INET, IP_WAIT);
_set_ip_state (self, AF_INET6, IP_WAIT);
@@ -8116,26 +8104,6 @@ activate_stage3_ip_config_start (NMDevice *self)
if (!nm_platform_link_is_up (nm_device_get_platform (self), nm_device_get_ip_ifindex (self)))
_LOGW (LOGD_DEVICE, "interface %s not up for IP configuration", nm_device_get_ip_iface (self));
- /* If the device is a slave, then we don't do any IP configuration but we
- * use the IP config stage to indicate to the master we're ready for
- * enslavement. If the master is already activating, it will have tried to
- * enslave us when we changed state to IP_CONFIG, causing us to queue a
- * transition to SECONDARIES (or FAILED if the enslavement failed), with
- * our IP states set to IP_DONE either way. If the master isn't yet
- * activating, then they'll still be in IP_WAIT. Either way, we bail out
- * of IP config here.
- */
- master = nm_active_connection_get_master (NM_ACTIVE_CONNECTION (priv->act_request));
- if (master) {
- master_device = nm_active_connection_get_device (master);
- if (priv->ip4_state == IP_WAIT && priv->ip6_state == IP_WAIT) {
- _LOGI (LOGD_DEVICE, "Activation: connection '%s' waiting on master '%s'",
- nm_connection_get_id (nm_device_get_applied_connection (self)),
- master_device ? nm_device_get_iface (master_device) : "(unknown)");
- }
- return;
- }
-
/* IPv4 */
if ( nm_device_activate_ip4_state_in_wait (self)
&& !nm_device_activate_stage3_ip4_start (self))