summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArne Schwabe <arne@rfc2549.org>2014-07-14 14:22:27 +0200
committerArne Schwabe <arne@rfc2549.org>2014-07-14 14:22:27 +0200
commitb5bf37d1e2ff5968f748d1d756e37e46eb572ffd (patch)
tree68c7b5daf2d1143d7e3b1493d2209c020c965220
parent10f995c10839e9f9582b31f4f24302d3a544f696 (diff)
Fix broken configuration net30 topology with subnet ifconfig
-rw-r--r--main/src/main/java/de/blinkt/openvpn/core/OpenVpnService.java11
-rwxr-xr-xmain/src/main/res/values/strings.xml1
2 files changed, 10 insertions, 2 deletions
diff --git a/main/src/main/java/de/blinkt/openvpn/core/OpenVpnService.java b/main/src/main/java/de/blinkt/openvpn/core/OpenVpnService.java
index 03be5f0d..a368edfe 100644
--- a/main/src/main/java/de/blinkt/openvpn/core/OpenVpnService.java
+++ b/main/src/main/java/de/blinkt/openvpn/core/OpenVpnService.java
@@ -644,10 +644,10 @@ public class OpenVpnService extends VpnService implements StateListener, Callbac
mMtu = mtu;
mRemoteGW=null;
+ long netMaskAsInt = CIDRIP.getInt(netmask);
if (mLocalIP.len == 32 && !netmask.equals("255.255.255.255")) {
// get the netmask as IP
- long netMaskAsInt = CIDRIP.getInt(netmask);
int masklen;
if ("net30".equals(mode))
@@ -660,11 +660,18 @@ public class OpenVpnService extends VpnService implements StateListener, Callbac
if ((netMaskAsInt & mask) == (mLocalIP.getInt() & mask )) {
mLocalIP.len = masklen;
} else {
+ mLocalIP.len = 32;
if (!"p2p".equals(mode))
VpnStatus.logWarning(R.string.ip_not_cidr, local, netmask, mode);
- mRemoteGW=netmask;
}
}
+ if (("p2p".equals(mode)) && mLocalIP.len < 32 || "net30".equals("net30") && mLocalIP.len < 30) {
+ VpnStatus.logWarning(R.string.ip_looks_like_subnet, local, netmask, mode);
+ }
+
+
+ // Configurations are sometimes really broken...
+ mRemoteGW=netmask;
}
public void setLocalIPv6(String ipv6addr) {
diff --git a/main/src/main/res/values/strings.xml b/main/src/main/res/values/strings.xml
index 6cd45b66..6481fc10 100755
--- a/main/src/main/res/values/strings.xml
+++ b/main/src/main/res/values/strings.xml
@@ -318,4 +318,5 @@
<string name="files_missing_hint">Some files could not be found. Please select the files to import the profile:</string>
<string name="openvpn_is_no_free_vpn">To use this app you need a VPN provider/VPN gateway supporting OpenVPN (often provided by your employer). Check out http://community.openvpn.net/ for more information on OpenVPN and how to setup your own OpenVPN server.</string>
<string name="import_log">Import log:</string>
+ <string name="ip_looks_like_subnet">Vpn topology \"%3$s\" specified but ifconfig %1$s %2$s looks more like an IP address with a network mask. Assuming \"subnet\" topology.</string>
</resources>