From: Rafał Miłecki Date: Wed, 8 Feb 2017 17:04:27 +0000 (+0100) Subject: Don't call dns_reply_a from service_reply X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=dfdebdd97909ebbefac4834d440847fe58daafb2;p=oweals%2Fmdnsd.git Don't call dns_reply_a from service_reply This simplifies code without changing any behavior. Having this call in service_reply required checking two conditions and was making code flow harder to follow. There are 2 more service_reply calls in the project: 1) In service_announce_services where we iterate over &services and every element of this list has "service" field filled. It means match argument was never NULL and dns_reply_a was never called from there. 2) In parse_question which also receives some name (there is a proper check in the dns_handle_packet). No call there neither. So after all there was only 1 place that was indeed calling dns_reply_a. Signed-off-by: Rafał Miłecki Acked-by: John Crispin --- diff --git a/dns.c b/dns.c index 7ca705e..aac1de1 100644 --- a/dns.c +++ b/dns.c @@ -360,8 +360,10 @@ parse_question(struct interface *iface, char *name, struct dns_question *q) switch (q->type) { case TYPE_ANY: - if (!strcmp(name, mdns_hostname_local)) + if (!strcmp(name, mdns_hostname_local)) { service_reply(iface, NULL, announce_ttl); + dns_reply_a(iface, announce_ttl); + } break; case TYPE_PTR: diff --git a/service.c b/service.c index a3a5bb4..f45784b 100644 --- a/service.c +++ b/service.c @@ -153,12 +153,6 @@ service_reply(struct interface *iface, const char *match, int ttl) vlist_for_each_element(&services, s, node) service_reply_single(iface, s, match, ttl, 0); - - if (match) - return; - - if (ttl) - dns_reply_a(iface, ttl); } void