summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLubomir Rintel <lkundrak@v3.sk>2015-06-24 18:24:22 +0200
committerLubomir Rintel <lkundrak@v3.sk>2015-06-24 18:24:22 +0200
commit44c36f1b16dca04b40ceb6aa59e33db97cf3afd1 (patch)
tree6b01ac5c09a8853f33ff55c372e5baa19ba2f0c4
parentc4e6dd71a531605b19e288c7d1800650b3b6c4c3 (diff)
parent7a066a35ad8c48aac669dce286be499663eb9cd8 (diff)
downloadNetworkManager-44c36f1b16dca04b40ceb6aa59e33db97cf3afd1.tar.gz
merge: branch 'lr/master-activations'
https://bugzilla.gnome.org/show_bug.cgi?id=750595
-rw-r--r--src/nm-active-connection.c5
-rw-r--r--src/nm-manager.c30
-rw-r--r--src/settings/plugins/ifcfg-rh/reader.c11
3 files changed, 34 insertions, 12 deletions
diff --git a/src/nm-active-connection.c b/src/nm-active-connection.c
index 2b7296196d..b0bdd77a81 100644
--- a/src/nm-active-connection.c
+++ b/src/nm-active-connection.c
@@ -530,6 +530,7 @@ master_state_cb (NMActiveConnection *master,
gpointer user_data)
{
NMActiveConnection *self = NM_ACTIVE_CONNECTION (user_data);
+ NMActiveConnectionPrivate *priv = NM_ACTIVE_CONNECTION_GET_PRIVATE (self);
NMActiveConnectionState master_state = nm_active_connection_get_state (master);
check_master_ready (self);
@@ -537,8 +538,8 @@ master_state_cb (NMActiveConnection *master,
nm_log_dbg (LOGD_DEVICE, "(%p): master ActiveConnection [%p] state now '%s' (%d)",
self, master, state_to_string (master_state), master_state);
- if (master_state == NM_ACTIVE_CONNECTION_STATE_DEACTIVATING &&
- nm_active_connection_get_device (master) == NULL) {
+ if ( master_state >= NM_ACTIVE_CONNECTION_STATE_DEACTIVATING
+ && !priv->master_ready) {
/* Master failed without ever creating its device */
if (NM_ACTIVE_CONNECTION_GET_CLASS (self)->master_failed)
NM_ACTIVE_CONNECTION_GET_CLASS (self)->master_failed (self);
diff --git a/src/nm-manager.c b/src/nm-manager.c
index f5f4ba80d6..13decd6d4f 100644
--- a/src/nm-manager.c
+++ b/src/nm-manager.c
@@ -154,6 +154,7 @@ typedef struct {
char *state_file;
GSList *active_connections;
+ GSList *authorizing_connections;
guint ac_cleanup_id;
NMActiveConnection *primary_connection;
NMActiveConnection *activating_connection;
@@ -2696,9 +2697,9 @@ _internal_activate_device (NMManager *self, NMActiveConnection *active, GError *
}
nm_active_connection_set_master (active, master_ac);
- nm_log_dbg (LOGD_CORE, "Activation of '%s' depends on active connection %s",
+ nm_log_dbg (LOGD_CORE, "Activation of '%s' depends on active connection %p",
nm_connection_get_id (connection),
- nm_active_connection_get_path (master_ac));
+ master_ac);
}
/* Check slaves for master connection and possibly activate them */
@@ -2857,8 +2858,11 @@ _internal_activation_auth_done (NMActiveConnection *active,
gpointer user_data2)
{
NMManager *self = user_data1;
+ NMManagerPrivate *priv = NM_MANAGER_GET_PRIVATE (self);
GError *error = NULL;
+ priv->authorizing_connections = g_slist_remove (priv->authorizing_connections, active);
+
if (success) {
if (_internal_activate_generic (self, active, &error)) {
g_object_unref (active);
@@ -2898,8 +2902,10 @@ nm_manager_activate_connection (NMManager *self,
NMAuthSubject *subject,
GError **error)
{
+ NMManagerPrivate *priv = NM_MANAGER_GET_PRIVATE (self);
NMActiveConnection *active;
char *error_desc = NULL;
+ GSList *iter;
g_return_val_if_fail (self != NULL, NULL);
g_return_val_if_fail (connection != NULL, NULL);
@@ -2918,14 +2924,32 @@ nm_manager_activate_connection (NMManager *self,
return NULL;
}
+ /* Look for a active connection that's equivalent and is already pending authorization
+ * and eventual activation. This is used to de-duplicate concurrent activations which would
+ * otherwise race and cause the device to disconnect and reconnect repeatedly.
+ * In particular, this allows the master and multiple slaves to concurrently auto-activate
+ * while all the slaves would use the same active-connection. */
+ for (iter = priv->authorizing_connections; iter; iter = g_slist_next (iter)) {
+ active = iter->data;
+
+ if ( connection == nm_active_connection_get_connection (active)
+ && g_strcmp0 (nm_active_connection_get_specific_object (active), specific_object) == 0
+ && nm_active_connection_get_device (active) == device
+ && nm_auth_subject_is_internal (nm_active_connection_get_subject (active))
+ && nm_auth_subject_is_internal (subject))
+ return active;
+ }
+
active = _new_active_connection (self,
connection,
specific_object,
device,
subject,
error);
- if (active)
+ if (active) {
+ priv->authorizing_connections = g_slist_prepend (priv->authorizing_connections, active);
nm_active_connection_authorize (active, _internal_activation_auth_done, self, NULL);
+ }
return active;
}
diff --git a/src/settings/plugins/ifcfg-rh/reader.c b/src/settings/plugins/ifcfg-rh/reader.c
index 9dcf5f3b59..29c7854dd1 100644
--- a/src/settings/plugins/ifcfg-rh/reader.c
+++ b/src/settings/plugins/ifcfg-rh/reader.c
@@ -4493,13 +4493,10 @@ make_vlan_setting (shvarFile *ifcfg,
/* Grab VLAN ID from interface name; this takes precedence over the
* separate VLAN_ID property for backwards compat.
*/
- vlan_id = (gint) g_ascii_strtoll (p, &end, 10);
- if (vlan_id < 0 || vlan_id > 4095 || end == p || *end) {
- g_set_error (error, NM_SETTINGS_ERROR, NM_SETTINGS_ERROR_INVALID_CONNECTION,
- "Failed to determine VLAN ID from DEVICE '%s'",
- iface_name);
- goto error;
- }
+
+ gint device_vlan_id = (gint) g_ascii_strtoll (p, &end, 10);
+ if (device_vlan_id >= 0 && device_vlan_id <= 4095 && end != p && !*end)
+ vlan_id = device_vlan_id;
}
}