TunnelManager: bound recursion in startActivation
This commit is contained in:
parent
5528be92ff
commit
04993104b1
|
@ -321,9 +321,17 @@ class TunnelContainer: NSObject {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fileprivate func startActivation(tunnelConfiguration: TunnelConfiguration,
|
fileprivate func startActivation(recursionCount: UInt = 0,
|
||||||
|
lastError: Error? = nil,
|
||||||
|
tunnelConfiguration: TunnelConfiguration,
|
||||||
resolvedEndpoints: [Endpoint?],
|
resolvedEndpoints: [Endpoint?],
|
||||||
completionHandler: @escaping (Error?) -> Void) {
|
completionHandler: @escaping (Error?) -> Void) {
|
||||||
|
if (recursionCount >= 8) {
|
||||||
|
os_log("startActivation: Failed after 8 attempts. Giving up with %{public}@.", log: OSLog.default, type: .error, "\(lastError!)")
|
||||||
|
completionHandler(lastError)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
// resolvedEndpoints should contain only IP addresses, not any named endpoints
|
// resolvedEndpoints should contain only IP addresses, not any named endpoints
|
||||||
assert(resolvedEndpoints.allSatisfy { (resolvedEndpoint) in
|
assert(resolvedEndpoints.allSatisfy { (resolvedEndpoint) in
|
||||||
guard let resolvedEndpoint = resolvedEndpoint else { return true }
|
guard let resolvedEndpoint = resolvedEndpoint else { return true }
|
||||||
|
@ -349,7 +357,7 @@ class TunnelContainer: NSObject {
|
||||||
}
|
}
|
||||||
os_log("startActivation: Tunnel saved after re-enabling.", log: OSLog.default, type: .info)
|
os_log("startActivation: Tunnel saved after re-enabling.", log: OSLog.default, type: .info)
|
||||||
os_log("startActivation: Invoking startActivation", log: OSLog.default, type: .debug)
|
os_log("startActivation: Invoking startActivation", log: OSLog.default, type: .debug)
|
||||||
self?.startActivation(tunnelConfiguration: tunnelConfiguration, resolvedEndpoints: resolvedEndpoints, completionHandler: completionHandler)
|
self?.startActivation(recursionCount: recursionCount + 1, lastError: NEVPNError(NEVPNError.configurationUnknown), tunnelConfiguration: tunnelConfiguration, resolvedEndpoints: resolvedEndpoints, completionHandler: completionHandler)
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -392,7 +400,7 @@ class TunnelContainer: NSObject {
|
||||||
}
|
}
|
||||||
os_log("startActivation: Tunnel reloaded.", log: OSLog.default, type: .info)
|
os_log("startActivation: Tunnel reloaded.", log: OSLog.default, type: .info)
|
||||||
os_log("startActivation: Invoking startActivation", log: OSLog.default, type: .debug)
|
os_log("startActivation: Invoking startActivation", log: OSLog.default, type: .debug)
|
||||||
self?.startActivation(tunnelConfiguration: tunnelConfiguration, resolvedEndpoints: resolvedEndpoints, completionHandler: completionHandler)
|
self?.startActivation(recursionCount: recursionCount + 1, lastError: vpnError, tunnelConfiguration: tunnelConfiguration, resolvedEndpoints: resolvedEndpoints, completionHandler: completionHandler)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue