fix: change servertailnet to register the DERP dialer before setting DERP map (#12137)

I noticed a possible race where tailnet.Conn can try to dial the embedded region before we've set our custom dialer that send the DERP in-memory.  This closes that race and adds a test case for servertailnet with no STUN and an embedded relay
This commit is contained in:
Spike Curtis
2024-02-15 10:51:12 +04:00
committed by GitHub
parent 1bb4aecf49
commit 2d0b9106c0
5 changed files with 81 additions and 34 deletions

View File

@ -204,7 +204,8 @@ func (c *configMaps) netMapLocked() *netmap.NetworkMap {
nm.Addresses = make([]netip.Prefix, len(c.addresses))
copy(nm.Addresses, c.addresses)
nm.DERPMap = c.derpMap.Clone()
// we don't need to set the DERPMap in the network map because we separately
// send the DERPMap directly via SetDERPMap
nm.Peers = c.peerConfigLocked()
nm.SelfNode.Addresses = nm.Addresses
nm.SelfNode.AllowedIPs = nm.Addresses