Skip to content

Read a number at the start of a line as its owner - #198

Merged
NelsonVides merged 2 commits into
mainfrom
zone-owner-at-line-start
Nov 16, 2026
Merged

NelsonVides merged 2 commits into
mainfrom
zone-owner-at-line-start

Conversation

@NelsonVides

Copy link
Copy Markdown
Contributor

RFC 1035 §5.1 has a line that does not start with a blank start with its owner. dns_zone took a first field that reads as a TTL for a TTL at the previous record's owner, unless the line only read with it as the owner. So a reverse zone written by hand lost its owners without an error:

$ORIGIN 2.0.192.in-addr.arpa.
$TTL 3600
1 IN PTR one.example.   ; read as 2.0.192.in-addr.arpa. 1 IN PTR one.example.
2 IN PTR two.example.   ; read as 2.0.192.in-addr.arpa. 2 IN PTR two.example.

BIND reads the owners 1 and 2, and so does dns_zone now. Only lines that start with no blank change:

  • 1 IN PTR host., indented, is still a TTL of 1 at the previous owner, as RFC 1035 has it.
  • A class or a type first, as in IN A 192.0.2.1 at the start of a line, still leaves the previous owner, as before.

This goes into 6.0 because it changes what an existing zone file means: a line that starts with 3600 IN A ... at column 0 meant "the previous owner, TTL 3600" and now has the owner 3600, as in BIND. #180 had partly fixed this for 6.0, so 1 3600 IN PTR ... read back, and its changelog line is folded into this one under Changed. Four tests asserted the old reading and now assert the new one. The new assertions fail with the fix reverted, and the indented-line case fails if a number is taken for an owner there too. No zone fixture here or in erldns starts a line with a number.

RFC 1035 §5.1 has a line that does not start with a blank start with its
owner. The parser took a first field that reads as a TTL for a TTL at the
owner of the record before it, unless the line only read with it as the
owner. So a reverse zone written by hand,

    $ORIGIN 2.0.192.in-addr.arpa.
    1 IN PTR one.example.
    2 IN PTR two.example.

had both PTRs at 2.0.192.in-addr.arpa., with TTLs of 1 and 2. BIND reads
the owners 1 and 2.

A line that starts with a blank still takes its number for a TTL, and a
class or a type first still leaves the owner before it.
@NelsonVides NelsonVides added the bug Code defect or incorrect behavior label Nov 16, 2026
@NelsonVides NelsonVides self-assigned this Nov 16, 2026
A line that starts with a blank has no owner (RFC 1035 §5.1), so a first
field that reads as a TTL is never one. The check took only lowercase
units, as the old lexer did, so " 1H 3600 IN A ..." took 1H for the
owner, the line reading no other way, where " 1 3600 IN A ..." was
refused. It now tells a TTL as the parser reads one, in either case.

The changelog line now says only what changed: a class or a type first
still leaves the owner before it.
@NelsonVides
NelsonVides merged commit 60db43f into main Nov 16, 2026
6 checks passed
@NelsonVides
NelsonVides deleted the zone-owner-at-line-start branch November 16, 2026 15:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Code defect or incorrect behavior

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant