mirror of https://github.com/M66B/NetGuard.git
Fix DNS routing on some devices
This commit is contained in:
parent
7084e90261
commit
624d3156e2
|
@ -993,6 +993,7 @@ public class ServiceSinkhole extends VpnService implements SharedPreferences.OnS
|
|||
} catch (Throwable ignored) {
|
||||
}
|
||||
|
||||
// Use default DNS servers when no two custom DNS servers specified
|
||||
if (listDns.size() <= 1)
|
||||
for (String def_dns : sysDns)
|
||||
try {
|
||||
|
|
|
@ -265,11 +265,18 @@ public class Util {
|
|||
}
|
||||
|
||||
public static List<String> getDefaultDNS(Context context) {
|
||||
List<String> listDns = new ArrayList<>();
|
||||
|
||||
// Needed to route DNS into VPN on some devices
|
||||
listDns.add("8.8.8.8");
|
||||
|
||||
String dns1 = jni_getprop("net.dns1");
|
||||
String dns2 = jni_getprop("net.dns2");
|
||||
List<String> listDns = new ArrayList<>();
|
||||
listDns.add(TextUtils.isEmpty(dns1) ? "8.8.8.8" : dns1);
|
||||
listDns.add(TextUtils.isEmpty(dns2) ? "8.8.4.4" : dns2);
|
||||
if (!TextUtils.isEmpty(dns1))
|
||||
listDns.add(dns1);
|
||||
if (!TextUtils.isEmpty(dns2))
|
||||
listDns.add(dns2);
|
||||
|
||||
return listDns;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue