wireguard-apple/Sources/WireGuardKit
Jason A. Donenfeld 23bf3cfccb Kit: Adapter: use more reliable utun detection technique
Rather than hoping that the AF_SYSTEM fd is of type utun, and then
calling "2" on it to get the name -- which could be defined as something
else for a different AF_SYSTEM socket type -- instead simply query the
AF_SYSTEM control socket ID with getpeername. This has one catch, which
is that the ID is dynamically allocated, so we resolve it using the
qualified name. Normally we'd make a new AF_SYSTEM socket for this, but
since that's not allowed in the sandbox, we reuse the AF_SYSTEM socket
that we're checking. At this point in the flow, we know that it's a
proper AF_SYSTEM one, based on the first sockaddr member; we just don't
know that it's a utun variety.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2021-06-16 17:40:12 +02:00
..
Array+ConcurrentMap.swift global: bump year in header 2020-12-04 12:15:29 +01:00
DNSResolver.swift WireGuardKit: Conditionally turn on/off wireguard-go 2020-12-11 11:15:22 +01:00
DNSServer.swift global: bump year in header 2020-12-04 12:15:29 +01:00
Endpoint.swift Kit: do not crash on [abcd::] with missing port 2020-12-23 14:06:26 +01:00
InterfaceConfiguration.swift global: support DNS search domains 2020-12-15 15:54:12 +01:00
IPAddress+AddrInfo.swift global: bump year in header 2020-12-04 12:15:29 +01:00
IPAddressRange.swift Kit: netcfg: add explicit IP mask routes 2021-01-01 18:28:14 +01:00
PacketTunnelSettingsGenerator.swift Kit: netcfg: add explicit IP mask routes 2021-01-01 18:28:14 +01:00
PeerConfiguration.swift global: bump year in header 2020-12-04 12:15:29 +01:00
PrivateKey.swift global: bump year in header 2020-12-04 12:15:29 +01:00
TunnelConfiguration.swift global: bump year in header 2020-12-04 12:15:29 +01:00
WireGuardAdapter.swift Kit: Adapter: use more reliable utun detection technique 2021-06-16 17:40:12 +02:00