From f743921f5812cd7f6c6b681382d60508ed02a4a9 Mon Sep 17 00:00:00 2001 From: Arne Schwabe Date: Fri, 18 May 2012 00:06:49 +0200 Subject: - Make Ipv6 support complete (minus tun-ipv6 warning) - Implement byte counter support in the log window - Fix spelling of secret (closes issue #22) - Replace "quot; with ", no idea what went wrong there (closes issue #21) --- src/de/blinkt/openvpn/VpnProfile.java | 35 ++++++++++++++++++++++++++++++++--- 1 file changed, 32 insertions(+), 3 deletions(-) (limited to 'src/de/blinkt/openvpn/VpnProfile.java') diff --git a/src/de/blinkt/openvpn/VpnProfile.java b/src/de/blinkt/openvpn/VpnProfile.java index a0f6db76..5cdff43d 100644 --- a/src/de/blinkt/openvpn/VpnProfile.java +++ b/src/de/blinkt/openvpn/VpnProfile.java @@ -91,6 +91,8 @@ public class VpnProfile implements Serializable{ public String mVerb="1"; public String mCipher=""; public boolean mNobind=false; + public boolean mUseDefaultRoutev6=true; + public String mCustomRoutesv6=""; public void clearDefaults() { @@ -231,7 +233,7 @@ public class VpnProfile implements Serializable{ if(mUseTLSAuth) { if(mAuthenticationType==TYPE_STATICKEYS) - cfg+=insertFileData("scecret",mTLSAuthFilename); + cfg+=insertFileData("secret",mTLSAuthFilename); else cfg+=insertFileData("tls-auth",mTLSAuthFilename); cfg+=" "; @@ -243,9 +245,12 @@ public class VpnProfile implements Serializable{ cfg+="\n"; } - // Basic Settings if(!mUsePull ) { - cfg +="ifconfig " + cidrToIPAndNetmask(mIPv4Address) + "\n"; + if(nonNull(mIPv4Address)) + cfg +="ifconfig " + cidrToIPAndNetmask(mIPv4Address) + "\n"; + + if(nonNull(mIPv6Address)) + cfg +="ifconfig-ipv6 " + mIPv6Address + "\n"; } if(mUsePull && mRoutenopull) @@ -258,6 +263,13 @@ public class VpnProfile implements Serializable{ cfg += "route " + route + "\n"; } + + if(mUseDefaultRoutev6) + cfg += "route-ipv6 ::/0\n"; + else + for(String route:getCustomRoutesv6()) { + cfg += "route-ipv6 " + route + "\n"; + } if(mOverrideDNS || !mUsePull) { if(!mDNS1.equals("") && mDNS1!=null) @@ -346,6 +358,23 @@ public class VpnProfile implements Serializable{ return cidrRoutes; } + private Collection getCustomRoutesv6() { + Vector cidrRoutes=new Vector(); + if(mCustomRoutesv6==null) { + // No routes set, return empty vector + return cidrRoutes; + } + for(String route:mCustomRoutesv6.split("[\n \t]")) { + if(!route.equals("")) { + cidrRoutes.add(route); + } + } + + return cidrRoutes; + } + + + private String cidrToIPAndNetmask(String route) { String[] parts = route.split("/"); -- cgit v1.2.3