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 <rafal@milecki.pl>
Acked-by: John Crispin <john@phrozen.org>
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:
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