summaryrefslogtreecommitdiff
path: root/main/src
diff options
context:
space:
mode:
authorArne Schwabe <arne@rfc2549.org>2018-03-11 22:05:15 +0100
committerArne Schwabe <arne@rfc2549.org>2018-03-11 22:05:15 +0100
commita8a48a9a67a94a3ddb547dc481ccf375f15e1e25 (patch)
tree57a5c9ad2f347266c28620325ec2b51293f764f2 /main/src
parent18ccd98389bbe25dedb7b2e78b4b1d37f6ed928e (diff)
OpenVPN 2.2 fixes and import socks/proxy in configparser
Diffstat (limited to 'main/src')
-rw-r--r--main/src/main/java/de/blinkt/openvpn/VpnProfile.java8
-rw-r--r--main/src/main/java/de/blinkt/openvpn/core/ConfigParser.java23
-rw-r--r--main/src/main/java/de/blinkt/openvpn/core/OpenVPNService.java4
3 files changed, 31 insertions, 4 deletions
diff --git a/main/src/main/java/de/blinkt/openvpn/VpnProfile.java b/main/src/main/java/de/blinkt/openvpn/VpnProfile.java
index 3ee293dc..8cce8597 100644
--- a/main/src/main/java/de/blinkt/openvpn/VpnProfile.java
+++ b/main/src/main/java/de/blinkt/openvpn/VpnProfile.java
@@ -312,7 +312,8 @@ public class VpnProfile implements Serializable, Cloneable {
cfg += "machine-readable-output\n";
- cfg += "allow-recursive-routing\n";
+ if (!mIsOpenVPN22)
+ cfg += "allow-recursive-routing\n";
// Users are confused by warnings that are misleading...
cfg += "ifconfig-nowarn\n";
@@ -347,7 +348,7 @@ public class VpnProfile implements Serializable, Cloneable {
if (!mIsOpenVPN22)
cfg += "connect-retry " + mConnectRetry + " " + mConnectRetryMaxTime + "\n";
- else if (mIsOpenVPN22 && mUseUdp)
+ else if (mIsOpenVPN22 && !mUseUdp)
cfg += "connect-retry " + mConnectRetry + "\n";
@@ -575,7 +576,8 @@ public class VpnProfile implements Serializable, Cloneable {
if (mPersistTun) {
cfg += "persist-tun\n";
cfg += "# persist-tun also enables pre resolving to avoid DNS resolve problem\n";
- cfg += "preresolve\n";
+ if (!mIsOpenVPN22)
+ cfg += "preresolve\n";
}
if (mPushPeerInfo)
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 abd60bcb..f83a271e 100644
--- a/main/src/main/java/de/blinkt/openvpn/core/ConfigParser.java
+++ b/main/src/main/java/de/blinkt/openvpn/core/ConfigParser.java
@@ -784,7 +784,28 @@ public class ConfigParser {
}
}
- // Parse remote config
+ Vector<String> proxy = getOption("socks-proxy", 1, 2);
+ if (proxy == null)
+ proxy = getOption("http-proxy", 2, 2);
+
+ if (proxy != null) {
+ if (proxy.get(0).equals("socks-proxy")) {
+ conn.mProxyType = Connection.ProxyType.SOCKS5;
+ // socks defaults to 1080, http always sets port
+ conn.mProxyPort = "1080";
+ } else {
+ conn.mProxyType = Connection.ProxyType.HTTP;
+ }
+
+ conn.mProxyName = proxy.get(1);
+ if (proxy.size() >= 3)
+ conn.mProxyPort = proxy.get(2);
+ }
+
+
+
+
+ // Parse remote config
Vector<Vector<String>> remotes = getAllOption("remote", 1, 3);
diff --git a/main/src/main/java/de/blinkt/openvpn/core/OpenVPNService.java b/main/src/main/java/de/blinkt/openvpn/core/OpenVPNService.java
index fd11a911..bc41c3d9 100644
--- a/main/src/main/java/de/blinkt/openvpn/core/OpenVPNService.java
+++ b/main/src/main/java/de/blinkt/openvpn/core/OpenVPNService.java
@@ -813,6 +813,10 @@ public class OpenVPNService extends VpnService implements StateListener, Callbac
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
setAllowedVpnPackages(builder);
}
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP_MR1) {
+ // VPN always uses the default network
+ builder.setUnderlyingNetworks(null);
+ }
String session = mProfile.mName;