From 3c236c88ebe396cff6ca492f1cc1cf1c30ed0e8c Mon Sep 17 00:00:00 2001 From: Dan Winship Date: Tue, 12 Nov 2013 14:18:44 -0500 Subject: [PATCH] core: fix re-activation of existing active connection The change to allow an NMConnection to only be active on a single device accidentally broke the case of re-activating a connection on the same device. Fix that. --- src/nm-manager.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/nm-manager.c b/src/nm-manager.c index 7555930d7a..039a6067e6 100644 --- a/src/nm-manager.c +++ b/src/nm-manager.c @@ -2894,20 +2894,23 @@ _new_active_connection (NMManager *self, /* Can't create new AC for already-active connection */ existing_ac = find_ac_for_connection (self, connection); + if (NM_IS_VPN_CONNECTION (existing_ac)) { + g_set_error (error, NM_MANAGER_ERROR, NM_MANAGER_ERROR_CONNECTION_ALREADY_ACTIVE, + "Connection '%s' is already active", + nm_connection_get_id (connection)); + return NULL; + } + if (existing_ac) { NMDevice *existing_device = nm_active_connection_get_device (existing_ac); - if (NM_IS_VPN_CONNECTION (existing_ac) || existing_device == device) { - g_set_error (error, NM_MANAGER_ERROR, NM_MANAGER_ERROR_CONNECTION_ALREADY_ACTIVE, - "Connection '%s' is already active", - nm_connection_get_id (connection)); - } else { + if (existing_device != device) { g_set_error (error, NM_MANAGER_ERROR, NM_MANAGER_ERROR_CONNECTION_ALREADY_ACTIVE, "Connection '%s' is already active on %s", nm_connection_get_id (connection), nm_device_get_iface (existing_device)); + return NULL; } - return NULL; } /* Normalize the specific object */