Disable DNSSEC for Android 7-

This commit is contained in:
M66B
2024-03-09 20:55:47 +01:00
parent d0f72d56ca
commit 88c7cb5bf4
4 changed files with 39 additions and 0 deletions

View File

@@ -322,6 +322,9 @@ public class DnsHelper {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
boolean dns_custom = prefs.getBoolean("dns_custom", false);
if (!hasDnsSec())
dnssec = false;
if (!dns_custom && !dnssec)
return InetAddress.getByName(host);
@@ -335,6 +338,9 @@ public class DnsHelper {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
boolean dns_custom = prefs.getBoolean("dns_custom", false);
if (!hasDnsSec())
dnssec = false;
if (!dns_custom && !dnssec)
return InetAddress.getAllByName(host);
@@ -360,6 +366,9 @@ public class DnsHelper {
}
static void verifyDane(X509Certificate[] chain, String server, int port) throws CertificateException {
if (!hasDnsSec())
return;
Handler handler = new Handler() {
@Override
public void publish(LogRecord record) {
@@ -452,6 +461,11 @@ public class DnsHelper {
editor.apply();
}
static boolean hasDnsSec() {
// DNSSEC causes crashes in libc
return (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O);
}
static void test(Context context) throws UnknownHostException {
test(context, "gmail.com", "ns");
test(context, "web.de", "mx");