While trying Deltachat for small/medium business use I came across the following issue: desktops and mobile phones are in different VLANs. Traffic between VLANs passes a router/firewall, which only allows specific connections. See also this thread: Add second device: which network connections are made?
Expected behavior
I need to allow inter VLAN connections in the firewall to Deltachat destination ports, so that mobile phones can be added as second device to existing desktop clients.
Actual behavior
When adding a second device Deltachat choses a random network port for the incoming connection. I cannot allow a random port in the firewall.
Solution
Deltachat should try some static ports for incoming connections first. If those ports are already in use by other tools, use a random port.
Examples:
- try port 62009 first, then random: a single port is more likely to be already occupied, so…
- try ports 62009-620011 first, then random. Easy to configure in firewall.
- try ports 62009, 63009, 64009 first, then random. Probably the highest chance to get a free static port.
Falling back to random port makes sure it will always work for the home user just like before.