I am trying to disable onDemanRules from within the NEPacketTunnelProvider extension, but when I try to load the NETunnelProviderManager I get this message in the logs:
NETunnelProviderManager objects cannot be instantiated from NEProvider processes
Does anyone know if there's a way I can disable onDemanRules from within the NEPacketTunnelProvider extension?
It seems odd that we can cancel the tunnel from the extension using cancelTunnelWithError(_:) but can't stop the system from trying to reconnect due to onDemandRules. Especially that in the documentation it says:
The Packet Tunnel Provider should call this method when an unrecoverable error occurs, such as the tunnel server going down or the VPN authentication session expiring.
^ How is it even useful to call this method when an unrecoverable error occurs, but cannot stop it from reconnecting. If the tunnel server is down, why would it even keep trying to reconnect forever? That would just block the internet connection from the phone, and for the user to gain access to the internet again they have to go to Settings > VPN > VPN Profile > Disable "Connect on Demand", which is a terrible user experience, we should just be able to disable it from the extension.