Skip to content

maradns: parse cname and unknown raw records - #33

Merged
msimerson merged 1 commit into
NicTool:mainfrom
aberoham:library-zero-skips
Aug 31, 2026
Merged

maradns: parse cname and unknown raw records#33
msimerson merged 1 commit into
NicTool:mainfrom
aberoham:library-zero-skips

Conversation

@aberoham

Copy link
Copy Markdown
Contributor

Two test cases were disabled with it.skip. Both hid real parser gaps.

cname was missing from the set of type tokens the parser recognises, so a CNAME line was read as an A record. dname and uri had the same problem. The dispatch switch already had cases for all three. None was ever reached, so all three threw:

before:  sub.example.net. DNAME target.example.net. ~   -> throws (read as A, fails RFC 1035)
after:   -> { owner, ttl, type: DNAME, target: 'target.example.net.' }

URI needed one more thing. csv2 quotes the target, and those quotes are what stop expandPercent from eating a percent-encoded URI, so they can only come off afterwards. The target now matches what fromTinydns produces:

_http._tcp.example.com. URI 10 1 'https://example.com/a%20b?x=1' ~
-> target: 'https://example.com/a%20b?x=1'

A RAW line with an unrecognised type id returned false and the record was discarded. It now returns an RR.UNKNOWN per RFC 3597. This changes output. A zone containing such a record now yields one more record than before. The fixture count moves from 40 to 41.

A malformed type id still returns false. RR.UNKNOWN validates the id and throws invalid DNS type: TYPENaN, so without that check a line that used to be skipped would end the parse instead.

RR.UNKNOWN arrived in dns-resource-record 1.9.0. That is already the declared floor.

231 tests, 231 pass, 0 failed, 0 skipped

@msimerson
msimerson merged commit 818b10f into NicTool:main Aug 31, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants