diff options
author | Arne Schwabe <arne@rfc2549.org> | 2014-02-19 11:51:55 +0100 |
---|---|---|
committer | Arne Schwabe <arne@rfc2549.org> | 2014-02-19 11:51:55 +0100 |
commit | b6f48ece692619382a8017b01c28be9cfb2e8739 (patch) | |
tree | a7ff937a6aeff5cc2e81da8697696f915802b7e9 /main/src | |
parent | 8bace544f8c97b6987960abfefd0867a2d514643 (diff) |
Fix a bug in network space calculation
Diffstat (limited to 'main/src')
-rw-r--r-- | main/src/main/java/de/blinkt/openvpn/core/ConfigParser.java | 4 | ||||
-rw-r--r-- | main/src/main/java/de/blinkt/openvpn/core/NetworkSpace.java | 6 |
2 files changed, 8 insertions, 2 deletions
diff --git a/main/src/main/java/de/blinkt/openvpn/core/ConfigParser.java b/main/src/main/java/de/blinkt/openvpn/core/ConfigParser.java index cd57b397..378b6b92 100644 --- a/main/src/main/java/de/blinkt/openvpn/core/ConfigParser.java +++ b/main/src/main/java/de/blinkt/openvpn/core/ConfigParser.java @@ -361,6 +361,10 @@ public class ConfigParser { } catch (ArrayIndexOutOfBoundsException aioob) { throw new ConfigParseError("Could not parse netmask of route " + netmask); } catch (NumberFormatException ne) { + + + + throw new ConfigParseError("Could not parse netmask of route " + netmask); } 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 6e27c0cb..044d99ff 100644 --- a/main/src/main/java/de/blinkt/openvpn/core/NetworkSpace.java +++ b/main/src/main/java/de/blinkt/openvpn/core/NetworkSpace.java @@ -200,13 +200,15 @@ public class NetworkSpace { ipAddress[] newNets = nextNet.split(); // First add the second half to keep the order in networks - networks.add(newNets[1]); + if (!networks.contains(newNets[1])) + networks.add(newNets[1]); if (newNets[0].getLastAddress().equals(currentNet.getLastAddress())) { assert (newNets[0].networkMask == currentNet.networkMask); // Don't add the lower half that would conflict with currentNet } else { - networks.add(newNets[0]); + if (!networks.contains(newNets[0])) + networks.add(newNets[0]); } // Keep currentNet as is } |