Repository navigation
fix(D_EXTEND): ignore the empty tag when extending a subdomain - #5034
Merged
Merged
Conversation
The documentation says `example.com` and `example.com!` name the same
domain, and D_EXTEND() already matches them to each other. It then
cuts the subdomain out of the name by length, and the empty tag is
still part of one of the two lengths.
With `D("example.com!", ...)` followed by
`D_EXTEND("sub.example.com", A("www", ...))`, the subdomain comes out
as `su` and the record is created as `www.su.example.com`. With
`D("example.com", ...)` followed by `D_EXTEND("sub.example.com!", ...)`
the subdomain is `sub.`, and `dnscontrol check` stops with a panic:
`short (www.sub.) is not supposed to end with a dot`.
Strip the empty tag from both names before taking the length.
`037-splithor` gets one case for each direction.
TomOnTime
approved these changes
Oct 25, 2026
Collaborator
|
Thanks for fixing that! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
D_EXTEND()puts records under the wrong name, or stops with a panic, when the empty tag is written on only one of the two names, althoughexample.comandexample.com!are documented as equivalent.dnscontrol print-irshowswww.suinstead ofwww.sub. WithD("example.com", ...)andD_EXTEND("sub.example.com!", ...),dnscontrol checkstops withpanic: short (www.sub.) is not supposed to end with a dot.Cause: the domain match removes the tag from both names, but the subdomain is cut out by length from names that still carry it.
Fix: remove the tag from both names before taking the length.
Test: one case per direction in
037-splithor, using its existing zone files. Without the fix the first givesmain.suand the second panics.go test -p 1 -count=1 ./pkg/js/ ./pkg/normalize/ ./models/passes with it.