From 9a6de52dd09fa2edc9ef54cc48ea3acc84f56033 Mon Sep 17 00:00:00 2001 From: Maycon Santos Date: Wed, 17 Jul 2024 23:49:09 +0200 Subject: [PATCH] Check if route interface is a Microsoft ISATAP device (#2282) check if the nexthop interfaces are Microsoft ISATAP devices and ignore their suffixes when comparing them --- .../internal/networkmonitor/monitor_windows.go | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/client/internal/networkmonitor/monitor_windows.go b/client/internal/networkmonitor/monitor_windows.go index e24bdd066..f58802e4e 100644 --- a/client/internal/networkmonitor/monitor_windows.go +++ b/client/internal/networkmonitor/monitor_windows.go @@ -232,14 +232,20 @@ func stateFromInt(state uint8) string { } func compareIntf(a, b *net.Interface) int { - if a == nil && b == nil { + switch { + case a == nil && b == nil: return 0 - } - if a == nil { + case a == nil: return -1 - } - if b == nil { + case b == nil: return 1 + case isIsatapInterface(a.Name) && isIsatapInterface(b.Name): + return 0 + default: + return a.Index - b.Index } - return a.Index - b.Index +} + +func isIsatapInterface(name string) bool { + return strings.HasPrefix(strings.ToLower(name), "isatap") }