Skip to content

Conversation

@thibaut-pascal
Copy link
Contributor

Add proper escaping of dots and backslashes in DNS-SD instance names according to RFC 6763 Section 4.3:

  • '.' becomes '.'
  • '' becomes '\'

This ensures that literal dots in instance names (e.g., "My.Service") are not interpreted as DNS label separators when constructing the Service Instance Name.

Fixes improper handling of instance names containing dots or backslashes.

Add proper escaping of dots and backslashes in DNS-SD instance names
according to RFC 6763 Section 4.3:
- '.' becomes '\.'
- '\' becomes '\\'

This ensures that literal dots in instance names (e.g., "My.Service")
are not interpreted as DNS label separators when constructing the
Service Instance Name.

Fixes improper handling of instance names containing dots or backslashes.
@keepsimple1
Copy link
Owner

The description section seems to be missing backslash in these:

  • . becomes \.
  • \ becomes \\

I think it's because of Markdown syntax, and should use ``, not '' for them.

Copy link
Owner

@keepsimple1 keepsimple1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your PR! LGTM, only a couple of minor comments inline.


/// Escapes dots and backslashes in a DNS instance name according to RFC 6763 Section 4.3.
/// - '.' becomes '\.'
/// - '\\' becomes '\\\\'
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpick: Because \ has to be escaped in the code representation, these two examples are not consistent:

either change the first line to: . becomes \\.
or change the 2nd line to: \ becomes \\

// etc.
//
// This function also handles RFC 6763 Section 4.3 escaping where dots and backslashes
// in instance names are escaped (e.g., "My\\.Service" represents a single label "My.Service").
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To clarify possible confusions, could you please add something like: "Name sent over the wire is unescaped, for example My.Service". )

/// `ty_domain` is the service type and the domain label, for example
/// "_my-service._udp.local.".
///
/// `my_name` is the instance name, without the service type suffix.
Copy link
Owner

@keepsimple1 keepsimple1 Jan 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please help add a bit here to describe that my_name now allows . or \\ in it?

@keepsimple1 keepsimple1 added the enhancement New feature or request label Jan 25, 2026
@keepsimple1
Copy link
Owner

Another small thing: could you please explicitly refer to the issue number in this PR description?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants