summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorEmīls Piņķis <emils@mullvad.net>2020-04-21 17:25:29 +0100
committerEmīls <emils@mullvad.net>2020-04-23 12:31:48 +0100
commita62fed3081b1dffbc65c9b51af5432778331ff7f (patch)
tree8273ba395bb6c3c18a4409062b297150d4da8373
parent61c7f338f29bc023261941ced58261c86e31f204 (diff)
downloadmullvadvpn-a62fed3081b1dffbc65c9b51af5432778331ff7f.tar.xz
mullvadvpn-a62fed3081b1dffbc65c9b51af5432778331ff7f.zip
Stop disabling IPv6 if the MTU is too low
-rw-r--r--CHANGELOG.md3
-rw-r--r--talpid-core/src/tunnel/wireguard/config.rs31
2 files changed, 8 insertions, 26 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 318deb91bc..f5160a390f 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -30,6 +30,9 @@ Line wrap the file at 100 chars. Th
- Downgrade to Electron 7 due to issues with tray icon in Electron 8.
### Fixed
+- Enable IPv6 in WireGuard regardless of the specified MTU value, previously IPv6 was disabled if
+ the MTU was below 1380.
+
#### Windows
- Improve offline detection logic.
diff --git a/talpid-core/src/tunnel/wireguard/config.rs b/talpid-core/src/tunnel/wireguard/config.rs
index 62c8d18144..c2d14c3604 100644
--- a/talpid-core/src/tunnel/wireguard/config.rs
+++ b/talpid-core/src/tunnel/wireguard/config.rs
@@ -3,7 +3,7 @@ use std::{
ffi::CString,
net::{Ipv4Addr, Ipv6Addr},
};
-use talpid_types::net::{wireguard, GenericTunnelOptions};
+use talpid_types::net::wireguard;
/// Config required to set up a single WireGuard tunnel
pub struct Config {
@@ -19,9 +19,7 @@ pub struct Config {
pub mtu: u16,
}
-/// Smallest MTU that supports IPv6
-const SMALLEST_IPV6_MTU: u16 = 1380;
-const DEFAULT_MTU: u16 = SMALLEST_IPV6_MTU;
+const DEFAULT_MTU: u16 = 1380;
/// Configuration errors
#[derive(err_derive::Error, Debug)]
@@ -49,41 +47,27 @@ impl Config {
peer,
&params.connection,
&params.options,
- &params.generic_options,
)
}
/// Constructs a new Config struct
pub fn new(
- mut tunnel: wireguard::TunnelConfig,
+ tunnel: wireguard::TunnelConfig,
mut peers: Vec<wireguard::PeerConfig>,
connection_config: &wireguard::ConnectionConfig,
wg_options: &wireguard::TunnelOptions,
- generic_options: &GenericTunnelOptions,
) -> Result<Config, Error> {
if peers.is_empty() {
return Err(Error::NoPeersSuppliedError);
}
let mtu = wg_options.mtu.unwrap_or(DEFAULT_MTU);
- let is_ipv6_enabled = mtu >= SMALLEST_IPV6_MTU && generic_options.enable_ipv6;
-
for peer in &mut peers {
- peer.allowed_ips = peer
- .allowed_ips
- .iter()
- .cloned()
- .filter(|ip| ip.is_ipv4() || is_ipv6_enabled)
- .collect();
+ peer.allowed_ips = peer.allowed_ips.clone();
if peer.allowed_ips.is_empty() {
return Err(Error::InvalidPeerIpError);
}
}
- tunnel.addresses = tunnel
- .addresses
- .into_iter()
- .filter(|ip| ip.is_ipv4() || is_ipv6_enabled)
- .collect();
if tunnel.addresses.is_empty() {
return Err(Error::InvalidTunnelIpError);
}
@@ -92,12 +76,7 @@ impl Config {
tunnel,
peers,
ipv4_gateway: connection_config.ipv4_gateway,
- // Only set the v6 gateway if setting a v6 gateway makes sense
- ipv6_gateway: if is_ipv6_enabled {
- connection_config.ipv6_gateway
- } else {
- None
- },
+ ipv6_gateway: connection_config.ipv6_gateway,
mtu,
})
}