@eskimo
Yes, I send a message in the APP to ask the tunnel to restart the internal service, not the entire extension process. The benefit of this is that reconnection takes less time and is simpler.
I mainly handle restarting the service in handleAppMessage():
Clear current configuration through setTunnelNetworkSettings(nil)
Call setTunnelNetworkSettings(settings) for configuration
In fact, I don't want to call setTunnelNetworkSettings before restarting the service, but I can't clear the DNS cache data without doing this, so I have to do this.
handleAppMessage looks more like:
open override func handleAppMessage(_ messageData: Data, completionHandler: ((Data?) -> Void)?) {
reasserting = true
setTunnelNetworkSettings(nil) { error in
// settings = ....
setTunnelNetworkSettings(settings) {
reasserting = false
proxy.restart()
completionHandler("ok"...)
}
}
}
I suspect there is a memory error inside setTunnelNetworkSettings(...) that causes completionHandler("ok"...) to fail occasionally
things would be simpler if NEVPNConnection provided restartVPNTunnel().
Post
Replies
Boosts
Views
Activity
@eskimo
Hello, I read it through Xcode->Organizer. In fact, I have been testing it myself for many days and have never reproduced the problem. However, I found from the report that many users have encountered this problem.
2023-05-18_22-34-51.5287_+0800-a128671a0851ccf901645b2b155c3f5c835c39df.crash
2024-01-04_23-49-28.8918_+0800-5ffc821bcd49492ca4758415150daf1cbf8514d3.crash
I have received some customer feedback that after upgrading iOS to 16.5, the VPN will disconnect frequently and randomly. They reported that they had never encountered this problem before upgrading, and I did not find any crash records on the App Store. I suspect something to do with the iOS timer implementation.
After they upgraded to iOS 16.5.1, the problem persisted.
I also have an old app that hasn't been updated in 2 years and has always been very stable. They reported that after upgrading iOS to 16.5, it will also be automatically disconnected.
Oddly for those customers who didn't experience this issue, the VPN never disconnected automatically. For devices that encounter this problem, whether it is restarting, reinstalling, or resetting the network, it cannot be solved.
Somehow it's working fine again. however the extension keeps not working:
ASI found [CoreFoundation] (sensitive) '*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** NSExtensionPrincipalClass PacketTunnel.PacketTunnelProvider must implement at least one public protocol''
class PacketTunnelProvider: NEPacketTunnelProvider {
override func startTunnel(options: [String : NSObject]? = nil, completionHandler: @escaping (Error?) -> Void) {
completionHandler(nil)
}
override func stopTunnel(with reason: NEProviderStopReason, completionHandler: @escaping () -> Void) {
completionHandler()
}
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
<key>NSExtension</key>
<dict>
<key>NSExtensionPointIdentifier</key>
<string>com.apple.networkextension.packet-tunnel</string>
<key>NSExtensionPrincipalClass</key>
<string>$(PRODUCT_MODULE_NAME).PacketTunnelProvider</string>
</dict>
</dict>
</plist>
Xcode version: 15.0 Beta
tvOS version: 17.0 (21J5273q)
The same iCloud problem. Is there a solution?