Skip to content

Commit

Permalink
fix: responder dns ptr record zeroconf support
Browse files Browse the repository at this point in the history
fixes #5
  • Loading branch information
Christoph Brand committed Sep 28, 2022
1 parent a3e0d47 commit 285d24b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/mdns_client/responder.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,9 @@ def _get_service_of(self, query: str) -> "Optional[str]":

def _ptr_record_for(self, query: str) -> DNSRecord:
ptr_target = ".".join((self.host, query))
return DNSRecord(query, TYPE_PTR, CLASS_IN, DEFAULT_TTL, name_to_bytes(ptr_target))
# For some reason the PTR is shortened and the last two bytes are removed
ptr_target_bytes = name_to_bytes(ptr_target)[:-2]
return DNSRecord(query, TYPE_PTR, CLASS_IN, DEFAULT_TTL, ptr_target_bytes)

def _srv_record_for(self, query: str) -> "Optional[DNSRecord]":
advertisment = self._advertisements.get(query, None)
Expand Down

0 comments on commit 285d24b

Please sign in to comment.