Commit 16389f10 authored by Thomas Haller's avatar Thomas Haller Committed by Beniamino Galvani

core: implement connection.multi-connect to activate profiles multiple times

Make use of the new property, and implement it.

See previous commits for the reasons why.

https://bugzilla.redhat.com/show_bug.cgi?id=1555012
parent 07a42191
......@@ -9,6 +9,8 @@ with the later release.
USE AT YOUR OWN RISK. NOT RECOMMENDED FOR PRODUCTION USE!
* Added support for IEEE 802.15.4 and 6LowPAN devices.
* Support activating profile multiple times via connection.multi-connect
setting.
The following changes were backported to 1.12.x releases between 1.12.0
and 1.12.2 are also present in NetworkManager-1.14:
......
......@@ -2485,6 +2485,7 @@ get_existing_connection (NMManager *self,
*/
if ( assume_state_connection_uuid
&& (connection_checked = nm_settings_get_connection_by_uuid (priv->settings, assume_state_connection_uuid))
/*XXX: consider connection multi_connect. */
&& !active_connection_find (self, connection_checked, NULL,
NM_ACTIVE_CONNECTION_STATE_ACTIVATED,
NULL)
......@@ -4116,6 +4117,7 @@ _internal_activate_device (NMManager *self, NMActiveConnection *active, GError *
NMActiveConnection *master_ac = NULL;
NMAuthSubject *subject;
GError *local = NULL;
NMConnectionMultiConnect multi_connect;
g_return_val_if_fail (NM_IS_MANAGER (self), FALSE);
g_return_val_if_fail (NM_IS_ACTIVE_CONNECTION (active), FALSE);
......@@ -4276,7 +4278,15 @@ _internal_activate_device (NMManager *self, NMActiveConnection *active, GError *
/* Check slaves for master connection and possibly activate them */
autoconnect_slaves (self, connection, device, nm_active_connection_get_subject (active));
{
multi_connect = _nm_connection_get_multi_connect (NM_CONNECTION (connection));
if ( multi_connect == NM_CONNECTION_MULTI_CONNECT_MULTIPLE
|| ( multi_connect == NM_CONNECTION_MULTI_CONNECT_MANUAL_MULTIPLE
&& NM_IN_SET (nm_active_connection_get_activation_reason (active),
NM_ACTIVATION_REASON_ASSUME,
NM_ACTIVATION_REASON_AUTOCONNECT_SLAVES,
NM_ACTIVATION_REASON_USER_REQUEST))) {
/* the profile can be activated multiple times. Proceed. */
} else {
gs_unref_ptrarray GPtrArray *all_ac_arr = NULL;
NMActiveConnection *ac;
guint i, n_all;
......
......@@ -1235,7 +1235,7 @@ auto_activate_device (NMPolicy *self,
if (!nm_device_autoconnect_allowed (device))
return;
connections = nm_manager_get_activatable_connections (priv->manager, FALSE, TRUE, &len);
connections = nm_manager_get_activatable_connections (priv->manager, TRUE, TRUE, &len);
if (!connections[0])
return;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment