diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c index 51c08acb3..ea5f3affe 100644 --- a/src/devices/nm-device.c +++ b/src/devices/nm-device.c @@ -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); } diff --git a/src/nm-manager.c b/src/nm-manager.c index 51d11ced3..be2f11846 100644 --- a/src/nm-manager.c +++ b/src/nm-manager.c @@ -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