diff --git a/wgengine/magicsock/magicsock.go b/wgengine/magicsock/magicsock.go index 8a6d0f82d5bfd..06dc19afec897 100644 --- a/wgengine/magicsock/magicsock.go +++ b/wgengine/magicsock/magicsock.go @@ -431,6 +431,7 @@ func NewConn(opts Options) (*Conn, error) { c.logf = opts.logf() c.epFunc = opts.endpointsFunc() c.derpActiveFunc = opts.derpActiveFunc() + c.blockEndpoints = opts.BlockEndpoints c.idleFunc = opts.IdleFunc c.testOnlyPacketListener = opts.TestOnlyPacketListener c.noteRecvActivity = opts.NoteRecvActivity diff --git a/wgengine/magicsock/magicsock_test.go b/wgengine/magicsock/magicsock_test.go index 444f5604933e9..051ead8d0acc8 100644 --- a/wgengine/magicsock/magicsock_test.go +++ b/wgengine/magicsock/magicsock_test.go @@ -3112,14 +3112,13 @@ func TestBlockEndpointsDERPOK(t *testing.T) { func waitForNoEndpoints(t *testing.T, ms *Conn) { t.Helper() ok := false -parentLoop: for i := 0; i < 50; i++ { time.Sleep(100 * time.Millisecond) ms.mu.Lock() - for _, ep := range ms.lastEndpoints { - t.Errorf("endpoint %v was not blocked", ep.Addr) + if len(ms.lastEndpoints) != 0 { + t.Errorf("some endpoints were not blocked: %v", ms.lastEndpoints) ms.mu.Unlock() - continue parentLoop + continue } ms.mu.Unlock() ok = true