Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use /dev/socket/dnsproxyd on Android rather than 8.8.8.8 for MX record resolution #4887

Open
link2xt opened this issue Oct 27, 2023 · 0 comments

Comments

@link2xt
Copy link
Collaborator

link2xt commented Oct 27, 2023

Currently the core falls back to using 8.8.8.8 resolver if /etc/resolv.conf is not found, which is the case on Android:

/// Get resolver to query MX records.
///
/// We first try to read the system's resolver from `/etc/resolv.conf`.
/// This does not work at least on some Androids, therefore we fallback
/// to the default `ResolverConfig` which uses eg. to google's `8.8.8.8` or `8.8.4.4`.
fn get_resolver() -> Result<TokioAsyncResolver> {
if let Ok(resolver) = AsyncResolver::tokio_from_system_conf() {
return Ok(resolver);
}
let resolver = AsyncResolver::tokio(
config::ResolverConfig::default(),
config::ResolverOpts::default(),
);
Ok(resolver)
}

This fallback was added in #2852

We should fallback to using /dev/socket/dnsproxyd instead which is a stable interface maintained even on newer Android for compatibility reason and it is easy to use: hickory-dns/hickory-dns#652 (comment)
Queries can be created using hickory-proto which is the same library we use for DNS resolution now: https://docs.rs/hickory-proto/latest/hickory_proto/op/query/struct.Query.html

Related forum thread: https://support.delta.chat/t/why-connection-to-googledns-8-8-8-8/2074

For Linux platform this /dev/socket/dnsproxyd can be tried unconditionally as deltachat-rpc-server binaries do not know if they are going to be running on Linux or in Termux on Android.

@iequidoo iequidoo self-assigned this Apr 24, 2024
@iequidoo iequidoo removed their assignment Oct 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants