Development discussion of WireGuard
 help / color / mirror / Atom feed
From: Joshua Sjoding <joshua.sjoding@scjalliance.com>
To: "Jason A. Donenfeld" <Jason@zx2c4.com>
Cc: WireGuard mailing list <wireguard@lists.zx2c4.com>
Subject: Re: WireGuard for Windows tunnel deactivation after prolonged resolution failure during startup
Date: Thu, 28 Jan 2021 17:02:04 -0800	[thread overview]
Message-ID: <CALaUSusBmLSAE3rYavFtEW5Bp+KoRVLfKFXga7Po+46KSGPbhg@mail.gmail.com> (raw)
In-Reply-To: <af71a4b2-989a-da04-2fa6-9467ec58997f@pineview.net>

Someone could power the laptop up but wait hours before they connect
it to their hotspot. For scenarios like that the current algorithm
seems insufficient.

My preference would be to listen for network changes while in a failed
state, then re-run the existing algorithm whenever a network
connect/disconnect occurs. This wouldn't cover cases where the
upstream ISP is having trouble, but it would probably be a big
improvement for us.

The best way to detect network changes on Windows is open for debate.
We've had great success with scheduled tasks that listen for events
10000 (connect) and 10001 (disconnect) in the
"Microsoft-Windows-NetworkProfile/Operational log" event log:

<QueryList><Query Id='1'><Select
Path='Microsoft-Windows-NetworkProfile/Operational'>*[System[(EventID=10000
or EventID=10001)]]</Select></Query></QueryList>

I don't know if that's helpful. There probably are better ways to
detect network changes, that's just what I've got off the cuff.

Joshua Sjoding
SCJ Alliance
IT Specialist
www.scjalliance.com


Joshua Sjoding
SCJ Alliance
IT Specialist
o. 360.352.1465, ext. 134
www.scjalliance.com

This communication may contain privileged or other confidential
information. If you have received it in error, please advise the
sender by reply email and immediately delete the message and any
attachments without copying or disclosing the contents. Thank you.


On Thu, Jan 28, 2021 at 4:39 PM Mike O'Connor <mike@pineview.net> wrote:
>
> Hi Jason
>
> I'm not a windows users so can not test, but it seems to me that
> Microsoft have API's to indicate the network status.
>
> This to indicate if there is a connection
> https://docs.microsoft.com/en-us/windows/win32/api/wininet/nf-wininet-internetgetconnectedstate
> This to indicate if there is route-able service. It seem this is
> deprecated for windows 10.
> https://docs.microsoft.com/en-us/windows/win32/api/wininet/nf-wininet-internetcheckconnectiona
> There is reference to a win10 version, in the notes.
>
> Not sure if this helps
>
> Cheers
> Mike
>
>
> On 29/1/21 10:53 am, Jason A. Donenfeld wrote:
> > Hi Joshua,
> >
> > Thanks for the bug report. Windows is usually all about heuristics.
> > Here's the current algorithm:
> >
> > - If the system has booted within the last 4 minutes, it retries 40
> > times. Otherwise it retries 10 times.
> > - If the resolution fails with a temporary error, or if it fails with
> > a permanent error but there's no available internet connection, then
> > we sleep for 4 seconds and try again.
> > - If we try the 40 or 10 times over the 160 or 40 seconds and don't
> > succeed, then we fail and shut down the service.
> >
> > It sounds like that set of heuristics isn't working out so great for
> > your use case. How long do those computers usually take to obtain an
> > Internet connection? If you could run some estimates on that, and come
> > up with some reasonable length of time ("not more than 3 minutes" for
> > example) then maybe we could just double that and make it the new
> > timeout? Or maybe you have a different idea?
> >
> > Jason
>
>

  parent reply	other threads:[~2021-01-29  1:05 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-28 22:54 Joshua Sjoding
2021-01-29  0:23 ` Jason A. Donenfeld
2021-01-29  0:39   ` Mike O'Connor
2021-01-29  0:54     ` Jason A. Donenfeld
2021-01-29  1:02     ` Joshua Sjoding [this message]
2021-01-29 20:14       ` Jason A. Donenfeld

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CALaUSusBmLSAE3rYavFtEW5Bp+KoRVLfKFXga7Po+46KSGPbhg@mail.gmail.com \
    --to=joshua.sjoding@scjalliance.com \
    --cc=Jason@zx2c4.com \
    --cc=wireguard@lists.zx2c4.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).