happy eyeball: fix dnssec for plain ip an srv-cname

This commit is contained in:
genofire 2020-02-18 22:56:03 +01:00
parent 89ecc47897
commit b28b1dd154
No known key found for this signature in database
GPG Key ID: 9D7D3C6BFF600C6A
1 changed files with 7 additions and 4 deletions

View File

@ -165,6 +165,7 @@ public class Resolver {
Result result = new Result(); Result result = new Result();
result.ip = InetAddress.getByName(domain); result.ip = InetAddress.getByName(domain);
result.port = port; result.port = port;
result.authenticated = true;
return result; return result;
} catch (UnknownHostException e) { } catch (UnknownHostException e) {
return null; return null;
@ -197,18 +198,20 @@ public class Resolver {
})); }));
fallbackThreads.add(new Thread(() -> { fallbackThreads.add(new Thread(() -> {
try { try {
for (CNAME cname : resolveWithFallback(record.name, CNAME.class, result.isAuthenticData()).getAnswersOrEmptySet()) { ResolverResult<CNAME> cnames = resolveWithFallback(record.name, CNAME.class, result.isAuthenticData());
final List<Result> ipv6s = resolveIp(record, cname.name, AAAA.class, result.isAuthenticData(), directTls); for (CNAME cname : cnames.getAnswersOrEmptySet()) {
final List<Result> ipv6s = resolveIp(record, cname.name, AAAA.class, cnames.isAuthenticData(), directTls);
synchronized (fallbackResults) { synchronized (fallbackResults) {
fallbackResults.addAll(ipv6s); fallbackResults.addAll(ipv6s);
} }
final List<Result> ipv4s = resolveIp(record, cname.name, A.class, result.isAuthenticData(), directTls); final List<Result> ipv4s = resolveIp(record, cname.name, A.class, cnames.isAuthenticData(), directTls);
synchronized (results) { synchronized (results) {
fallbackResults.addAll(ipv4s); fallbackResults.addAll(ipv4s);
} }
} }
Log.d(Config.LOGTAG, Resolver.class.getSimpleName() + "cname in srv (agains RFC2782) - run slow fallback");
} catch (Throwable throwable) { } catch (Throwable throwable) {
Log.d(Config.LOGTAG, Resolver.class.getSimpleName() + "error resolving srv cname-fallback records", throwable); Log.i(Config.LOGTAG, Resolver.class.getSimpleName() + "error resolving srv cname-fallback records", throwable);
} }
})); }));
} }