Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 2 additions & 9 deletions zeroconf/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2950,21 +2950,19 @@ def handle_query( # pylint: disable=too-many-branches
) -> None:
"""Deal with incoming query packets. Provides a response if
possible."""
out = None

# Support unicast client responses
#
if port != _MDNS_PORT:
out = DNSOutgoing(_FLAGS_QR_RESPONSE | _FLAGS_AA, multicast=False)
for question in msg.questions:
out.add_question(question)
else:
out = DNSOutgoing(_FLAGS_QR_RESPONSE | _FLAGS_AA)

for question in msg.questions:
if question.type == _TYPE_PTR:
if question.name == "_services._dns-sd._udp.local.":
for stype in self.registry.get_types():
if out is None:
out = DNSOutgoing(_FLAGS_QR_RESPONSE | _FLAGS_AA)
out.add_answer(
msg,
DNSPointer(
Expand All @@ -2978,8 +2976,6 @@ def handle_query( # pylint: disable=too-many-branches
continue

for service in self.registry.get_infos_type(question.name):
if out is None:
out = DNSOutgoing(_FLAGS_QR_RESPONSE | _FLAGS_AA)
out.add_answer(msg, service.dns_pointer())
# Add recommended additional answers according to
# https://tools.ietf.org/html/rfc6763#section-12.1.
Expand All @@ -2990,9 +2986,6 @@ def handle_query( # pylint: disable=too-many-branches

continue

if out is None:
out = DNSOutgoing(_FLAGS_QR_RESPONSE | _FLAGS_AA)

name_to_find = question.name.lower()
# Answer A record queries for any service addresses we know
if question.type in (_TYPE_A, _TYPE_ANY):
Expand Down