diff options
| author | Janito Vaqueiro Ferreira Filho <janito@mullvad.net> | 2018-09-08 22:02:55 -0300 |
|---|---|---|
| committer | Janito Vaqueiro Ferreira Filho <janito@mullvad.net> | 2018-09-11 12:52:21 -0300 |
| commit | 5cf6b6b54f264fac16840edf950e7115182c386d (patch) | |
| tree | c9f8488fd14b79009dcb0bc58a9589bee3b9cada | |
| parent | 94bf26bea42c43d98546642f78a99e3f71d6f811 (diff) | |
| download | mullvadvpn-5cf6b6b54f264fac16840edf950e7115182c386d.tar.xz mullvadvpn-5cf6b6b54f264fac16840edf950e7115182c386d.zip | |
Change global IPv6 check
Check if a bit flag is set indicating IPv6 is disabled on tunnel
interfaces instead of checking if all bit flags are set. Also assume
IPv6 is enabled if the registry entry is missing.
| -rw-r--r-- | talpid-core/src/tunnel/mod.rs | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/talpid-core/src/tunnel/mod.rs b/talpid-core/src/tunnel/mod.rs index 2969f8660d..ffb624d6c1 100644 --- a/talpid-core/src/tunnel/mod.rs +++ b/talpid-core/src/tunnel/mod.rs @@ -322,13 +322,16 @@ fn is_ipv6_enabled_in_os() -> bool { use winreg::enums::*; use winreg::RegKey; - const IPV6_DISABLED: u8 = 0xFF; + const IPV6_DISABLED_ON_TUNNELS_MASK: u32 = 0x01; + // Check registry if IPv6 is disabled on tunnel interfaces, as documented in + // https://support.microsoft.com/en-us/help/929852/guidance-for-configuring-ipv6-in-windows-for-advanced-users let globally_enabled = RegKey::predef(HKEY_LOCAL_MACHINE) .open_subkey(r#"SYSTEM\CurrentControlSet\Services\Tcpip6\Parameters"#) .and_then(|ipv6_config| ipv6_config.get_value("DisabledComponents")) - .map(|ipv6_disabled_bits: u32| (ipv6_disabled_bits & 0xFF) == IPV6_DISABLED as u32) - .unwrap_or(false); + .map(|ipv6_disabled_bits: u32| { + (ipv6_disabled_bits & IPV6_DISABLED_ON_TUNNELS_MASK) == 0 + }).unwrap_or(true); globally_enabled && ::winnet::get_tap_interface_ipv6_status().unwrap_or(false) } |
