summaryrefslogtreecommitdiffhomepage
path: root/tun
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2019-02-07 18:24:28 +0100
committerJason A. Donenfeld <Jason@zx2c4.com>2019-02-07 18:24:28 +0100
commitc4b43e35a772305858e610d879c2b9d47f4d9866 (patch)
tree481779caaf60a709e621e61ac37cf969fb85b89e /tun
parent2efafecab5ee755a2b73e02ad340ab7f701e4f84 (diff)
wintun: add FlushInterface stub
Diffstat (limited to 'tun')
-rw-r--r--tun/tun_windows.go5
-rw-r--r--tun/wintun/wintun_windows.go17
2 files changed, 18 insertions, 4 deletions
diff --git a/tun/tun_windows.go b/tun/tun_windows.go
index 6449974..5f4f22a 100644
--- a/tun/tun_windows.go
+++ b/tun/tun_windows.go
@@ -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 {
diff --git a/tun/wintun/wintun_windows.go b/tun/wintun/wintun_windows.go
index 6adbb94..b7d84fa 100644
--- a/tun/wintun/wintun_windows.go
+++ b/tun/wintun/wintun_windows.go
@@ -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
+}