Subject: | bug(?): Net::DNS returns empty string instead of "." for root |
Date: | Wed, 8 Apr 2009 16:58:51 -0700 |
To: | <bug-Net-DNS [...] rt.cpan.org> |
From: | David LaMacchia <dlamacchia [...] cloudmark.com> |
Hi there,
According to RFC 2181, "The zero length full name is defined as
representing the root of the DNS tree, and is typically written and
displayed as "." ." I've found that Net::DNS (latest, 0.65) returns
"" (empty string) instead of "." for these domains, whereas dig/host/
nslookup/etc. return "." I work for an anti-spam company and we've
found a lot of spammy IPs that exhibit this issue.
You may disagree that this needs to be fixed -- the RFC says that the
root is *typically* written but this is not a requirement that MUST be
followed. However, due to the disagreement with dig/host/nslookup/etc
I'm submitting the issue.
Basic information:
Distribution name and version: Net-DNS-0.65 (latest)
Perl version: perl v5.8.8 (i486-linux-gnu-thread-multi)
Operating System vendor and version: Linux freeside 2.6.24-22-generic
#1 SMP Mon Nov 24 18:32:42 UTC 2008 i686 GNU/Linux (this is Ubuntu,
hardy heron).
Sample data:
Here's an IP and the output from dig:
% dig -x 74.63.95.254
; <<>> DiG 9.4.2-P2 <<>> -x 74.63.95.254
;; global options: printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 20464
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0
;; QUESTION SECTION:
;254.95.63.74.in-addr.arpa. IN PTR
;; ANSWER SECTION:
254.95.63.74.in-addr.arpa. 10186 IN PTR .
;; Query time: 3 msec
;; SERVER: 172.20.0.21#53(172.20.0.21)
;; WHEN: Wed Apr 8 16:32:22 2009
;; MSG SIZE rcvd: 56
(note the '.' above)
I ran wireshark an looked at the answer packet data:
Domain Name System (response)
[Request In: 714]
[Time: 0.000556000 seconds]
Transaction ID: 0xcfa1
Flags: 0x8180 (Standard query response, No error)
Questions: 1
Answer RRs: 1
Authority RRs: 0
Additional RRs: 0
Queries
254.95.63.74.in-addr.arpa: type PTR, class IN
Name: 254.95.63.74.in-addr.arpa
Type: PTR (Domain name pointer)
Class: IN (0x0001)
Answers
254.95.63.74.in-addr.arpa: type PTR, class IN, <Root>
Name: 254.95.63.74.in-addr.arpa
Type: PTR (Domain name pointer)
Class: IN (0x0001)
Time to live: 2 hours, 36 minutes, 24 seconds
Data length: 1
Domain name: <Root>
0000 00 0f fe 89 c0 8b 00 11 20 d1 8d c6 08 00 45 00 ........ .....E.
0010 00 54 5a cd 00 00 7f 11 86 0e ac 14 00 15 ac 14 .TZ.............
0020 02 80 00 35 a5 3f 00 40 c3 13 cf a1 81 80 00 01 ...5.?.@........
0030 00 01 00 00 00 00 03 32 35 34 02 39 35 02 36 33 .......254.95.63
0040 02 37 34 07 69 6e 2d 61 64 64 72 04 61 72 70 61 .74.in-addr.arpa
0050 00 00 0c 00 01 c0 0c 00 0c 00 01 00 00 24 a8 00 .............$..
0060 01 00
Those last two bytes are the answer length (01) and the data (00).
I made a patch for both netdns.c (netdns_dn_expand) and Packet.pm
(dn_expand_PP). I'm not claiming the patch is perfect, but it should
at least be a start. I've attached the patches.
Thanks!
-dave
Hi there,
According to RFC 2181, "The zero length full name is defined as representing the root of the DNS tree, and is typically written and displayed as "." ." I've found that Net::DNS (latest, 0.65) returns "" (empty string) instead of "." for these domains, whereas dig/host/nslookup/etc. return "." I work for an anti-spam company and we've found a lot of spammy IPs that exhibit this issue.
You may disagree that this needs to be fixed -- the RFC says that the root is *typically* written but this is not a requirement that MUST be followed. However, due to the disagreement with dig/host/nslookup/etc I'm submitting the issue.
Basic information:
Distribution name and version: Net-DNS-0.65 (latest)
Perl version: perl v5.8.8 (i486-linux-gnu-thread-multi)
Operating System vendor and version: Linux freeside 2.6.24-22-generic #1 SMP Mon Nov 24 18:32:42 UTC 2008 i686 GNU/Linux (this is Ubuntu, hardy heron).
Sample data:
Here's an IP and the output from dig:
% dig -x 74.63.95.254
; <<>> DiG 9.4.2-P2 <<>> -x 74.63.95.254
;; global options: printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 20464
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0
;; QUESTION SECTION:
;254.95.63.74.in-addr.arpa. IN PTR
;; ANSWER SECTION:
254.95.63.74.in-addr.arpa. 10186 IN PTR .
;; Query time: 3 msec
;; SERVER: 172.20.0.21#53(172.20.0.21)
;; WHEN: Wed Apr 8 16:32:22 2009
;; MSG SIZE rcvd: 56
(note the '.' above)
I ran wireshark an looked at the answer packet data:
Domain Name System (response)
[Request In: 714]
[Time: 0.000556000 seconds]
Transaction ID: 0xcfa1
Flags: 0x8180 (Standard query response, No error)
Questions: 1
Answer RRs: 1
Authority RRs: 0
Additional RRs: 0
Queries
254.95.63.74.in-addr.arpa: type PTR, class IN
Name: 254.95.63.74.in-addr.arpa
Type: PTR (Domain name pointer)
Class: IN (0x0001)
Answers
254.95.63.74.in-addr.arpa: type PTR, class IN, <Root>
Name: 254.95.63.74.in-addr.arpa
Type: PTR (Domain name pointer)
Class: IN (0x0001)
Time to live: 2 hours, 36 minutes, 24 seconds
Data length: 1
Domain name: <Root>
0000 00 0f fe 89 c0 8b 00 11 20 d1 8d c6 08 00 45 00 ........ .....E.
0010 00 54 5a cd 00 00 7f 11 86 0e ac 14 00 15 ac 14 .TZ.............
0020 02 80 00 35 a5 3f 00 40 c3 13 cf a1 81 80 00 01 ...5.?.@........
0030 00 01 00 00 00 00 03 32 35 34 02 39 35 02 36 33 .......254.95.63
0040 02 37 34 07 69 6e 2d 61 64 64 72 04 61 72 70 61 .74.in-addr.arpa
0050 00 00 0c 00 01 c0 0c 00 0c 00 01 00 00 24 a8 00 .............$..
0060 01 00
Those last two bytes are the answer length (01) and the data (00).
I made a patch for both netdns.c (netdns_dn_expand) and Packet.pm (dn_expand_PP). I'm not claiming the patch is perfect, but it should at least be a start. I've attached the patches.
Thanks!
-dave
Message body is not shown because sender requested not to inline it.
Message body is not shown because sender requested not to inline it.