tailscale/cmd
Mihai Parparita 6842c3c194 net/interfaces: redo how we get the default interface on macOS and iOS
With #6566 we added an external mechanism for getting the default
interface, and used it on macOS and iOS (see tailscale/corp#8201).
The goal was to be able to get the default physical interface even when
using an exit node (in which case the routing table would say that the
Tailscale utun* interface is the default).

However, the external mechanism turns out to be unreliable in some
cases, e.g. when multiple cellular interfaces are present/toggled (I
have occasionally gotten my phone into a state where it reports the pdp_ip1
interface as the default, even though it can't actually route traffic).

It was observed that `ifconfig -v` on macOS reports an "effective interface"
for the Tailscale utn* interface, which seems promising. By examining
the ifconfig source code, it turns out that this is done via a
SIOCGIFDELEGATE ioctl syscall. Though this is a private API, it appears
to have been around for a long time (e.g. it's in the 10.13 xnu release
at https://opensource.apple.com/source/xnu/xnu-4570.41.2/bsd/net/if_types.h.auto.html)
and thus is unlikely to go away.

We can thus use this ioctl if the routing table says that a utun*
interface is the default, and go back to the simpler mechanism that
we had before #6566.

Updates #7184
Updates #7188

Signed-off-by: Mihai Parparita <mihai@tailscale.com>
(cherry picked from commit fa932fefe7)
2023-02-15 10:44:05 -07:00
..
addlicense cmd/addlicense: add command to add licenseheaders to generated code 2021-07-19 15:31:56 -07:00
cloner util/codegen, all: use latest year, not time.Now, in generated files 2023-01-02 20:38:32 -08:00
containerboot cmd/containerboot: use TS_AUTHKEY as the parameter for auth keys 2023-01-05 13:03:39 -08:00
derper net/interfaces: redo how we get the default interface on macOS and iOS 2023-02-15 10:44:05 -07:00
derpprobe cmd/derpprobe: add -once flag for one-off CLI diagnostics 2022-11-23 17:41:12 -08:00
get-authkey cmd/get-authkey: add an OAuth API client to produce an authkey 2023-02-08 12:17:38 -08:00
gitops-pusher cmd/gitops-pusher: support alternate api-server URLs 2022-12-14 05:07:12 -08:00
hello refactor: move from io/ioutil to io and os packages 2022-09-15 21:45:53 -07:00
k8s-operator cmd/k8s-operator: remove use of InjectClient (deprecated) 2023-01-24 09:11:45 -08:00
mkmanifest cmd/{tailscale,tailscaled}: embed manifest into Windows binaries 2022-11-21 18:15:51 -05:00
mkpkg cmd/mkpkg: allow specifying recommended dependencies 2023-01-24 12:43:24 +00:00
nardump cmd/nardump: Go tool to build Nix NARs and compute their hashes. 2022-12-24 15:22:41 -08:00
netlogfmt cmd/netlogfmt: handle any stream of network logs (#6108) 2022-10-28 10:40:45 -07:00
nginx-auth cmd/nginx-auth: add experimental status badge to README 2022-10-25 11:03:40 -07:00
pgproxy cmd/pgproxy: link to blog post at the top. 2022-10-04 16:47:12 -07:00
printdep cmd/printdep: support printing the toolchain SRI hash. 2022-12-24 15:40:22 -08:00
proxy-to-grafana all: gofmt for Go 1.19 2022-08-02 10:08:05 -07:00
speedtest net/speedtest: retune to meet iperf on localhost in a VM 2022-09-23 10:46:04 -07:00
ssh-auth-none-demo ssh/tailssh: add password-forcing workaround for buggy SSH clients 2022-10-11 15:03:02 -07:00
stunc cmd/stunc: add command for making debug stun requests 2022-11-23 15:38:54 -08:00
sync-containers cmd/sync-containers: add a dry-run option. 2022-12-19 19:00:53 -08:00
tailscale cmd/tailscale/cli: fix TUNmode display on synology web page (#7064) 2023-01-25 10:24:04 -08:00
tailscaled go.mod: bump AWS SDK past a breaking API change of theirs 2023-01-20 10:14:56 -08:00
testcontrol all: use any instead of interface{} 2022-03-17 11:35:09 -07:00
testwrapper tstest/integration: mark all integration tests as flaky 2023-01-23 14:36:16 -05:00
tsconnect wgengine/netstack: change netstack API to require LocalBackend 2022-12-23 14:01:26 -08:00
tsshd all: remove old +build tags 2022-11-04 07:25:42 -07:00
viewer util/codegen, all: use latest year, not time.Now, in generated files 2023-01-02 20:38:32 -08:00