Skip to content

fix: add hickory-dns resolver for musl/Android Termux DNS resolution#164

Merged
Bahtya merged 1 commit intomainfrom
fix/hickory-dns-163
Apr 25, 2026
Merged

fix: add hickory-dns resolver for musl/Android Termux DNS resolution#164
Bahtya merged 1 commit intomainfrom
fix/hickory-dns-163

Conversation

@Bahtya
Copy link
Copy Markdown
Owner

@Bahtya Bahtya commented Apr 25, 2026

Summary

  • Add hickory-dns feature flag to workspace reqwest dependency, replacing the default DNS resolver with hickory-resolver

Problem

musl's getaddrinfo() hardcodes /etc/resolv.conf lookup, which doesn't exist on Android Termux. This causes all HTTPS requests to timeout with 5-second delays when running the statically-linked musl binary on Android.

Fix

The reqwest hickory-dns feature replaces the system resolver with hickory-resolver, which correctly handles Android's DNS configuration. No code changes needed — the feature flag applies globally to all reqwest::Client instances.

Impact

  • Linux (glibc): No change — hickory reads /etc/resolv.conf same as system
  • macOS: No change
  • Android Termux (musl static): Fixed — bypasses musl getaddrinfo entirely
  • Proxy mode: Unaffected — proxy handles DNS, reqwest does not resolve

Closes #163

Test plan

  • CI compiles successfully across all targets (x86_64, aarch64, musl)
  • Existing integration tests pass
  • Manual test on Android Termux: kestrel resolves api.telegram.org without timeout

Bahtya

…163)

musl's getaddrinfo hardcodes /etc/resolv.conf lookup which doesn't
exist on Android. The hickory-dns feature replaces reqwest's default
DNS resolver with hickory-resolver, which handles Android's DNS
configuration correctly.

Bahtya
@Bahtya Bahtya merged commit 15e163e into main Apr 25, 2026
6 checks passed
@Bahtya Bahtya deleted the fix/hickory-dns-163 branch April 25, 2026 20:06
@Bahtya
Copy link
Copy Markdown
Owner Author

Bahtya commented Apr 25, 2026

Retroactive Code Review — PR #164

Issue #163 Summary

musl's getaddrinfo() hardcodes /etc/resolv.conf lookup, which doesn't exist on Android Termux, causing all HTTPS requests to 5s timeout. Recommended fix: add reqwest hickory-dns feature flag.


CRITICAL: Cargo.lock is inconsistent — hickory-resolver packages are missing

The hickory-dns feature was added to Cargo.toml, but Cargo.lock was never regenerated to include hickory-resolver and its dependency tree. Evidence:

  1. grep 'name = "hickory' Cargo.lock returns 0 results on the merge commit (15e163e)
  2. The reqwest entry in Cargo.lock does not list hickory-resolver as a dependency
  3. Per docs.rs/reqwest/0.12.28/features, the hickory-dns feature enables dep:hickory-resolver + dep:once_cell

This means: the committed lock file does not actually activate hickory-dns. If cargo build --locked were used, the resulting binary would NOT use hickory for DNS.

Mitigating factor: CI does NOT use --locked, so cargo auto-updates the lock during builds. The feature would work in CI and release. But the repository state is inconsistent, and adding --locked to CI in the future would break builds.

Action needed: Run cargo update and commit the updated Cargo.lock to include hickory-resolver packages.


MEDIUM: Unrelated Cargo.lock changes bundled in

The diff shows 247 packages removed, 45 added (+381/-3125 lines), far exceeding what a single feature flag addition should produce. The changes include:

This happened because PR #164's Cargo.lock was regenerated from a state where PR #160's dependency changes hadn't been locked yet, picking up both changes in one shot.


LOW: native-tls still present despite default-features = false

The reqwest entry in Cargo.lock still includes native-tls, hyper-tls, and tokio-native-tls, even though workspace Cargo.toml specifies default-features = false. Likely another dependency enables reqwest's default features. Not specific to this PR but worth investigating separately.


POSITIVE: The fix approach is correct

  • The feature flag approach is exactly right — reqwest's hickory-dns feature replaces the system resolver globally, no code changes needed
  • All 15+ reqwest::Client construction points (telegram.rs, discord.rs, providers/lib.rs, web tools) are covered automatically
  • No side effects on Linux/macOS — hickory reads /etc/resolv.conf like the system resolver
  • Proxy mode unaffected — proxy handles DNS, reqwest doesn't resolve

Verdict: Needs follow-up

The Cargo.toml change is correct, but the fix is incomplete without an updated Cargo.lock. A follow-up commit running cargo update is needed to actually pull in hickory-resolver dependencies.

Bahtya added a commit that referenced this pull request Apr 25, 2026
PR #164 added hickory-resolver dependency but Cargo.lock was not
updated, causing CI resolution failures.

Bahtya
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

Successfully merging this pull request may close these issues.

feat: use hickory-dns resolver in reqwest client for musl/Android compatibility

1 participant