summaryrefslogtreecommitdiff
path: root/main/src
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 /main/src
parentb41c3c2d8d9856c962f8cff38a8ebaa908e562d3 (diff)
Fix net comparision, I officialy hate java for their non overloaded broken big integers.
Diffstat (limited to 'main/src')
-rw-r--r--main/src/main/java/de/blinkt/openvpn/core/NetworkSpace.java12
1 files changed, 10 insertions, 2 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;