mirror of
https://github.com/tailscale/tailscale.git
synced 2024-11-29 13:05:46 +00:00
wgengine/magicsock: finish IPv6 transport support
DEBUG_INCLUDE_IPV6=1 is still required, but works now. Updates #18 (fixes it, once env var gate is removed)
This commit is contained in:
parent
82ed7e527e
commit
3c3ea8bc8a
@ -1170,8 +1170,8 @@ func (c *Conn) ReceiveIPv6(b []byte) (int, conn.Endpoint, *net.UDPAddr, error) {
|
||||
c.stunReceiveFunc.Load().(func([]byte, *net.UDPAddr))(b[:n], addr)
|
||||
continue
|
||||
}
|
||||
// TODO(bradfitz): finish. look up addrset, return etc.
|
||||
// For now we're only using this for STUN.
|
||||
ep := c.findEndpoint(addr)
|
||||
return n, ep, addr, nil
|
||||
}
|
||||
}
|
||||
|
||||
@ -1687,13 +1687,7 @@ func (c *Conn) CreateEndpoint(key [32]byte, addrs string) (conn.Endpoint, error)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if ip4 := addr.IP.To4(); ip4 != nil {
|
||||
addr.IP = ip4
|
||||
} else {
|
||||
// TODO(bradfitz): stop skipping IPv6 ones for now.
|
||||
c.logf("magicsock: CreateEndpoint: ignoring IPv6 addr %v for now", addr)
|
||||
continue
|
||||
}
|
||||
addr.IP = ip4or6(addr.IP)
|
||||
a.addrs = append(a.addrs, *addr)
|
||||
}
|
||||
}
|
||||
@ -1844,3 +1838,10 @@ func peerShort(k key.Public) string {
|
||||
k2 := wgcfg.Key(k)
|
||||
return k2.ShortString()
|
||||
}
|
||||
|
||||
func ip4or6(ip net.IP) net.IP {
|
||||
if ip4 := ip.To4(); ip4 != nil {
|
||||
return ip4
|
||||
}
|
||||
return ip
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user