diff options
author | Beniamino Galvani <bgalvani@redhat.com> | 2018-04-19 15:30:31 +0200 |
---|---|---|
committer | Beniamino Galvani <bgalvani@redhat.com> | 2018-04-20 09:02:59 +0200 |
commit | a1c24eff68230ec6204e55031ca4f2dfe5eb467b (patch) | |
tree | a8a279c6bbf1a94fb92c891d955c9a0c12ce663b | |
parent | 47bafa07102373c843e756adc315f28240a1aef2 (diff) | |
download | NetworkManager-bg/manager-vpn-fixes.tar.gz |
manager: fix assertions when activating VPNsbg/manager-vpn-fixes
_new_active_connection() can be called with both a device and a
specific object set when activating secondaries.
Fixes: 10753c36168a82cd658df8a7da800960fddd78ed
-rw-r--r-- | src/nm-manager.c | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/src/nm-manager.c b/src/nm-manager.c index ca04cce2ae..1ccfad8ebf 100644 --- a/src/nm-manager.c +++ b/src/nm-manager.c @@ -4017,15 +4017,13 @@ _new_active_connection (NMManager *self, { NMManagerPrivate *priv = NM_MANAGER_GET_PRIVATE (self); NMSettingsConnection *settings_connection = NULL; + NMDevice *parent_device; g_return_val_if_fail (NM_IS_CONNECTION (connection), NULL); g_return_val_if_fail (NM_IS_AUTH_SUBJECT (subject), NULL); nm_assert (is_vpn == _connection_is_vpn (connection)); - - nm_assert ( ( is_vpn && !device) - || (!is_vpn && NM_IS_DEVICE (device))); - + nm_assert (is_vpn || NM_IS_DEVICE (device)); nm_assert (!nm_streq0 (specific_object, "/")); if (NM_IS_SETTINGS_CONNECTION (connection)) @@ -4069,15 +4067,21 @@ _new_active_connection (NMManager *self, return NULL; } - device = nm_active_connection_get_device (parent); - if (!device) { + parent_device = nm_active_connection_get_device (parent); + if (!parent_device) { g_set_error_literal (error, NM_MANAGER_ERROR, NM_MANAGER_ERROR_UNKNOWN_DEVICE, "Source connection had no active device"); return NULL; } + if (device && device != parent_device) { + g_set_error_literal (error, NM_MANAGER_ERROR, NM_MANAGER_ERROR_UNKNOWN_DEVICE, + "The device doesn't match the active connection."); + return NULL; + } + return (NMActiveConnection *) nm_vpn_connection_new (settings_connection, - device, + parent_device, nm_dbus_object_get_path (NM_DBUS_OBJECT (parent)), activation_reason, subject); |