From 964ca82b1cecd73fa9dceff54b99c45782d2c1e0 Mon Sep 17 00:00:00 2001 From: Arne Schwabe Date: Thu, 13 Sep 2012 01:42:20 +0200 Subject: Add support for persist-tun option (closes issue #83) --- src/de/blinkt/openvpn/ConfigParser.java | 4 +++- src/de/blinkt/openvpn/OpenVpnManagementThread.java | 2 ++ src/de/blinkt/openvpn/VpnProfile.java | 5 +++++ 3 files changed, 10 insertions(+), 1 deletion(-) (limited to 'src/de') diff --git a/src/de/blinkt/openvpn/ConfigParser.java b/src/de/blinkt/openvpn/ConfigParser.java index 8ee05e23..2ee6061d 100644 --- a/src/de/blinkt/openvpn/ConfigParser.java +++ b/src/de/blinkt/openvpn/ConfigParser.java @@ -223,7 +223,6 @@ public class ConfigParser { "management", "management-query-passwords", "pause-exit", - "persist-tun", "persist-key", "register-dns", "route-delay", @@ -433,6 +432,9 @@ public class ConfigParser { if(getOption("nobind", 0, 0) != null) np.mNobind=true; + if(getOption("persist-tun", 0,0) != null) + np.mPersistTun=true; + Vector authuser = getOption("auth-user-pass",0,1); if(authuser !=null){ diff --git a/src/de/blinkt/openvpn/OpenVpnManagementThread.java b/src/de/blinkt/openvpn/OpenVpnManagementThread.java index e06c1194..24537732 100644 --- a/src/de/blinkt/openvpn/OpenVpnManagementThread.java +++ b/src/de/blinkt/openvpn/OpenVpnManagementThread.java @@ -147,6 +147,8 @@ public class OpenVpnManagementThread implements Runnable { exp =e; } catch (InvocationTargetException e) { exp =e; + } catch (NullPointerException e) { + exp =e; } if(exp!=null) { exp.printStackTrace(); diff --git a/src/de/blinkt/openvpn/VpnProfile.java b/src/de/blinkt/openvpn/VpnProfile.java index afb779d2..404072b1 100644 --- a/src/de/blinkt/openvpn/VpnProfile.java +++ b/src/de/blinkt/openvpn/VpnProfile.java @@ -101,6 +101,7 @@ public class VpnProfile implements Serializable{ public String mKeyPassword=""; static final String MINIVPN = "miniopenvpn"; + public boolean mPersistTun = true; public void clearDefaults() { @@ -110,6 +111,7 @@ public class VpnProfile implements Serializable{ mUseDefaultRoute=false; mUseDefaultRoutev6=false; mExpectTLSCert=false; + mPersistTun = false; } @@ -337,6 +339,9 @@ public class VpnProfile implements Serializable{ if(mUseFloat) cfg+= "float\n"; + if(mPersistTun) + cfg+= "persist-tun\n"; + SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); boolean usesystemproxy = prefs.getBoolean("usesystemproxy", true); if(usesystemproxy) { -- cgit v1.2.3