Commit 4ca3d80f authored by Matthew Barnes's avatar Matthew Barnes Committed by Dan Winship

g_network_monitor_base_can_reach: Check for default route after enumerating.

Enumerate the GSocketConnectable before checking for a default route.
For some connectable types this will involve a DNS lookup.  This will
elminate false positives for hosts behind a VPN since DNS lookup will
fail if the VPN is not connected.

https://bugzilla.gnome.org/show_bug.cgi?id=694181
parent c6c11665
...@@ -168,10 +168,6 @@ g_network_monitor_base_can_reach (GNetworkMonitor *monitor, ...@@ -168,10 +168,6 @@ g_network_monitor_base_can_reach (GNetworkMonitor *monitor,
GSocketAddressEnumerator *enumerator; GSocketAddressEnumerator *enumerator;
GSocketAddress *addr; GSocketAddress *addr;
if (priv->have_ipv4_default_route &&
priv->have_ipv6_default_route)
return TRUE;
if (priv->networks->len == 0) if (priv->networks->len == 0)
{ {
g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_NETWORK_UNREACHABLE, g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_NETWORK_UNREACHABLE,
...@@ -188,6 +184,14 @@ g_network_monitor_base_can_reach (GNetworkMonitor *monitor, ...@@ -188,6 +184,14 @@ g_network_monitor_base_can_reach (GNetworkMonitor *monitor,
return FALSE; return FALSE;
} }
if (priv->have_ipv4_default_route &&
priv->have_ipv6_default_route)
{
g_object_unref (enumerator);
g_object_unref (addr);
return TRUE;
}
while (addr) while (addr)
{ {
if (G_IS_INET_SOCKET_ADDRESS (addr)) if (G_IS_INET_SOCKET_ADDRESS (addr))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment