[GH-ISSUE #2167] IN keyword is not accepted #907

Open
opened 2026-03-16 00:49:57 +03:00 by kerem · 5 comments
Owner

Originally created by @eirnym on GitHub (Mar 7, 2024).
Original GitHub issue: https://github.com/hickory-dns/hickory-dns/issues/2167

Describe the bug

IN keyword beside SOA records is not accepted.

Bind and Knot DNS servers accepts to use CLASS RRs in each line, many zone editors and definitions contain these keyword on each line as well, also it's possible to specify record-specific TTL (which is usually 0, so in most cases it's not worth a while to respond).

please, note that RFCs has mixed opinion on this, so I see it as an optional keywords. There's no RFC to define zone file format

nslookup, dig and many other clients would response with a full line: zone, ttl, class RR value

www.example.com.	86400	IN	A	127.0.0.1

To Reproduce
Steps to reproduce the behavior:

zone can contain IN records will fail

www IN A 127.0.0.1

Expected behavior

no syntax error on class and invalid syntax if invalid class has been specified

System:

  • OS: macOS
  • Architecture: aarch64
  • Version Monterey
  • rustc version: 1.75.0

Version:
Crate: hickory-dns binary
Version: git revision da41e4ad

Additional context
Add any other context about the problem here.

Originally created by @eirnym on GitHub (Mar 7, 2024). Original GitHub issue: https://github.com/hickory-dns/hickory-dns/issues/2167 **Describe the bug** `IN` keyword beside SOA records is not accepted. Bind and Knot DNS servers accepts to use CLASS RRs in each line, many zone editors and definitions contain these keyword on each line as well, also it's possible to specify record-specific TTL (which is usually 0, so in most cases it's not worth a while to respond). please, note that RFCs has mixed opinion on this, so I see it as an optional keywords. There's no RFC to define zone file format nslookup, dig and many other clients would response with a full line: `zone, ttl, class RR value` ``` www.example.com. 86400 IN A 127.0.0.1 ``` **To Reproduce** Steps to reproduce the behavior: zone can contain `IN` records will fail ``` www IN A 127.0.0.1 ``` **Expected behavior** no syntax error on class and invalid syntax if invalid class has been specified **System:** - OS: macOS - Architecture: aarch64 - Version Monterey - rustc version: 1.75.0 **Version:** Crate: hickory-dns binary Version: git revision da41e4ad **Additional context** Add any other context about the problem here.
Author
Owner

@djc commented on GitHub (Mar 7, 2024):

Thanks for the report! Would you be able to take a whack at fixing this?

The zone file parsing code lives here: https://github.com/hickory-dns/hickory-dns/blob/main/crates/proto/src/serialize/txt/zone.rs.

Would also be great if you can just contribute a PR that adds tests for this.

Happy to answer any questions you might have.

<!-- gh-comment-id:1983030728 --> @djc commented on GitHub (Mar 7, 2024): Thanks for the report! Would you be able to take a whack at fixing this? The zone file parsing code lives here: https://github.com/hickory-dns/hickory-dns/blob/main/crates/proto/src/serialize/txt/zone.rs. Would also be great if you can just contribute a PR that adds tests for this. Happy to answer any questions you might have.
Author
Owner

@eirnym commented on GitHub (Mar 7, 2024):

Thanks, I'll try

<!-- gh-comment-id:1983202368 --> @eirnym commented on GitHub (Mar 7, 2024): Thanks, I'll try
Author
Owner

@eirnym commented on GitHub (Feb 16, 2025):

Any news on this one?

<!-- gh-comment-id:2661466333 --> @eirnym commented on GitHub (Feb 16, 2025): Any news on this one?
Author
Owner

@bluejekyll commented on GitHub (Mar 2, 2025):

I'm unable to reproduce this issue. As far as I can tell our zone parsing accepts an inline TTL with an SOA, we have some tests that cover this case. Can you provide a reproducible case for this?

We have an example zone file we use which has this example, github.com/hickory-dns/hickory-dns@cda2c38fd4/tests/test-data/test_configs/example.com.zone (L31)

no-service 86400 IN MX 0 .

I've written a test to verify this, when the SOA is present in the zone file, TTL and IN are properly optional, I've tried these combinations, and they all appear to work,

both TTL and type are optional

@   IN          SOA     hickory-dns.org. root.hickory-dns.org. (
                            199609203 ; Serial
                            8h        ; Refresh
                            120m      ; Retry
                            7d        ; Expire
                            24h)      ; Minimum TTL
test A 1.2.3.4

TTL not specified

@   IN          SOA     hickory-dns.org. root.hickory-dns.org. (
                            199609203 ; Serial
                            8h        ; Refresh
                            120m      ; Retry
                            7d        ; Expire
                            24h)      ; Minimum TTL
test IN A 1.2.3.4

TTL and type specified

@   IN          SOA     hickory-dns.org. root.hickory-dns.org. (
                            199609203 ; Serial
                            8h        ; Refresh
                            120m      ; Retry
                            7d        ; Expire
                            24h)      ; Minimum TTL
test 86400 IN A 1.2.3.4

TTL without type specified

@   IN          SOA     hickory-dns.org. root.hickory-dns.org. (
                            199609203 ; Serial
                            8h        ; Refresh
                            120m      ; Retry
                            7d        ; Expire
                            24h)      ; Minimum TTL
test 86400 A 1.2.3.4
<!-- gh-comment-id:2692831904 --> @bluejekyll commented on GitHub (Mar 2, 2025): I'm unable to reproduce this issue. As far as I can tell our zone parsing accepts an inline TTL with an SOA, we have some tests that cover this case. Can you provide a reproducible case for this? We have an example zone file we use which has this example, https://github.com/hickory-dns/hickory-dns/blob/cda2c38fd439090e76644c3726a2ffa2aa14e370/tests/test-data/test_configs/example.com.zone#L31 ``` no-service 86400 IN MX 0 . ``` I've written a test to verify this, when the SOA is present in the zone file, TTL and IN are properly optional, I've tried these combinations, and they all appear to work, both TTL and type are optional ``` @ IN SOA hickory-dns.org. root.hickory-dns.org. ( 199609203 ; Serial 8h ; Refresh 120m ; Retry 7d ; Expire 24h) ; Minimum TTL test A 1.2.3.4 ``` TTL not specified ``` @ IN SOA hickory-dns.org. root.hickory-dns.org. ( 199609203 ; Serial 8h ; Refresh 120m ; Retry 7d ; Expire 24h) ; Minimum TTL test IN A 1.2.3.4 ``` TTL and type specified ``` @ IN SOA hickory-dns.org. root.hickory-dns.org. ( 199609203 ; Serial 8h ; Refresh 120m ; Retry 7d ; Expire 24h) ; Minimum TTL test 86400 IN A 1.2.3.4 ``` TTL without type specified ``` @ IN SOA hickory-dns.org. root.hickory-dns.org. ( 199609203 ; Serial 8h ; Refresh 120m ; Retry 7d ; Expire 24h) ; Minimum TTL test 86400 A 1.2.3.4 ```
Author
Owner

@eirnym commented on GitHub (Mar 2, 2025):

At the moment of the report, it wasn't accepted without TTL. Because of it and other problem, I've started to use Knot DNS.

I need to retest it.

<!-- gh-comment-id:2692880870 --> @eirnym commented on GitHub (Mar 2, 2025): At the moment of the report, it wasn't accepted without TTL. Because of it and other problem, I've started to use Knot DNS. I need to retest it.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/hickory-dns#907
No description provided.