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
This commit is contained in:
Maycon Santos 2024-07-17 23:49:09 +02:00 committed by GitHub
parent 19147f518e
commit 9a6de52dd0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -232,14 +232,20 @@ func stateFromInt(state uint8) string {
} }
func compareIntf(a, b *net.Interface) int { func compareIntf(a, b *net.Interface) int {
if a == nil && b == nil { switch {
case a == nil && b == nil:
return 0 return 0
} case a == nil:
if a == nil {
return -1 return -1
} case b == nil:
if b == nil {
return 1 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")
} }