Issue parsing TTL values after <class>

15 views
Skip to first unread message

Nick Michaels

unread,
Jun 7, 2023, 2:41:08 PM6/7/23
to dnspython-users
Hi, I am having trouble parsing zone information when the TTL information appears after the [<class>] as in the sample file below ....the line "sample.com. IN 600 A 120.130.128.70".

Seems like both the forms are valid from RFC 1035, Section 5 and only the first one is supported:
[<domain>] [<TTL>] [<class>] <type> <RDATA>

[<domain>] [<class>] [<TTL>] <type> <RDATA>

Any help in getting the second form working is greatly appreciated.  The specific error I recieve is:

Getting zone object for %s from file %s sample.com test.db
 <class 'dns.exception.SyntaxError'> test.db:11: unknown rdatatype '600'

Thanks, in advance.
     ..Nick

PS: Sample file
$TTL 3600
@ IN SOA ns1.sample.com. admin.sample.com. (
291618071
10800
3600
604800
86400 )

sample.com. IN NS ns1.sample.com.
ns1 IN A 130.108.1.20
sample.com. IN 600 A 120.130.128.70
record2.a2 IN A 130.108.2.12

Bob Halley

unread,
Jun 7, 2023, 5:43:55 PM6/7/23
to dnspython-users
This is a bug.  As you say, dnspython should support the alternative ordering specified in RFC 1035, but it currently does not.  If you'd like to open a bug report at dnspython's GitHub, that would be helpful, otherwise I will do it at some point.  A software fix will probably be available pretty quickly, though you'll have to apply it yourself if you need it right away, as there will not be a dnspython release for at least another few weeks.  In the meantime, if you cannot generate things in the more usual order, you might be able to preprocess the input to change " IN " to " ", but this needs hand verification for safety as that could possibly break other records (e.g. a TXT record containing " IN ").

/Bob
Reply all
Reply to author
Forward
0 new messages