cmd/tailscale/cli: fix panic in netcheck with mismatched DERP region IDs
Fixes #17564 Signed-off-by: Xinyu Kuo <gxylong@126.com>
This commit is contained in:
committed by
Brad Fitzpatrick
parent
e1f0ad7a05
commit
8444659ed8
@@ -180,7 +180,11 @@ func printReport(dm *tailcfg.DERPMap, report *netcheck.Report) error {
|
|||||||
printf("\t* Nearest DERP: unknown (no response to latency probes)\n")
|
printf("\t* Nearest DERP: unknown (no response to latency probes)\n")
|
||||||
} else {
|
} else {
|
||||||
if report.PreferredDERP != 0 {
|
if report.PreferredDERP != 0 {
|
||||||
printf("\t* Nearest DERP: %v\n", dm.Regions[report.PreferredDERP].RegionName)
|
if region, ok := dm.Regions[report.PreferredDERP]; ok {
|
||||||
|
printf("\t* Nearest DERP: %v\n", region.RegionName)
|
||||||
|
} else {
|
||||||
|
printf("\t* Nearest DERP: %v (region not found in map)\n", report.PreferredDERP)
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
printf("\t* Nearest DERP: [none]\n")
|
printf("\t* Nearest DERP: [none]\n")
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user