File tree 1 file changed +6
-2
lines changed
talpid-tunnel/src/tun_provider/android
1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -296,12 +296,16 @@ impl VpnServiceConfig {
296
296
/// Return a list of custom DNS servers. If not specified, gateway addresses are used for DNS.
297
297
/// Note that `Some(vec![])` is different from `None`. `Some(vec![])` disables DNS.
298
298
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 ( ) ;
299
302
config
300
303
. dns_servers
301
304
. clone ( )
302
305
. 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 ( )
305
309
}
306
310
307
311
/// Potentially subtract LAN nets from the VPN service routes, excepting gateways.
You can’t perform that action at this time.
0 commit comments