aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2019-07-18 19:26:25 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2019-07-18 19:27:27 +0200
commit31ff9c02fec42f38b0e444c41744887a1b9fedaf (patch)
treea8bcf7e429bf00faa57000fb3458c8ff30f39306
parenttun: windows: silently drop packet when ring is full (diff)
downloadwireguard-go-31ff9c02fec42f38b0e444c41744887a1b9fedaf.tar.xz
wireguard-go-31ff9c02fec42f38b0e444c41744887a1b9fedaf.zip
tun: windows: open file at startup time
-rw-r--r--tun/tun_windows.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/tun/tun_windows.go b/tun/tun_windows.go
index 86995a7..dff51dd 100644
--- a/tun/tun_windows.go
+++ b/tun/tun_windows.go
@@ -142,6 +142,15 @@ func CreateTUNWithRequestedGUID(ifname string, requestedGUID *windows.GUID) (Dev
return nil, fmt.Errorf("Error creating event: %v", err)
}
+ _, err = tun.getTUN()
+ if err != nil {
+ windows.CloseHandle(tun.rings.send.tailMoved)
+ windows.CloseHandle(tun.rings.receive.tailMoved)
+ tun.closeTUN()
+ wt.DeleteInterface()
+ return nil, err
+ }
+
return tun, nil
}