summaryrefslogtreecommitdiff
path: root/src/de/blinkt/openvpn/core/ConfigParser.java
diff options
context:
space:
mode:
authorArne Schwabe <arne@rfc2549.org>2014-02-04 10:03:13 +0100
committerArne Schwabe <arne@rfc2549.org>2014-02-04 10:03:13 +0100
commit1705a3d66d5c2bc8b0c59b2e53c56ed7f6003f56 (patch)
tree2af9a91382e16ee10f021646272fd07af5f9e9de /src/de/blinkt/openvpn/core/ConfigParser.java
parentde196596a6f93c797e4332c8dc463ccb90ece3f5 (diff)
Add UI/config parsing for excluded routes
Diffstat (limited to 'src/de/blinkt/openvpn/core/ConfigParser.java')
-rw-r--r--src/de/blinkt/openvpn/core/ConfigParser.java28
1 files changed, 24 insertions, 4 deletions
diff --git a/src/de/blinkt/openvpn/core/ConfigParser.java b/src/de/blinkt/openvpn/core/ConfigParser.java
index 895f048e..6ce7467f 100644
--- a/src/de/blinkt/openvpn/core/ConfigParser.java
+++ b/src/de/blinkt/openvpn/core/ConfigParser.java
@@ -322,14 +322,23 @@ public class ConfigParser {
Vector<Vector<String>> routes = getAllOption("route", 1, 4);
if(routes!=null) {
String routeopt = "";
- for(Vector<String> route:routes){
+ String routeExcluded = "";
+ for(Vector<String> route:routes){
String netmask = "255.255.255.255";
- if(route.size() >= 3)
+ String gateway = "vpn_gateway";
+
+ if(route.size() >= 3)
netmask = route.get(2);
+ if (route.size() >= 4)
+ gateway = route.get(3);
+
String net = route.get(1);
try {
CIDRIP cidr = new CIDRIP(net, netmask);
- routeopt+=cidr.toString() + " ";
+ if (gateway.equals("net_gateway"))
+ routeExcluded += cidr.toString() + " ";
+ else
+ routeopt+=cidr.toString() + " ";
} catch (ArrayIndexOutOfBoundsException aioob) {
throw new ConfigParseError("Could not parse netmask of route " + netmask);
} catch (NumberFormatException ne) {
@@ -338,9 +347,20 @@ public class ConfigParser {
}
np.mCustomRoutes=routeopt;
+ np.mExcludedRoutes=routeExcluded;
}
- // Also recognize tls-auth [inline] direction ...
+ Vector<Vector<String>> routesV6 = getAllOption("route-ipv6", 1, 4);
+ if (routesV6!=null) {
+ String customIPv6Routes = "";
+ for (Vector<String> route:routesV6){
+ customIPv6Routes += route.get(1) + " ";
+ }
+
+ np.mCustomRoutesv6 = customIPv6Routes;
+ }
+
+ // Also recognize tls-auth [inline] direction ...
Vector<Vector<String>> tlsauthoptions = getAllOption("tls-auth", 1, 2);
if(tlsauthoptions!=null) {
for(Vector<String> tlsauth:tlsauthoptions) {