From 04f4b4feec2790b620419bdc4fa2c7ae4f2451bd Mon Sep 17 00:00:00 2001 From: Domagoj Pensa Date: Wed, 5 Feb 2020 13:46:14 +0100 Subject: [PATCH] Skip DNS address validation When adding IPv4 DNS servers without interactive service use "validate=no", on Windows 7 and higher, to skip time consuming automatic address validation, that is on by default. Fix uses adapted code from commit 786e06a Signed-off-by: Domagoj Pensa Acked-by: Lev Stipakov Acked-by: Selva Nair Message-Id: <20200205124615.15758-2-domagoj@pensa.hr> URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg19355.html Signed-off-by: Gert Doering --- src/openvpn/tun.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/openvpn/tun.c b/src/openvpn/tun.c index 1f848d244..a81842fb7 100644 --- a/src/openvpn/tun.c +++ b/src/openvpn/tun.c @@ -5224,6 +5224,7 @@ netsh_ifconfig_options(const char *type, struct gc_arena gc = gc_new(); struct argv argv = argv_new(); bool delete_first = false; + bool is_dns = !strcmp(type, "dns"); /* first check if we should delete existing DNS/WINS settings from TAP interface */ if (test_first) @@ -5267,6 +5268,14 @@ netsh_ifconfig_options(const char *type, type, flex_name, print_in_addr_t(addr_list[i], 0, &gc)); + + /* disable slow address validation on Windows 7 and higher */ + /* only for DNS */ + if (is_dns && win32_version_info() >= WIN_7) + { + argv_printf_cat(&argv, "%s", "validate=no"); + } + netsh_command(&argv, 2, M_FATAL); ++count; -- 2.47.2