From 85b9a6c601d82d4c2c5971f29f2c6771962ab7e9 Mon Sep 17 00:00:00 2001 From: Maisem Ali Date: Tue, 7 May 2024 15:50:54 -0700 Subject: [PATCH] net/netcheck: do not add derps if IPv4/IPv6 is set to "none" It was documented as such but seems to have been dropped in a refactor, restore the behavior. This brings down the time it takes to run a single integration test by 2s which adds up quite a bit. Updates tailscale/corp#19786 Signed-off-by: Maisem Ali --- net/netcheck/netcheck.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/net/netcheck/netcheck.go b/net/netcheck/netcheck.go index 1a0be9ebf..45523c7ae 100644 --- a/net/netcheck/netcheck.go +++ b/net/netcheck/netcheck.go @@ -450,10 +450,10 @@ func makeProbePlan(dm *tailcfg.DERPMap, ifState *netmon.State, last *Report) (pl if try > 1 { delay += time.Duration(try) * 50 * time.Millisecond } - if do4 || n.IsTestNode() { + if n.IPv4 != "none" && (do4 || n.IsTestNode()) { p4 = append(p4, probe{delay: delay, node: n.Name, proto: probeIPv4}) } - if do6 || n.IsTestNode() { + if n.IPv6 != "none" && (do6 || n.IsTestNode()) { p6 = append(p6, probe{delay: delay, node: n.Name, proto: probeIPv6}) } } @@ -476,10 +476,10 @@ func makeProbePlanInitial(dm *tailcfg.DERPMap, ifState *netmon.State) (plan prob for try := 0; try < 3; try++ { n := reg.Nodes[try%len(reg.Nodes)] delay := time.Duration(try) * defaultInitialRetransmitTime - if ifState.HaveV4 && nodeMight4(n) || n.IsTestNode() { + if n.IPv4 != "none" && ((ifState.HaveV4 && nodeMight4(n)) || n.IsTestNode()) { p4 = append(p4, probe{delay: delay, node: n.Name, proto: probeIPv4}) } - if ifState.HaveV6 && nodeMight6(n) || n.IsTestNode() { + if n.IPv6 != "none" && ((ifState.HaveV6 && nodeMight6(n)) || n.IsTestNode()) { p6 = append(p6, probe{delay: delay, node: n.Name, proto: probeIPv6}) } }