From c084e3f6ec81dc629f7ed3aed54148a56a27269a Mon Sep 17 00:00:00 2001 From: Brad Fitzpatrick Date: Tue, 19 Nov 2024 13:29:33 -0800 Subject: [PATCH] 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 --- net/netcheck/netcheck.go | 2 +- net/netcheck/netcheck_test.go | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/net/netcheck/netcheck.go b/net/netcheck/netcheck.go index 2c429862e..c701cc05e 100644 --- a/net/netcheck/netcheck.go +++ b/net/netcheck/netcheck.go @@ -541,7 +541,7 @@ func makeProbePlanInitial(dm *tailcfg.DERPMap, ifState *netmon.State) (plan prob plan = make(probePlan) for _, reg := range dm.Regions { - if len(reg.Nodes) == 0 { + if reg.Avoid || len(reg.Nodes) == 0 { continue } diff --git a/net/netcheck/netcheck_test.go b/net/netcheck/netcheck_test.go index b4fbb4023..3881fe1bc 100644 --- a/net/netcheck/netcheck_test.go +++ b/net/netcheck/netcheck_test.go @@ -401,7 +401,7 @@ func TestMakeProbePlan(t *testing.T) { basicMap := &tailcfg.DERPMap{ Regions: map[int]*tailcfg.DERPRegion{}, } - for rid := 1; rid <= 5; rid++ { + for rid := 1; rid <= 6; rid++ { var nodes []*tailcfg.DERPNode for nid := 0; nid < rid; nid++ { nodes = append(nodes, &tailcfg.DERPNode{ @@ -415,6 +415,7 @@ func TestMakeProbePlan(t *testing.T) { basicMap.Regions[rid] = &tailcfg.DERPRegion{ RegionID: rid, Nodes: nodes, + Avoid: rid == 6, } }