diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2019-05-25 18:02:16 +0200 |
---|---|---|
committer | Roopesh Chander <roop@roopc.net> | 2019-05-26 00:12:47 +0530 |
commit | 0340641c4c8d7be93e8f85be9827dec68711ab9a (patch) | |
tree | 9ec13f987bd55da78cc983d6e62fe9bb2f8c2651 /WireGuard/WireGuardNetworkExtension/PacketTunnelSettingsGenerator.swift | |
parent | NetworkExtension: use excludedRoutes instead of binding on iOS (diff) | |
download | wireguard-apple-0340641c4c8d7be93e8f85be9827dec68711ab9a.tar.xz wireguard-apple-0340641c4c8d7be93e8f85be9827dec68711ab9a.zip |
NetworkExtension: apparently the extension process is scoped properly anyway
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'WireGuard/WireGuardNetworkExtension/PacketTunnelSettingsGenerator.swift')
-rw-r--r-- | WireGuard/WireGuardNetworkExtension/PacketTunnelSettingsGenerator.swift | 23 |
1 files changed, 0 insertions, 23 deletions
diff --git a/WireGuard/WireGuardNetworkExtension/PacketTunnelSettingsGenerator.swift b/WireGuard/WireGuardNetworkExtension/PacketTunnelSettingsGenerator.swift index cc491af..a4ff7dd 100644 --- a/WireGuard/WireGuardNetworkExtension/PacketTunnelSettingsGenerator.swift +++ b/WireGuard/WireGuardNetworkExtension/PacketTunnelSettingsGenerator.swift @@ -97,16 +97,13 @@ class PacketTunnelSettingsGenerator { let (ipv4Routes, ipv6Routes) = routes() let (ipv4IncludedRoutes, ipv6IncludedRoutes) = includedRoutes() - let (ipv4ExcludedRoutes, ipv6ExcludedRoutes) = excludedRoutes() let ipv4Settings = NEIPv4Settings(addresses: ipv4Routes.map { $0.destinationAddress }, subnetMasks: ipv4Routes.map { $0.destinationSubnetMask }) ipv4Settings.includedRoutes = ipv4IncludedRoutes - ipv4Settings.excludedRoutes = ipv4ExcludedRoutes networkSettings.ipv4Settings = ipv4Settings let ipv6Settings = NEIPv6Settings(addresses: ipv6Routes.map { $0.destinationAddress }, networkPrefixLengths: ipv6Routes.map { $0.destinationNetworkPrefixLength }) ipv6Settings.includedRoutes = ipv6IncludedRoutes - ipv6Settings.excludedRoutes = ipv6ExcludedRoutes networkSettings.ipv6Settings = ipv6Settings return networkSettings @@ -156,24 +153,4 @@ class PacketTunnelSettingsGenerator { } return (ipv4IncludedRoutes, ipv6IncludedRoutes) } - private func excludedRoutes() -> ([NEIPv4Route]?, [NEIPv6Route]?) { - #if os(macOS) - return (nil, nil) - #elseif os(iOS) - var ipv4ExcludedRoutes = [NEIPv4Route]() - var ipv6ExcludedRoutes = [NEIPv6Route]() - for endpoint in resolvedEndpoints { - guard let host = endpoint?.host else { continue } - switch host { - case .ipv4(let v4): - ipv4ExcludedRoutes.append(NEIPv4Route(destinationAddress: "\(v4)", subnetMask: "255.255.255.255")) - case .ipv6(let v6): - ipv6ExcludedRoutes.append(NEIPv6Route(destinationAddress: "\(v6)", networkPrefixLength: 128)) - default: - continue - } - } - return (ipv4ExcludedRoutes, ipv6ExcludedRoutes) - #endif - } } |