Skip Menu |

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

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

People
Owner: Nobody in particular
Requestors: Greg.Webster [...] westfraser.com
Cc:
AdminCc:

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



Subject: Net::DNS appears to round-robin nameservers and/or domains listed in resolv.conf when multiple are listed
Date: Mon, 25 Apr 2011 16:08:18 -0700
To: <bug-Net-DNS [...] rt.cpan.org>
From: <Greg.Webster [...] westfraser.com>
$ perl -v This is perl, v5.8.8 built for i386-linux-thread-multi $ perl use Net::DNS; print Net::DNS->version, "\n"; 0.59 $ uname -a Linux redacted.domain.ca 2.6.18-194.32.1.el5PAE #1 SMP Wed Jan 5 18:43:13 EST 2011 i686 i686 i386 GNU/Linux Report: Net::DNS appears to round-robin nameservers and/or domains listed in resolv.conf when multiple are listed. Hopefully this bug is not already fixed in a later version...I searched but could not see anything applicable. For example, my resolv.conf contains two domains and three nameservers, like this: $ cat /etc/resolv.conf search wft.ca wwd.com nameserver 10.0.228.1001 nameserver 10.10.228.1002 nameserver 10.0.228.1003 (Domains and IPs changed for privacy reasons) Nameservers 1 and 2 correspond DNS servers on the first domain and nameserver 3 for the second domain. When I do a query of an hostname which only exists in the second domain, it only resolves sporadically (about half the time). Here is the code I am using which gives this result: #!/usr/bin/perl use Net::DNS; my $res = Net::DNS::Resolver->new; my $infile = "/tmp/gwk_hosts.txt"; open (INFILE, $infile) || die "Could not open $infile for reading"; while (<INFILE>) { my $hostip = ""; ($thishost,$thisip) = split(/\t/,$_); next if ($thishost eq "name"); chomp $thisip; #print "Host: $thishost - IP: $thisip\n"; my $query = $res->search("$thishost"); if ($query) { foreach my $rr ($query->answer) { next unless $rr->type eq "A"; $hostip = $rr->address; } } else { warn "query failed: ", $res->errorstring, "\n"; } if ($hostip ne $thisip) { print "Error: $thishost resolves to $hostip not $thisip\n"; } }
On Mon Apr 25 19:08:40 2011, Greg.Webster@westfraser.com wrote: Show quoted text
> $ cat /etc/resolv.conf > search wft.ca wwd.com > nameserver 10.0.228.1001 > nameserver 10.10.228.1002 > nameserver 10.0.228.1003 > > (Domains and IPs changed for privacy reasons) > > Nameservers 1 and 2 correspond DNS servers on the first domain and > nameserver 3 for the second domain.
I hope you know that /etc/resolv.conf should contain resolving nameservers and not authoritative. But, even then, an authoritative should return SERVFAIL when it is asked about domainnames that it doesn't serve, which would trigger the next nameserver to be tried. Might it be that the second domain is a subdomain of the first (or vice versa?). In that case the nameserver would indicate which server you have to query in the authority and additional section. However, looking at your code, you seem to expect an RR of type A. If all this is not the case, could you please enable debugging and post the (anonymized) report? Thanks. -- Willem