controlclient, magicsock: add debug knob to request IPv6 endpoints

Add opt-in method to request IPv6 endpoints from the control plane.
For now they should just be skipped. A previous version of this CL was
unconditional and reportedly had problems that I can't reproduce. So
make it a knob until the mystery is solved.

Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
pull/203/head
Brad Fitzpatrick 4 years ago
parent 221e7d7767
commit af277a6762

@ -18,6 +18,7 @@ import (
"net/http" "net/http"
"os" "os"
"runtime" "runtime"
"strconv"
"strings" "strings"
"sync" "sync"
"time" "time"
@ -447,13 +448,18 @@ func (c *Direct) PollNetMap(ctx context.Context, maxPolls int, cb func(*NetworkM
allowStream := maxPolls != 1 allowStream := maxPolls != 1
c.logf("PollNetMap: stream=%v :%v %v\n", maxPolls, localPort, ep) c.logf("PollNetMap: stream=%v :%v %v\n", maxPolls, localPort, ep)
// TODO(bradfitz): once this is verified to not be problematic, remove this
// knob and hard-code true below.
includeIPv6, _ := strconv.ParseBool(os.Getenv("DEBUG_INCLUDE_IPV6"))
request := tailcfg.MapRequest{ request := tailcfg.MapRequest{
Version: 4, Version: 4,
KeepAlive: c.keepAlive, IncludeIPv6: includeIPv6,
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"

@ -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