summaryrefslogtreecommitdiff
path: root/libnm-glib/nm-vpn-plugin.c
diff options
context:
space:
mode:
authorDan Williams <dcbw@redhat.com>2012-06-11 10:14:38 -0500
committerDan Williams <dcbw@redhat.com>2012-06-11 10:17:12 -0500
commit11b8574f07ca1df74b84c51195ba76a3218d4c54 (patch)
tree32505d499fceedde5dd3e5783a87a6af394b992b /libnm-glib/nm-vpn-plugin.c
parentcd4edef5d31a59dc060f90bb5a19976ad32af34a (diff)
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.
Diffstat (limited to 'libnm-glib/nm-vpn-plugin.c')
-rw-r--r--libnm-glib/nm-vpn-plugin.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/libnm-glib/nm-vpn-plugin.c b/libnm-glib/nm-vpn-plugin.c
index d41a4f6ddf..c95b40217c 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