Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

spotifyd is listening to UDP port 5353 and replying to mDNS requests #1101

Closed
1 of 6 tasks
stuart12 opened this issue Aug 11, 2022 · 7 comments
Closed
1 of 6 tasks

spotifyd is listening to UDP port 5353 and replying to mDNS requests #1101

stuart12 opened this issue Aug 11, 2022 · 7 comments
Labels
bug A functionality or parts of a program that do not work as intended

Comments

@stuart12
Copy link

Description

Spotifyd is listening to UDP port 5353 and appears to be replying to mDNS requests, This breaks avahi-daemon.service on my Debian machine

To Reproduce

  1. watch the avahi-daemon.service logs with journalctl -fu avahi-daemon.service
  2. Start spotifyd
  3. See: avahi-daemon[1866]: Host name conflict, retrying with entrance-2

The problem became worse when I started running docker. Spotifyd is now advertising 172.17.0.1 (the address of the docker0 interface) in addition to the correct IP address. Every second lookup of entrance.local (my machine is called entrance) now gets the incorrect address 172.17.0.1.

Expected behavior

Spotifyd does not listen to UDP port 5353, Spotifyd does not reply to mdns requests.

Logs

Click to show logs
Aug 10 23:40:58 entrance avahi-daemon[2346]: Successfully dropped remaining capabilities.
Aug 10 23:40:58 entrance avahi-daemon[2346]: No service file found in /etc/avahi/services.
Aug 10 23:40:58 entrance avahi-daemon[2346]: Joining mDNS multicast group on interface eth0.IPv6 with address 2a01:e34:ec11:66e0:dea6:32ff:fe68:5ede.
Aug 10 23:40:58 entrance avahi-daemon[2346]: New relevant interface eth0.IPv6 for mDNS.
Aug 10 23:40:58 entrance avahi-daemon[2346]: Joining mDNS multicast group on interface eth0.IPv4 with address 192.168.0.30.
Aug 10 23:40:58 entrance avahi-daemon[2346]: New relevant interface eth0.IPv4 for mDNS.
Aug 10 23:40:58 entrance avahi-daemon[2346]: Network interface enumeration completed.
Aug 10 23:40:58 entrance avahi-daemon[2346]: Registering new address record for 2a01:e34:ec11:66e0:dea6:32ff:fe68:5ede on eth0.*.
Aug 10 23:40:58 entrance avahi-daemon[2346]: Registering new address record for 192.168.0.30 on eth0.IPv4.
Aug 10 23:40:59 entrance avahi-daemon[2346]: Server startup complete. Host name is entrance.local. Local service cookie is 2850886868.
Aug 10 23:41:45 entrance avahi-daemon[2346]: Withdrawing address record for 2a01:e34:ec11:66e0:dea6:32ff:fe68:5ede on eth0.
Aug 10 23:41:45 entrance avahi-daemon[2346]: Host name conflict, retrying with entrance-2
Aug 10 23:41:45 entrance avahi-daemon[2346]: Registering new address record for 2a01:e34:ec11:66e0:dea6:32ff:fe68:5ede on eth0.*.
Aug 10 23:41:45 entrance avahi-daemon[2346]: Registering new address record for 192.168.0.30 on eth0.IPv4.
Aug 10 23:41:45 entrance avahi-daemon[2346]: Server startup complete. Host name is entrance-2.local. Local service cookie is 2850886868.
Aug 10 23:41:44 entrance systemd[1]: Starting Run Spotifyd...
Aug 10 23:41:45 entrance systemd[1]: Started Run Spotifyd.
Aug 10 23:41:45 entrance sh[2433]: Loading config from "/run/spotifyd-run/spotifyd.conf"
Aug 10 23:41:45 entrance sh[2433]: Unable to identify shell. Defaulting to "sh".
Aug 10 23:41:45 entrance sh[2433]: No proxy specified
Aug 10 23:41:45 entrance sh[2433]: Using software volume controller.
Aug 10 23:41:45 entrance sh[2433]: Connecting to AP "ap.spotify.com:443"
Aug 10 23:41:45 entrance sh[2433]: Authenticated as "XXXXXXXX" !
Aug 10 23:41:45 entrance sh[2433]: Country: "FR"
Aug 10 23:41:45 entrance sh[2433]: Using PulseAudio sink with format: S16

: @entrance; sudo ss -lpna | grep spotifyd
u_str ESTAB  0      0                                * 30343                           * 30344 users:(("spotifyd",pid=2433,fd=8),("spotifyd",pid=2433,fd=6))                                                                      
u_str ESTAB  0      0                                * 30344                           * 30343 users:(("spotifyd",pid=2433,fd=7))                                                                                                 
u_str ESTAB  0      0                                * 30332                           * 31883 users:(("spotifyd",pid=2433,fd=2),("spotifyd",pid=2433,fd=1))                                                                      
udp   UNCONN 0      0                           0.0.0.0:5353                     0.0.0.0:*     users:(("spotifyd",pid=2433,fd=10))                                                                                                
udp   UNCONN 0      0                                 *:5353                           *:*     users:(("spotifyd",pid=2433,fd=11))                                                                                                
tcp   LISTEN 0      128                        0.0.0.0:41743                     0.0.0.0:*     users:(("spotifyd",pid=2433,fd=9))                                                                                                 
tcp   ESTAB  0      0                     192.168.0.30:40366              104.199.65.124:443   users:(("spotifyd",pid=2433,fd=12))                                                                                                

Compilation flags

  • dbus_mpris
  • dbus_keyring
  • alsa_backend
  • portaudio_backend
  • pulseaudio_backend
  • rodio_backend

cargo build --release --no-default-features --features pulseaudio_backend

Versions:

  • OS: Linux Debian unstable (5.18.0-3-arm64)
  • Spotifyd: 993336f
  • cargo: 1.56.0
@stuart12 stuart12 added the bug A functionality or parts of a program that do not work as intended label Aug 11, 2022
@wasamasa
Copy link

This could be a duplicate of #990 which is caused by librespot-org/librespot#486 and could be theoretically resolved since libmdns allows specifying allowed IP addresses: librespot-org/libmdns#35

@eladyn
Copy link
Member

eladyn commented Aug 16, 2022

As @wasamasa correctly points out, spotifyd replies to mDNS requests to make itself discoverable on the network as a Connect device. While this is an integral part of spotifyd it shouldn't be necessary to advertise itself, if you run spotifyd by providing it with your credentials.

In librespot, the underlying library, there are multiple things you could do to mitigate this:

  • enable the with-dns-sd feature, which instructs librespot to use avahi instead of spinning up its own solution
  • --disable-discovery, if you don't need it, but use your credentials

Unfortunately, spotifyd exposes neither of those methods. So your options are basically to either modify spotifyd (e.g. change this line to include features = ["with-dns-sd"]) or to use librespot.

Hope this helps!

@eladyn
Copy link
Member

eladyn commented Sep 8, 2022

So with #1059 having been merged, spotifyd should no longer use mDNS, when you run it with credentials. Thus, I think this issue might be resolved?

@wasamasa
Copy link

wasamasa commented Sep 8, 2022

Yes, I can confirm that a recently built spotifyd does no longer have this issue.

@eladyn
Copy link
Member

eladyn commented Sep 8, 2022

@stuart12 feel free to reopen, if it still doesn't work for you.

@eladyn eladyn closed this as completed Sep 8, 2022
@xanderio
Copy link

This is an issue when running spotifyd without credentials.

@beh-10257
Copy link

I know this is an issue specifically in this application but I have the same issue using the official client is there any idea on how to fix the problem

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A functionality or parts of a program that do not work as intended
Projects
None yet
Development

No branches or pull requests

5 participants