tailscale/net
Mihai Parparita fa932fefe7 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>
2023-02-10 16:23:37 -08:00
..
connstats net/connstats: fix ticker in NewStatistics (#7225) 2023-02-09 01:24:52 -08:00
dns net/dns/resolver: remove maxDoHInFlight 2023-02-03 17:07:12 -08:00
dnscache all: update copyright and license headers 2023-01-27 15:36:29 -08:00
dnsfallback all: update copyright and license headers 2023-01-27 15:36:29 -08:00
flowtrack all: update copyright and license headers 2023-01-27 15:36:29 -08:00
interfaces net/interfaces: redo how we get the default interface on macOS and iOS 2023-02-10 16:23:37 -08:00
memnet net/memnet: rename from net/nettest 2023-01-30 13:03:32 -08:00
netaddr all: update copyright and license headers 2023-01-27 15:36:29 -08:00
netcheck all: update to Go 1.20, use strings.CutPrefix/Suffix instead of our fork 2023-02-01 15:23:54 -08:00
neterror all: update copyright and license headers 2023-01-27 15:36:29 -08:00
netknob all: update copyright and license headers 2023-01-27 15:36:29 -08:00
netns net/interfaces, net/netns: add node attributes to control default interface getting and binding 2023-02-08 13:15:10 -08:00
netstat net/{netns,netstat}: use new x/sys/cpu.IsBigEndian 2023-02-02 07:41:49 -08:00
netutil net/netutil: only check Linux sysctls w/ procfs, assume absent means false 2023-02-08 12:23:36 -08:00
packet all: update copyright and license headers 2023-01-27 15:36:29 -08:00
ping all: update copyright and license headers 2023-01-27 15:36:29 -08:00
portmapper all: update tools that manage copyright headers 2023-01-27 15:36:29 -08:00
proxymux all: update copyright and license headers 2023-01-27 15:36:29 -08:00
routetable net/routetable: include unknown flags in the routetable doctor output 2023-02-10 15:54:31 -08:00
socks5 all: update copyright and license headers 2023-01-27 15:36:29 -08:00
speedtest all: update copyright and license headers 2023-01-27 15:36:29 -08:00
stun all: use Go 1.20's bytes.Clone 2023-02-01 17:39:18 -08:00
tlsdial health, net/tlsdial: add healthcheck for self-signed cert 2023-02-01 23:17:41 -05:00
tsaddr all: update copyright and license headers 2023-01-27 15:36:29 -08:00
tsdial all: update copyright and license headers 2023-01-27 15:36:29 -08:00
tshttpproxy net/tshttpproxy: more directly use Transport proxy CONNECT hooks 2023-02-03 16:51:50 -08:00
tstun wgengine: start logging DISCO frames to pcap stream 2023-02-10 11:22:34 -10:00
wsconn all: update copyright and license headers 2023-01-27 15:36:29 -08:00