From bf70ed2e868a4be60cbc0d7e8235d969e2704e39 Mon Sep 17 00:00:00 2001 From: Lubomir Rintel Date: Sat, 19 Nov 2016 10:33:11 +0100 Subject: [PATCH] vpn-manager: ignore ip configs from disconnected plugins Plugins could be already failed or disconnected when the helper fires. E.g. they could send in an invalid IP4Config that would cause them to fail and then follow with an IP6Config before they realize it's of no use. We'd hit an assertion failure in that case, because the NMVpnConnection would already be cleaned up. --- src/vpn-manager/nm-vpn-connection.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/vpn-manager/nm-vpn-connection.c b/src/vpn-manager/nm-vpn-connection.c index fbdd77e993..4158831007 100644 --- a/src/vpn-manager/nm-vpn-connection.c +++ b/src/vpn-manager/nm-vpn-connection.c @@ -1408,6 +1408,11 @@ nm_vpn_connection_ip4_config_get (NMVpnConnection *self, GVariant *dict) if (priv->vpn_state == STATE_CONNECT) _set_vpn_state (self, STATE_IP_CONFIG_GET, NM_VPN_CONNECTION_STATE_REASON_NONE, FALSE); + if (priv->vpn_state > STATE_ACTIVATED) { + _LOGI ("VPN connection: (IP4 Config Get) ignoring, the connection is no longer active"); + return; + } + if (priv->has_ip4) { _LOGI ("VPN connection: (IP4 Config Get) reply received"); @@ -1577,6 +1582,11 @@ nm_vpn_connection_ip6_config_get (NMVpnConnection *self, GVariant *dict) if (priv->vpn_state == STATE_CONNECT) _set_vpn_state (self, STATE_IP_CONFIG_GET, NM_VPN_CONNECTION_STATE_REASON_NONE, FALSE); + if (priv->vpn_state > STATE_ACTIVATED) { + _LOGI ("VPN connection: (IP6 Config Get) ignoring, the connection is no longer active"); + return; + } + if (g_variant_n_children (dict) == 0) { priv->has_ip6 = FALSE; nm_vpn_connection_config_maybe_complete (self, TRUE);