]> git.ipfire.org Git - thirdparty/wireguard-go.git/commitdiff
wintun: add FlushInterface stub
authorJason A. Donenfeld <Jason@zx2c4.com>
Thu, 7 Feb 2019 17:24:28 +0000 (18:24 +0100)
committerJason A. Donenfeld <Jason@zx2c4.com>
Thu, 7 Feb 2019 17:24:28 +0000 (18:24 +0100)
tun/tun_windows.go
tun/wintun/wintun_windows.go

index 644997458bcf3e5e926a93772ece343fdbbde34c..5f4f22aff3a256daecc2bdadedc3fa5c018bf20a 100644 (file)
@@ -65,6 +65,11 @@ func CreateTUN(ifname string) (TUNDevice, error) {
                // Set interface name. (Ignore errors.)
                wt.SetInterfaceName(ifname)
        }
+       err = wt.FlushInterface()
+       if err != nil {
+               wt.DeleteInterface(0)
+               return nil, err
+       }
 
        signalNameUTF16, err := windows.UTF16PtrFromString(wt.SignalEventName())
        if err != nil {
index 6adbb946d5be097ff0e9978e5632cf9155dea75e..b7d84fa9ffb36e3464beb5baf08c7801f07a1860 100644 (file)
@@ -322,9 +322,18 @@ func (wintun *Wintun) DeleteInterface(hwndParent uintptr) (bool, bool, error) {
        return false, false, nil
 }
 
-///
-/// checkReboot checks device install parameters if a system reboot is required.
-///
+//
+// FlushInterface removes all properties from the interface and gives it only a very
+// vanilla IPv4 and IPv6 configuration with no addresses of any sort assigned.
+//
+func (wintun *Wintun) FlushInterface() error {
+       //TODO: implement me!
+       return nil
+}
+
+//
+// checkReboot checks device install parameters if a system reboot is required.
+//
 func checkReboot(deviceInfoSet setupapi.DevInfo, deviceInfoData *setupapi.SP_DEVINFO_DATA) (bool, error) {
        devInstallParams, err := deviceInfoSet.GetDeviceInstallParams(deviceInfoData)
        if err != nil {
@@ -458,4 +467,4 @@ func (wintun *Wintun) SignalEventName() string {
 
 func (wintun *Wintun) DataFileName() string {
        return fmt.Sprintf("\\\\.\\Global\\WINTUN_DEVICE_%s", guid.ToString((*windows.GUID)(wintun)))
-}
\ No newline at end of file
+}