]> git.ipfire.org Git - thirdparty/wireguard-go.git/commitdiff
tun: windows: open file at startup time
authorJason A. Donenfeld <Jason@zx2c4.com>
Thu, 18 Jul 2019 17:26:25 +0000 (19:26 +0200)
committerJason A. Donenfeld <Jason@zx2c4.com>
Thu, 18 Jul 2019 17:27:27 +0000 (19:27 +0200)
tun/tun_windows.go

index 86995a77cc9546b3d22fcfe53aaf52d54a6b5e58..dff51dd4ad0d3f5fabe30e312ab0eedb20903768 100644 (file)
@@ -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
 }