summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArne Schwabe <arne@rfc2549.org>2015-01-27 23:06:10 +0100
committerArne Schwabe <arne@rfc2549.org>2015-01-27 23:06:10 +0100
commit8a54bf7ff277a765e60f00dbf1505d4e56bd0853 (patch)
treee3b1cce1b83447651a610b6ed813ba9d6d063f91
parentb41c3c2d8d9856c962f8cff38a8ebaa908e562d3 (diff)
Fix net comparision, I officialy hate java for their non overloaded broken big integers.
-rw-r--r--main/src/main/java/de/blinkt/openvpn/core/NetworkSpace.java12
-rw-r--r--remoteExample/build.gradle2
-rw-r--r--vpndialogxposed/build.gradle2
3 files changed, 12 insertions, 4 deletions
diff --git a/main/src/main/java/de/blinkt/openvpn/core/NetworkSpace.java b/main/src/main/java/de/blinkt/openvpn/core/NetworkSpace.java
index 705d737b..d3c69ef1 100644
--- a/main/src/main/java/de/blinkt/openvpn/core/NetworkSpace.java
+++ b/main/src/main/java/de/blinkt/openvpn/core/NetworkSpace.java
@@ -173,8 +173,15 @@ public class NetworkSpace {
public boolean containsNet(ipAddress network) {
// this.first >= net.first && this.last <= net.last
- return getFirstAddress().compareTo(network.getFirstAddress()) != -1 &&
- getLastAddress().compareTo(network.getLastAddress()) != 1;
+ BigInteger ourFirst = getFirstAddress();
+ BigInteger ourLast = getLastAddress();
+ BigInteger netFirst = network.getFirstAddress();
+ BigInteger netLast = network.getLastAddress();
+
+ boolean a = ourFirst.compareTo(netFirst) != 1;
+ boolean b = ourLast.compareTo(netLast) != -1;
+ return a && b;
+
}
}
@@ -321,6 +328,7 @@ public class NetworkSpace {
boolean skipIp=false;
// If there is any smaller net that is excluded we may not add the positive route back
+
for (ipAddress calculatedIp: ipsSorted) {
if(!calculatedIp.included && origIp.containsNet(calculatedIp)) {
skipIp=true;
diff --git a/remoteExample/build.gradle b/remoteExample/build.gradle
index a7e79b70..78361ba5 100644
--- a/remoteExample/build.gradle
+++ b/remoteExample/build.gradle
@@ -2,7 +2,7 @@ apply plugin: 'com.android.application'
android {
compileSdkVersion 21
- buildToolsVersion "19.1.0"
+ buildToolsVersion "21.1.2"
defaultConfig {
minSdkVersion 15
diff --git a/vpndialogxposed/build.gradle b/vpndialogxposed/build.gradle
index b8cd5678..345807ea 100644
--- a/vpndialogxposed/build.gradle
+++ b/vpndialogxposed/build.gradle
@@ -15,7 +15,7 @@ dependencies {
android {
compileSdkVersion 21
- buildToolsVersion "19.1.0"
+ buildToolsVersion "21.1.2"
defaultConfig {
minSdkVersion 14