diff options
| author | Bug Magnet <marco.nikic@mullvad.net> | 2023-10-04 14:32:59 +0200 |
|---|---|---|
| committer | Bug Magnet <marco.nikic@mullvad.net> | 2023-10-05 09:55:31 +0200 |
| commit | cae5cdf4d74ec60614ea85531feb7cd682500fc6 (patch) | |
| tree | a6335b2d5dee43703f9c947af2eb301a7e05abf6 /ios/PacketTunnel | |
| parent | 53b7f1ceffecae15eb8261c86399867e51c3978f (diff) | |
| download | mullvadvpn-cae5cdf4d74ec60614ea85531feb7cd682500fc6.tar.xz mullvadvpn-cae5cdf4d74ec60614ea85531feb7cd682500fc6.zip | |
Log if Same IP is used when starting a tunnel
Diffstat (limited to 'ios/PacketTunnel')
| -rw-r--r-- | ios/PacketTunnel/PacketTunnelProvider.swift | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/ios/PacketTunnel/PacketTunnelProvider.swift b/ios/PacketTunnel/PacketTunnelProvider.swift index e132952ee3..910c8b2bef 100644 --- a/ios/PacketTunnel/PacketTunnelProvider.swift +++ b/ios/PacketTunnel/PacketTunnelProvider.swift @@ -208,6 +208,7 @@ class PacketTunnelProvider: NEPacketTunnelProvider { let selectorResult = tunnelConfiguration.selectorResult self.selectorResult = selectorResult self.providerLogger.debug("Set tunnel relay to \(selectorResult.relay.hostname).") + self.logIfDeviceHasSameIP(than: tunnelConfiguration.wgTunnelConfig.interface.addresses) // Start tunnel. self.adapter.start(tunnelConfiguration: tunnelConfiguration.wgTunnelConfig) { error in @@ -238,6 +239,16 @@ class PacketTunnelProvider: NEPacketTunnelProvider { } } + private func logIfDeviceHasSameIP(than addresses: [IPAddressRange]) { + let hasIPv4SameAddress = addresses.compactMap { $0.address as? IPv4Address } + .contains { $0 == ApplicationConfiguration.sameIPv4 } + let hasIPv6SameAddress = addresses.compactMap { $0.address as? IPv6Address } + .contains { $0 == ApplicationConfiguration.sameIPv6 } + + let isUsingSameIP = (hasIPv4SameAddress || hasIPv6SameAddress) ? "" : "NOT " + providerLogger.debug("Same IP is \(isUsingSameIP)being used") + } + override func stopTunnel(with reason: NEProviderStopReason, completionHandler: @escaping () -> Void) { dispatchQueue.async { self.providerLogger.debug("Stop the tunnel: \(reason)") |
