aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2020-12-17 00:24:39 +0100
committerJason A. Donenfeld <Jason@zx2c4.com>2020-12-17 00:26:00 +0100
commitdb4e2915f33aa561fff2401e05319e1b5241fdf8 (patch)
treeaf58dd8ef9956a9b8559e2e37ba02ca5f2dec5b5
parentKit: PacketTunnelSettingsGenerator: do not require DNS queries if no DNS (diff)
downloadwireguard-apple-db4e2915f33aa561fff2401e05319e1b5241fdf8.tar.xz
wireguard-apple-db4e2915f33aa561fff2401e05319e1b5241fdf8.zip
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>
-rw-r--r--Sources/WireGuardKit/WireGuardAdapter.swift5
-rw-r--r--Sources/WireGuardNetworkExtension/PacketTunnelProvider.swift5
2 files changed, 1 insertions, 9 deletions
diff --git a/Sources/WireGuardKit/WireGuardAdapter.swift b/Sources/WireGuardKit/WireGuardAdapter.swift
index 6c2e956..16e1b28 100644
--- a/Sources/WireGuardKit/WireGuardAdapter.swift
+++ b/Sources/WireGuardKit/WireGuardAdapter.swift
@@ -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")
}
}
diff --git a/Sources/WireGuardNetworkExtension/PacketTunnelProvider.swift b/Sources/WireGuardNetworkExtension/PacketTunnelProvider.swift
index 042d86c..5ba8222 100644
--- a/Sources/WireGuardNetworkExtension/PacketTunnelProvider.swift
+++ b/Sources/WireGuardNetworkExtension/PacketTunnelProvider.swift
@@ -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)