summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--tun/wintun/wintun_windows.go21
1 files changed, 19 insertions, 2 deletions
diff --git a/tun/wintun/wintun_windows.go b/tun/wintun/wintun_windows.go
index 4c12d97..3aada08 100644
--- a/tun/wintun/wintun_windows.go
+++ b/tun/wintun/wintun_windows.go
@@ -136,7 +136,7 @@ func (pool Pool) GetInterface(ifname string) (*Interface, error) {
if err != nil {
continue
}
- if hwids, ok := property.([]string); ok && len(hwids) > 0 && hwids[0] != hardwareID {
+ if !isOurHardwareID(property) {
continue
}
@@ -508,7 +508,7 @@ func (pool Pool) DeleteMatchingInterfaces(matches func(wintun *Interface) bool)
if err != nil {
continue
}
- if hwids, ok := property.([]string); ok && len(hwids) > 0 && hwids[0] != hardwareID {
+ if !isOurHardwareID(property) {
continue
}
@@ -801,3 +801,20 @@ func (wintun *Interface) GUID() windows.GUID {
func (wintun *Interface) LUID() uint64 {
return ((uint64(wintun.luidIndex) & ((1 << 24) - 1)) << 24) | ((uint64(wintun.ifType) & ((1 << 16) - 1)) << 48)
}
+
+func isOurHardwareID(property interface{}) bool {
+ hwidLC := strings.ToLower(hardwareID)
+
+ if hwids, ok := property.([]string); ok && len(hwids) > 0 {
+ for i := range hwids {
+ if strings.ToLower(hwids[i]) == hwidLC {
+ return true
+ }
+ }
+ }
+ if hwid, ok := property.(string); ok && strings.ToLower(hwid) == hwidLC {
+ return true
+ }
+
+ return false
+}