@ -41,6 +41,7 @@ import (
"tailscale.com/types/key"
"tailscale.com/types/key"
"tailscale.com/types/logger"
"tailscale.com/types/logger"
"tailscale.com/types/netmap"
"tailscale.com/types/netmap"
"tailscale.com/types/views"
"tailscale.com/util/clientmetric"
"tailscale.com/util/clientmetric"
"tailscale.com/util/deephash"
"tailscale.com/util/deephash"
"tailscale.com/util/mak"
"tailscale.com/util/mak"
@ -755,12 +756,11 @@ func (e *userspaceEngine) updateActivityMapsLocked(trackNodes []key.NodePublic,
// hasOverlap checks if there is a IPPrefix which is common amongst the two
// hasOverlap checks if there is a IPPrefix which is common amongst the two
// provided slices.
// provided slices.
func hasOverlap ( aips , rips [ ] netip . Prefix ) bool {
func hasOverlap ( aips , rips views . Slice [ netip . Prefix ] ) bool {
for _ , aip := range aips {
for i := range aips . LenIter ( ) {
for _ , rip := range rips {
aip := aips . At ( i )
if aip == rip {
if views . SliceContains ( rips , aip ) {
return true
return true
}
}
}
}
}
return false
return false
@ -800,9 +800,9 @@ func (e *userspaceEngine) Reconfig(cfg *wgcfg.Config, routerCfg *router.Config,
isSubnetRouter := false
isSubnetRouter := false
if e . birdClient != nil && nm != nil && nm . SelfNode . Valid ( ) {
if e . birdClient != nil && nm != nil && nm . SelfNode . Valid ( ) {
isSubnetRouter = hasOverlap ( nm . SelfNode . PrimaryRoutes ( ) .AsSlice ( ) , nm . Hostinfo . RoutableIPs )
isSubnetRouter = hasOverlap ( nm . SelfNode . PrimaryRoutes ( ) , nm . SelfNode . Hostinfo ( ) . RoutableIPs ( ) )
e . logf ( "[v1] Reconfig: hasOverlap(%v, %v) = %v; isSubnetRouter=%v lastIsSubnetRouter=%v" ,
e . logf ( "[v1] Reconfig: hasOverlap(%v, %v) = %v; isSubnetRouter=%v lastIsSubnetRouter=%v" ,
nm . SelfNode . PrimaryRoutes , nm . Hostinfo . RoutableIPs ,
nm . SelfNode . PrimaryRoutes ( ) , nm . SelfNode . Hostinfo ( ) . RoutableIPs ( ) ,
isSubnetRouter , isSubnetRouter , e . lastIsSubnetRouter )
isSubnetRouter , isSubnetRouter , e . lastIsSubnetRouter )
}
}
isSubnetRouterChanged := isSubnetRouter != e . lastIsSubnetRouter
isSubnetRouterChanged := isSubnetRouter != e . lastIsSubnetRouter