plugin/file: preserve case in SRV record names and targets per RFC 6763 #7402
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What this PR does
This PR ensures SRV record names and targets preserve their original case in responses, aligning with RFC 6763 §4.1.1, which requires that service instance names be treated as user-friendly Unicode text and must retain casing and formatting.
What Changed
Insert()
(e.g.samba.home.arpa.
)less()
inplugin/file/tree/less.go
now compares labels case-insensitivelydig
Query:
dig @127.0.0.1 -p 53 SRV "Home\\032Media._smb._tcp.home.arpa."
Expected response:
Why this is needed
Although DNS is case-insensitive, [RFC 6763](https://datatracker.ietf.org/doc/html/rfc6763#section-4.1.1) mandates that SRV record names used in service discovery retain original case and formatting, especially for mDNS, Bonjour, and DNS-SD clients.
Prior to this fix, CoreDNS returned lowercased instance names, breaking spec-compliant discovery clients.
Limitations
This PR does not preserve the casing of the query name, as it is already normalized (lowercased) by CoreDNS or
miekg/dns
before plugin processing. This fix ensures the record data (response) complies with the spec.Related
Fixes #7237