Monal icon indicating copy to clipboard operation
Monal copied to clipboard

[Bug]: Monal doesn't fallback to IPv4 when IPv6 network doesn't work

Open catap opened this issue 8 months ago • 3 comments

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

Considerations for XMPP users

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

catap avatar Apr 19 '25 23:04 catap

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 :)

tmolitor-stud-tu avatar Jun 06 '25 14:06 tmolitor-stud-tu

Maybe using two stage is the right approach?

  1. Resolve IP addresses of server
  2. Try to connect to them one by one?

catap avatar Jun 06 '25 15:06 catap

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.

tmolitor-stud-tu avatar Jun 06 '25 16:06 tmolitor-stud-tu