[LEDE-DEV] mdnsd ignoring questions

Cristian Morales Vega cristian at samknows.com
Wed Dec 14 08:35:51 PST 2016


I have found a problem with mdnsd, but since I'm no expert in the
protocol and would prefer to stay that way, could somebody comment on
these?

The problem is with service_reply_single()
(https://git.lede-project.org/?p=project/mdnsd.git;a=blob;f=service.c;h=fe6e5a91d31bd3475e47b3775db3e3474b848de6;hb=HEAD#l153).

The call to service_timeout() resets the timeout counter, but if the
later strcmp(match, s->service) check fails, the service is not
actually announced. Since service_reply() calls service_reply_single()
for every single registered service, it means that every time an
Android phone in the networks looks for a Chromecast it resets the
timeout counter of the _ssh counter. And when later somebody asks for
the _ssh service, mdnsd will fail to reply.

I would be tempted to just get rid of the service_timeout() call. Why
does it exist? There would really be a problem if mdnsd would reply to
every single request, even when it has already replied to it half a
second ago?
I could also change the order of the strcmp(match, s->service) and
service_timeout() checks, but notice that when a device looks for a
service via both IPv4 and IPv6 changing the order of the checks would
still make it, for example, get a reply via IPv6 and not via IPv4
(which I guess can be a good thing since it's just a duplicate?).



More information about the Lede-dev mailing list