[avahi] Howto remove stale entries from cache

Mueller, Daniel Daniel.Mueller at karlstorz.com
Wed Feb 3 07:25:47 PST 2016


Hi

I want to use avahi for device/service discovery in a kind of ad-hoc bus system where the bus communication starts as soon as a new device pops up. While service advertising works great as long as a service is properly shutdown - I'm not sure how to deal with clients which silently vanish from the network (cable pulled).

Theses services stay listed in the avahi cache for a quite a long time (depending on the TTL). My bus application detects those vanishing clients almost immediately and could then trigger a cache flush. Otherwise I have to keep polling that client until avahi drops it from the list eventually.

To my understanding this would also be the recommended way of doing it according to RFC 6762 (https://tools.ietf.org/html/rfc6762):
"10.4 Cache Flush on Failure Indication
Sometimes a cache record can be determined to be stale when a client attempts to use the rdata it contains, and the client finds that rdata to be incorrect. (...) The software implementing the Multicast DNS resource record cache should provide a mechanism so that clients detecting stale rdata can inform the cache."

Is there a way to remove stale entries from the avahi cache or can I flush the cache?

Btw. I'm publishing my service to avahi via libkdnssd.

Kind regards
Daniel


More information about the avahi mailing list