diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2019-01-03 19:24:30 +0100 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2019-01-07 19:23:39 -0500 |
commit | 150cd119c7144b7701a15286781bc1d62bdd82b3 (patch) | |
tree | 2a8e8873f4d0e94ff250344c5d5d5d22d85ccca4 /WireGuard/WireGuardNetworkExtension/PacketTunnelSettingsGenerator.swift | |
parent | Update copyright (diff) | |
download | wireguard-apple-150cd119c7144b7701a15286781bc1d62bdd82b3.tar.xz wireguard-apple-150cd119c7144b7701a15286781bc1d62bdd82b3.zip |
Avoid dynamic MTU calculations for now
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'WireGuard/WireGuardNetworkExtension/PacketTunnelSettingsGenerator.swift')
-rw-r--r-- | WireGuard/WireGuardNetworkExtension/PacketTunnelSettingsGenerator.swift | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/WireGuard/WireGuardNetworkExtension/PacketTunnelSettingsGenerator.swift b/WireGuard/WireGuardNetworkExtension/PacketTunnelSettingsGenerator.swift index 7c908aa..b011c2a 100644 --- a/WireGuard/WireGuardNetworkExtension/PacketTunnelSettingsGenerator.swift +++ b/WireGuard/WireGuardNetworkExtension/PacketTunnelSettingsGenerator.swift @@ -72,14 +72,20 @@ class PacketTunnelSettingsGenerator { dnsSettings.matchDomains = [""] // All DNS queries must first go through the tunnel's DNS networkSettings.dnsSettings = dnsSettings - let mtu = tunnelConfiguration.interface.mtu ?? 0 + var mtu = tunnelConfiguration.interface.mtu ?? 0 + + /* 0 means automatic MTU. In theory, we should just do + * `networkSettings.tunnelOverheadBytes = 80` but in + * practice there are too many broken networks out there. + * Instead set it to 1280. Boohoo. Maybe someday we'll + * add a nob, maybe, or iOS will do probing for us. + */ if mtu == 0 { - // 0 imples automatic MTU, where we set overhead as 80 bytes, which is the worst case for WireGuard - networkSettings.tunnelOverheadBytes = 80 - } else { - networkSettings.mtu = NSNumber(value: mtu) + mtu = 1280 } + networkSettings.mtu = NSNumber(value: mtu) + let (ipv4Routes, ipv6Routes) = routes() let (ipv4IncludedRoutes, ipv6IncludedRoutes) = includedRoutes() |