From 11b8574f07ca1df74b84c51195ba76a3218d4c54 Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Mon, 11 Jun 2012 10:14:38 -0500 Subject: [PATCH] vpn: fix connect timeout issue with old IPv4-only plugins Old plugins (ie, that aren't IPv6 capable) don't send the 'config' signal, and thus have no way of signalling which IP methods they have support for. Which means they won't set priv->has_ip4 and thus the connect timer will kill the connection after a minute. So track whether we got a 'config' signal, and if we didn't, but we did get an 'ip4-config' signal (which means this is an old plugin) then we just assume that the plugin supports IPv4. This allows the connect timer to be canceled and the plugin to advance to the STARTED state. --- libnm-glib/nm-vpn-plugin.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/libnm-glib/nm-vpn-plugin.c b/libnm-glib/nm-vpn-plugin.c index d41a4f6dd..c95b40217 100644 --- a/libnm-glib/nm-vpn-plugin.c +++ b/libnm-glib/nm-vpn-plugin.c @@ -76,6 +76,7 @@ typedef struct { guint quit_timer; guint fail_stop_id; + gboolean got_config; gboolean has_ip4, got_ip4; gboolean has_ip6, got_ip6; @@ -341,6 +342,8 @@ nm_vpn_plugin_set_config (NMVPNPlugin *plugin, g_return_if_fail (NM_IS_VPN_PLUGIN (plugin)); g_return_if_fail (config != NULL); + priv->got_config = TRUE; + val = g_hash_table_lookup (config, NM_VPN_PLUGIN_CONFIG_HAS_IP4); if (val && g_value_get_boolean (val)) priv->has_ip4 = TRUE; @@ -391,6 +394,14 @@ nm_vpn_plugin_set_ip4_config (NMVPNPlugin *plugin, priv->got_ip4 = TRUE; + /* Old plugins won't send the "config" signal and thus can't send + * NM_VPN_PLUGIN_CONFIG_HAS_IP4 either. But since they don't support IPv6, + * we can safely assume that, if we don't receive a "config" signal but do + * receive an "ip4-config" signal, the old plugin supports IPv4. + */ + if (!priv->got_config) + priv->has_ip4 = TRUE; + /* Older NetworkManager daemons expect all config info to be in * the ip4 config, so they won't even notice the "config" signal * being emitted. So just copy all of that data into the ip4