Ive made a Per-App VPN client which reads a vpn configuration from a configuration profile and then launches the PacketTunnelProvider to establish a connection with the tunnel_server (both PacketTunnelProvider and tunnel_server are identical to the ones in the SimpleTunnel example). Furthermore, the tunnel_server is able to successfully start as well.
The problem seems to be in the PacketTunnelProvider right after the ClientTunnel calls the first line in the "observeValue" function which only gets triggered after "connection!.addObserver" is called by ClientTunnel as it attempts to start the tunnel. The PacketTunnelProvider doesnt seem to get passed this line and never connects. (Connection status remains "disconnected")
Specific Line in the "ObserverValue" function that fails:
guard keyPath == "state" && context?.assumingBound().pointee == connection else
{
//code never reaches this
}
//code reaches this either
Any assistance would be appreciated.
So the issue seemed to be that for the Packet Tunnel Provider target, the "Outgoing Connections Client" check box within the App Sandbox capability wasnt checked so no outgoing network connections were allowed even though my server address was indeed correct.
I currently have a different issue but at least this one was resolved.