Hi, everyone!
Our application has the ability to run the Network Extension when there is no internet connection. While testing our application, we found incorrect behavior in the Network Extension disconnect process when there is no internet connection, sometimes the Network Extension hangs in a .disconnecting state when it finishes.
In most cases, the work in this case finishes correctly. So for example.
We monitor changes in the Network Extension connection status using NEVPNStatusDidChange notifications.
We turn off the Internet and try to connect to the VPN tunnel using next NETunnelProviderManager configuration:
{
localizedDescription = <description>
enabled = YES
protocolConfiguration = {
serverAddress = <13-char-str>
disconnectOnSleep = NO
includeAllNetworks = NO
excludeLocalNetworks = YES
enforceRoutes = NO
providerBundleIdentifier = <bundle_identifier>
}
onDemandEnabled = NO
}
Next, we get the configuration and try to start the Network Extension via NEVPNConnection.startVPNTunnel(options:). When call finished, we get a notification .NEVPNStatusDidChange to change the NEVPNStatus to .disconnecting.
After a failed connection, we get .NEVPNStatusDidChange to change the NEVPNStatus to .disconnected. This behavior is correct because we could not connect to the Network Extension without internet. But this is not always the case, as it turns out the Network Extension may not return to .disconnected and hangs in .disconnecting.
After trying to connect again, a situation may occur where NEVPNStatus remains in the .disconnecting state. This does not seem to be the correct behavior for the system Network Extension and it should not hang in an intermediate state and not terminate with the final value (.connected or .disconnected).
Issue FB11934787 has been created for this problem, where we have attached both the application logs at the time of the problem and the system logs with the VPN Extension keyed logging.