mirror of
https://github.com/M66B/NetGuard.git
synced 2025-02-07 15:23:13 +00:00
Always honor set DNS servers
This commit is contained in:
parent
f2485d7d94
commit
f632a96f11
1 changed files with 13 additions and 12 deletions
|
@ -1149,18 +1149,19 @@ public class ServiceSinkhole extends VpnService implements SharedPreferences.OnS
|
|||
Log.e(TAG, ex.toString() + "\n" + Log.getStackTraceString(ex));
|
||||
}
|
||||
|
||||
// Use system DNS servers only when no two custom DNS servers specified
|
||||
if (listDns.size() < 2)
|
||||
for (String def_dns : sysDns)
|
||||
try {
|
||||
InetAddress ddns = InetAddress.getByName(def_dns);
|
||||
if (!listDns.contains(ddns) &&
|
||||
!(ddns.isLoopbackAddress() || ddns.isAnyLocalAddress()) &&
|
||||
(ip6 || ddns instanceof Inet4Address))
|
||||
listDns.add(ddns);
|
||||
} catch (Throwable ex) {
|
||||
Log.e(TAG, ex.toString() + "\n" + Log.getStackTraceString(ex));
|
||||
}
|
||||
if (listDns.size() == 2)
|
||||
return listDns;
|
||||
|
||||
for (String def_dns : sysDns)
|
||||
try {
|
||||
InetAddress ddns = InetAddress.getByName(def_dns);
|
||||
if (!listDns.contains(ddns) &&
|
||||
!(ddns.isLoopbackAddress() || ddns.isAnyLocalAddress()) &&
|
||||
(ip6 || ddns instanceof Inet4Address))
|
||||
listDns.add(ddns);
|
||||
} catch (Throwable ex) {
|
||||
Log.e(TAG, ex.toString() + "\n" + Log.getStackTraceString(ex));
|
||||
}
|
||||
|
||||
// Remove local DNS servers when not routing LAN
|
||||
boolean lan = prefs.getBoolean("lan", false);
|
||||
|
|
Loading…
Reference in a new issue