fix: add IPv6 bootstrap DNS servers for IPv6-only uplinks#24
Merged
Conversation
On IPv6-only mobile networks (e.g. 464XLAT cellular) the outbound interface has no IPv4 address, so the IPv4-only default bootstrap nameservers all time out. Every DNS client then fails to initialize, leaving "no DNS clients available for query" and breaking all domain-based connections while literal-IP traffic still works. Add AliDNS/Google IPv6 servers to the built-in default-nameserver list so bootstrap resolution works over IPv6. Also switch the hardcoded defaults from Host::Domain to typed Host::Ipv4/Host::Ipv6. Bootstrap clients are built with no parent resolver, so a Host::Domain entry hits the resolve path and fails to initialize; literal IPs must use the typed variants. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Itsusinn
added a commit
that referenced
this pull request
Jun 15, 2026
Commit #24 added IPv6 bootstrap nameservers for IPv6-only uplinks, but gated them behind `if config.dns.default_nameserver.is_empty()`. When a profile supplies its own `default-nameserver` (typically IPv4-only), the else branch cloned that list verbatim and the IPv6 fallback was dropped. On an IPv6-only uplink (e.g. 464XLAT cellular, interface has no IPv4 address) the IPv4 bootstrap servers are unreachable, so every bootstrap query times out, the DoT main nameservers cannot be resolved, and the resolver ends up with zero usable clients -> "no DNS clients available for query" on every connection. Always append the IPv6 bootstrap servers (with a dedup check) regardless of whether the list came from defaults or the profile, so resolution can still proceed on IPv6-only networks. Also factor the repeated NameServer literals into a small udp_bootstrap closure. Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
On IPv6-only mobile networks (e.g. China Mobile / 464XLAT cellular), the selected outbound interface has only a global IPv6 address and no IPv4 address. The built-in DNS bootstrap (
default-nameserver) servers are all IPv4, so every query is routed out an interface that cannot send IPv4 — and times out:With no bootstrap client available, the DoT nameservers can't resolve either, leaving the resolver empty. Every domain-based connection then fails while literal-IP traffic keeps working:
Changes
In
uniffi/clash-android-ffi/src/lib.rs, the built-indefault_nameserverlist:2400:3200::1,2400:3200:baba::1, and Google2001:4860:4860::8888.Host::Domainto typedHost::Ipv4/Host::Ipv6. This is required, not cosmetic: bootstrap clients are constructed with no parent resolver (father: Nonein clash-lib'sEnhancedResolver::new), so aHost::Domainentry takes the resolve path and fails to initialize. The previous hardcoded IPv4Host::Domaindefaults were a latent bug that only worked when a profile supplied its owndefault-nameserver(which clash-rs pre-parses into typedHost::Ipv4).Notes for reviewers
default-nameserver). A profile that sets its own IPv4-onlydefault-nameserveris still used verbatim and will need an IPv6 entry to work on IPv6-only networks.ProfileOverride.ipv6already defaults totrueand feeds bothgeneral.ipv6anddns.ipv6.Testing
cargo check -p clash-android-ffi --target aarch64-linux-androidpasses.