parent
f6d915e6dd
commit
311015950e
@ -142,6 +142,9 @@ extension OpenVPNTunnelProvider {
|
||||
/// Default gateway could not be attained.
|
||||
case gatewayUnattainable
|
||||
|
||||
/// Remove server has shut down.
|
||||
case serverShutdown
|
||||
|
||||
/// The server replied in an unexpected way.
|
||||
case unexpectedReply
|
||||
}
|
||||
|
@ -876,6 +876,9 @@ extension OpenVPNTunnelProvider {
|
||||
|
||||
case .noRouting:
|
||||
return .routing
|
||||
|
||||
case .serverShutdown:
|
||||
return .serverShutdown
|
||||
|
||||
default:
|
||||
return .unexpectedReply
|
||||
|
@ -77,4 +77,7 @@ public enum OpenVPNError: String, Error {
|
||||
|
||||
/// Missing routing information.
|
||||
case noRouting
|
||||
|
||||
/// Remote server shut down (--explicit-exit-notify).
|
||||
case serverShutdown
|
||||
}
|
||||
|
@ -907,6 +907,11 @@ public class OpenVPNSession: Session {
|
||||
|
||||
// Ruby: handle_ctrl_msg
|
||||
private func handleControlMessage(_ message: String) {
|
||||
if CoreConfiguration.logsSensitiveData {
|
||||
log.debug("Received control message: \"\(message)\"")
|
||||
}
|
||||
|
||||
// disconnect on authentication failure
|
||||
guard !message.hasPrefix("AUTH_FAILED") else {
|
||||
|
||||
// XXX: retry without client options
|
||||
@ -921,14 +926,18 @@ public class OpenVPNSession: Session {
|
||||
return
|
||||
}
|
||||
|
||||
guard (negotiationKey.controlState == .preIfConfig) else {
|
||||
// disconnect on remote server restart (--explicit-exit-notify)
|
||||
guard !message.hasPrefix("RESTART") else {
|
||||
log.debug("Disconnecting due to server shutdown")
|
||||
deferStop(.shutdown, OpenVPNError.serverShutdown)
|
||||
return
|
||||
}
|
||||
|
||||
// handle authentication from now on
|
||||
guard negotiationKey.controlState == .preIfConfig else {
|
||||
return
|
||||
}
|
||||
|
||||
if CoreConfiguration.logsSensitiveData {
|
||||
log.debug("Received control message: \"\(message)\"")
|
||||
}
|
||||
|
||||
let completeMessage: String
|
||||
if let continuated = continuatedPushReplyMessage {
|
||||
completeMessage = "\(continuated),\(message)"
|
||||
|
Loading…
Reference in New Issue
Block a user