Skip to content

Update CNAME resolution#1518

Open
tgreenx wants to merge 2 commits intozonemaster:developfrom
tgreenx:update-cname
Open

Update CNAME resolution#1518
tgreenx wants to merge 2 commits intozonemaster:developfrom
tgreenx:update-cname

Conversation

@tgreenx
Copy link
Copy Markdown
Contributor

@tgreenx tgreenx commented Apr 7, 2026

Purpose

This PR slightly updates the CNAME resolution of Engine's recursor. See the Changes section below.
Updated test scenarios are defined in zonemaster/zonemaster#1477.

Context

zonemaster/zonemaster#1477

Changes

  • Zonemaster::Engine::Recursor::_resolve_cname() now returns undef when the CNAME resolution fails, along with a new message tag: CNAME_UNRESOLVABLE
  • Update unit tests: move the content of scenario TOO-LONG-CNAME-CHAIN to a new scenario TOO-MANY-CNAME, and update scenario TOO-LONG-CNAME-CHAIN to check for tag CNAME_CHAIN_TOO_LONG instead

How to test this PR

Unit tests are updated and should pass.

- `Zonemaster::Engine::Recursor::_resolve_cname()` now returns undef when the CNAME resolution fails, along with a new message tag: `CNAME_UNRESOLVABLE`
- Update unit tests: move the content of scenario `TOO-LONG-CNAME-CHAIN` to a new scenario `TOO-MANY-CNAME`, and update scenario `TOO-LONG-CNAME-CHAIN` to check for tag `CNAME_CHAIN_TOO_LONG` instead
@tgreenx tgreenx added this to the v2026.1 milestone Apr 7, 2026
@tgreenx tgreenx added V-Patch Versioning: The change gives an update of patch in version. RC-Fixes Release category: Fixes. labels Apr 7, 2026
Copy link
Copy Markdown
Contributor

@marc-vanderwal marc-vanderwal left a comment

Choose a reason for hiding this comment

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

So far, so good.

Comment thread lib/Zonemaster/Engine/Recursor.pm Outdated
Comment thread t/recursor-A.t
Comment on lines +274 to +276
local $TODO = "Need to create zones with those errors: ";
my @missing_tags = qw( CNAME_UNRESOLVABLE );
warn $TODO, "\n\t", join("\n\t", @missing_tags), "\n";
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

You could write the test already, even if you haven’t set up the infrastructure yet. It will fail, but because it’s in a TODO block, it is expected to fail, and therefore this failure will not fail the test suite itself. And if it passes, you’ll get a message about an “unexpectedly passing TODO test” reminding you to remove the TODO block.

Co-authored-by: Marc van der Wal <103426270+marc-vanderwal@users.noreply.github.com>
return ( $p, $state );
# Catch-all; unforeseen problem in CNAME resolution
Zonemaster::Engine->logger->add( CNAME_UNRESOLVABLE => { name => $name, type => $type, target => $target } );
return ( undef, $state );
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We’ll reach that case when the recursor is trying to resolve a name that is an alias to a subdomain of that name, and there is no resource record of the requested type at the alias’ target. For example, the break-me.test domain name in the zone file below:

$ORIGIN test.
;; SOA records, NS records, etc.

break-me                IN  CNAME  sub.break-me
;; sub.break-me is an empty non-terminal
*.sub.break-me          IN  AAAA   ::

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

Labels

RC-Fixes Release category: Fixes. V-Patch Versioning: The change gives an update of patch in version.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants