Daenou / ansible-multiroom-audio

9 stars 0 forks source link

snapserver should listen to both IPv4 and IPv6 #34

Closed nis65 closed 2 years ago

nis65 commented 2 years ago

In the past days, I had some snapclients that were not able to connect to the snapserver. Sometimes only a reboot (of the snapserver host) helped. Now I found out the reason:

It seems that snapclients do not very nicely failover from IPv6 to IPv4. Although I could see an strace (and a log file of my DNS server) that the snapclient was making an AAAA DNS request first, then an A request. But still, connection was not possible unless I configured the IPv4 address literal. So snapclient is preferring IPv6 over IPv4 a bit too much, the connection attempt is done over IPv6 only and your log gets filled with

Dec 05 06:25:09 schlaf snapclient[482]: Resolving host IP for: pidev.example.net
Dec 05 06:25:09 schlaf snapclient[482]: Connecting
Dec 05 06:25:40 schlaf snapclient[482]: Failed to connect to host 'pidev.example.net', error: No route to host
Dec 05 06:25:40 schlaf snapclient[482]: Error: No route to host
Dec 05 06:25:40 schlaf snapclient[482]: Error in socket shutdown: Transport endpoint is not connected

Solution (Workaround?): Configure snapserver to listen on both IPv6 and IPv4 (and not only IPv4 as the default does). Use always

bind_to_address = ::

instead of the default

bind_to_address = 0.0.0.0

Although this is not documented very clearly, the former setting enables both IPv6 and IPv4, while the latter enables only IPv4. See also snapcast bug 518.