]> git.ipfire.org Git - thirdparty/wireguard-go.git/commitdiff
wintun: handle error for deadgwdetect
authorJason A. Donenfeld <Jason@zx2c4.com>
Fri, 2 Aug 2019 12:37:09 +0000 (14:37 +0200)
committerJason A. Donenfeld <Jason@zx2c4.com>
Fri, 2 Aug 2019 12:37:09 +0000 (14:37 +0200)
tun/wintun/wintun_windows.go

index 26ebf6012ff17436528769a7170ebc1e70670e00..09bf14f378ab155cc7fbd9537f96a5d224e5f1e2 100644 (file)
@@ -362,9 +362,10 @@ func CreateInterface(description string, requestedGUID *windows.GUID) (wintun *W
                key, err = registry.OpenKey(registry.LOCAL_MACHINE, tcpipInterfaceRegKeyName, registry.SET_VALUE)
                if err != nil {
                        err = fmt.Errorf("Error opening interface-specific TCP/IP network registry key: %v", err)
+               } else {
+                       key.SetDWordValue("EnableDeadGWDetect", 0)
+                       key.Close()
                }
-               key.SetDWordValue("EnableDeadGWDetect", 0)
-               key.Close()
        }
 
        if err == nil {