mirror of
https://github.com/M66B/NetGuard.git
synced 2025-02-24 07:10:50 +00:00
Fix DNS routing on some devices
This commit is contained in:
parent
7084e90261
commit
624d3156e2
2 changed files with 11 additions and 3 deletions
|
@ -993,6 +993,7 @@ public class ServiceSinkhole extends VpnService implements SharedPreferences.OnS
|
||||||
} catch (Throwable ignored) {
|
} catch (Throwable ignored) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Use default DNS servers when no two custom DNS servers specified
|
||||||
if (listDns.size() <= 1)
|
if (listDns.size() <= 1)
|
||||||
for (String def_dns : sysDns)
|
for (String def_dns : sysDns)
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -265,11 +265,18 @@ public class Util {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<String> getDefaultDNS(Context context) {
|
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 dns1 = jni_getprop("net.dns1");
|
||||||
String dns2 = jni_getprop("net.dns2");
|
String dns2 = jni_getprop("net.dns2");
|
||||||
List<String> listDns = new ArrayList<>();
|
if (!TextUtils.isEmpty(dns1))
|
||||||
listDns.add(TextUtils.isEmpty(dns1) ? "8.8.8.8" : dns1);
|
listDns.add(dns1);
|
||||||
listDns.add(TextUtils.isEmpty(dns2) ? "8.8.4.4" : dns2);
|
if (!TextUtils.isEmpty(dns2))
|
||||||
|
listDns.add(dns2);
|
||||||
|
|
||||||
return listDns;
|
return listDns;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue