Skip to content

fix(D_EXTEND): ignore the empty tag when extending a subdomain - #5034

Merged
TomOnTime merged 1 commit into
DNSControl:mainfrom
spicysharkco:fix/d-extend-empty-tag
Oct 25, 2026
Merged

TomOnTime merged 1 commit into
DNSControl:mainfrom
spicysharkco:fix/d-extend-empty-tag

Conversation

@spicysharkco

Copy link
Copy Markdown
Contributor

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, although example.com and example.com! are documented as equivalent.

D("example.com!", REG_NONE, DnsProvider(DSP_BIND), A("@", "192.0.2.1"));
D_EXTEND("sub.example.com", A("www", "192.0.2.2"));

dnscontrol print-ir shows www.su instead of www.sub. With D("example.com", ...) and D_EXTEND("sub.example.com!", ...), dnscontrol check stops with panic: 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 gives main.su and the second panics. go test -p 1 -count=1 ./pkg/js/ ./pkg/normalize/ ./models/ passes with it.

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

Copy link
Copy Markdown
Collaborator

Thanks for fixing that!

@TomOnTime
TomOnTime merged commit ec3d801 into DNSControl:main Oct 25, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants