mirror of
https://github.com/tailscale/tailscale.git
synced 2024-12-02 14:35:39 +00:00
wgengine/magicsock: debug knob to override preferred derp region
Signed-off-by: Jordan Whited <jordan@tailscale.com>
This commit is contained in:
parent
2f529d7120
commit
682d9ea896
@ -56,6 +56,7 @@
|
|||||||
debugEnablePMTUD = envknob.RegisterOptBool("TS_DEBUG_ENABLE_PMTUD")
|
debugEnablePMTUD = envknob.RegisterOptBool("TS_DEBUG_ENABLE_PMTUD")
|
||||||
// debugPMTUD prints extra debugging about peer MTU path discovery.
|
// debugPMTUD prints extra debugging about peer MTU path discovery.
|
||||||
debugPMTUD = envknob.RegisterBool("TS_DEBUG_PMTUD")
|
debugPMTUD = envknob.RegisterBool("TS_DEBUG_PMTUD")
|
||||||
|
debugPreferDERPRegion = envknob.RegisterInt("TS_DEBUG_PREFER_DERP_REGION")
|
||||||
// Hey you! Adding a new debugknob? Make sure to stub it out in the
|
// Hey you! Adding a new debugknob? Make sure to stub it out in the
|
||||||
// debugknobs_stubs.go file too.
|
// debugknobs_stubs.go file too.
|
||||||
)
|
)
|
||||||
|
@ -28,3 +28,4 @@ func debugEnablePMTUD() opt.Bool { return "" }
|
|||||||
func debugRingBufferMaxSizeBytes() int { return 0 }
|
func debugRingBufferMaxSizeBytes() int { return 0 }
|
||||||
func inTest() bool { return false }
|
func inTest() bool { return false }
|
||||||
func debugPeerMap() bool { return false }
|
func debugPeerMap() bool { return false }
|
||||||
|
func debugPreferDERPRegion() int { return 0 }
|
||||||
|
@ -649,6 +649,10 @@ func (c *Conn) updateNetInfo(ctx context.Context) (*netcheck.Report, error) {
|
|||||||
ni.WorkingUDP.Set(report.UDP)
|
ni.WorkingUDP.Set(report.UDP)
|
||||||
ni.WorkingICMPv4.Set(report.ICMPv4)
|
ni.WorkingICMPv4.Set(report.ICMPv4)
|
||||||
ni.PreferredDERP = report.PreferredDERP
|
ni.PreferredDERP = report.PreferredDERP
|
||||||
|
preferDERP := debugPreferDERPRegion()
|
||||||
|
if preferDERP > 0 {
|
||||||
|
ni.PreferredDERP = preferDERP
|
||||||
|
}
|
||||||
|
|
||||||
if ni.PreferredDERP == 0 {
|
if ni.PreferredDERP == 0 {
|
||||||
// Perhaps UDP is blocked. Pick a deterministic but arbitrary
|
// Perhaps UDP is blocked. Pick a deterministic but arbitrary
|
||||||
|
Loading…
Reference in New Issue
Block a user