Skip Menu |

This queue is for tickets about the Net-DNS CPAN distribution.

Report information
The Basics
Id: 52307
Status: resolved
Priority: 0/
Queue: Net-DNS

People
Owner: Nobody in particular
Requestors: blblack [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 0.65
Fixed in: (no value)



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");
Subject: Re: [rt.cpan.org #52307] AAAA v4compat parsing bug
Date: Tue, 1 Dec 2009 07:48:14 +0100
To: bug-Net-DNS [...] rt.cpan.org
From: Olaf Kolkman <olaf [...] dacht.net>
Thanks, for report, fix, and(!) test. Fixed on the trunk.... http://www.net-dns.org/svn/net-dns/trunk release hopefully before end of year. --Olaf On Dec 1, 2009, at 6:58 AM, Brandon L Black via RT wrote: Show quoted text
> Tue Dec 01 00:58:29 2009: Request 52307 was acted upon. > Transaction: Ticket created by BLBLACK > Queue: Net-DNS > Subject: AAAA v4compat parsing bug > Broken in: 0.65 > Severity: Important > Owner: Nobody > Requestors: blblack@gmail.com > Status: new > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=52307 > > > > > 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. > === 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");
Show quoted text
__________________________________________ Ik dacht net... heel even maar.