When trying to bind a socket to the tunnel interface via
setsockopt(socket, IPPROTO_IP, IP_BOUND_IF, &ifindex, len)
Within the PacketTunnel itself despite this call succeeding the data is still routed through the default interface.
This is observed when includeAllNetworks is true. When it is false it seems to send it on both interfaces.
Is there something wrong with how I'm doing it?
When trying to bind a socket to the tunnel interface … Within the PacketTunnel itself
This technique won’t work because NECP works hard to prevent VPN loops. AFAIK the only way to run a connection through the tunnel from within your packet tunnel provider is to create the connection using either:
-
createTCPConnectionThroughTunnel(to:enableTLS:tlsParameters:delegate:)
, for a TCP connection (docs) -
createUDPSessionThroughTunnel(to:from:)
, for a UDP flow (docs)
Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"