aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrej Mihajlov <and@mullvad.net>2021-07-01 14:00:17 +0200
committerAndrej Mihajlov <and@mullvad.net>2021-07-01 14:08:07 +0200
commit79aeb0be0d0aa3f6c8bd24309aaa8dcf03216fb4 (patch)
tree574a2f060f359790868279e932b5fbc6e5d5e9db
parentKit: handle path monitor quirks when includeAllNetworks enabled. (diff)
downloadwireguard-apple-am/enable-include-all-networks.tar.xz
wireguard-apple-am/enable-include-all-networks.zip
UI: enable includeAllNetworksam/enable-include-all-networks
Signed-off-by: Andrej Mihajlov <and@mullvad.net>
-rw-r--r--Sources/Shared/Model/NETunnelProviderProtocol+Extension.swift16
1 files changed, 16 insertions, 0 deletions
diff --git a/Sources/Shared/Model/NETunnelProviderProtocol+Extension.swift b/Sources/Shared/Model/NETunnelProviderProtocol+Extension.swift
index 12b9d6bc..8ae4f3b2 100644
--- a/Sources/Shared/Model/NETunnelProviderProtocol+Extension.swift
+++ b/Sources/Shared/Model/NETunnelProviderProtocol+Extension.swift
@@ -26,6 +26,8 @@ extension NETunnelProviderProtocol {
providerConfiguration = ["UID": getuid()]
#endif
+ setAlwaysRouteViaTunnelIfNeeded()
+
let endpoints = tunnelConfiguration.peers.compactMap { $0.endpoint }
if endpoints.count == 1 {
serverAddress = endpoints[0].stringRepresentation
@@ -59,6 +61,8 @@ extension NETunnelProviderProtocol {
@discardableResult
func migrateConfigurationIfNeeded(called name: String) -> Bool {
+ let didSetAlwaysRouteViaTunnel = setAlwaysRouteViaTunnelIfNeeded()
+
/* This is how we did things before we switched to putting items
* in the keychain. But it's still useful to keep the migration
* around so that .mobileconfig files are easier.
@@ -82,6 +86,18 @@ extension NETunnelProviderProtocol {
return true
}
#endif
+ return didSetAlwaysRouteViaTunnel
+ }
+
+ @discardableResult
+ private func setAlwaysRouteViaTunnelIfNeeded() -> Bool {
+ if #available(iOS 15, macOS 12, *) {
+ if !includeAllNetworks || !excludeLocalNetworks {
+ includeAllNetworks = true
+ excludeLocalNetworks = true
+ return true
+ }
+ }
return false
}
}