1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
|
Remove workaround if issue is fixed otherwise, read explanation
below. Bug number is #50476.
################################################################
Date: Fri, 31 Mar 2000 13:04:01 -0500
Message-ID: <20000331130401.N16430@justice.loyola.edu>
From: Michael Stone <mstone@debian.org>
To: Florian Hinzmann <fh@debian.org>
Subject: Re: Need help with bug in libnet-dns-perl
Cc: committee@qa.debian.org
On Fri, Mar 31, 2000 at 12:07:50PM +0200, Florian Hinzmann wrote:
> > After changing nameserver with $res->nameservers, $res->query fails
> > with the error "send: Cannot determine peer address at
> > /usr/lib/perl5/Net/DNS/Resolver.pm line 664". The following program
> > demonstrates this:
> >
> > ------------------------------------------------------------------------
> > #!/usr/bin/perl -Tw
> >
> > use Net::DNS;
> >
> > die("USAGE: $0 domain\n") unless scalar(@ARGV) == 1;
> > my($res) = new Net::DNS::Resolver;
> > $res->nameservers('a.root-servers.net');
> > print($res->query($ARGV[0], "NS")? "success\n": "failure\n");
There are a couple of problems here. The code snippit actually works if
you remove the -T:
(100)osgiliath:~/> ./test.dns.pl netscape.com
success
...but the root servers only resolve first & second level domains:
(101)osgiliath:~/> ./test.dns.pl com.
success
(102)osgiliath:~/> ./test.dns.pl www.netscape.com
failure
If you use a normal dns server (as opposed to a root server) you
don't have that problem. I don't know if that might have been a point of
confusion for the original submitter.
The larger problem is that adding the -T make the code fail. IMHO, this
isn't a problem in the Net::DNS library, but rather in the IO::Socket
routines. If you specify an ip address rather than a name for the
nameserver, the code works with -T. (And since /etc/resolv.conf uses
ip's, this is why the default works.) If you go through the Net::DNS
code and replace all instances of PeerAddr=>something (used when creating
the IO::Socket::INET's) with
PeerAddr=>IO::Socket::inet_ntoa(IO::Socket::inet_aton(something)) then you
can use names as well as ip's for nameservers. So there's a workaround.
But the IO::Socket man page specifies that hostnames are legal
PeerAddr's, so the best course of action is probably to forward this bug
to the IO::Socket maintainer. The actual failure condition for
IO::Socket is calling peerhost on a udp socket which was created with a
host name rather than an ip number for PeerAddr. (I didn't test tcp
sockets, which might also fail.)
--
Mike Stone
|