I'm trying to create my own VPN manager and I found one issue. If I start VPN connection and after that I close my app, VPN will stay alive. But how can I restore my connection to it after reopen my application?
Restore connection to VPN after restart app
Not exactly sure in what context you mean here. If you mean after the device is coming out of sleep, checkout the wake() method in your provider. If you mean that your container app has detected that your NEVPNConnection is in status .disconnected then try to reconnect via startVPNTunnel once the user enters your container app. If you mean that your Network Extension has disconnected in general outside of the context of what I described above, this could mean something entirely different is going on and it could be an issue with your server, Network Extension, or connectivity of the device/workstation. In this case check that your extension did not crash, or more debugging on the server side may need to be involved. If you are experiencing connectivity issues checkout using an NEOnDemandRule to try and handle network interface change.But how can I restore my connection to it after reopen my application?
Matt Eaton
DTS Engineering, CoreOS
meaton3@apple.com
Hello Matt,
I have a somewhat related question here.
What I am noticing is, if for some reason the system network extension crashes, then it gets relaunched. I can see my system network extension process running in activity monitor however it doesn't serve traffic i.e it requires me to trigger a new startVPNtunnel from the container app again. Is that expected behavior?
Does this mean we need to instruct our application users to always have the container app running so that we can detect the extension crashing or other problems via some keepalive messaging and re-trigger the startVPNtunnel or do u have something more spontaneous in mind that can help re-init the extension when it gets auto launched by Apple?
I have a somewhat related question here.
What I am noticing is, if for some reason the system network extension crashes, then it gets relaunched. I can see my system network extension process running in activity monitor however it doesn't serve traffic i.e it requires me to trigger a new startVPNtunnel from the container app again. Is that expected behavior?
Does this mean we need to instruct our application users to always have the container app running so that we can detect the extension crashing or other problems via some keepalive messaging and re-trigger the startVPNtunnel or do u have something more spontaneous in mind that can help re-init the extension when it gets auto launched by Apple?
Hello vtewari,
On crash and re-init of your Network System Extension you could try to re-establish your tunnel through the standard startTunnelWithOptions path but this will create all sorts of workflow and state issues in your logic I am assuming. The best option here is to let your user re-initialize the tunnel from the container app, this would put everything back in-sync.
Matt Eaton
DTS Engineering, CoreOS
meaton3@apple.com
On crash and re-init of your Network System Extension you could try to re-establish your tunnel through the standard startTunnelWithOptions path but this will create all sorts of workflow and state issues in your logic I am assuming. The best option here is to let your user re-initialize the tunnel from the container app, this would put everything back in-sync.
Matt Eaton
DTS Engineering, CoreOS
meaton3@apple.com
Thank you Matt for reverting on this.
I will keep your opinion in my mind.
I will keep your opinion in my mind.