summaryrefslogtreecommitdiff
path: root/main/src/test
diff options
context:
space:
mode:
authorArne Schwabe <arne@rfc2549.org>2021-10-25 00:53:02 +0200
committerArne Schwabe <arne@rfc2549.org>2021-10-25 00:54:00 +0200
commit3348484912550a4d72a082ad21f9871bc2159afb (patch)
treef3b48dc7e6fa31d180b2ba55d033236bfc925a99 /main/src/test
parent7fb58f6609802a03dc82169531badbad98d4c33d (diff)
Leave second DNS empty when importing config with only one DNS (closes #1410)
When importing a configuration with only one DNS server, the second DNS server what never overwritten, resulting in having the Google DNS as backup server. Also change Google DNS to Quad9 by default.
Diffstat (limited to 'main/src/test')
-rw-r--r--main/src/test/java/de/blinkt/openvpn/core/TestConfigParser.kt19
1 files changed, 19 insertions, 0 deletions
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() {