core: export ActiveConnection before handing it to the device (bgo #723783)
The AC doesn't get a D-Bus path until it's exported, but that happens after it's handed to the Device it will be activated on. The Device emits a PropertyChanged event when it's handed the AC, but it ignores ACs that aren't exported yet. Thus when activating, the Device doesn't emit the AC's path at all in the ActiveConnection property because it's NULL. Fix that by exporting the AC immediately before starting activation with it. Second, move the notification of the Device.ActiveConnection property to be emitted along with the state change to PREPARE instead of long before it. While we don't guarantee signal ordering in general, this seems like a more correct ordering. https://bugzilla.gnome.org/show_bug.cgi?id=723783
This commit is contained in:
@@ -2168,6 +2168,9 @@ nm_device_activate_stage1_device_prepare (gpointer user_data)
|
||||
|
||||
priv->ip4_state = priv->ip6_state = IP_NONE;
|
||||
|
||||
/* Notify the new ActiveConnection along with the state change */
|
||||
g_object_notify (G_OBJECT (self), NM_DEVICE_ACTIVE_CONNECTION);
|
||||
|
||||
iface = nm_device_get_iface (self);
|
||||
nm_log_info (LOGD_DEVICE, "Activation (%s) Stage 1 of 5 (Device Prepare) started...", iface);
|
||||
nm_device_state_changed (self, NM_DEVICE_STATE_PREPARE, NM_DEVICE_STATE_REASON_NONE);
|
||||
@@ -4938,8 +4941,10 @@ _device_activate (NMDevice *self, NMActRequest *req)
|
||||
NM_DEVICE_STATE_REASON_NOW_MANAGED);
|
||||
}
|
||||
|
||||
/* note: don't notify D-Bus of the new AC here, but do it later when
|
||||
* changing state to PREPARE so that the two properties change together.
|
||||
*/
|
||||
priv->act_request = g_object_ref (req);
|
||||
g_object_notify (G_OBJECT (self), NM_DEVICE_ACTIVE_CONNECTION);
|
||||
|
||||
nm_device_activate_schedule_stage1_device_prepare (self);
|
||||
}
|
||||
|
@@ -2597,11 +2597,18 @@ ensure_master_active_connection (NMManager *self,
|
||||
static gboolean
|
||||
_internal_activate_vpn (NMManager *self, NMActiveConnection *active, GError **error)
|
||||
{
|
||||
gboolean success;
|
||||
|
||||
g_assert (NM_IS_VPN_CONNECTION (active));
|
||||
|
||||
return nm_vpn_manager_activate_connection (NM_MANAGER_GET_PRIVATE (self)->vpn_manager,
|
||||
NM_VPN_CONNECTION (active),
|
||||
error);
|
||||
success = nm_vpn_manager_activate_connection (NM_MANAGER_GET_PRIVATE (self)->vpn_manager,
|
||||
NM_VPN_CONNECTION (active),
|
||||
error);
|
||||
if (success) {
|
||||
nm_active_connection_export (active);
|
||||
g_object_notify (G_OBJECT (self), NM_MANAGER_ACTIVE_CONNECTIONS);
|
||||
}
|
||||
return success;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
@@ -2732,7 +2739,9 @@ _internal_activate_device (NMManager *self, NMActiveConnection *active, GError *
|
||||
nm_active_connection_get_path (master_ac));
|
||||
}
|
||||
|
||||
/* Start the new activation */
|
||||
/* Export the new ActiveConnection to clients and start it on the device */
|
||||
nm_active_connection_export (active);
|
||||
g_object_notify (G_OBJECT (self), NM_MANAGER_ACTIVE_CONNECTIONS);
|
||||
nm_device_queue_activation (device, NM_ACT_REQUEST (active));
|
||||
return TRUE;
|
||||
}
|
||||
@@ -2760,9 +2769,6 @@ _internal_activate_generic (NMManager *self, NMActiveConnection *active, GError
|
||||
success = _internal_activate_device (self, active, error);
|
||||
|
||||
if (success) {
|
||||
nm_active_connection_export (active);
|
||||
g_object_notify (G_OBJECT (self), NM_MANAGER_ACTIVE_CONNECTIONS);
|
||||
|
||||
/* Force an update of the Manager's activating-connection property.
|
||||
* The device changes state before the AC gets exported, which causes
|
||||
* the manager's 'activating-connection' property to be NULL since the
|
||||
|
Reference in New Issue
Block a user