android icon indicating copy to clipboard operation
android copied to clipboard

Connection to HTTP fails when the server has an AAAA (IPv6) DNS record and connection is unreacheable

Open xheonin opened this issue 2 weeks ago • 2 comments

This was mentioned again in #1339 but was closed and not fixed. My server has DNS records for both IPv4 and IPv6 connections and the OwnTracks app will choose the IPv6 address to connect to by default. If I delete the AAAA record it works just fine. The error in the logs is the following:

Caused by: java.net.ConnectException: failed to connect to mydomain.com/<Server's IPV6> (port 443) from /<Phone's IPV6> (port 57050) after 30000ms: isConnected failed: EHOSTUNREACH (Software caused connection abort)

xheonin avatar Dec 09 '25 14:12 xheonin

This is a normal behavior for any modern application: if an AAAA record is offered it will be used. If the connection fails over IPv6 there is typically no downgrade to IPv4 nor should there be.

Not publishing an AAAA record is the correct way to indicate that IPv6 cannot be used.

jpmens avatar Dec 09 '25 14:12 jpmens

Not sure if openssh-client is modern application, but my experience on daily basis is ssh trying to connect to IPv6 address and then switch on IPv4 if IPv6 is not reachable. Web browsers has similiar behaviour. Apple came with Happy Eyeball mechanism to resolve this problem I think.

kri164 avatar Dec 17 '25 09:12 kri164

Yep - this is an issue. The fix is to upgrade to okhttp 5 (that has happy eyeballs), which we can't do until we upgrade to Kotlin 2. Which we can't do whilst we still need kapt. Which we can't get rid of until we migrate from databinding.

Yak shaving!

growse avatar Dec 22 '25 17:12 growse