summaryrefslogtreecommitdiffstats
path: root/tun.c
diff options
context:
space:
mode:
authorDavid Sommerseth <davids@redhat.com>2011-08-24 13:06:39 +0200
committerDavid Sommerseth <davids@redhat.com>2011-08-24 13:06:39 +0200
commit20fc33707eab708dfd7e8ffcf2eea0f8362b10b3 (patch)
tree7f60234df8fc0e073cf40ea25361d1e3f35bed50 /tun.c
parent3b75dec3e32e7d838ed56be5667d1cf3ac4cef18 (diff)
parent576dc96ca1ef1badb651e05ac694f07c91e02518 (diff)
downloadopenvpn-20fc33707eab708dfd7e8ffcf2eea0f8362b10b3.tar.gz
openvpn-20fc33707eab708dfd7e8ffcf2eea0f8362b10b3.tar.xz
openvpn-20fc33707eab708dfd7e8ffcf2eea0f8362b10b3.zip
Merge branch 'svn-merger'
Diffstat (limited to 'tun.c')
-rw-r--r--tun.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/tun.c b/tun.c
index aa7f667..1d3f8bc 100644
--- a/tun.c
+++ b/tun.c
@@ -248,11 +248,12 @@ check_subnet_conflict (const in_addr_t ip,
const in_addr_t netmask,
const char *prefix)
{
+#if 0 /* too many false positives */
struct gc_arena gc = gc_new ();
in_addr_t lan_gw = 0;
in_addr_t lan_netmask = 0;
- if (get_default_gateway (&lan_gw, &lan_netmask))
+ if (get_default_gateway (&lan_gw, &lan_netmask) && lan_netmask)
{
const in_addr_t lan_network = lan_gw & lan_netmask;
const in_addr_t network = ip & netmask;
@@ -270,18 +271,20 @@ check_subnet_conflict (const in_addr_t ip,
}
}
gc_free (&gc);
+#endif
}
void
warn_on_use_of_common_subnets (void)
{
struct gc_arena gc = gc_new ();
- in_addr_t lan_gw = 0;
- in_addr_t lan_netmask = 0;
+ struct route_gateway_info rgi;
+ const int needed = (RGI_ADDR_DEFINED|RGI_NETMASK_DEFINED);
- if (get_default_gateway (&lan_gw, &lan_netmask))
+ get_default_gateway (&rgi);
+ if ((rgi.flags & needed) == needed)
{
- const in_addr_t lan_network = lan_gw & lan_netmask;
+ const in_addr_t lan_network = rgi.gateway.addr & rgi.gateway.netmask;
if (lan_network == 0xC0A80000 || lan_network == 0xC0A80100)
msg (M_WARN, "NOTE: your local LAN uses the extremely common subnet address 192.168.0.x or 192.168.1.x. Be aware that this might create routing conflicts if you connect to the VPN server from public locations such as internet cafes that use the same subnet.");
}