diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2019-08-26 14:46:43 -0600 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2019-08-26 14:46:43 -0600 |
commit | d9008ac35cc9eff988680895a81445ad6b049d65 (patch) | |
tree | 48538d9d7eb0c634d57e0b6df1c5f958d64ecf34 /tun/wintun/wintun_windows.go | |
parent | f8198c042810b2c512c610654272db845e32b75e (diff) |
wintun: match suffix numbers
Diffstat (limited to 'tun/wintun/wintun_windows.go')
-rw-r--r-- | tun/wintun/wintun_windows.go | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/tun/wintun/wintun_windows.go b/tun/wintun/wintun_windows.go index c1f5025..81da251 100644 --- a/tun/wintun/wintun_windows.go +++ b/tun/wintun/wintun_windows.go @@ -121,8 +121,15 @@ func GetInterface(ifname string) (*Wintun, error) { if err != nil { continue } + ifname2 = strings.ToLower(ifname2) + ifname3 := strings.TrimRight(ifname2, "0123456789") + if ifname3 != ifname2 && len(ifname3) > 1 && ifname3[len(ifname3)-1] == ' ' { + ifname3 = ifname3[:len(ifname3)-1] + } else { + ifname3 = "" + } - if ifname == strings.ToLower(ifname2) { + if ifname == ifname2 || (len(ifname3) > 0 && ifname == ifname3) { err = devInfoList.BuildDriverInfoList(deviceData, setupapi.SPDIT_COMPATDRIVER) if err != nil { return nil, fmt.Errorf("SetupDiBuildDriverInfoList failed: %v", err) |