From b6f48ece692619382a8017b01c28be9cfb2e8739 Mon Sep 17 00:00:00 2001 From: Arne Schwabe Date: Wed, 19 Feb 2014 11:51:55 +0100 Subject: Fix a bug in network space calculation --- main/src/main/java/de/blinkt/openvpn/core/ConfigParser.java | 4 ++++ main/src/main/java/de/blinkt/openvpn/core/NetworkSpace.java | 6 ++++-- 2 files changed, 8 insertions(+), 2 deletions(-) (limited to 'main') 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 } -- cgit v1.2.3