From e6b1a31106a98bea2f1347feeacaa082185405e4 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Thu, 13 Apr 2017 17:28:22 +0200 Subject: [PATCH 1/2] vpn: avoid calling call_plugin_disconnect() without proxy Got an assertion due to priv-proxy unset. NMDevice: - _platform_link_cb_idle() - nm_device_unrealize() [NMDeviceTun] - nm_device_state_changed() - _set_state_full() NMVpnConnection: - _set_vpn_state() - call_plugin_disconnect() It seam to me, that can only happen if the NMVpnConnection never completed on_proxy_acquired() and is still in preparing state when being disconnected. Avoid that be checking whether we have a proxy. https://bugzilla.redhat.com/show_bug.cgi?id=1442064 (cherry picked from commit bc1d1c9df4c1d68233a3743dab030480aeed2831) --- src/vpn/nm-vpn-connection.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/vpn/nm-vpn-connection.c b/src/vpn/nm-vpn-connection.c index 464395dffa..ac86a7a96d 100644 --- a/src/vpn/nm-vpn-connection.c +++ b/src/vpn/nm-vpn-connection.c @@ -646,7 +646,8 @@ _set_vpn_state (NMVpnConnection *self, } /* Tear down and clean up the connection */ - call_plugin_disconnect (self); + if (priv->proxy) + call_plugin_disconnect (self); vpn_cleanup (self, parent_dev); /* fall through */ default: From 6bfd9b4e851f5a78d975b2de2a5e1493e073e4a2 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Thu, 13 Apr 2017 17:34:00 +0200 Subject: [PATCH 2/2] vpn: inline call_plugin_disconnect() There is only one caller. Don't bother moving the logic to a separate function. (cherry picked from commit b23484be720ac72a1a7e176813a179993d97f36e) --- src/vpn/nm-vpn-connection.c | 28 +++++++++++----------------- 1 file changed, 11 insertions(+), 17 deletions(-) diff --git a/src/vpn/nm-vpn-connection.c b/src/vpn/nm-vpn-connection.c index ac86a7a96d..4079195a09 100644 --- a/src/vpn/nm-vpn-connection.c +++ b/src/vpn/nm-vpn-connection.c @@ -358,21 +358,6 @@ disconnect_cb (GDBusProxy *proxy, GAsyncResult *result, gpointer user_data) g_object_unref (user_data); } -static void -call_plugin_disconnect (NMVpnConnection *self) -{ - NMVpnConnectionPrivate *priv = NM_VPN_CONNECTION_GET_PRIVATE (self); - - g_dbus_proxy_call (priv->proxy, - "Disconnect", - NULL, - G_DBUS_CALL_FLAGS_NONE, - -1, - priv->cancellable, - (GAsyncReadyCallback) disconnect_cb, - g_object_ref (self)); -} - static void fw_call_cleanup (NMVpnConnection *self) { @@ -646,8 +631,17 @@ _set_vpn_state (NMVpnConnection *self, } /* Tear down and clean up the connection */ - if (priv->proxy) - call_plugin_disconnect (self); + if (priv->proxy) { + g_dbus_proxy_call (priv->proxy, + "Disconnect", + NULL, + G_DBUS_CALL_FLAGS_NONE, + -1, + priv->cancellable, + (GAsyncReadyCallback) disconnect_cb, + g_object_ref (self)); + } + vpn_cleanup (self, parent_dev); /* fall through */ default: