From 7f8af5845ddec1816f93a2cb013f0818c19caab3 Mon Sep 17 00:00:00 2001 From: jwijenbergh Date: Wed, 10 Jul 2024 14:37:14 +0200 Subject: Client Proxy: Fix theoretical race condition --- client/proxy.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'client') diff --git a/client/proxy.go b/client/proxy.go index b39af32..ed17c82 100644 --- a/client/proxy.go +++ b/client/proxy.go @@ -80,6 +80,7 @@ func (p *Proxy) Tunnel(ctx context.Context, peer string) error { } cctx, cf := context.WithCancel(ctx) p.cancel = cf + client := *p.c p.mu.Unlock() defer func() { p.mu.Lock() @@ -87,7 +88,7 @@ func (p *Proxy) Tunnel(ctx context.Context, peer string) error { p.mu.Unlock() }() // we set peer IPs to nil here as proxyguard already does a DNS request for us - return p.c.Tunnel(cctx, peer, nil) + return client.Tunnel(cctx, peer, nil) } // StartProxyguard starts proxyguard for proxied WireGuard connections -- cgit v1.2.3