I’m building COOL (24.04) on Ubuntu 24.04, and in coolwsd.xml.in there is a comment:
<!-- On systems where localhost resolves to IPv6 [::1] address first, when net.proto is all and net.listen is loopback, coolwsd unexpectedly listens on [::1] only.
You need to change net.proto to IPv4, if you want to use 127.0.0.1. -->
However, in the default settings, net.proto is all and net.listen is any instead of loopback, and after make run it still listen to IPv6 only. I had to change net.proto to IPv4 to make it listen to IPv4. How could I get it to listen both IPv4 and IPv6? Either to change in the settings or the code, or the OS?
OS might prioritize IPv6 in a way that affects COOL’s binding:
Check IPv6 Preference:
Run cat /etc/gai.conf and look for precedence or label directives. If IPv6 is strongly preferred, it might influence the socket behavior.
Temporarily disable IPv6 to test: sudo sysctl -w net.ipv6.conf.all.disable_ipv6=1. Then run COOL and check if it switches to IPv4. Re-enable with 0 afterward.
<net desc="Network settings">
<!-- On systems where localhost resolves to IPv6 [::1] address first, when net.proto is all and net.listen is loopback, coolwsd unexpectedly listens on [::1] only.
You need to change net.proto to IPv4, if you want to use 127.0.0.1. -->
<proto type="string" default="all" desc="Protocol to use IPv4, IPv6 or all for both">all</proto>
<listen type="string" default="any" desc="Listen address that coolwsd binds to. Can be 'any' or 'loopback'.">any</listen>
All the lines in /etc/gai.conf are commented out.
After disabling ipv6, netstat -tuln still shows tcp6 only.
As there is discussion on matrix about this issue Michael suggested
Could you grab an strace of coolwsd to check what parameters are being passed to the listen system call? That should help clarify whether it’s binding as expected or if something else is interfering.
Also, running lsof -p <pid-of-coolwsd> might reveal useful details about what addresses and ports it’s actually listening on
And yes, you can join the public discussion channel—or as we call it, the Matrix channel—here: COOL Dev Matrix Channel!
Not sure how to do it and what to look. I ran strace ./coolwsd and got a lot of output. It was a lot, so I paste something I think it may be helpful here:
I’m sure in coolwsd.xml(.in) the proto is all and listen is any. It still looks like only bound to IPv6.
(There is a setsockopt setting the socket option as 'IPV6_V6only`. I’m not sure if it is the cause or not, or where it comes from.
The only place mentioning IPv4 in this strace log is