mirror of
https://github.com/passepartoutvpn/passepartout-apple.git
synced 2025-02-21 23:32:07 +00:00
Retain legacy MTU across iOS update
Enforce 1200 (formerly 1250). If and only if unset. Defaulting to standard MTU (1500) without notice, may break connectivity for some existing users.
This commit is contained in:
parent
04fc806e5a
commit
7b87f4247c
@ -44,6 +44,8 @@ public class TransientStore {
|
|||||||
static let didMigrateHostsToUUID = "DidMigrateHostsToUUID"
|
static let didMigrateHostsToUUID = "DidMigrateHostsToUUID"
|
||||||
|
|
||||||
static let didMigrateKeychainContext = "didMigrateKeychainContext"
|
static let didMigrateKeychainContext = "didMigrateKeychainContext"
|
||||||
|
|
||||||
|
static let didMigrateRetainLowMTU = "didMigrateRetainLowMTU"
|
||||||
}
|
}
|
||||||
|
|
||||||
public static let shared = TransientStore()
|
public static let shared = TransientStore()
|
||||||
@ -81,6 +83,15 @@ public class TransientStore {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static var didMigrateRetainLowMTU: Bool {
|
||||||
|
get {
|
||||||
|
return UserDefaults.standard.bool(forKey: Keys.didMigrateRetainLowMTU)
|
||||||
|
}
|
||||||
|
set {
|
||||||
|
UserDefaults.standard.set(newValue, forKey: Keys.didMigrateRetainLowMTU)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static var baseVPNConfiguration: OpenVPNTunnelProvider.ConfigurationBuilder {
|
public static var baseVPNConfiguration: OpenVPNTunnelProvider.ConfigurationBuilder {
|
||||||
let sessionBuilder = OpenVPN.ConfigurationBuilder()
|
let sessionBuilder = OpenVPN.ConfigurationBuilder()
|
||||||
var builder = OpenVPNTunnelProvider.ConfigurationBuilder(sessionConfiguration: sessionBuilder.build())
|
var builder = OpenVPNTunnelProvider.ConfigurationBuilder(sessionConfiguration: sessionBuilder.build())
|
||||||
@ -127,6 +138,26 @@ public class TransientStore {
|
|||||||
service.migrateKeychainContext()
|
service.migrateKeychainContext()
|
||||||
TransientStore.didMigrateKeychainContext = true
|
TransientStore.didMigrateKeychainContext = true
|
||||||
}
|
}
|
||||||
|
if !TransientStore.didMigrateRetainLowMTU {
|
||||||
|
for key in service.allProfileKeys() {
|
||||||
|
guard let profile = service.profile(withKey: key) else {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if profile.networkChoices == nil {
|
||||||
|
profile.networkChoices = ProfileNetworkChoices(
|
||||||
|
choice: (key.context == .provider) ? .server : .client
|
||||||
|
)
|
||||||
|
}
|
||||||
|
if profile.manualNetworkSettings == nil {
|
||||||
|
profile.manualNetworkSettings = ProfileNetworkSettings()
|
||||||
|
}
|
||||||
|
if profile.manualNetworkSettings?.mtuBytes == nil {
|
||||||
|
profile.networkChoices?.mtu = .manual
|
||||||
|
profile.manualNetworkSettings?.mtuBytes = 1200
|
||||||
|
}
|
||||||
|
}
|
||||||
|
TransientStore.didMigrateRetainLowMTU = true
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
} catch let e {
|
} catch let e {
|
||||||
log.error("Could not decode service: \(e)")
|
log.error("Could not decode service: \(e)")
|
||||||
|
Loading…
Reference in New Issue
Block a user