Skip to content

Commit 8444659

Browse files
kingcanfishbradfitz
authored andcommitted
cmd/tailscale/cli: fix panic in netcheck with mismatched DERP region IDs
Fixes tailscale#17564 Signed-off-by: Xinyu Kuo <[email protected]>
1 parent e1f0ad7 commit 8444659

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

cmd/tailscale/cli/netcheck.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,11 @@ func printReport(dm *tailcfg.DERPMap, report *netcheck.Report) error {
180180
printf("\t* Nearest DERP: unknown (no response to latency probes)\n")
181181
} else {
182182
if report.PreferredDERP != 0 {
183-
printf("\t* Nearest DERP: %v\n", dm.Regions[report.PreferredDERP].RegionName)
183+
if region, ok := dm.Regions[report.PreferredDERP]; ok {
184+
printf("\t* Nearest DERP: %v\n", region.RegionName)
185+
} else {
186+
printf("\t* Nearest DERP: %v (region not found in map)\n", report.PreferredDERP)
187+
}
184188
} else {
185189
printf("\t* Nearest DERP: [none]\n")
186190
}

0 commit comments

Comments
 (0)