Skip to content

Commit

Permalink
Fix the leaks
Browse files Browse the repository at this point in the history
For the packet tunnel to receive traffic, it needs to have a peer
configured so that the system configures routes for it. Otherwise, no
routes are applied and all traffic leaks.
  • Loading branch information
pinkisemils committed Nov 22, 2023
1 parent 6dc527e commit 6cd825b
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion ios/PacketTunnelCore/Actor/PacketTunnelActor+ErrorState.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
//

import Foundation
import MullvadTypes
import Network
import WireGuardKitTypes

extension PacketTunnelActor {
Expand Down Expand Up @@ -114,7 +116,15 @@ extension PacketTunnelActor {
privateKey: PrivateKey(),
interfaceAddresses: []
)
try await tunnelAdapter.start(configuration: configurationBuilder.makeConfiguration())
var config = try configurationBuilder.makeConfiguration()
config.dns = [IPv4Address.loopback]
config.interfaceAddresses = [IPAddressRange(from: "10.64.0.1/8")!]
config.peer = TunnelPeer(
endpoint: .ipv4(IPv4Endpoint(string: "127.0.0.1:9090")!),
publicKey: PrivateKey().publicKey
)
try? await tunnelAdapter.stop()
try await tunnelAdapter.start(configuration: config)
} catch {
logger.error(error: error, message: "Unable to configure the tunnel for error state.")
}
Expand Down

0 comments on commit 6cd825b

Please sign in to comment.