Comment 0 for bug 141546

Revision history for this message
Scott Kitterman (kitterman) wrote : make_query_packet() IP address detection seriously broken

Binary package hint: libnet-dns-perl

The IP address detection logic (for PTR query magic) in
 Net::DNS::Resolver::Base::make_query_packet() is seriously broken as of
 Net::DNS 0.60.

 The documentation for Net::DNS::Resolver::send() specifies:

 | The argument list can be either a Net::DNS::Packet object or a list
 | of strings. The record type and class can be omitted; they default to
 | A and IN. If the name looks like an IP address (Ipv4 or IPv6), then
 | an appropriate PTR query will be performed.

 However, "foo:bar/baz.example.com" does NOT look like an IP address!

Setting up libnet-dns-perl (0.60-1) ...
$ perl -MNet::DNS::Resolver -MData::Dumper -e 'my $r = Net::DNS::Resolver->new(); my $packet = $r->make_query_packet("foo:bar/baz.example.com", "A"); print(Dumper($packet->question))'
$VAR1 = bless( {
                 'qclass' => 'IN',
                 'qname' => 'r.a.b.0.o.o.f.0.ip6.arpa',
                 'qtype' => 'PTR'
               }, 'Net::DNS::Question' );

Setting up libnet-dns-perl (0.59-1build1) ...
$ perl -MNet::DNS::Resolver -MData::Dumper -e 'my $r = Net::DNS::Resolver->new(); my $packet = $r->make_query_packet("foo:bar/baz.example.com", "A"); print(Dumper($packet->question))'
$VAR1 = bless( {
                 'qclass' => 'IN',
                 'qname' => 'foo:bar/baz.example.com',
                 'qtype' => 'A'
               }, 'Net::DNS::Question' );

It looks like the problem is a regex that believes that if both ":" and "/" appear in a domain name it must be an IPv6 address. These are both legal.