mirror of
https://github.com/tailscale/tailscale.git
synced 2024-12-01 14:05:39 +00:00
magicsock: keep DERP magic IPs out of the address map
Signed-off-by: David Crawshaw <crawshaw@tailscale.com>
This commit is contained in:
parent
c6550135d5
commit
0752c77dc2
@ -446,7 +446,12 @@ func (c *Conn) Send(b []byte, ep conn.Endpoint) error {
|
||||
default:
|
||||
panic(fmt.Sprintf("unexpected Endpoint type %T", v))
|
||||
case *singleEndpoint:
|
||||
_, err := c.pconn.WriteTo(b, (*net.UDPAddr)(v))
|
||||
addr := (*net.UDPAddr)(v)
|
||||
if addr.IP.Equal(derpMagicIP) {
|
||||
c.logf("DERP BUG: attempting to send packet to DERP address %v", addr)
|
||||
return nil
|
||||
}
|
||||
_, err := c.pconn.WriteTo(b, addr)
|
||||
return err
|
||||
case *AddrSet:
|
||||
as = v
|
||||
@ -1033,6 +1038,10 @@ func (c *Conn) CreateEndpoint(key [32]byte, addrs string) (conn.Endpoint, error)
|
||||
|
||||
c.addrsMu.Lock()
|
||||
for _, addr := range a.addrs {
|
||||
if addr.IP.Equal(derpMagicIP) {
|
||||
continue
|
||||
}
|
||||
|
||||
var epAddr udpAddr
|
||||
copy(epAddr.ip.Addr[:], addr.IP.To16())
|
||||
epAddr.port = uint16(addr.Port)
|
||||
|
Loading…
Reference in New Issue
Block a user