Thanks to visit codestin.com
Credit goes to github.com

Skip to content

fix: fall back to AAAA lookup for socks5 hostnames with no A record - #2054

Open
immanuwell wants to merge 1 commit into
istio:masterfrom
immanuwell:fix-socks5-ipv6-dns-fallback
Open

fix: fall back to AAAA lookup for socks5 hostnames with no A record#2054
immanuwell wants to merge 1 commit into
istio:masterfrom
immanuwell:fix-socks5-ipv6-dns-fallback

Conversation

@immanuwell

@immanuwell immanuwell commented Aug 15, 2026

Copy link
Copy Markdown
Member

socks5 dns lookup only ever queries A records, never AAAA

dns_lookup() picks A vs AAAA based on client_addr.is_ipv4().
but client_addr is just the socks client's own tcp peer addr, and the socks5 listener only binds on 127.0.0.1.
so that check is always true. AAAA never gets queried

result: hostnames with only AAAA records fail to resolve, even when the resolver has a valid answer for them.

not new either, the PR that added this (#1096) straight up said "the DNS usage is wonky".

repro: added a test with a stub resolver that only answers AAAA. fails on master with DnsEmpty:

cargo test --lib socks5::tests::dns_lookup_falls_back_to_aaaa_for_ipv6_only_host

fix: try A first, same as before, fall back to AAAA if empty.
no behavior change for hosts that already work

tests, clippy and fmt all pass

@immanuwell
immanuwell requested a review from a team as a code owner August 15, 2026 12:56
@istio-testing istio-testing added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Aug 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants