Skip to content

Queries for an instance name with dots get no answer (names read from packets are not escaped) #536

Closed

Description

@meliodaff

Since #420, ServiceInfo::new escapes dots in the instance name, and write_name sends L\.A\.R\.A Hub as one label. Browsing works: the PTR answer carries the right single label.

But read_labels appends each incoming label as-is, so a question for that instance arrives as L.A.R.A Hub._lara._tcp.local.. It never matches the registered l\.a\.r\.a hub._lara._tcp.local. in handle_query, so SRV, TXT and ANY questions for the instance go unanswered. Even with a match, add_answer_of_service uses the question's name as the record owner, so the answer would be written split at the dots.

To reproduce (0.21.6, Windows 11):

  1. Register ServiceInfo::new("_lara._tcp.local.", "L.A.R.A Hub", "host.local.", ip, 8080, None).
  2. Send a QU query for SRV with the single label L.A.R.A Hub + _lara + _tcp + local (what Android NSD's resolveService asks when the records are not cached).
  3. No response. A PTR query for _lara._tcp.local is answered, with SRV, TXT and A in the additional section.

Possible fix: in read_labels, escape . and \ inside a label, the inverse of parse_escaped_name. One change fixes both the lookup and the answer owner, and it removes the root cause of #483 (a label ending in \ swallowed the next separator). Side effect: a browsed fullname keeps its escapes and equals the registered fullname, so test_rfc6763_utf8_network_integration, which expects it unescaped, would change. With that fix, a QU SRV query for L.A.R.A Hub is answered, and all crate tests pass after updating that test and the #483 test. I can send the patch as a PR.

Activity

  1. keepsimple1 commented on Nov 1, 2026

    @keepsimple1
    Owner

    Looks like a valid issue and your proposed fix makes sense. Please go ahead and send the PR. Thanks!

  2. added a commit that references this issue on Nov 12, 2026
    8eb02e5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions