[avahi] Ensuring prompt reconnect to services that do not announce themselves

Esko Dijk esko.dijk at iotconsultancy.nl
Tue Nov 15 11:04:40 UTC 2022


Hello Mathias,

If the service you mention does not announce its presence, it is not compliant to mDNS specifications – unfortunately.  So if the client “browse” operation for that service is already ongoing while the service is started, it may indeed take long before the client eventually resends its mDNS query. (The specification mentions up to 1 hour for query resending time.) So if possible the service should be fixed ;)

The mDNS standard RFC 6762 does provide a way to discover such a service, which is the One-Shot Multicast DNS Query (Section 5.1).
This is the simplest type of mDNS client. It may be operated even in addition to the full/regular mDNS Querier (Section 5.2) that avahi implements. It sends a one-shot query from a different source port so it can work alongside the avahi daemon.

When using such one-shot client, it’s important to make the query specific to the (misbehaving) service or service type to discover, to avoid clogging the network with many responses from non-relevant services.

I haven’t found any code for the one-shot client within avahi, maybe others know this?
There are some webpages explaining to use ‘dig’ or ‘nslookup’ tools to test one-shot mDNS queries. And there’s some code mentioning it here: https://github.com/mjansson/mdns

A “hack” solution could also be to restart Avahi-daemon such that its cache is cleared and it is forced to send out an mDNS query as soon as the running application reregisters to the daemon.

Regards
Esko


IoTconsultancy.nl  |  Email/Teams: esko.dijk at iotconsultancy.nl


From: avahi <avahi-bounces at lists.freedesktop.org> On Behalf Of Mathias De Roover
Sent: Monday, November 14, 2022 17:08
To: avahi at lists.freedesktop.org
Subject: [avahi] Ensuring prompt reconnect to services that do not announce themselves

Dear avahi community,
I'm using the avahi-client interface (C api) to create a service-browser with the goal of listening to the presence of a specific service in my network.
It appears however that this service does not automatically announce itself when it joins the network but does react to MDNS queries.
This results in quite a delay between the connection and the discovery (more than 15 minutes).
Does a method exist by which I can regularly schedule these MDNS queries so that I have guarantees about the time between connection and discovery?
Thanks in advance and kind regards,
Mathias
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/avahi/attachments/20221115/afaa4f44/attachment.htm>


More information about the avahi mailing list