From 410bd341fa3c82fcdfa502956cd7fc5ba5dae088 Mon Sep 17 00:00:00 2001 From: Jamil Date: Wed, 13 Dec 2023 13:00:48 -0800 Subject: [PATCH] Set the MTU to 1280 on Apple to avoid connectivity issues (#2901) Unfortunately tunnelOverheadBytes isn't a reliable way to calculate the MTU. This could be the issue behind #2855 --- .../apple/FirezoneNetworkExtension/NetworkSettings.swift | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/swift/apple/FirezoneNetworkExtension/NetworkSettings.swift b/swift/apple/FirezoneNetworkExtension/NetworkSettings.swift index 2f917af0b..41ba898e4 100644 --- a/swift/apple/FirezoneNetworkExtension/NetworkSettings.swift +++ b/swift/apple/FirezoneNetworkExtension/NetworkSettings.swift @@ -34,8 +34,10 @@ class NetworkSettings { let tunnelAddressIPv6: String let dnsAddress: String - // WireGuard has an 80-byte overhead. - let tunnelOverheadBytes = NSNumber(80) + // WireGuard has an 80-byte overhead. We could try setting tunnelOverheadBytes + // but that's not a reliable way to calculate how big our packets should be, + // so just use the minimum. + let mtu: NSNumber = 1280 // Modifiable values private(set) var dnsFallbackStrategy: DNSFallbackStrategy @@ -181,7 +183,7 @@ class NetworkSettings { dnsSettings.matchDomains = [""] } tunnelNetworkSettings.dnsSettings = dnsSettings - tunnelNetworkSettings.tunnelOverheadBytes = tunnelOverheadBytes + tunnelNetworkSettings.mtu = mtu self.hasUnappliedChanges = false logger.log("Attempting to set network settings")