diff options
-rw-r--r-- | main/build.gradle | 4 | ||||
-rw-r--r-- | main/src/main/java/de/blinkt/openvpn/core/OpenVpnManagementThread.java | 17 | ||||
-rw-r--r-- | main/src/main/java/de/blinkt/openvpn/core/OpenVpnService.java | 18 |
3 files changed, 22 insertions, 17 deletions
diff --git a/main/build.gradle b/main/build.gradle index 8b03c862..326dad78 100644 --- a/main/build.gradle +++ b/main/build.gradle @@ -24,8 +24,8 @@ android { defaultConfig { minSdkVersion 14 targetSdkVersion 19 - versionCode = 89 - versionName = "0.6.8" + versionCode = 90 + versionName = "0.6.9" } sourceSets { diff --git a/main/src/main/java/de/blinkt/openvpn/core/OpenVpnManagementThread.java b/main/src/main/java/de/blinkt/openvpn/core/OpenVpnManagementThread.java index 5fa70cc8..0da067ab 100644 --- a/main/src/main/java/de/blinkt/openvpn/core/OpenVpnManagementThread.java +++ b/main/src/main/java/de/blinkt/openvpn/core/OpenVpnManagementThread.java @@ -22,10 +22,7 @@ import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method;
import java.net.InetSocketAddress;
import java.net.SocketAddress;
-import java.util.Collections;
-import java.util.LinkedList;
-import java.util.Locale;
-import java.util.Vector;
+import java.util.*;
public class OpenVpnManagementThread implements Runnable, OpenVPNManagement {
@@ -380,11 +377,19 @@ public class OpenVpnManagementThread implements Runnable, OpenVPNManagement { } else if (needed.equals("ROUTE")) {
String[] routeparts = extra.split(" ");
- if(routeparts.length>3) {
+ /*
+ buf_printf (&out, "%s %s %s dev %s", network, netmask, gateway, rgi->iface);
+ else
+ buf_printf (&out, "%s %s %s", network, netmask, gateway);
+ */
+
+ if(routeparts.length==5) {
assert(routeparts[3].equals("dev"));
mOpenVPNService.addRoute(routeparts[0], routeparts[1], routeparts[2], routeparts[4]);
- } else {
+ } else if (routeparts.length == 3) {
mOpenVPNService.addRoute(routeparts[0], routeparts[1], routeparts[2], null);
+ } else {
+ VpnStatus.logError("Unrecognized ROUTE cmd:" + Arrays.toString(routeparts) + " | " + argument);
}
} else if (needed.equals("ROUTE6")) {
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 49f315a3..bc3fe552 100644 --- a/main/src/main/java/de/blinkt/openvpn/core/OpenVpnService.java +++ b/main/src/main/java/de/blinkt/openvpn/core/OpenVpnService.java @@ -591,25 +591,25 @@ public class OpenVpnService extends VpnService implements StateListener, Callbac public void setLocalIP(String local, String netmask, int mtu, String mode) { mLocalIP = new CIDRIP(local, netmask); mMtu = mtu; + mRemoteGW=null; + if (mLocalIP.len == 32 && !netmask.equals("255.255.255.255")) { // get the netmask as IP - long netint = CIDRIP.getInt(netmask); - if (Math.abs(netint - mLocalIP.getInt()) == 1) { + long netMaskAsInt = CIDRIP.getInt(netmask); + + // Netmask is Ip address +/-1, assume net30/p2p with small net + if (Math.abs(netMaskAsInt - mLocalIP.getInt()) == 1) { if ("net30".equals(mode)) mLocalIP.len = 30; else mLocalIP.len = 31; } else { - VpnStatus.logWarning(R.string.ip_not_cidr, local, netmask, mode); + if (!"p2p".equals(mode)) + VpnStatus.logWarning(R.string.ip_not_cidr, local, netmask, mode); + mRemoteGW=netmask; } } - - if ("p2p".equals(mode)) - mRemoteGW=netmask; - else - mRemoteGW=null; - } public void setLocalIPv6(String ipv6addr) { |