]> git.ipfire.org Git - thirdparty/wireguard-go.git/commitdiff
wintun: log when reboot is suggested by Windows
authorSimon Rozman <simon@rozman.si>
Wed, 25 Nov 2020 11:54:26 +0000 (12:54 +0100)
committerJason A. Donenfeld <Jason@zx2c4.com>
Wed, 25 Nov 2020 12:58:11 +0000 (13:58 +0100)
Which really shouldn't happen. But it is a useful information for
troubleshooting.

Signed-off-by: Simon Rozman <simon@rozman.si>
tun/tun_windows.go

index a132d068f5d9187629d5556ad993c2c6581a3481..238bee0545f373958647d11ee86bca08602e51f9 100644 (file)
@@ -8,6 +8,7 @@ package tun
 import (
        "errors"
        "fmt"
+       "log"
        "os"
        "sync/atomic"
        "time"
@@ -84,10 +85,13 @@ func CreateTUNWithRequestedGUID(ifname string, requestedGUID *windows.GUID, mtu
                        return nil, fmt.Errorf("Error deleting already existing interface: %w", err)
                }
        }
-       wt, _, err = WintunPool.CreateAdapter(ifname, requestedGUID)
+       wt, rebootRequired, err := WintunPool.CreateAdapter(ifname, requestedGUID)
        if err != nil {
                return nil, fmt.Errorf("Error creating interface: %w", err)
        }
+       if rebootRequired {
+               log.Println("Windows indicated a reboot is required.")
+       }
 
        forcedMTU := 1420
        if mtu > 0 {