Win32: problem with tinc-up script

borg at uu3.net borg at uu3.net
Mon Oct 24 22:03:18 CEST 2016


GetIpAddrTable() does not clear anything, it just
get IP addresses.
Its NotifyAddrChange() that installs notification.
It can be canceled by CancelIPChangeNotify().

In case of tinc, the call just gets necessary length
to allocate buffor to talk with API.

In case of wipchg, we get IP addresses to check
if IP is already set on interface, just in case
if wipchg is called multiple times.
I do not see any race condition here...

---------- Original message ----------

From: Guus Sliepen <guus at tinc-vpn.org>
To: tinc-devel at tinc-vpn.org
Subject: Re: Win32: problem with tinc-up script
Date: Mon, 24 Oct 2016 21:41:17 +0200
Message-ID: <20161024194117.GU4585 at sliepen.org>

On Mon, Oct 24, 2016 at 09:04:49PM +0200, borg at uu3.net wrote:

> Okey, after more extensive R&D and testing I came up with 2
> final solutions:
> 
> 1) external tool: wipchg
> 2) internal tincd: wait_device(int secs)
> 
> Both solution works 100% time (tested on Win2003).
> I publish them here, so interested parties can do they own testing.
> 
> 1) ftp://borg.uu3.net/home/borg/tmp/wipchg.tgz
>   You need Mingw compiler to build this.
> 2) http://borg.uu3.net/cgit/cgit.cgi/OEM/tinc/log/?h=tap_wait

In both solutions, I do see a race condition: first GetIpAddrTable() is
called, then NotifyAddrChange() is called. If the IP address is assigned
between those two calls, you will not get a notification anymore. I
think you should instead call NotifyAddrChange() first, then do
GetIpAddrTable(), then WaitForSingleObject() if there is no IP address
assigned to tinc's interface yet.

-- 
Met vriendelijke groet / with kind regards,
     Guus Sliepen <guus at tinc-vpn.org>


More information about the tinc-devel mailing list