aboutsummaryrefslogtreecommitdiffstats
path: root/tun/tun_windows.go
diff options
context:
space:
mode:
authorJames Tucker <james@tailscale.com>2023-09-27 14:52:21 -0700
committerJason A. Donenfeld <Jason@zx2c4.com>2023-10-10 15:37:17 +0200
commitec8f6f82c20c617a3ea94478f2b5e4d49c6d3c2c (patch)
treeadb403a01a3e2bcc0b821772bba3a8e20b281674 /tun/tun_windows.go
parentdevice: move Queue{In,Out}boundElement Mutex to container type (diff)
downloadwireguard-go-ec8f6f82c20c617a3ea94478f2b5e4d49c6d3c2c.tar.xz
wireguard-go-ec8f6f82c20c617a3ea94478f2b5e4d49c6d3c2c.zip
tun: fix crash when ForceMTU is called after close
Close closes the events channel, resulting in a panic from send on closed channel. Reported-By: Brad Fitzpatrick <brad@tailscale.com> Signed-off-by: James Tucker <james@tailscale.com> Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to '')
-rw-r--r--tun/tun_windows.go3
1 files changed, 3 insertions, 0 deletions
diff --git a/tun/tun_windows.go b/tun/tun_windows.go
index 0cb4ce1..34f2980 100644
--- a/tun/tun_windows.go
+++ b/tun/tun_windows.go
@@ -127,6 +127,9 @@ func (tun *NativeTun) MTU() (int, error) {
// TODO: This is a temporary hack. We really need to be monitoring the interface in real time and adapting to MTU changes.
func (tun *NativeTun) ForceMTU(mtu int) {
+ if tun.close.Load() {
+ return
+ }
update := tun.forcedMTU != mtu
tun.forcedMTU = mtu
if update {