[Bug]: Monal doesn't fallback to IPv4 when IPv6 network doesn't work
What Monal Release channel are you using?
AppStore
iOS system version (if applicable)
18.3.2
macOS system version (if applicable)
No response
Monal version
6.4.10
Used XMPP server (domain)
korins.ky
Which XMPP-Server software are you using?
ejabberd
XMPP Server Software Version
25.04
How many accounts are you using in Monal?
2
What happened?
A problem happened!
Anything else?
My home network has IPv4 and IPv6. IPv4 is under NAT, and IPv6 is delegated "as is" from the ISP.
It also has a backup network, which is IPv4 only.
When it is switched to backup, IPv6 is configured, but not routed and I can't connect to any IPv6 address from home network.
Usually everything is downgraded to IPv4, but monal doesn't. Instead it ends with DNS lookup and give up on not working IPv6 address.
As soon as I had switched off IPv6 in the network, it had connected again.
FAQ
- [x] I have checked the FAQ for my issue
Considerations for XMPP users
- [x] I have checked if my issue can be solved with Considerations for XMPP users and Considerations for XMPP server admins
XEP-Check
- [x] I have checked that at least XEP-198, XEP-0280, XEP-0352, XEP-0357, XEP-0313 and XEP-0163 are activated on my server and shown as 'green' under Settings --> Account--> (i) in advanced settings
Notifications-Menu
- [x] I have checked that all checkmarks are present under Settings --> Notifications
We are using the standard iOS/macOS API to connect to the server using the DNS name. Apparently that doesn't fall back between IPv6/IPv4.
To have that, the connection process would have to reworked to implement something like happy eyeballs. PRs welcome :)
Maybe using two stage is the right approach?
- Resolve IP addresses of server
- Try to connect to them one by one?
That would slow down the connection if only one IP is usable. Additionally, a DNS name can have several IPv4 and IPv6 attached. And last but not least, there can be multiple SRV records having the same priority. All of these should be tried in paallel since we get only ~25 seconds of background time for each incoming push.
Trying everything in parallel and using the connection that wins the race is called "happy eyeballs" (RFC 8305) and that's the only proper solution. Everything else is not worth the effort of touching the connection code.