You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
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)
1 year ago
..
addlicense cmd/addlicense: add command to add licenseheaders to generated code 3 years ago
cloner util/codegen, all: use latest year, not time.Now, in generated files 1 year ago
containerboot cmd/containerboot: use TS_AUTHKEY as the parameter for auth keys 1 year ago
derper net/interfaces: redo how we get the default interface on macOS and iOS 1 year ago
derpprobe cmd/derpprobe: add -once flag for one-off CLI diagnostics 2 years ago
get-authkey cmd/get-authkey: add an OAuth API client to produce an authkey 1 year ago
gitops-pusher cmd/gitops-pusher: support alternate api-server URLs 1 year ago
hello refactor: move from io/ioutil to io and os packages 2 years ago
k8s-operator cmd/k8s-operator: remove use of InjectClient (deprecated) 1 year ago
mkmanifest cmd/{tailscale,tailscaled}: embed manifest into Windows binaries 2 years ago
mkpkg cmd/mkpkg: allow specifying recommended dependencies 1 year ago
nardump cmd/nardump: Go tool to build Nix NARs and compute their hashes. 1 year ago
netlogfmt cmd/netlogfmt: handle any stream of network logs (#6108) 2 years ago
nginx-auth cmd/nginx-auth: add experimental status badge to README 2 years ago
pgproxy cmd/pgproxy: link to blog post at the top. 2 years ago
printdep cmd/printdep: support printing the toolchain SRI hash. 1 year ago
proxy-to-grafana all: gofmt for Go 1.19 2 years ago
speedtest net/speedtest: retune to meet iperf on localhost in a VM 2 years ago
ssh-auth-none-demo ssh/tailssh: add password-forcing workaround for buggy SSH clients 2 years ago
stunc cmd/stunc: add command for making debug stun requests 2 years ago
sync-containers cmd/sync-containers: add a dry-run option. 1 year ago
tailscale cmd/tailscale/cli: fix TUNmode display on synology web page (#7064) 1 year ago
tailscaled go.mod: bump AWS SDK past a breaking API change of theirs 1 year ago
testcontrol all: use any instead of interface{} 2 years ago
testwrapper tstest/integration: mark all integration tests as flaky 1 year ago
tsconnect wgengine/netstack: change netstack API to require LocalBackend 1 year ago
tsshd all: remove old +build tags 2 years ago
viewer util/codegen, all: use latest year, not time.Now, in generated files 1 year ago