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) = ?