My network is separated into multiple VLANs for clients, guests and devices.
The mDNS repeater is enabled between the VLANs.
The firewall blocks connections from devices to clients.
I have Yamaha amplifiers that support Spotify Connect on the device network.
I use Spotify on an iPhone on the device network.
I’ve been having trouble with Spotify not discovering the amplifiers when I try to connect to remote speakers. I could make it work by restarting the amplifier or restarting the mDNS repeater but it would then fail next time I tried to connect.
I’ve discovered that this is related to avahi’s caching of mDNS messages, not responding in the same way when using cached data.
I’ve been able to resolve this problem by disabling the cache by adding this to the avahi config file:
[server]
cache-entries-max=0
I’ve been able to make the configuration change persistent by adding a post commit hook:
/config/scripts/commit/post-hooks.d/avahi:
#!/bin/bash
CONFIG=/run/avahi-daemon/avahi-daemon.conf
AFTER=disallow-other-stacks=no
ADD=cache-entries-max=0
if ! grep -Fxq $ADD $CONFIG; then
sudo sed -i "/$AFTER/a$ADD" $CONFIG
sudo systemctl restart avahi-daemon
fi
Has anyone else had any similar problems?
Is there a better way to resolve this?
Is there a better way of making this persistent other than submitting a patch to add it to the config?