* Understanding Protocol / State Machine
@ 2018-12-21 18:18 Iain Douglas
2019-01-02 18:20 ` Jason A. Donenfeld
0 siblings, 1 reply; 2+ messages in thread
From: Iain Douglas @ 2018-12-21 18:18 UTC (permalink / raw)
To: wireguard
Hi,
I have been investigating what happens when a peer crashes/goes away for
some reason and the configuration is reset.
My test setup is quite simple, I have 2 peers and one is acting as a
gateway for the other for the remote address 8.8.8.8.
I can ping 8.8.8.8 and traffic goes over the WireGuard link as expected.
When I want to test I delete the key on the peer and add it again.
Wireguard is te lates version from CentOS repo 0.0.20181218-1.
I see three different things happening depending on when the last
handshake took place.
1. Handshake < 119 seconds ago the link takes ~ 15 seconds to recover
2. Handshake between 120 and 179 seconds ago - 1st packet is lost then
link recovers
3. Handshake >=180 second ago - link just works as normal.
It is (2) that I don't understand. When I look at the packets sent I see
ping out
handshake out
handshake response
No reply to the ping
However for (3) above I see
handshake out
handshake response
ping
ping reply
So for (3) I guess that the ping is queued until after the handshake
occurs.
Having watched Jason's talk at the Linux Plumbers conference I was
expecting what happens at (3) to be at (2).
Can someone enlighten me as to why the first packet at (2) is sent
before the handshake?
Cheers
Iain
_______________________________________________
WireGuard mailing list
WireGuard@lists.zx2c4.com
https://lists.zx2c4.com/mailman/listinfo/wireguard
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Understanding Protocol / State Machine
2018-12-21 18:18 Understanding Protocol / State Machine Iain Douglas
@ 2019-01-02 18:20 ` Jason A. Donenfeld
0 siblings, 0 replies; 2+ messages in thread
From: Jason A. Donenfeld @ 2019-01-02 18:20 UTC (permalink / raw)
To: Iain Douglas; +Cc: WireGuard mailing list
On Wed, Jan 2, 2019 at 7:03 PM Iain Douglas <wireguard@1n6.org.uk> wrote:
> 1. Handshake < 119 seconds ago the link takes ~ 15 seconds to recover
> 2. Handshake between 120 and 179 seconds ago - 1st packet is lost then
> link recovers
> 3. Handshake >=180 second ago - link just works as normal.
For 1, it's hitting the timeout of detecting the dead peer before
reestablishing the handshake, since it still believes it has a valid
session.
For 2, it's the same as 1, except that when sending packets when your
current session is older than two minutes, it will start trying to
create a new one. The way to think of this that sessions live
optimally for only 2 minutes and maximally for 3.
For 3, the current session is unusable and already cleared from
memory, since it expired after 3 minutes, and so a new session is
established before the packet is sent.
_______________________________________________
WireGuard mailing list
WireGuard@lists.zx2c4.com
https://lists.zx2c4.com/mailman/listinfo/wireguard
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-01-02 18:20 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-21 18:18 Understanding Protocol / State Machine Iain Douglas
2019-01-02 18:20 ` Jason A. Donenfeld
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).