I have a weird issue; for a single connect request to a server that has a single AAAA record my device runs two A queries instead and fails to connect.
My setup is as follows:
- LAN (a regular router) without IPv6 connectivity
- Android 10 with only WiFi connectivity, having one
fe80:and twofd14:addresses - Debian box, wired, running
dnsmasq, acting as the DNS server for all devices dnsmasqwill reply that websitefoo.comhas an IPv6 of the Debian box, and no IPv4
I can:
- Connect from my phone to the Debian box using literal IPv6 address
- Connect from other devices to
foo.com - Connect to
foo.comfrom JuiceSSH - Do
ping6 foo.comsuccessfully in Termux on the phone
What I can't do, I can't connect from my phone to the Debian box via foo.com using regular apps such as Chrome, or my own app. JuiceSSH is the weird exception. I tried making a new app, adding INTERNET permission and this bit of code only:
thread { Socket("foo.com", 9000) } This works consistently with the apps such as Chrome in that it doesn't connect and—from what I see in dsmasq logs—performs two A queries (both with NODATA-IPv4 response). It never performs an AAAA query. Inet*Address.getAllByName() behaves in a similar way. I tested with another device running Android 6, same outcome.
What's going on here?