mirror of
https://github.com/netbirdio/netbird.git
synced 2024-11-21 23:53:14 +01:00
Ignore network monitor checks for software interfaces (#2302)
ignore checks for Teredo and ISATAP interfaces
This commit is contained in:
parent
788f130941
commit
268e801ec5
@ -99,6 +99,11 @@ func routeChanged(nexthop systemops.Nexthop, intf *net.Interface, routes []syste
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if isSoftInterface(nexthop.Intf.Name) {
|
||||||
|
log.Tracef("network monitor: ignoring default route change for soft interface %s", nexthop.Intf.Name)
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
unspec := getUnspecifiedPrefix(nexthop.IP)
|
unspec := getUnspecifiedPrefix(nexthop.IP)
|
||||||
defaultRoutes, foundMatchingRoute := processRoutes(nexthop, intf, routes, unspec)
|
defaultRoutes, foundMatchingRoute := processRoutes(nexthop, intf, routes, unspec)
|
||||||
|
|
||||||
@ -119,7 +124,7 @@ func getUnspecifiedPrefix(ip netip.Addr) netip.Prefix {
|
|||||||
return netip.PrefixFrom(netip.IPv4Unspecified(), 0)
|
return netip.PrefixFrom(netip.IPv4Unspecified(), 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
func processRoutes(nexthop systemops.Nexthop, intf *net.Interface, routes []systemops.Route, unspec netip.Prefix) ([]string, bool) {
|
func processRoutes(nexthop systemops.Nexthop, nexthopIntf *net.Interface, routes []systemops.Route, unspec netip.Prefix) ([]string, bool) {
|
||||||
var defaultRoutes []string
|
var defaultRoutes []string
|
||||||
foundMatchingRoute := false
|
foundMatchingRoute := false
|
||||||
|
|
||||||
@ -128,7 +133,7 @@ func processRoutes(nexthop systemops.Nexthop, intf *net.Interface, routes []syst
|
|||||||
routeInfo := formatRouteInfo(r)
|
routeInfo := formatRouteInfo(r)
|
||||||
defaultRoutes = append(defaultRoutes, routeInfo)
|
defaultRoutes = append(defaultRoutes, routeInfo)
|
||||||
|
|
||||||
if r.Nexthop == nexthop.IP && compareIntf(r.Interface, intf) == 0 {
|
if r.Nexthop == nexthop.IP && compareIntf(r.Interface, nexthopIntf) == 0 {
|
||||||
foundMatchingRoute = true
|
foundMatchingRoute = true
|
||||||
log.Debugf("network monitor: found matching default route: %s", routeInfo)
|
log.Debugf("network monitor: found matching default route: %s", routeInfo)
|
||||||
}
|
}
|
||||||
@ -239,13 +244,11 @@ func compareIntf(a, b *net.Interface) int {
|
|||||||
return -1
|
return -1
|
||||||
case b == nil:
|
case b == nil:
|
||||||
return 1
|
return 1
|
||||||
case isIsatapInterface(a.Name) && isIsatapInterface(b.Name):
|
|
||||||
return 0
|
|
||||||
default:
|
default:
|
||||||
return a.Index - b.Index
|
return a.Index - b.Index
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func isIsatapInterface(name string) bool {
|
func isSoftInterface(name string) bool {
|
||||||
return strings.HasPrefix(strings.ToLower(name), "isatap")
|
return strings.Contains(strings.ToLower(name), "isatap") || strings.Contains(strings.ToLower(name), "teredo")
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user