close
Skip to content

fix(iroh-dns): Fix DNS resolution on Android#4183

Draft
Frando wants to merge 4 commits intomainfrom
Frando/android-dns
Draft

fix(iroh-dns): Fix DNS resolution on Android#4183
Frando wants to merge 4 commits intomainfrom
Frando/android-dns

Conversation

@Frando
Copy link
Copy Markdown
Member

@Frando Frando commented Apr 27, 2026

Description

We currently use hickory-resolver to resolve the DNS system configuration. On Android, this path panics if no ndk JNI context has been initialized prior to initializing the DNS resolver.

Additionally, we have reports that Android reports bogus nameservers when tethered over an Iphone.

This PR fixes both issues:

  • When resolving the system config fails, we now fall back to Google plus Cloudflare servers. This happens across all platforms (though we don't yet have any reports that reading the system conf fails on other platforms than Android)
  • We use our own JNI code to load the system conf; it differs to hickory's that it does not panic but return an error if the NDK context hasn't been initialized
  • We now provide a android-only public function install_android_jni_context that needs to be called before initalizing iroh to be able to use the system DNS config on android
  • We filter out the bogus nameservers that are reported when on a tethered connection

The PR also adds a CI job to run all iroh tests, including the DNS tests, in an Android emulator.

Breaking Changes

Notes & open questions

Change checklist

  • Self-review.
  • Documentation updates following the style guide, if relevant.
  • Tests if relevant.
  • All breaking changes documented.
    • List all breaking changes in the above "Breaking Changes" section.
    • Open an issue or PR on any number0 repos that are affected by this breaking change. Give guidance on how the updates should be handled or do the actual updates themselves. The major ones are:

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 27, 2026

Netsim report & logs for this PR have been generated and is available at: LOGS
This report will remain available for 3 days.

Last updated for commit: 4289446

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 27, 2026

Documentation for this PR has been generated and is available at: https://n0-computer.github.io/iroh/pr/4183/docs/iroh/

Last updated: 2026-04-28T13:51:31Z

@Frando Frando force-pushed the Frando/android-dns branch from e8e8871 to c87caa4 Compare April 27, 2026 09:59
@dignifiedquire dignifiedquire added this to the v1.0.0-rc.0 milestone Apr 27, 2026
@Frando Frando force-pushed the Frando/android-dns branch from 9ee9b3a to 39ae911 Compare April 27, 2026 10:33
@n0bot n0bot Bot added this to iroh Apr 27, 2026
@github-project-automation github-project-automation Bot moved this to 🚑 Needs Triage in iroh Apr 27, 2026
@dignifiedquire dignifiedquire moved this from 🚑 Needs Triage to 🏗 In progress in iroh Apr 28, 2026
@Frando Frando force-pushed the Frando/android-dns branch from a036a85 to f34f1e4 Compare April 28, 2026 13:37
@Frando Frando changed the title fix(iroh-dns): Provide JNI path for DNS config on Android with fallback to Google/Cloudflare fix(iroh-dns): Fix DNS resolution on Android Apr 28, 2026
Frando added 2 commits April 28, 2026 15:43
Trim verbose comments, the cargo-ndk-runner wrapper, and a couple of
diagnostic dumps now that the job is green:

* Wrapper: drop the conditional env-prefix dance (RUST_LOG and
  RUST_BACKTRACE are always set on the step), drop the
  set +e / capture rc / set -e pattern (set -e propagates the final
  adb shell's exit code already), drop the on-exit `adb shell rm`
  (the emulator is destroyed at job end).
* Script: keep the boot-completed and route-readiness polling
  verbatim, but drop the on-timeout echo messages and the
  `ip route` / `ip -6 route` / `getprop net.dns1` dumps. `ip addr`
  alone confirms IPv6 is disabled (no `inet6` lines).
Make `is_usable_nameserver_config` and the Windows-anycast filter
unconditional in `system_config`. The Android reader now returns the
raw nameserver list it gets back from JNI, and the top-level
`read_system_conf` runs the same `sanitize()` pass on every platform.

* Folds the platform_tests module into the main tests module - the
  fixtures only need hickory-resolver, which is on every non-wasm
  target the system_config module is compiled for.
* Hoists the platform dispatch from `read_system_conf` into a private
  `read_raw()` so the sanitize pass lives in one place.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: 🏗 In progress

Development

Successfully merging this pull request may close these issues.

2 participants