Subject: | AAAA v4compat parsing bug |
It seems the parsing (from text) of AAAA records in v4-style ( ::1.2.3.4
) gained a bug somewhere between 0.63 and 0.65, in that it no longer
seems to work at all (the addresses end up stored as all-zeros).
Attached is a patch with a testcase and fix. Without the fix the logic
in that subroutine is pretty broken, so I think this is what was
intended originally.
Subject: | aaaa_v4compat.patch |
=== lib/Net/DNS/RR/AAAA.pm
==================================================================
--- lib/Net/DNS/RR/AAAA.pm (revision 14154)
+++ lib/Net/DNS/RR/AAAA.pm (local)
@@ -65,7 +65,9 @@
$string = $front . sprintf(":%x:%x",
($a << 8 | $b),
($c << 8 | $d));
- }elsif($string =~ /^(.*)::(.*)$/) {
+ }
+
+ if($string =~ /^(.*)::(.*)$/) {
my ($front, $back) = ($1, $2);
my @front = split(/:/, $front);
my @back = split(/:/, $back);
=== t/05-rr-various.t
==================================================================
--- t/05-rr-various.t (revision 14154)
+++ t/05-rr-various.t (local)
@@ -8,7 +8,7 @@
use vars qw( $HAS_DNSSEC $HAS_DLV $HAS_NSEC3 $HAS_NSEC3PARAM);
-plan tests => 6;
+plan tests => 7;
is ( Net::DNS::stripdot ('foo\\\\\..'),'foo\\\\\.', "Stripdot does its magic in precense of escapes test 1");
@@ -54,3 +54,7 @@
is($newrr1->string,$newrr2->string, "Failed to parse ". $string);
+
+
+my $rr_aaaa_v4compat = Net::DNS::RR->new("foo AAAA ::0.0.0.2");
+is($rr_aaaa_v4compat->address, "0:0:0:0:0:0:0:2", "v4compat AAAA records parsed correctly");