Skip to content

Commit afc5469

Browse files
committed
Fixes
1 parent ba1df31 commit afc5469

File tree

1 file changed

+6
-2
lines changed
  • talpid-tunnel/src/tun_provider/android

1 file changed

+6
-2
lines changed

talpid-tunnel/src/tun_provider/android/mod.rs

+6-2
Original file line numberDiff line numberDiff line change
@@ -296,12 +296,16 @@ impl VpnServiceConfig {
296296
/// Return a list of custom DNS servers. If not specified, gateway addresses are used for DNS.
297297
/// Note that `Some(vec![])` is different from `None`. `Some(vec![])` disables DNS.
298298
fn resolve_dns_servers(config: &TunConfig) -> Vec<IpAddr> {
299+
// If IPv6 is not available we need to disable all IPv6 DNS servers as setting any ipv6
300+
// setting while ipv6 is disabled will cause leaks.
301+
let want_ipv6 = |ip: &IpAddr| config.ipv6_gateway.is_some() || !ip.is_ipv6();
299302
config
300303
.dns_servers
301304
.clone()
302305
.unwrap_or_else(|| config.gateways())
303-
// If IPv6 not available we need to disable all IPv6 DNS servers as that will cause leaks
304-
.iter().filter(|ip| !ip.is_ipv6() || config.ipv6_gateway.is_some()).copied().collect()
306+
.into_iter()
307+
.filter(want_ipv6)
308+
.collect()
305309
}
306310

307311
/// Potentially subtract LAN nets from the VPN service routes, excepting gateways.

0 commit comments

Comments
 (0)