diff options
| author | Michael Biebl <biebl@debian.org> | 2017-02-16 00:00:34 +0100 |
|---|---|---|
| committer | Michael Biebl <biebl@debian.org> | 2017-02-16 00:00:34 +0100 |
| commit | a222e56e103f949b148a6942e385ccca2c26d9f3 (patch) | |
| tree | 7978165f4d291224c854adb4c96c863a924b4882 /src/nm-manager.c | |
| parent | 7f4dff3943c64e1d0e5d13b2ac915088dde165e6 (diff) | |
New upstream version 1.6.2 upstream/1.6.2
Diffstat (limited to 'src/nm-manager.c')
| -rw-r--r-- | src/nm-manager.c | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/src/nm-manager.c b/src/nm-manager.c index 0c1d36e1..7dfaa5ab 100644 --- a/src/nm-manager.c +++ b/src/nm-manager.c @@ -3126,8 +3126,10 @@ _internal_activate_device (NMManager *self, NMActiveConnection *active, GError * * decides to go unmanaged while we're activating (perhaps because other slaves * go away leaving him with no kids). */ - nm_device_set_unmanaged_by_flags (master_device, NM_UNMANAGED_EXTERNAL_DOWN, - NM_UNMAN_FLAG_OP_FORGET, NM_DEVICE_STATE_REASON_USER_REQUESTED); + if (master_device) { + nm_device_set_unmanaged_by_flags (master_device, NM_UNMANAGED_EXTERNAL_DOWN, + NM_UNMAN_FLAG_OP_FORGET, NM_DEVICE_STATE_REASON_USER_REQUESTED); + } nm_active_connection_set_master (active, master_ac); _LOGD (LOGD_CORE, "Activation of '%s' depends on active connection %p %s", @@ -3877,20 +3879,12 @@ error: gboolean nm_manager_deactivate_connection (NMManager *manager, - const char *connection_path, + NMActiveConnection *active, NMDeviceStateReason reason, GError **error) { - NMActiveConnection *active; gboolean success = FALSE; - active = active_connection_get_by_path (manager, connection_path); - if (!active) { - g_set_error_literal (error, NM_MANAGER_ERROR, NM_MANAGER_ERROR_CONNECTION_NOT_ACTIVE, - "The connection was not active."); - return FALSE; - } - if (NM_IS_VPN_CONNECTION (active)) { NMVpnConnectionStateReason vpn_reason = NM_VPN_CONNECTION_STATE_REASON_USER_DISCONNECTED; @@ -3934,6 +3928,7 @@ deactivate_net_auth_done_cb (NMAuthChain *chain, path = nm_auth_chain_get_data (chain, "path"); result = nm_auth_chain_get_result (chain, NM_AUTH_PERMISSION_NETWORK_CONTROL); + active = active_connection_get_by_path (self, path); if (auth_error) { _LOGD (LOGD_CORE, "Disconnect request failed: %s", auth_error->message); @@ -3945,16 +3940,19 @@ deactivate_net_auth_done_cb (NMAuthChain *chain, error = g_error_new_literal (NM_MANAGER_ERROR, NM_MANAGER_ERROR_PERMISSION_DENIED, "Not authorized to deactivate connections"); + } else if (!active) { + error = g_error_new_literal (NM_MANAGER_ERROR, + NM_MANAGER_ERROR_CONNECTION_NOT_ACTIVE, + "The connection was not active."); } else { /* success; deactivation allowed */ if (!nm_manager_deactivate_connection (self, - path, + active, NM_DEVICE_STATE_REASON_USER_REQUESTED, &error)) nm_assert (error); } - active = active_connection_get_by_path (self, path); if (active) { nm_audit_log_connection_op (NM_AUDIT_OP_CONN_DEACTIVATE, nm_active_connection_get_settings_connection (active), |