net/netcheck: respect DERPRegion.Avoid on initial probe plan too

As found by @jwhited/@raggi.

Updates #8603
Updates #13969
Updates tailscale/corp#24697

Change-Id: I32bb412a06e46a5fc154d87147e75363cf0d5407
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:
Brad Fitzpatrick 2024-11-19 13:29:33 -08:00
parent 9f33aeb649
commit c084e3f6ec
2 changed files with 3 additions and 2 deletions

View File

@ -541,7 +541,7 @@ func makeProbePlanInitial(dm *tailcfg.DERPMap, ifState *netmon.State) (plan prob
plan = make(probePlan) plan = make(probePlan)
for _, reg := range dm.Regions { for _, reg := range dm.Regions {
if len(reg.Nodes) == 0 { if reg.Avoid || len(reg.Nodes) == 0 {
continue continue
} }

View File

@ -401,7 +401,7 @@ func TestMakeProbePlan(t *testing.T) {
basicMap := &tailcfg.DERPMap{ basicMap := &tailcfg.DERPMap{
Regions: map[int]*tailcfg.DERPRegion{}, Regions: map[int]*tailcfg.DERPRegion{},
} }
for rid := 1; rid <= 5; rid++ { for rid := 1; rid <= 6; rid++ {
var nodes []*tailcfg.DERPNode var nodes []*tailcfg.DERPNode
for nid := 0; nid < rid; nid++ { for nid := 0; nid < rid; nid++ {
nodes = append(nodes, &tailcfg.DERPNode{ nodes = append(nodes, &tailcfg.DERPNode{
@ -415,6 +415,7 @@ func TestMakeProbePlan(t *testing.T) {
basicMap.Regions[rid] = &tailcfg.DERPRegion{ basicMap.Regions[rid] = &tailcfg.DERPRegion{
RegionID: rid, RegionID: rid,
Nodes: nodes, Nodes: nodes,
Avoid: rid == 6,
} }
} }