summaryrefslogtreecommitdiffhomepage
AgeCommit message (Collapse)AuthorFilesLines
2021-08-04net/portmapper: fix UPnP probing, work against all portsupnpdebugBrad Fitzpatrick7-64/+237
Prior to Tailscale 1.12 it detected UPnP on any port. Starting with Tailscale 1.11.x, it stopped detecting UPnP on all ports. Then start plumbing its discovered Location header port number to the code that was assuming port 5000. Fixes #2109 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-08-03cmd/tailscaled: let portmap debug mode have an gateway/IP override knobBrad Fitzpatrick1-1/+21
For testing pfSense clients "behind" pfSense on Digital Ocean where the main interface still exists. This is easier for debugging. Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-08-03net/dns: correct log message.Denton Gentry1-1/+1
Signed-off-by: Denton Gentry <dgentry@tailscale.com>
2021-08-03net/dns/resolver: add test that I forgot to git add earlierBrad Fitzpatrick1-0/+90
This was meant to be part of 53a2f6365801c44d4a34797c0d38af26fb5f9296 earlier but I guess I failed at git. Updates #2436 Updates tailscale/corp#2250 Updates tailscale/corp#2238 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-08-03logpolicy: only log panics when running under systemdDavid Crawshaw1-2/+8
Given that https://github.com/golang/go/issues/42888 is coming, this catches most practical panics without interfering in our development environments. Signed-off-by: David Crawshaw <crawshaw@tailscale.com>
2021-08-02tstest/integration: update test depsBrad Fitzpatrick5-0/+5
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-08-02cmd/tailscaled: add debug -portmap modeBrad Fitzpatrick1-0/+68
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-08-02util/deephash: hash uint{8,16,32,64} explicitly (#2502)Joe Tsai2-46/+116
Instead of hashing the humanly formatted forms of a number, hash the native machine bits of the integers themselves. There is a small performance gain for this: name old time/op new time/op delta Hash-8 75.7µs ± 1% 76.0µs ± 2% ~ (p=0.315 n=10+9) HashMapAcyclic-8 63.1µs ± 3% 61.3µs ± 1% -2.77% (p=0.000 n=10+10) TailcfgNode-8 10.3µs ± 1% 10.2µs ± 1% -1.48% (p=0.000 n=10+10) HashArray-8 1.07µs ± 1% 1.05µs ± 1% -1.79% (p=0.000 n=10+10) Signed-off-by: Joe Tsai <joetsai@digital-static.net>
2021-08-02util/deephash: simplify hasher.hashMap (#2503)Joe Tsai1-80/+46
The swapping of bufio.Writer between hasher and mapHasher is subtle. Just embed a hasher in mapHasher to avoid complexity here. No notable change in performance: name old time/op new time/op delta Hash-8 76.7µs ± 1% 77.0µs ± 1% ~ (p=0.182 n=9+10) HashMapAcyclic-8 62.4µs ± 1% 62.5µs ± 1% ~ (p=0.315 n=10+9) TailcfgNode-8 10.3µs ± 1% 10.3µs ± 1% -0.62% (p=0.004 n=10+9) HashArray-8 1.07µs ± 1% 1.06µs ± 1% -0.98% (p=0.001 n=8+9) Signed-off-by: Joe Tsai <joetsai@digital-static.net>
2021-08-02net/dns/resolver: fix skipped DoH test that bitrotBrad Fitzpatrick1-1/+3
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-08-02logtail: fix typo in commentJosh Bleecher Snyder1-1/+1
Signed-off-by: Josh Bleecher Snyder <josh@tailscale.com>
2021-08-02logtail: print panics from previous runs on stderrDavid Crawshaw1-0/+9
Signed-off-by: David Crawshaw <crawshaw@tailscale.com>
2021-08-02logpolicy: actually collect panicsDavid Crawshaw3-1/+41
(Written with Josh) For #2544 Signed-off-by: David Crawshaw <crawshaw@tailscale.com>
2021-08-02derp: reduce server memory by 30% by removing persistent bufio.WriterBrad Fitzpatrick1-13/+58
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-08-01net/dnsfallback: re-run go generateBrad Fitzpatrick1-21/+14
2021-08-01derp,wgengine/magicsock: don't assume stringer is in $PATH for go:generateBrad Fitzpatrick2-2/+2
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-07-30net/interfaces: explicitly check netaddr.IP.Is6 in isUsableV6Matt Layher2-1/+3
Signed-off-by: Matt Layher <mdlayher@gmail.com>
2021-07-30net/tsaddr: remove IsULA, replace with netaddr.IP.IsPrivateMatt Layher3-29/+2
Signed-off-by: Matt Layher <mdlayher@gmail.com>
2021-07-29cmd/derper: dial VPC address with right contextBrad Fitzpatrick1-1/+1
Fix bug from just-submitted e422e9f4c949. Updates #2414 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-07-29cmd/derper: mesh over VPC networkBrad Fitzpatrick2-1/+44
Updates #2414 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-07-29ipnlocal: allow access to guest VMs/containers while using an exit nodeDavid Crawshaw1-7/+48
Signed-off-by: David Crawshaw <crawshaw@tailscale.com>
2021-07-29tstime/rate: new packageJosh Bleecher Snyder6-2/+339
This is a simplified rate limiter geared for exactly our needs: A fast, mono.Time-based rate limiter for use in tstun. It was generated by stripping down the x/time/rate rate limiter to just our needs and switching it to use mono.Time. It removes one time.Now call per packet. Signed-off-by: Josh Bleecher Snyder <josh@tailscale.com>
2021-07-29wgengine: use mono.TimeJosh Bleecher Snyder2-26/+30
Migrate wgengine to mono.Time for performance-sensitive call sites. Signed-off-by: Josh Bleecher Snyder <josh@tailscale.com>
2021-07-29wgengine/magicsock: use mono.TimeJosh Bleecher Snyder8-55/+61
magicsock makes multiple calls to Now per packet. Move to mono.Now. Changing some of the calls to use package mono has a cascading effect, causing non-per-packet call sites to also switch. Signed-off-by: Josh Bleecher Snyder <josh@tailscale.com>
2021-07-29net/tstun: use mono.TimeJosh Bleecher Snyder3-10/+12
There's a call to Now once per packet. Move to mono.Now. Though the current implementation provides high precision, we document it to be coarse, to preserve the ability to switch to a coarse monotonic time later. Signed-off-by: Josh Bleecher Snyder <josh@tailscale.com>
2021-07-29tstime/mono: new packageJosh Bleecher Snyder2-0/+151
Package mono provides a fast monotonic time. Its primary advantage is that it is fast: It is approximately twice as fast as time.Now. This is because time.Now uses two clock calls, one for wall time and one for monotonic time. We ask for the current time 4-6 times per network packet. At ~50ns per call to time.Now, that's enough to show up in CPU profiles. Package mono is a first step towards addressing that. It is designed to be a near drop-in replacement for package time. Signed-off-by: Josh Bleecher Snyder <josh@tailscale.com>
2021-07-29net/dns/resolver: allow an extra alloc for go closure allocationJosh Bleecher Snyder1-2/+5
Go 1.17 switches to a register ABI on amd64 platforms. Part of that switch is that go and defer calls use an argument-less closure, which allocates. This means that we have an extra alloc in some DNS work. That's unfortunate but not a showstopper, and I don't see a clear path to fixing it. The other performance benefits from the register ABI will all but certainly outweigh this extra alloc. Fixes #2545 Signed-off-by: Josh Bleecher Snyder <josh@tailscale.com>
2021-07-29net/dnsfallback: add new nodesBrad Fitzpatrick1-0/+21
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-07-28Dockerfile: remove extra COPY step (#2355)Pratik1-2/+1
Signed-off-by: pratikbalar <pratik@improwised.com>
2021-07-28cmd/tsshd: switch from github.com/kr/pty to github.com/creack/ptyAaron Bieber3-17/+6
The kr/pty module moved to creack/pty per the kr/pty README[1]. creack/pty brings in support for a number of OS/arch combos that are lacking in kr/pty. Run `go mod tidy` while here. [1] https://github.com/kr/pty/blob/master/README.md Signed-off-by: Aaron Bieber <aaron@bolddaemon.com>
2021-07-28ipn/ipnlocal: add URL to IP forwarding error messageBrad Fitzpatrick1-3/+4
Updates #606 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-07-27net/dns/resolver: EDNS OPT record off-by-oneDavid Crawshaw1-2/+3
I don't know how to get access to a real packet. Basing this commit entirely off: +------------+--------------+------------------------------+ | Field Name | Field Type | Description | +------------+--------------+------------------------------+ | NAME | domain name | MUST be 0 (root domain) | | TYPE | u_int16_t | OPT (41) | | CLASS | u_int16_t | requestor's UDP payload size | | TTL | u_int32_t | extended RCODE and flags | | RDLEN | u_int16_t | length of all RDATA | | RDATA | octet stream | {attribute,value} pairs | +------------+--------------+------------------------------+ From https://datatracker.ietf.org/doc/html/rfc6891#section-6.1.2 Signed-off-by: David Crawshaw <crawshaw@tailscale.com>
2021-07-27net/tstun: buffer outbound channelJosh Bleecher Snyder1-1/+1
The handoff between tstun.Wrap's Read and poll methods is one of the per-packet hotspots. It shows up in pprof. Making outbound buffered increases throughput. It is hard to measure exactly how much, because the numbers are highly variable, but I'd estimate it at about 1%, using the best observed max throughput across three runs. Signed-off-by: Josh Bleecher Snyder <josh@tailscale.com>
2021-07-27net/tstun: buffer outbound channelJosh Bleecher Snyder1-3/+4
The handoff between tstun.Wrap's Read and poll methods is one of the per-packet hotspots. It shows up in pprof. Making outbound buffered increases throughput. It is hard to measure exactly how much, because the numbers are highly variable, but I'd estimate it at about 1%, using the best observed max throughput across three runs. Signed-off-by: Josh Bleecher Snyder <josh@tailscale.com>
2021-07-27cmd/tailscale/cli: document that empty string disable exit nodes, routesBrad Fitzpatrick1-2/+2
Updates #2529 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-07-27tailcfg: add Node.PrimaryRoutesBrad Fitzpatrick3-1/+11
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-07-27version: bump dateBrad Fitzpatrick1-1/+1
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-07-27VERSION.txt: this is v1.13.0.Denton Gentry1-1/+1
Signed-off-by: Denton Gentry <dgentry@tailscale.com>
2021-07-26net/portmapper: rename ErrGatewayNotFound to ErrGatewayRange, reword textBrad Fitzpatrick1-3/+3
It confused & scared people. And it was just bad. Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-07-26net/{dnscache,interfaces}: use netaddr.IP.IsPrivate, delete copied codeBrad Fitzpatrick8-65/+13
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-07-26disable vm tests on every commit to mainChristine Dodrill1-2/+0
This experiment apparently failed. Signed-off-by: Christine Dodrill <xe@tailscale.com>
2021-07-26net/dnscache: update a commentBrad Fitzpatrick1-1/+1
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-07-26net/dnscache: make Dialer try all resolved IPsBrad Fitzpatrick2-24/+137
Tested manually with: $ go test -v ./net/dnscache/ -dial-test=bogusplane.dev.tailscale.com:80 Where bogusplane has three A records, only one of which works. Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-07-26control/controlclient: report whether we're in a snap packageBrad Fitzpatrick1-0/+7
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-07-26net/dnscache: cache all IPs per hostnameBrad Fitzpatrick2-34/+43
Not yet used in the dialer, but plumbed around. Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-07-26ipn/ipnlocal: populate Hostinfo.Package on AndroidBrad Fitzpatrick1-0/+12
Fixes tailscale/corp#2266 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-07-26wgengine: re-set DNS config on Linux after a major link changeBrad Fitzpatrick1-0/+19
Updates #2458 (maybe fixes it) Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-07-25tsweb: add float64 to logged metricsjulianknodt1-1/+1
A previously added metric which was float64 was being ignored in tsweb, because it previously only accepted int64 and ints. It can be handled in the same way as ints. Signed-off-by: julianknodt <julianknodt@gmail.com>
2021-07-25net/dns/resolver: race well-known resolvers less aggressivelyBrad Fitzpatrick2-20/+113
Instead of blasting away at all upstream resolvers at the same time, make a timing plan upon reconfiguration and have each upstream have an associated start delay, depending on the overall forwarding config. So now if you have two or four upstream Google or Cloudflare DNS servers (e.g. two IPv4 and two IPv6), we now usually only send a query, not four. This is especially nice on iOS where we start fewer DoH queries and thus fewer HTTP/1 requests (because we still disable HTTP/2 on iOS), fewer sockets, fewer goroutines, and fewer associated HTTP buffers, etc, saving overall memory burstiness. Fixes #2436 Updates tailscale/corp#2250 Updates tailscale/corp#2238 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-07-25net/dns/resolver: add forwardQuery type as race work prepBrad Fitzpatrick1-15/+37
Add a place to hang state in a future change for #2436. For now this just simplifies the send signature without any functional change. Updates #2436 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>