tailcfg, controlclient, magicsock: request IPv6 endpoints, but ignore them

Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
reviewable/pr200/r1
Brad Fitzpatrick 5 years ago committed by Brad Fitzpatrick
parent 12a6626a94
commit 94024355ed

@ -448,12 +448,13 @@ func (c *Direct) PollNetMap(ctx context.Context, maxPolls int, cb func(*NetworkM
c.logf("PollNetMap: stream=%v :%v %v\n", maxPolls, localPort, ep) c.logf("PollNetMap: stream=%v :%v %v\n", maxPolls, localPort, ep)
request := tailcfg.MapRequest{ request := tailcfg.MapRequest{
Version: 4, Version: 4,
KeepAlive: c.keepAlive, IncludeIPv6: true,
NodeKey: tailcfg.NodeKey(persist.PrivateNodeKey.Public()), KeepAlive: c.keepAlive,
Endpoints: ep, NodeKey: tailcfg.NodeKey(persist.PrivateNodeKey.Public()),
Stream: allowStream, Endpoints: ep,
Hostinfo: hostinfo, Stream: allowStream,
Hostinfo: hostinfo,
} }
if c.newDecompressor != nil { if c.newDecompressor != nil {
request.Compress = "zstd" request.Compress = "zstd"

@ -391,13 +391,14 @@ type RegisterResponse struct {
// using the local machine key, and sent to: // using the local machine key, and sent to:
// https://login.tailscale.com/machine/<mkey hex>/map // https://login.tailscale.com/machine/<mkey hex>/map
type MapRequest struct { type MapRequest struct {
Version int // current version is 4 Version int // current version is 4
Compress string // "zstd" or "" (no compression) Compress string // "zstd" or "" (no compression)
KeepAlive bool // server sends keep-alives KeepAlive bool // server sends keep-alives
NodeKey NodeKey NodeKey NodeKey
Endpoints []string Endpoints []string // caller's endpoints (IPv4 or IPv6)
Stream bool // if true, multiple MapResponse objects are returned IncludeIPv6 bool // include IPv6 endpoints in returned Node Endpoints
Hostinfo *Hostinfo Stream bool // if true, multiple MapResponse objects are returned
Hostinfo *Hostinfo
} }
type MapResponse struct { type MapResponse struct {

@ -1456,6 +1456,10 @@ func (c *Conn) CreateEndpoint(key [32]byte, addrs string) (conn.Endpoint, error)
} }
if ip4 := addr.IP.To4(); ip4 != nil { if ip4 := addr.IP.To4(); ip4 != nil {
addr.IP = ip4 addr.IP = ip4
} else {
// TODO(bradfitz): stop skipping IPv6 ones for now.
c.logf("magicsock: CreateEndpoint: ignoring IPv6 addr %v for now", addr)
continue
} }
a.addrs = append(a.addrs, *addr) a.addrs = append(a.addrs, *addr)
} }

Loading…
Cancel
Save