mikebrady / shairport-sync

AirPlay and AirPlay 2 audio player
Other
7.31k stars 574 forks source link

On FreeBSD, daemon only advertises on IPv6 if detected; IPv4 is ignored. #584

Closed freultwah closed 7 years ago

freultwah commented 7 years ago

[Edited my initial report about not binding to IPv4. Must get more sleep.]

On FreeBSD, shairport-sync only advertises on IPv6 if present. IPv4 gets ignored completely. This should not be.

I noticed the issue because the Remote app on iOS only works over IPv4, and thus I needed to run forked-daapd on IPv4, in which case it just plain did not see the shairport-sync speakers. When I ran it with IPv6 enabled, Remote did not see forked-daapd. I managed to coerce avahi to advertise A records on IPv6, but that workaround is not the default setting and not immediately obvious. It would be more prudent to advertise on both protocols if present.

sockstat | grep shair

nobody shairport- 66323 3 dgram -> /var/run/log nobody shairport- 66323 5 tcp6 :5000 : nobody shairport- 66323 6 tcp4 :5000 : nobody shairport- 66323 9 stream -> /var/run/dbus/system_bus_socket

avahi-browse -art | grep raop

Kodi's implementation can be seen listening on IPv4, yet shairport-sync is only visible on IPv6 despite listening on both.

mikebrady commented 7 years ago

This is intriguing, thanks. Can you post the result of $ shairport-sync -V please?

mikebrady commented 7 years ago

When you say you coerced avahi into advertising on IPv6, can you indicate how did you did that, please?

mikebrady commented 7 years ago

Could it be this – in the Avahi daemon configuration file at /usr/local/etc/avahi/avahi-daemon.conf, change the [server] setting use-ipv6=no to use-ipv6=yes and reboot?

freultwah commented 7 years ago

shairport-sync -V:

3.2d3-OpenSSL-Avahi-sndio-stdout-pipe-soxr-metadata-sysconfdir:/usr/local/etc

Regarding avahi: I enabled ‘publish-a-on-ipv6’.

freultwah commented 7 years ago

I do have use-ipv6=yes, and it's also the default.

When I set use-ipv6=no, shairport-sync happily reports:

avahi: register_service. avahi: request to add "_raop._tcp" service without metadata avahi: service 'CD50CED772D5@Buzibusz Express' successfully added.

The usual stuff. Yet avahi-browse sees nothing, probably because use-ipv6=no.

mikebrady commented 7 years ago

Thanks for your quick response.

freultwah commented 7 years ago

I have ip6addrctl_policy="AUTO" in rc.conf, which means that the system may prefer IPv6. Then again, it shouldn't make a difference. It sure looks as if everything on the local machine gets advertised only on IPv6, which makes me sorry for wasting your time, because it looks as if ignoring IPv4 when it's explicitly enabled could actually be avahi's fault.

mikebrady commented 7 years ago

Thanks – it's very interesting. For my part, I have been using a standard installation of FreeBSD and a standard installation of Avahi, only changing that one setting to enable the use of IPv6. The rc.conf file is:

hostname="orig41"
ifconfig_bge0="DHCP"
ifconfig_bge0_ipv6="inet6 accept_rtadv"
sshd_enable="YES"
ntpd_enable="YES"
powerd_enable="YES"
# Set dumpdev to "AUTO" to enable crash dumps, "NO" to disable
dumpdev="AUTO"

dbus_enable="YES"
avahi_daemon_enable="YES"

shairport_sync_enable="YES"

FWIW, the $ uname -a response is:

FreeBSD orig41 11.0-RELEASE-p12 FreeBSD 11.0-RELEASE-p12 #0: Wed Aug  9 09:43:35 UTC 2017     root@amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC  i386
mikebrady commented 7 years ago

Do you think out would be okay to close this issue?