summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--main/src/main/java/de/blinkt/openvpn/VpnProfile.java4
-rw-r--r--main/src/main/java/de/blinkt/openvpn/core/ConfigParser.java4
-rw-r--r--main/src/test/java/de/blinkt/openvpn/core/TestConfigParser.kt19
3 files changed, 24 insertions, 3 deletions
diff --git a/main/src/main/java/de/blinkt/openvpn/VpnProfile.java b/main/src/main/java/de/blinkt/openvpn/VpnProfile.java
index af65873d..4a5b2b4c 100644
--- a/main/src/main/java/de/blinkt/openvpn/VpnProfile.java
+++ b/main/src/main/java/de/blinkt/openvpn/VpnProfile.java
@@ -89,8 +89,8 @@ public class VpnProfile implements Serializable, Cloneable {
private static final int AUTH_RETRY_NONE_KEEP = 1;
private static final int AUTH_RETRY_INTERACT = 3;
private static final String EXTRA_RSA_PADDING_TYPE = "de.blinkt.openvpn.api.RSA_PADDING_TYPE";
- public static String DEFAULT_DNS1 = "8.8.8.8";
- public static String DEFAULT_DNS2 = "8.8.4.4";
+ public static String DEFAULT_DNS1 = "9.9.9.9";
+ public static String DEFAULT_DNS2 = "2620:fe::fe";
// variable named wrong and should haven beeen transient
// but needs to keep wrong name to guarante loading of old
// profiles
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 01f7cf69..db530320 100644
--- a/main/src/main/java/de/blinkt/openvpn/core/ConfigParser.java
+++ b/main/src/main/java/de/blinkt/openvpn/core/ConfigParser.java
@@ -503,8 +503,10 @@ public class ConfigParser {
np.mSearchDomain = dhcpoption.get(2);
} else if (type.equals("DNS")) {
np.mOverrideDNS = true;
- if (np.mDNS1.equals(VpnProfile.DEFAULT_DNS1))
+ if (np.mDNS1.equals(VpnProfile.DEFAULT_DNS1)) {
np.mDNS1 = arg;
+ np.mDNS2 = "";
+ }
else
np.mDNS2 = arg;
}
diff --git a/main/src/test/java/de/blinkt/openvpn/core/TestConfigParser.kt b/main/src/test/java/de/blinkt/openvpn/core/TestConfigParser.kt
index 0830c32c..53bfd00a 100644
--- a/main/src/test/java/de/blinkt/openvpn/core/TestConfigParser.kt
+++ b/main/src/test/java/de/blinkt/openvpn/core/TestConfigParser.kt
@@ -106,6 +106,25 @@ class TestConfigParser {
Assert.assertEquals(vp.mExcludedRoutes.trim(), "8.8.8.8/32");
}
+ @Test
+ fun testOneDNSImport()
+ {
+ val config = "client\n" +
+ "tun-mtu 1234\n" +
+ "<connection>\n" +
+ "remote foo.bar\n" +
+ "tun-mtu 1222\n" +
+ "</connection>\n" +
+ "route 8.8.8.8 255.255.255.255 net_gateway\n" +
+ "dhcp-option DNS 1.2.3.4\n"
+
+ val cp = ConfigParser()
+ cp.parseConfig(StringReader(config))
+ val vp = cp.convertProfile()
+
+ Assert.assertEquals("1.2.3.4", vp.mDNS1)
+ Assert.assertEquals("" , vp.mDNS2)
+ }
@Test
fun testCipherImport() {