summaryrefslogtreecommitdiffhomepage
path: root/cmd
AgeCommit message (Collapse)AuthorFilesLines
2021-08-04net/portmapper: fix UPnP probing, work against all portsupnpdebugBrad Fitzpatrick1-0/+2
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-02cmd/tailscaled: add debug -portmap modeBrad Fitzpatrick1-0/+68
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-08-02logpolicy: actually collect panicsDavid Crawshaw1-0/+3
(Written with Josh) For #2544 Signed-off-by: David Crawshaw <crawshaw@tailscale.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 Fitzpatrick1-0/+30
Updates #2414 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-07-29tstime/rate: new packageJosh Bleecher Snyder2-0/+2
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/magicsock: use mono.TimeJosh Bleecher Snyder3-2/+4
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 Snyder1-0/+1
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-28cmd/tsshd: switch from github.com/kr/pty to github.com/creack/ptyAaron Bieber1-1/+1
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-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-22util/deephash: improve cycle detection (#2470)Joe Tsai1-1/+1
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-20wgengine/router: take a link monitorBrad Fitzpatrick2-2/+2
Prep for #1591 which will need to make Linux's router react to changes that the link monitor observes. The router package already depended on the monitor package transitively. Now it's explicit. Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-07-19cmd/tailscaled: add func to create ipnserver.OptsBrad Fitzpatrick2-15/+25
To unify the Windows service and non-service/non-Windows paths a bit. And provides a way to make Linux act like Windows for testing. (notably, for testing the fix to #2137) One perhaps visible change of this is that tailscaled.exe when run in cmd.exe/powershell (not as a Windows Service) no longer uses the "_daemon" autostart key. But in addition to being naturally what falls out of this change, that's also what Windows users would likely want, as otherwise the unattended mode user is ignored when the "_daemon" autostart key is specified. Notably, this would let people debug what their normally-run-as-a-service tailscaled is doing, even when they're running in Unattended Mode. Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-07-19cmd/tailscale/cli: allow effective GOOS to be changed for integration testsBrad Fitzpatrick1-5/+12
Adds TS_DEBUG_UP_FLAG_GOOS for integration tests to make "tailscale up" act like other OSes. For an upcoming change to test #2137. Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-07-19cmd/addlicense: add command to add licenseheaders to generated codeJosh Bleecher Snyder1-0/+77
And use it to make our stringer invocations match the existing code. Signed-off-by: Josh Bleecher Snyder <josh@tailscale.com>
2021-07-19cmd/tailscaled: use state key constant from ipn packageBrad Fitzpatrick1-10/+2
Rather than redefining it again. Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-07-19cmd/derpprobe: add in a delay to wait for mesh info to syncBrad Fitzpatrick1-0/+7
2021-07-15net/portmapper: add upnp port mappingjulianknodt2-3/+18
Add in UPnP portmapping, using goupnp library in order to get the UPnP client and run the portmapping functions. This rips out anywhere where UPnP used to be in portmapping, and has a flow separate from PMP and PCP. RELNOTE=portmapper now supports UPnP mappings Fixes #682 Updates #2109 Signed-off-by: julianknodt <julianknodt@gmail.com>
2021-07-15Implemented Commandline Download Speedtest (#2064)Aaditya Chaudhary1-0/+121
Added the net/speedtest package that contains code for starting up a speedtest server and a client. The speedtest command for starting a client takes in a duration for the speedtest as well as the host and port of the speedtest server to connect to. The speedtest command for starting a server takes in a host:port pair to listen on. Signed-off-by: Aaditya Chaudhary <32117362+AadityaChaudhary@users.noreply.github.com>
2021-07-14cmd/derper: remove default for non-root usersjulianknodt1-1/+1
Signed-off-by: julianknodt <julianknodt@gmail.com>
2021-07-14cmd/derper: add default -c argumentsjulianknodt1-1/+6
This adds some convenient defaults for -c, so that user-provided DERPs require less command line flags. Signed-off-by: julianknodt <julianknodt@gmail.com>
2021-07-14cmd/derpprobe: bound node pair probe durationBrad Fitzpatrick1-0/+10
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-07-14netns_linux: remove special handling for tests.Denton Gentry1-1/+1
With netns handling localhost now, existing tests no longer need special handling. The tests set up their connections to localhost, and the connections work without fuss. Remove the special handling for tests. Also remove the hostinfo.TestCase support, since this was the only use of it. It can be added back later if really needed, but it would be better to try to make tests work without special cases. Signed-off-by: Denton Gentry <dgentry@tailscale.com>
2021-07-14net/netns: support !CAP_NET_ADMINDenton Gentry1-1/+1
netns_linux checked whether "ip rule" could run to determine whether to use SO_MARK for network namespacing. However in Linux environments which lack CAP_NET_ADMIN, such as various container runtimes, the "ip rule" command succeeds but SO_MARK fails due to lack of permission. SO_BINDTODEVICE would work in these environments, but isn't tried. In addition to running "ip rule" check directly whether SO_MARK works or not. Among others, this allows Microsoft Azure App Service and AWS App Runner to work. Signed-off-by: Denton Gentry <dgentry@tailscale.com>
2021-07-13cmd/tailscale: update web server test copyrightDan Bond1-1/+1
Signed-off-by: Dan Bond <danbond@protonmail.com>
2021-07-13cmd/tailscale: improve web server test structureDan Bond1-22/+24
Signed-off-by: Dan Bond <danbond@protonmail.com>
2021-07-13cmd/tailscale: test web server url funcDan Bond2-1/+54
Signed-off-by: Dan Bond <danbond@protonmail.com>
2021-07-13cmd/tailscale: log web listen addrDan Bond1-0/+1
Signed-off-by: Dan Bond <danbond@protonmail.com>
2021-07-13cmd/tailscale/cli: diagnose missing tailscaled on 'up'Brad Fitzpatrick5-2/+74
Fixes #2029 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-07-13cmd/derpprobe: move from cmd/derper/derpprobeBrad Fitzpatrick1-0/+0
Because our corp build system is confused by nested binaries. Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-07-13cmd/derper/derpprobe: add derp proberBrad Fitzpatrick1-0/+337
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-07-13ipn: another controlplane synonymDavid Crawshaw2-9/+21
This one doesn't bother me so much, as long term we want a synonym here. Fixes #2384 Fixes #2386 Signed-off-by: David Crawshaw <crawshaw@tailscale.com>
2021-07-13cmd/tailscale/cli: factor out more up code for testingDavid Crawshaw2-44/+159
In theory, some of the other table-driven tests could be moved into this form now but I didn't want to disturb too much good test code. Includes a commented-out test for #2384 that is currently failing. Signed-off-by: David Crawshaw <crawshaw@tailscale.com>
2021-07-09wgengine/magicsock: make portmapping asyncBrad Fitzpatrick1-1/+1
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-07-08tstest/integration/vms: use an in-process logcatcher (#2360)Christine Dodrill1-0/+2
This adapts the existing in-process logcatcher from tstest/integration into a public type and uses it on the side of testcontrol. This also fixes a bug in the Alpine Linux OpenRC unit that makes every value in `/etc/default/tailscaled` exported into tailscaled's environment, a-la systemd [Service].EnviromentFile. Signed-off-by: Christine Dodrill <xe@tailscale.com>
2021-07-07cmd/tailscale/cli: document the web subcommand a bit moreBrad Fitzpatrick1-0/+8
Fixes #2326 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-07-02util/deephash: move internal/deephash to util/deephashBrad Fitzpatrick1-1/+1
No code changes. Just a minor package doc addition about lack of API stability.
2021-06-29wgengine/router_windows: support toggling local lan access when usingMaisem Ali1-14/+18
exit nodes. Signed-off-by: Maisem Ali <maisem@tailscale.com>
2021-06-29cmd/tailscale/cli: accept login server synonymDavid Crawshaw2-0/+29
Fixes #2272 Signed-off-by: David Crawshaw <crawshaw@tailscale.com>
2021-06-28cmd/tailscale: add debug flag to dump derp mapjulianknodt1-0/+14
This adds a flag in tailscale debug for dumping the derp map to stdout. Fixes #2249. Signed-off-by: julianknodt <julianknodt@gmail.com>
2021-06-28cmd/tailscale: make netcheck use active DERP map, delete static copyjulianknodt4-6/+59
After allowing for custom DERP maps, it's convenient to be able to see their latency in netcheck. This adds a query to the local tailscaled for the current DERPMap. Updates #1264 Signed-off-by: julianknodt <julianknodt@gmail.com>
2021-06-28net/socks5/tssocks: add new package, move SOCKS5 glue out of tailscaledBrad Fitzpatrick2-36/+5
Prep for #1970, #2264, #2268 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-06-28cmd/tailscaled: log SOCKS5 port when port 0 requestedBrad Fitzpatrick1-0/+5
Part of #2158 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-06-27net/dnsfallback: don't depend on derpmap.ProdBrad Fitzpatrick1-2/+2
Move derpmap.Prod to a static JSON file (go:generate'd) instead, to make its role explicit. And add a TODO about making dnsfallback use an update-over-time DERP map file instead of a baked-in one. Updates #1264 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-06-24derp,cmd/derper: allow server to verify clientsjulianknodt3-2/+5
This adds a flag to the DERP server which specifies to verify clients through a local tailscaled. It is opt-in, so should not affect existing clients, and is mainly intended for users who want to run their own DERP servers. It assumes there is a local tailscaled running and will attempt to hit it for peer status information. Updates #1264 Signed-off-by: julianknodt <julianknodt@gmail.com>
2021-06-22cmd/cloner: support maps with clone ptrsjulianknodt1-1/+3
In order to clone DERPMaps, it was necessary to extend the cloner so that it supports nested pointers inside of maps which are also cloneable. This also adds cloning for DERPRegions and DERPNodes because they are on DERPMap's maps. Signed-off-by: julianknodt <julianknodt@gmail.com>
2021-06-22go.mod: update netstackBrad Fitzpatrick1-1/+3
Fixes a atomic alignment crash on 32-bit machines. Fixes #2129 Fixes tailscale/tailscale-synology#66 (same) Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-06-18net/interfaces: use IPv4 link local if nothing betterDenton Gentry2-3/+4
The only connectivity an AWS Lambda container has is an IPv4 link-local 169.254.x.x address using NAT: 12: vtarget_1@if11: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000 link/ether 7e:1c:3f:00:00:00 brd ff:ff:ff:ff:ff:ff link-netnsid 1 inet 169.254.79.1/32 scope global vtarget_1 valid_lft forever preferred_lft forever If there are no other IPv4/v6 addresses available, and we are running in AWS Lambda, allow IPv4 169.254.x.x addresses to be used. ---- Similarly, a Google Cloud Run container's only connectivity is a Unique Local Address fddf:3978:feb1:d745::c001/128. If there are no other addresses available then allow IPv6 Unique Local Addresses to be used. We actually did this in an earlier release, but now refactor it to work the same way as the IPv4 link-local support is being done. Signed-off-by: Denton Gentry <dgentry@tailscale.com>
2021-06-18staticcheck.conf: turn off noisy lint errorsDavid Crawshaw1-1/+0
Signed-off-by: David Crawshaw <crawshaw@tailscale.com>