summaryrefslogtreecommitdiffhomepage
AgeCommit message (Collapse)AuthorFilesLines
2021-07-29ipnlocal, resolver, etc: add peer API DoHcrawshaw/peerdohDavid Crawshaw8-16/+104
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>
2021-07-25net/dns/resolver: fix func used as netaddr.IP in printfBrad Fitzpatrick1-3/+5
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-07-22util/deephash: improve cycle detection (#2470)Joe Tsai4-332/+101
The previous algorithm used a map of all visited pointers. The strength of this approach is that it quickly prunes any nodes that we have ever visited before. The detriment of the approach is that pruning is heavily dependent on the order that pointers were visited. This is especially relevant for hashing a map where map entries are visited in a non-deterministic manner, which would cause the map hash to be non-deterministic (which defeats the point of a hash). This new algorithm uses a stack of all visited pointers, similar to how github.com/google/go-cmp performs cycle detection. When we visit a pointer, we push it onto the stack, and when we leave a pointer, we pop it from the stack. Before visiting a pointer, we first check whether the pointer exists anywhere in the stack. If yes, then we prune the node. The detriment of this approach is that we may hash a node more often than before since we do not prune as aggressively. The set of visited pointers up until any node is only the path of nodes up to that node and not any other pointers that may have been visited elsewhere. This provides us deterministic hashing regardless of visit order. We can now delete hashMapFallback and associated complexity, which only exists because the previous approach was non-deterministic in the presence of cycles. This fixes a failure of the old algorithm where obviously different values are treated as equal because the pruning was too aggresive. See https://github.com/tailscale/tailscale/issues/2443#issuecomment-883653534 The new algorithm is slightly slower since it prunes less aggresively: name old time/op new time/op delta Hash-8 66.1µs ± 1% 68.8µs ± 1% +4.09% (p=0.000 n=19+19) HashMapAcyclic-8 63.0µs ± 1% 62.5µs ± 1% -0.76% (p=0.000 n=18+19) TailcfgNode-8 9.79µs ± 2% 9.88µs ± 1% +0.95% (p=0.000 n=19+17) HashArray-8 643ns ± 1% 653ns ± 1% +1.64% (p=0.000 n=19+19) However, a slower but more correct algorithm seems more favorable than a faster but incorrect algorithm. Signed-off-by: Joe Tsai <joetsai@digital-static.net>
2021-07-22net/portmapper: disable UPnP on iOS for nowBrad Fitzpatrick2-0/+32
Updates #2495 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-07-22control/controlclient: grow goroutine debug buffer as neededBrad Fitzpatrick1-2/+11
To not allocate 1MB up front on iOS. Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-07-22control/controlclient: don't use regexp in goroutine stack scrubbingBrad Fitzpatrick2-9/+72
To reduce binary size on iOS. Updates tailscale/corp#2238 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-07-22tstest/integration/vms: disable rDNS for sshd on centos (#2492)Christine Dodrill1-1/+3
This prevents centos tests from timing out because sshd does reverse dns lookups on every session being established instead of doing it once on the acutal ssh connection being established. This is odd. Appending this to the sshd config and restarting it seems to fix it though. Signed-off-by: Christine Dodrill <xe@tailscale.com>
2021-07-22tstest/integration/vms: disable nixos unstable (#2491)Christine Dodrill1-0/+4
cloud-init broke with the upgrade to python 3.9: https://github.com/NixOS/nixpkgs/issues/131098 Signed-off-by: Christine Dodrill <xe@tailscale.com>
2021-07-22net/dns: don't build init*.go on non-windowsBrad Fitzpatrick2-0/+4
To remove the regexp dep on iOS, notably. Updates tailscale/corp#2238 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-07-22net/dns/resolver: bound DoH usage on iOSBrad Fitzpatrick1-0/+24
Updates tailscale/corp#2238 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-07-21wgengine/netstack: implement UDP relaying to advertised subnetsBrad Fitzpatrick1-46/+96
TCP was done in 662fbd4a09664e849f0b898d1e8df13325d36efa. This does the same for UDP. Tested by hand. Integration tests will have to come later. I'd wanted to do it in this commit, but the SOCKS5 server needed for interop testing between two userspace nodes doesn't yet support UDP and I didn't want to invent some whole new userspace packet injection interface at this point, as SOCKS seems like a better route, but that's its own bug. Fixes #2302 RELNOTE=netstack mode can now UDP relay to subnets Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-07-21net/dns/resolver: fall back to IPv6 for well-known DoH servers if v4 failsBrad Fitzpatrick2-2/+39
Should help with IPv6-only environments when the tailnet admin only specified IPv4 DNS IPs. See https://github.com/tailscale/tailscale/issues/2447#issuecomment-884188562 Co-Author: Adrian Dewhurst <adrian@tailscale.com> Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-07-21net/dns/resolver: use correct Cloudflare DoH hostnamesBrad Fitzpatrick1-8/+8
We were using the wrong ones for the malware & adult content variants. Docs: https://developers.cloudflare.com/1.1.1.1/1.1.1.1-for-families/setup-instructions/dns-over-https Earlier commit which added them: 236eb4d04d33c43b0d73fb7372353cb26b62421b Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-07-21util/deephash: disambiguate hashing of AppendTo (#2483)Joe Tsai2-2/+12
Prepend size to AppendTo output. Fixes #2443 Signed-off-by: Joe Tsai <joetsai@digital-static.net>
2021-07-21util/deephash: include type as part of hash for interfaces (#2476)Joe Tsai2-1/+48
A Go interface may hold any number of different concrete types. Just because two underlying values hash to the same thing does not mean the two values are identical if they have different concrete types. As such, include the type in the hash.
2021-07-21net/portmapper: return correct upnp portjulianknodt1-1/+7
Previously, this was incorrectly returning the internal port, and using that with the external exposed IP when it did not use WANIPConnection2. In the case when we must provide a port, we return it instead. Noticed this while implementing the integration test for upnp. Signed-off-by: julianknodt <julianknodt@gmail.com>
2021-07-21util/deephash: introduce deliberate instability (#2477)Joe Tsai1-2/+15
Seed the hash upon first use with the current time. This ensures that the stability of the hash is bounded within the lifetime of one program execution. Hopefully, this prevents future bugs where someone assumes that this hash is stable. Signed-off-by: Joe Tsai <joetsai@digital-static.net>
2021-07-21wgengine/netstack: fix doc commentBrad Fitzpatrick1-1/+0
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>