Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows: Fix interface selection by name #68

Merged
merged 1 commit into from
Jul 25, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions syscalls_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@ import (
// https://github.com/OpenVPN/openvpn

const (
// tapDriverKey is a location of the TAP driver key.
// tapDriverKey is the location of the TAP driver key.
tapDriverKey = `SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002BE10318}`
// netConfigKey is the location of the TAP adapter's network config.
netConfigKey = `SYSTEM\CurrentControlSet\Control\Network\{4D36E972-E325-11CE-BFC1-08002BE10318}`
)

var (
Expand Down Expand Up @@ -173,7 +175,7 @@ func getdeviceid(componentID string, interfaceName string) (deviceid string, err
continue
}
if len(interfaceName) > 0 {
key2 := fmt.Sprintf("%s\\%s\\Connection", tapDriverKey, val)
key2 := fmt.Sprintf("%s\\%s\\Connection", netConfigKey, val)
k2, err := registry.OpenKey(registry.LOCAL_MACHINE, key2, registry.READ)
if err != nil {
continue
Expand Down