diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2019-08-24 12:29:17 +0200 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2019-08-24 12:29:17 +0200 |
commit | 0c540ad60e6942f0c8458d8b9b5ceb2d76a0d29b (patch) | |
tree | 7cfb3c2a29aa5959c60a6952f96672ef2fd3e3fd | |
parent | 3cedc22d7b49be8ca00dc549c79de9e4a2d3df5b (diff) |
wintun: make description consistent across fields
-rw-r--r-- | tun/tun_windows.go | 2 | ||||
-rw-r--r-- | tun/wintun/wintun_windows.go | 21 |
2 files changed, 10 insertions, 13 deletions
diff --git a/tun/tun_windows.go b/tun/tun_windows.go index a66f709..aa54ad5 100644 --- a/tun/tun_windows.go +++ b/tun/tun_windows.go @@ -108,7 +108,7 @@ func CreateTUNWithRequestedGUID(ifname string, requestedGUID *windows.GUID) (Dev } else if err == windows.ERROR_ALREADY_EXISTS { return nil, fmt.Errorf("Foreign network interface with the same name exists") } - wt, _, err = wintun.CreateInterface("WireGuard Tunnel Adapter", requestedGUID) + wt, _, err = wintun.CreateInterface(requestedGUID) if err != nil { return nil, fmt.Errorf("Unable to create Wintun interface: %v", err) } diff --git a/tun/wintun/wintun_windows.go b/tun/wintun/wintun_windows.go index 1caa4a1..c1f5025 100644 --- a/tun/wintun/wintun_windows.go +++ b/tun/wintun/wintun_windows.go @@ -157,17 +157,14 @@ func GetInterface(ifname string) (*Wintun, error) { return nil, windows.ERROR_OBJECT_NOT_FOUND } -// CreateInterface creates a Wintun interface. description is a string that -// supplies the text description of the device. The description is optional -// and can be "". requestedGUID is the GUID of the created network interface, -// which then influences NLA generation deterministically. If it is set to nil, -// the GUID is chosen by the system at random, and hence a new NLA entry is -// created for each new interface. It is called "requested" GUID because the -// API it uses is completely undocumented, and so there could be minor -// interesting complications with its usage. This function returns the network -// interface ID and a flag if reboot is required. -// -func CreateInterface(description string, requestedGUID *windows.GUID) (wintun *Wintun, rebootRequired bool, err error) { +// CreateInterface creates a Wintun interface. requestedGUID is the GUID of the +// created network interface, which then influences NLA generation +// deterministically. If it is set to nil, the GUID is chosen by the system at +// random, and hence a new NLA entry is created for each new interface. It is +// called "requested" GUID because the API it uses is completely undocumented, +// and so there could be minor interesting complications with its usage. This +// function returns the network interface ID and a flag if reboot is required. +func CreateInterface(requestedGUID *windows.GUID) (wintun *Wintun, rebootRequired bool, err error) { // Create an empty device info set for network adapter device class. devInfoList, err := setupapi.SetupDiCreateDeviceInfoListEx(&deviceClassNetGUID, 0, "") if err != nil { @@ -184,7 +181,7 @@ func CreateInterface(description string, requestedGUID *windows.GUID) (wintun *W } // Create a new device info element and add it to the device info set. - deviceData, err := devInfoList.CreateDeviceInfo(className, &deviceClassNetGUID, description, 0, setupapi.DICD_GENERATE_ID) + deviceData, err := devInfoList.CreateDeviceInfo(className, &deviceClassNetGUID, deviceTypeName, 0, setupapi.DICD_GENERATE_ID) if err != nil { err = fmt.Errorf("SetupDiCreateDeviceInfo failed: %v", err) return |