Re: [Openvpn-devel] [PATCH] Remove 1 second delay before running netsh

2020-12-24 Thread Domagoj Pensa
Hi!

I've sent a new patch that uses management_sleep(0) instead.

I've also added your explanation why management_sleep(0) is used.

Regards,
Domagoj

On Mon, Dec 21, 2020 at 10:06:57AM +0200, Lev Stipakov wrote:
> Hi,
> 
> > Lev: do you have a particular opinion on this change?  You do more
> > testing with wintun...
> 
> Wintun uses iservice where we don't have those delays.
> 
> I tend to agree with Vladislav (themiron), let's use management_sleep(0) which
> processes any pending actions on the management interface without any wait.
> 
> -Lev


___
Openvpn-devel mailing list
Openvpn-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openvpn-devel


[Openvpn-devel] [PATCH v2] Remove 1 second delay before running netsh

2020-12-24 Thread Domagoj Pensa
When running various netsh commands before each 1 second sleep is added.
As more netsh commands are run, especially for Wintun adapters, that can
add to a noticable delayed connecting time.

This should be safe. No problems were found in tests and all netsh
commands executed properly with delay removed. Also, no delays are used
in a similar code in interactive service and netsh command executions
are guarded with a semaphore.

Instead of removing management_sleep(1), management_sleep(0) is used as
a replacement to allow processing any pending actions on the management
interface without any wait.

Signed-off-by: Domagoj Pensa 
---
 src/openvpn/tun.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/openvpn/tun.c b/src/openvpn/tun.c
index 400a50ca..0751ae46 100644
--- a/src/openvpn/tun.c
+++ b/src/openvpn/tun.c
@@ -5207,7 +5207,7 @@ netsh_command(const struct argv *a, int n, int msglevel)
 for (i = 0; i < n; ++i)
 {
 bool status;
-management_sleep(1);
+management_sleep(0);
 netcmd_semaphore_lock();
 argv_msg_prefix(M_INFO, a, "NETSH");
 status = openvpn_execve_check(a, NULL, 0, "ERROR: netsh command 
failed");
-- 
2.29.2




___
Openvpn-devel mailing list
Openvpn-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openvpn-devel


Re: [Openvpn-devel] [PATCH] Skip DHCP renew with Wintun adapter

2020-12-19 Thread Domagoj Pensa
Hi!

I've done some more investigation and I've found out that problem was 
introduced in commit:

09ae6280 tun.c: revise the IPv4 ifconfig flow on Windows

in the following change:

@@ -6420,10 +6419,7 @@ open_tun(const char *dev, const char *dev_type, const 
char *dev_node, struct tun
 struct gc_arena gc = gc_new(); /* used also for device_guid allocation */
 tun_open_device(tt, dev_node, _guid, );
 
-if (tt->windows_driver == WINDOWS_DRIVER_TAP_WINDOWS6)
-{
 tuntap_post_open(tt, device_guid);
-}
 
 gc_free();

Due to that, DHCP setup section in tuntap_set_ip_addr() is executed when 
Wintun is used, but it shouldn't.

As dhcp_masq_post is false for Wintun, fork_dhcp_action() is executed and 
that outputs warning and does unnecessary fork.

With my patch applied, DHCP setup is done only when TAP-Windows6 is used.

In my case server pushes both dhcp-renew and dhcp-release.

When I pull-filter ignore them no forking occurs and thus no warning.

I hope this helps.

Regards,
Domagoj

On Fri, Dec 18, 2020 at 12:45:43PM +0200, Lev Stipakov wrote:
> Hi,
> 
> The patch looks fine, but I wonder how did you manage to trigger this case?
> 
> dhcp_release() or dhcp_renew() are called if dhcp_masq_post is set to true,
> which only happens for tap-windows6.
> 
> fork_dhcp_action() is no-op unless dhcp-renew/dhcp-pre-release
> are explicitly defined in the ovpn profile.
> 
> If latter is the case, I wonder if options postprocessing would be a
> better place
> to fix it.
> 
> -Lev


___
Openvpn-devel mailing list
Openvpn-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openvpn-devel


Re: [Openvpn-devel] [PATCH applied] Re: Fix too early argv freeing when registering DNS

2020-12-17 Thread Domagoj Pensa
Hi!

You're welcome.
I'm glad that it helps.
Even if it is just one line of code removed. :)

Best regards,
Domagoj

On Tue, Dec 15, 2020 at 08:21:51PM +0100, Gert Doering wrote:
> Thanks.  As already said, all of a sudden it is very obvious
> why it is crashing here... somewhat annoying that this wasn't
> noticed before 2.5.0 release, though.
> 
> I've stared-at-code, and tested this on Win10 (ubuntu 18 / mingw build)
> with a config with --register-dns. Without the patch, crash, with the 
> patch, it just works.
> 
> Testing is not fully straightforward, as you can not "just run" such 
> a config, but you need to either run openvpn-gui as admin, or run 
> openvpn from a admin-cmd.exe - and it never OOMs for me, just never
> proceeeds after "ipconfig.exe /flushdns".
> 
> Thanks :-)
> 
> Your patch has been applied to the master and release/2.5 branch.
> 
> commit ab4688e3bd78d010ccc96adec66ab552bd009328 (master)
> commit 2f2df474158b6c24325a47334fc8b5eb77a69b85 (release/2.5)
> Author: Domagoj Pensa
> Date:   Tue Dec 15 18:16:00 2020 +0100
> 
>      Fix too early argv freeing when registering DNS
> 
>  Signed-off-by: Domagoj Pensa 
>  Acked-by: Gert Doering 
>  Message-Id: <20201215171600.25534-1-doma...@pensa.hr>
>  URL: 
> https://www.mail-archive.com/search?l=mid=20201215171600.25534-1-doma...@pensa.hr
>  Signed-off-by: Gert Doering 
> 
> 
> --
> kind regards,
> 
> Gert Doering
> 


___
Openvpn-devel mailing list
Openvpn-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openvpn-devel


[Openvpn-devel] [PATCH] Remove 1 second delay before running netsh

2020-12-15 Thread Domagoj Pensa
When running various netsh commands before each 1 second sleep is added.
As more netsh commands are run, especially for Wintun adapters, that can
add to a noticable delayed connecting time.

This should be safe. No problems were found in tests and all netsh
commands executed properly with delay removed. Also, no delays are used
in a similar code in interactive service and netsh command executions
are guarded with a semaphore.

Signed-off-by: Domagoj Pensa 
---
 src/openvpn/tun.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/src/openvpn/tun.c b/src/openvpn/tun.c
index 400a50ca..e9f1aadb 100644
--- a/src/openvpn/tun.c
+++ b/src/openvpn/tun.c
@@ -5207,7 +5207,6 @@ netsh_command(const struct argv *a, int n, int msglevel)
 for (i = 0; i < n; ++i)
 {
 bool status;
-management_sleep(1);
 netcmd_semaphore_lock();
 argv_msg_prefix(M_INFO, a, "NETSH");
 status = openvpn_execve_check(a, NULL, 0, "ERROR: netsh command 
failed");
-- 
2.29.2




___
Openvpn-devel mailing list
Openvpn-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openvpn-devel


[Openvpn-devel] [PATCH] Fix too early argv freeing when registering DNS

2020-12-15 Thread Domagoj Pensa
When registering DNS on Windows, argv is freed after being used in first
ipconfig command (/flushdns).

Then same argv is used uninitialized in next ipconfig command (/registerdns)
causing heap exception and subprocess crash.

As a consequence second command is never executed and locked netcmd
semaphore is not cleanly released.

Removing argv freeing between ipconfig calls solves the problem.

This issue was introduced in commit 870e240 (argv: do fewer memory
re-allocations). After a quick glance at commit no similar problem was
spotted in rest of the argv related changes.

Signed-off-by: Domagoj Pensa 
---
 src/openvpn/tun.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/src/openvpn/tun.c b/src/openvpn/tun.c
index 400a50ca..2b227bb6 100644
--- a/src/openvpn/tun.c
+++ b/src/openvpn/tun.c
@@ -5235,7 +5235,6 @@ ipconfig_register_dns(const struct env_set *es)
 WIN_IPCONFIG_PATH_SUFFIX);
 argv_msg(D_TUNTAP_INFO, );
 openvpn_execve_check(, es, 0, err);
-argv_free();
 
 argv_printf(, "%s%s /registerdns",
 get_win_sys_path(),
-- 
2.29.2




___
Openvpn-devel mailing list
Openvpn-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openvpn-devel


[Openvpn-devel] [PATCH] Skip DHCP renew with Wintun adapter

2020-12-15 Thread Domagoj Pensa
Wintun does not support DHCP.
Running  DHCP renew with Wintun adapter fails with a logged warning.

Fixed so that DHCP renewing is called only for TAP-Windows6 adapters.
---
 src/openvpn/tun.c | 44 ++--
 1 file changed, 22 insertions(+), 22 deletions(-)

diff --git a/src/openvpn/tun.c b/src/openvpn/tun.c
index 400a50ca..6892fdb7 100644
--- a/src/openvpn/tun.c
+++ b/src/openvpn/tun.c
@@ -6155,35 +6155,35 @@ tuntap_set_ip_addr(struct tuntap *tt,
 status,
 strerror_win32(status, ));
 }
-}
 
-/*
- * If the TAP-Windows driver is masquerading as a DHCP server
- * make sure the TCP/IP properties for the adapter are
- * set correctly.
- */
-if (dhcp_masq_post)
-{
-/* check dhcp enable status */
-if (dhcp_status(index) == DHCP_STATUS_DISABLED)
+/*
+ * If the TAP-Windows driver is masquerading as a DHCP server
+ * make sure the TCP/IP properties for the adapter are
+ * set correctly.
+ */
+if (dhcp_masq_post)
 {
-msg(M_WARN, "WARNING: You have selected '--ip-win32 dynamic', 
which will not work unless the TAP-Windows TCP/IP properties are set to 'Obtain 
an IP address automatically'");
-}
+/* check dhcp enable status */
+if (dhcp_status(index) == DHCP_STATUS_DISABLED)
+{
+msg(M_WARN, "WARNING: You have selected '--ip-win32 dynamic', 
which will not work unless the TAP-Windows TCP/IP properties are set to 'Obtain 
an IP address automatically'");
+}
 
-/* force an explicit DHCP lease renewal on TAP adapter? */
-if (tt->options.dhcp_pre_release)
-{
-dhcp_release(tt);
+/* force an explicit DHCP lease renewal on TAP adapter? */
+if (tt->options.dhcp_pre_release)
+{
+dhcp_release(tt);
+}
+if (tt->options.dhcp_renew)
+{
+dhcp_renew(tt);
+}
 }
-if (tt->options.dhcp_renew)
+else
 {
-dhcp_renew(tt);
+fork_dhcp_action(tt);
 }
 }
-else
-{
-fork_dhcp_action(tt);
-}
 
 if (tt->did_ifconfig_setup && tt->options.ip_win32_type == IPW32_SET_IPAPI)
 {
-- 
2.29.2




___
Openvpn-devel mailing list
Openvpn-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openvpn-devel


Re: [Openvpn-devel] [PATCH applied] Re: Skip DNS address validation

2020-03-16 Thread Domagoj Pensa
On Fri, Mar 13, 2020 at 08:17:15PM +0100, Gert Doering wrote:
> Your patch has been applied to the master branch.
> 
> Sorry for the delay, it's been a very busy month.
> 

No problem at all.
Thank you for applying patch! :)

Regards,
Domagoj


___
Openvpn-devel mailing list
Openvpn-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openvpn-devel


Re: [Openvpn-devel] [PATCH 1/2] Skip DNS address validation

2020-02-12 Thread Domagoj Pensa
Hi!

My I ask if there is anything else I can (or should) do regarding this 
patch? Perhaps send patch again with revised/updated description as 
suggested by Simon?

Thank you!

Regards,
Domagoj


___
Openvpn-devel mailing list
Openvpn-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openvpn-devel


Re: [Openvpn-devel] [PATCH 1/2] Skip DNS address validation

2020-02-06 Thread Domagoj Pensa
Hi!

On Thu, Feb 06, 2020 at 09:58:37AM +, Simon Rozman wrote:
> Hi,
> 
> My thoughts exactly: as Lev pointed out:
> https://github.com/rozmansi/openvpn/commit/6b746cb0bf72a75e9963cc1a037c18cfb
> 856702a
> 
> Acked-by: Simon Rozman 
> 
> Domagoj, if it's not too much for you, maybe document the reason why DNS
> validation is so slow in the commit message. My wording went like this:
> 
> > DNS validation usually fails, as the pushed routes should be added first
> > to make DNS servers not part of the OpenVPN subnet reachable before
> > instructing Windows to use them.
> 
> Maybe Gert can update the commit message when applying?

Absolutely, Gert can add your additional description in the commit.

Regards,
Domagoj


___
Openvpn-devel mailing list
Openvpn-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openvpn-devel


Re: [Openvpn-devel] Fwd: [PATCH 2/2] Fix linking issues on MinGW

2020-02-05 Thread Domagoj Pensa
Hi,

On Wed, Feb 05, 2020 at 10:28:38AM -0500, Selva Nair wrote:
> Are you building without optimization? Please try using the latest
> openvpn-build (or just add -O2 to complier options).

Yes, that was it!

When Lev said that he doesn't have problems with build, I've noticed that he 
is using script build-complete from windows-nsis.

I didn't want installer build, just binaries, so I followed  instructions 
from README and generic/README and thus I used generic/build.

But that doesn't include -O2 and I get mentioned error when linking.

In windows-nsis/build-complete there are additional flags "-O2 -flto" and 
that's why Lev doesn't have issues and we are using same tools and OS 
versions.

Those additional flags where added by Lev in commit 3eb61bb in 
openvpn-build.

Problem solved, now I know for the future.

But still it would be nice to somehow "fix" this for others, by either 
updating READMEs, adding -O2 to generic/build script or apply patch I've 
sent that helped me and links with optimization off.

Maybe doing all that won't be bad.

Thank you all!

Domagoj


___
Openvpn-devel mailing list
Openvpn-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openvpn-devel


Re: [Openvpn-devel] [PATCH 2/2] Fix linking issues on MinGW

2020-02-05 Thread Domagoj Pensa
Hi!

On Wed, Feb 05, 2020 at 02:05:11PM +0100, Gert Doering wrote:
> Hi,
> 
> On Wed, Feb 05, 2020 at 01:46:15PM +0100, Domagoj Pensa wrote:
> > MinGW linking fails for several files due to a missing "static"
> > declaration in functions tuntap_is_wintun() and tuntap_ring_empty().
> 
> It does not fail for us.  So what MinGW version on what OS are you using
> to exhibit this error?

I've mentioned that in first mail:

I'm using Ubuntu 19.04 with mingw-w64 from official repository (version 
6.0.0-3) and for build process script generic/build from openvpn-build 
repository.

I've also included linker output same mail:

/usr/bin/x86_64-w64-mingw32-ld: forward.o:forward.c:(.text+0x5fec): 
undefined reference to `tuntap_is_wintun'
/usr/bin/x86_64-w64-mingw32-ld: mtcp.o:mtcp.c:(.text+0x8a4): undefined 
reference to `tuntap_is_wintun'
/usr/bin/x86_64-w64-mingw32-ld: mtcp.o:mtcp.c:(.text+0x1362): undefined 
reference to `tuntap_is_wintun'
/usr/bin/x86_64-w64-mingw32-ld: mtcp.o:mtcp.c:(.text+0x1379): undefined 
reference to `tuntap_ring_empty'
/usr/bin/x86_64-w64-mingw32-ld: mudp.o:mudp.c:(.text+0x536): undefined 
reference to `tuntap_is_wintun'
/usr/bin/x86_64-w64-mingw32-ld: mudp.o:mudp.c:(.text+0xf53): undefined 
reference to `tuntap_ring_empty'
/usr/bin/x86_64-w64-mingw32-ld: openvpn.o:openvpn.c:(.text+0x1b6): undefined 
reference to `tuntap_ring_empty'
/usr/bin/x86_64-w64-mingw32-ld: openvpn.o:openvpn.c:(.text+0x261): undefined 
reference to `tuntap_is_wintun'
collect2: error: ld returned 1 exit status

Here are versions for some tools from that package:

$ /usr/bin/x86_64-w64-mingw32-ld -v
GNU ld (GNU Binutils) 2.32

$ x86_64-w64-mingw32-gcc -v
Using built-in specs.
COLLECT_GCC=x86_64-w64-mingw32-gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-w64-mingw32/8.3-win32/lto-wrapper
Target: x86_64-w64-mingw32
Configured with: ../../src/configure --build=x86_64-linux-gnu --prefix=/usr 
--includedir='/usr/include' --mandir='/usr/share/man' 
--infodir='/usr/share/info' --sysconfdir=/etc --localstatedir=/var 
--disable-silent-rules --libdir='/usr/lib/x86_64-linux-gnu' 
--libexecdir='/usr/lib/x86_64-linux-gnu' --disable-maintainer-mode 
--disable-dependency-tracking --prefix=/usr --enable-shared --enable-static 
--disable-multilib --with-system-zlib --libexecdir=/usr/lib 
--without-included-gettext --libdir=/usr/lib --enable-libstdcxx-time=yes 
--with-tune=generic --with-headers=/usr/x86_64-w64-mingw32/include 
--enable-version-specific-runtime-libs --enable-fully-dynamic-string 
--enable-libgomp --enable-languages=c,c++,fortran,objc,obj-c++,ada --enable-lto 
--with-plugin-ld --enable-threads=win32 --program-suffix=-win32 
--program-prefix=x86_64-w64-mingw32- --target=x86_64-w64-mingw32 
--with-as=/usr/bin/x86_64-w64-mingw32-as 
--with-ld=/usr/bin/x86_64-w64-mingw32-ld --enable-libatomic
Thread model: win32
gcc version 8.3-win32 20190406 (GCC)

Domagoj


___
Openvpn-devel mailing list
Openvpn-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openvpn-devel


Re: [Openvpn-devel] [PATCH 2/2] Fix linking issues on MinGW

2020-02-05 Thread Domagoj Pensa
Hi!

On Wed, Feb 05, 2020 at 02:05:11PM +0100, Gert Doering wrote:
> Hi,
> 
> On Wed, Feb 05, 2020 at 01:46:15PM +0100, Domagoj Pensa wrote:
> > MinGW linking fails for several files due to a missing "static"
> > declaration in functions tuntap_is_wintun() and tuntap_ring_empty().
> 
> It does not fail for us.  So what MinGW version on what OS are you using
> to exhibit this error?

I've mentioned that in first mail:

I'm using Ubuntu 19.04 with mingw-w64 from official repository (version 
6.0.0-3) and for build process script generic/build from openvpn-build 
repository.

I've also included linker output same mail:

/usr/bin/x86_64-w64-mingw32-ld: forward.o:forward.c:(.text+0x5fec): 
undefined reference to `tuntap_is_wintun'
/usr/bin/x86_64-w64-mingw32-ld: mtcp.o:mtcp.c:(.text+0x8a4): undefined 
reference to `tuntap_is_wintun'
/usr/bin/x86_64-w64-mingw32-ld: mtcp.o:mtcp.c:(.text+0x1362): undefined 
reference to `tuntap_is_wintun'
/usr/bin/x86_64-w64-mingw32-ld: mtcp.o:mtcp.c:(.text+0x1379): undefined 
reference to `tuntap_ring_empty'
/usr/bin/x86_64-w64-mingw32-ld: mudp.o:mudp.c:(.text+0x536): undefined 
reference to `tuntap_is_wintun'
/usr/bin/x86_64-w64-mingw32-ld: mudp.o:mudp.c:(.text+0xf53): undefined 
reference to `tuntap_ring_empty'
/usr/bin/x86_64-w64-mingw32-ld: openvpn.o:openvpn.c:(.text+0x1b6): undefined 
reference to `tuntap_ring_empty'
/usr/bin/x86_64-w64-mingw32-ld: openvpn.o:openvpn.c:(.text+0x261): undefined 
reference to `tuntap_is_wintun'
collect2: error: ld returned 1 exit status

Here are versions for some tools from that package:

$ /usr/bin/x86_64-w64-mingw32-ld -v
GNU ld (GNU Binutils) 2.32

$ x86_64-w64-mingw32-gcc -v
Using built-in specs.
COLLECT_GCC=x86_64-w64-mingw32-gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-w64-mingw32/8.3-win32/lto-wrapper
Target: x86_64-w64-mingw32
Configured with: ../../src/configure --build=x86_64-linux-gnu --prefix=/usr 
--includedir='/usr/include' --mandir='/usr/share/man' 
--infodir='/usr/share/info' --sysconfdir=/etc --localstatedir=/var 
--disable-silent-rules --libdir='/usr/lib/x86_64-linux-gnu' 
--libexecdir='/usr/lib/x86_64-linux-gnu' --disable-maintainer-mode 
--disable-dependency-tracking --prefix=/usr --enable-shared --enable-static 
--disable-multilib --with-system-zlib --libexecdir=/usr/lib 
--without-included-gettext --libdir=/usr/lib --enable-libstdcxx-time=yes 
--with-tune=generic --with-headers=/usr/x86_64-w64-mingw32/include 
--enable-version-specific-runtime-libs --enable-fully-dynamic-string 
--enable-libgomp --enable-languages=c,c++,fortran,objc,obj-c++,ada --enable-lto 
--with-plugin-ld --enable-threads=win32 --program-suffix=-win32 
--program-prefix=x86_64-w64-mingw32- --target=x86_64-w64-mingw32 
--with-as=/usr/bin/x86_64-w64-mingw32-as 
--with-ld=/usr/bin/x86_64-w64-mingw32-ld --enable-libatomic
Thread model: win32
gcc version 8.3-win32 20190406 (GCC)

Domagoj



___
Openvpn-devel mailing list
Openvpn-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openvpn-devel


[Openvpn-devel] [PATCH 2/2] Fix linking issues on MinGW

2020-02-05 Thread Domagoj Pensa
MinGW linking fails for several files due to a missing "static"
declaration in functions tuntap_is_wintun() and tuntap_ring_empty().

Signed-off-by: Domagoj Pensa 
---
 src/openvpn/tun.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/openvpn/tun.h b/src/openvpn/tun.h
index 97d28f45..327d7927 100644
--- a/src/openvpn/tun.h
+++ b/src/openvpn/tun.h
@@ -224,13 +224,13 @@ tuntap_defined(const struct tuntap *tt)
 }
 
 #ifdef _WIN32
-inline bool
+static inline bool
 tuntap_is_wintun(struct tuntap *tt)
 {
 return tt && tt->windows_driver == WINDOWS_DRIVER_WINTUN;
 }
 
-inline bool
+static inline bool
 tuntap_ring_empty(struct tuntap *tt)
 {
 return tuntap_is_wintun(tt) && (tt->wintun_send_ring->head == 
tt->wintun_send_ring->tail);
-- 
2.25.0




___
Openvpn-devel mailing list
Openvpn-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openvpn-devel


[Openvpn-devel] [PATCH 1/2] Skip DNS address validation

2020-02-05 Thread Domagoj Pensa
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 
---
 src/openvpn/tun.c | 9 +
 1 file changed, 9 insertions(+)

diff --git a/src/openvpn/tun.c b/src/openvpn/tun.c
index af09e676..9f369f74 100644
--- a/src/openvpn/tun.c
+++ b/src/openvpn/tun.c
@@ -5216,6 +5216,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)
@@ -5259,6 +5260,14 @@ netsh_ifconfig_options(const char *type,
 type,
 flex_name,
 print_in_addr_t(addr_list[i], 0, ));
+
+/* disable slow address validation on Windows 7 and higher */
+/* only for DNS */
+if (is_dns && win32_version_info() >= WIN_7)
+{
+argv_printf_cat(, "%s", "validate=no");
+}
+
 netsh_command(, 2, M_FATAL);
 
 ++count;
-- 
2.25.0




___
Openvpn-devel mailing list
Openvpn-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openvpn-devel


[Openvpn-devel] [PATCH 0/2] Couple of fixes

2020-02-05 Thread Domagoj Pensa
Hi!

First patch fixes long delays when setting IPv4 DNS using netsh without 
interactive service by adding "validate=no" to netsh invocation.

I've noticed that issue while testing wintun, as it is setup using netsh.

All other variants, IPv6 DNS without interactive service and IPv4/IPv6 DNS 
with interactive service, have validation already turned off.

Change is adapted from code by commit 786e06a.
It is necessary to make sure that argument is added only for DNS and not 
WINS, thus additional check is made (is_dns).

Second patch was necessary, at least for me, because build process was 
unable to perform linking, with the following output:

/usr/bin/x86_64-w64-mingw32-ld: forward.o:forward.c:(.text+0x5fec): 
undefined reference to `tuntap_is_wintun'
/usr/bin/x86_64-w64-mingw32-ld: mtcp.o:mtcp.c:(.text+0x8a4): undefined 
reference to `tuntap_is_wintun'
/usr/bin/x86_64-w64-mingw32-ld: mtcp.o:mtcp.c:(.text+0x1362): undefined 
reference to `tuntap_is_wintun'
/usr/bin/x86_64-w64-mingw32-ld: mtcp.o:mtcp.c:(.text+0x1379): undefined 
reference to `tuntap_ring_empty'
/usr/bin/x86_64-w64-mingw32-ld: mudp.o:mudp.c:(.text+0x536): undefined 
reference to `tuntap_is_wintun'
/usr/bin/x86_64-w64-mingw32-ld: mudp.o:mudp.c:(.text+0xf53): undefined 
reference to `tuntap_ring_empty'
/usr/bin/x86_64-w64-mingw32-ld: openvpn.o:openvpn.c:(.text+0x1b6): undefined 
reference to `tuntap_ring_empty'
/usr/bin/x86_64-w64-mingw32-ld: openvpn.o:openvpn.c:(.text+0x261): undefined 
reference to `tuntap_is_wintun'
collect2: error: ld returned 1 exit status

After declaring both functions as static linking worked.

I'm using Ubuntu 19.04 with mingw-w64 from official repository (version 
6.0.0-3) and for build process script generic/build from openvpn-build 
repository.

It is also worth noting that similar function tuntap_defined() with same 
signature (static inline bool) already exists in the same header file, so 
this change should be safe.

Domagoj Pensa (2):
  Skip DNS address validation
  Fix linking issues on MinGW

 src/openvpn/tun.c | 9 +
 src/openvpn/tun.h | 4 ++--
 2 files changed, 11 insertions(+), 2 deletions(-)

-- 
2.25.0




___
Openvpn-devel mailing list
Openvpn-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openvpn-devel