diff options
| author | Andrej Mihajlov <and@mullvad.net> | 2023-02-01 16:28:10 +0100 |
|---|---|---|
| committer | Andrej Mihajlov <and@mullvad.net> | 2023-02-03 10:58:39 +0100 |
| commit | 2240e29f72b20ea8da5d1e437543069fb5b29aa7 (patch) | |
| tree | cb714e6f06bdef8c3683867cb0db5bde6bd95553 | |
| parent | f82bdfaf29b41fcc7bca6d5c293769f3aca5f179 (diff) | |
| download | mullvadvpn-2240e29f72b20ea8da5d1e437543069fb5b29aa7.tar.xz mullvadvpn-2240e29f72b20ea8da5d1e437543069fb5b29aa7.zip | |
Exit tunnel when keychain is locked (solves boot issue)
| -rw-r--r-- | ios/PacketTunnel/PacketTunnelProvider.swift | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/ios/PacketTunnel/PacketTunnelProvider.swift b/ios/PacketTunnel/PacketTunnelProvider.swift index 6c28d845d9..50de296161 100644 --- a/ios/PacketTunnel/PacketTunnelProvider.swift +++ b/ios/PacketTunnel/PacketTunnelProvider.swift @@ -194,6 +194,24 @@ class PacketTunnelProvider: NEPacketTunnelProvider, TunnelMonitorDelegate { message: "Failed to read tunnel configuration when starting the tunnel." ) + /* + We use default data protection level which locks keychain and file system access + until device is first unlocked. + + However iOS starts packet tunnel on boot and unfortunately we do not have access to + UIApplication.isProtectedDataAvailable nor associated delegate methods that would + tell us when data protection is being lifted. + + Exit immediately and pass the underlying error to completion handler to tell iOS to + restart the tunnel later on. + */ + if let error = error as? ReadSettingsVersionError, + error.underlyingError as? KeychainError == KeychainError.interactionNotAllowed + { + completionHandler(error.underlyingError) + return + } + configurationError = error startEmptyTunnel(completionHandler: completionHandler) |
