summaryrefslogtreecommitdiff
path: root/main/src
diff options
context:
space:
mode:
authorArne Schwabe <arne@rfc2549.org>2014-08-13 13:51:22 +0200
committerArne Schwabe <arne@rfc2549.org>2014-08-13 13:51:22 +0200
commit4b8344372863771a497b5ba00c57c6a9030920ab (patch)
tree0669da42c20febc27dd9bf32a8ce02a945bfc3b7 /main/src
parenta3fd5dfdb90a8791ba4fc51f90d512c48c3d9df2 (diff)
Fix broken parsing and output of IPv6 Routes
--HG-- extra : rebase_source : 3ffb8db4e128c62426e18c79d5cc6876136bf3bf
Diffstat (limited to 'main/src')
-rw-r--r--main/src/main/java/de/blinkt/openvpn/core/NetworkSpace.java8
1 files changed, 4 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 31290d8a..cb662944 100644
--- a/main/src/main/java/de/blinkt/openvpn/core/NetworkSpace.java
+++ b/main/src/main/java/de/blinkt/openvpn/core/NetworkSpace.java
@@ -76,8 +76,8 @@ public class NetworkSpace {
netAddress = BigInteger.ZERO;
for (byte b : address.getAddress()) {
- s -= 16;
- netAddress = netAddress.add(BigInteger.valueOf(b).shiftLeft(s));
+ s -= 8;
+ netAddress = netAddress.add(BigInteger.valueOf((b & 0xFF)).shiftLeft(s));
}
}
@@ -152,12 +152,12 @@ public class NetworkSpace {
String getIPv6Address() {
if (BuildConfig.DEBUG) Assert.assertTrue (!isV4);
BigInteger r = netAddress;
- if (r.longValue() == 0)
+ if (r.compareTo(BigInteger.ZERO)==0 && networkMask==0)
return "::";
Vector<String> parts = new Vector<String>();
while (r.compareTo(BigInteger.ZERO) == 1) {
- parts.add(0, String.format(Locale.US, "%x", r.mod(BigInteger.valueOf(256)).longValue()));
+ parts.add(0, String.format(Locale.US, "%x", r.mod(BigInteger.valueOf(0x10000)).longValue()));
r = r.shiftRight(16);
}