From 7578c815bea2c52be53badac215a9215f9985f1b Mon Sep 17 00:00:00 2001 From: David Anderson Date: Mon, 27 Jul 2020 16:20:31 +0000 Subject: [PATCH] wgengine/magicsock: give pinger a more generous packet timeout. The first packet to transit may take several seconds to do so, because setup rates in wgengine may result in the initial WireGuard handshake init to get dropped. So, we have to wait at least long enough for a retransmit to correct the fault. Signed-off-by: David Anderson --- wgengine/magicsock/magicsock_test.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/wgengine/magicsock/magicsock_test.go b/wgengine/magicsock/magicsock_test.go index 643895eb2..c433b8eec 100644 --- a/wgengine/magicsock/magicsock_test.go +++ b/wgengine/magicsock/magicsock_test.go @@ -722,7 +722,13 @@ func newPinger(t *testing.T, logf logger.Logf, srcM, dstM *magicStack, srcIP, ds select { case <-dstM.tun.Inbound: return true - case <-time.After(time.Second): + case <-time.After(10 * time.Second): + // Very generous timeout here because depending on + // magicsock setup races, the first handshake might get + // eaten by the receiving end (if wireguard-go hasn't been + // configured quite yet), so we have to wait for at least + // the first retransmit from wireguard before we declare + // failure. t.Errorf("timed out waiting for ping to transit") return true case <-ctx.Done():