Kit: Adapter: do not treat NE settings timeouts as fatal
The general Network Extension framework is incredibly buggy, and a timeout when setting the network settings does not necessarily imply that the whole operation failed. Simply log the condition and move on. This restores the app's old behavior. Reported-by: Filipe Mendonça <cfilipem@gmail.com> Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
parent
20bdf46792
commit
db4e2915f3
|
@ -21,9 +21,6 @@ public enum WireGuardAdapterError: Error {
|
|||
/// Failure to set network settings.
|
||||
case setNetworkSettings(Error)
|
||||
|
||||
/// Timeout when calling to set network settings.
|
||||
case setNetworkSettingsTimeout
|
||||
|
||||
/// Failure to start WireGuard backend.
|
||||
case startWireGuardBackend(Int32)
|
||||
}
|
||||
|
@ -304,7 +301,7 @@ public class WireGuardAdapter {
|
|||
throw WireGuardAdapterError.setNetworkSettings(systemError)
|
||||
}
|
||||
} else {
|
||||
throw WireGuardAdapterError.setNetworkSettingsTimeout
|
||||
self.logHandler(.error, "setTunnelNetworkSettings timed out after 5 seconds; proceeding anyway")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -57,11 +57,6 @@ class PacketTunnelProvider: NEPacketTunnelProvider {
|
|||
errorNotifier.notify(PacketTunnelProviderError.couldNotSetNetworkSettings)
|
||||
completionHandler(PacketTunnelProviderError.couldNotSetNetworkSettings)
|
||||
|
||||
case .setNetworkSettingsTimeout:
|
||||
wg_log(.error, message: "Starting tunnel failed with setTunnelNetworkSettings timing out")
|
||||
errorNotifier.notify(PacketTunnelProviderError.couldNotSetNetworkSettings)
|
||||
completionHandler(PacketTunnelProviderError.couldNotSetNetworkSettings)
|
||||
|
||||
case .startWireGuardBackend(let errorCode):
|
||||
wg_log(.error, message: "Starting tunnel failed with wgTurnOn returning \(errorCode)")
|
||||
errorNotifier.notify(PacketTunnelProviderError.couldNotStartBackend)
|
||||
|
|
Loading…
Reference in New Issue