Skip Menu |

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

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

People
Owner: OLAF [...] cpan.org
Requestors: brian [...] interlinx.bc.ca
Cc:
AdminCc:

Bug Information
Severity: Critical
Broken in: 0.47
Fixed in: (no value)



Subject: Does not search multiple DNS servers
Distribution: Mandrake Cooker Perl version: This is perl, v5.8.4 built for i386-linux-thread-multi When /etc/resolv.conf contains multiple servers as in: search foo local nameserver 127.0.0.1 nameserver 10.75.22.3 only the first server is queried and if it does not return any RRs other servers are not queried. A small test program: require Net::DNS; $foo = Net::DNS::Resolver->new; @rrs = Net::DNS::mx($foo, "yahoo.com"); print "got 'em" if @rrs; confirms this. If I run the above program with the aforementioned resolv.conf, @rrs is empty. However if I remove the 127.0.0.1 server entry, @rrs contains RRs. I verified this behaviour using strace: $ strace -f perl foo.pl ... socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP) = 3 ioctl(3, SNDCTL_TMR_TIMEBASE or TCGETS, 0xbffff398) = -1 EINVAL (Invalid argument) _llseek(3, 0, 0xbffff3e0, SEEK_CUR) = -1 ESPIPE (Illegal seek) ioctl(3, SNDCTL_TMR_TIMEBASE or TCGETS, 0xbffff398) = -1 EINVAL (Invalid argument) _llseek(3, 0, 0xbffff3e0, SEEK_CUR) = -1 ESPIPE (Illegal seek) fcntl64(3, F_SETFD, FD_CLOEXEC) = 0 getpeername(3, 0x82a8d08, [256]) = -1 ENOTCONN (Transport endpoint is not connected) sendto(3, "U\277\1\0\0\1\0\0\0\0\0\0\5yahoo\3com\0\0\17\0\1", 27, 0, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("127.0.0.1")}, 16) = 27 select(8, [3], NULL, NULL, {5, 0}) = 1 (in [3], left {4, 992000}) recvfrom(3, "U\277\201\2\0\1\0\0\0\0\0\0\5yahoo\3com\0\0\17\0\1", 512, 0, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("127.0.0.1")}, [16]) = 27 getpeername(3, 0x82a9160, [256]) = -1 ENOTCONN (Transport endpoint is not connected) close(3) = 0 exit_group(0) = ?
From: Chris Reinhardt <chris [...] dyndns.org>
Subject: Re: [cpan #6149] Does not search multiple DNS servers
Date: Wed, 28 Apr 2004 20:04:21 -0400
To: bug-Net-DNS [...] rt.cpan.org
RT-Send-Cc:
On Apr 27, 2004, at 5:01 PM, Guest via RT wrote: Show quoted text
> > search foo local > nameserver 127.0.0.1 > nameserver 10.75.22.3 > > only the first server is queried and if it does not return any RRs > other servers are not queried. A small test program: > > require Net::DNS; > $foo = Net::DNS::Resolver->new; > @rrs = Net::DNS::mx($foo, "yahoo.com"); > print "got 'em" if @rrs; > > confirms this. If I run the above program with the aforementioned > resolv.conf, @rrs is empty. However if I remove the 127.0.0.1 server > entry, @rrs contains RRs.
I was not able to replicate this behavior. I used the following script: #!/usr/local/bin/perl use strict; use warnings; use Net::DNS; my $res = Net::DNS::Resolver->new( nameservers => ['192.168.0.40', '192.168.0.2'], debug => 1, ); mx($res, 'yahoo.com'); __END__ Which tries the servers in order: ctriv@olorin:~/projects/Net-DNS/CVS-Root/bugs$ ./multi-servers.pl ;; query(yahoo.com, MX, IN) ;; send_udp(192.168.0.40:53) ;; send_udp(192.168.0.2:53) ;; answer from 192.168.0.2:53 : 470 bytes [etc] This also works correctly when multiple servers are given in /etc/resolv.conf instead of the resolver constructor. -- Chris Reinhardt -- chris@dyndns.org -- http://www.dyndns.org/ The problem with computers is you *play* with them. --Richard Feynman
From: Chris Reinhardt <chris [...] dyndns.org>
Subject: Re: [Comment] Re: [cpan #6149] Does not search multiple DNS servers
Date: Wed, 28 Apr 2004 22:47:06 -0400
To: bug-Net-DNS [...] rt.cpan.org
RT-Send-Cc:
On Apr 28, 2004, at 10:18 PM, brian@interlinx.bc.ca via RT wrote: Show quoted text
>> >> I was not able to replicate this behavior.
> > Yes, when I used your example exactly, I get the expected behaviour as > well, however, if I modify the "nameservers" as such: > > - nameservers => ['192.168.0.40', '192.168.0.2'], > + nameservers => ['127.0.0.1', '192.168.0.40', '192.168.0.2'], > > _and_ run a DNS server (tmdns to be precise) on localhost which does > not > have the answer for yahoo.com's MX record and does not recurse to find > it, I get the following... > > ;; query(yahoo.com, MX, IN) > ;; send_udp(127.0.0.1:53) > ;; answer from 127.0.0.1:53 : 27 bytes > ;; HEADER SECTION > ;; id = 39686 > ;; qr = 1 opcode = QUERY aa = 0 tc = 0 rd = 1 > ;; ra = 0 ad = 0 cd = 0 rcode = SERVFAIL
That's not a bug; it got an answer back, it returned the answer. You have an odd DNS setup though. Not only is it odd to have a non-recursive server used by your resolver, but it should return a referral to the roots. -- Chris Reinhardt -- chris@dyndns.org -- http://www.dyndns.org/ The First Amendment was designed to protect offensive speech, because nobody ever tries to ban the other kind. --Mike Godwin