- Timestamp:
- 08/08/25 12:36:19 (21 hours ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/DNSDB.pm
r893 r897 1679 1679 $res->tcp_timeout(2); 1680 1680 $res->udp_timeout(2); 1681 my $reply = $res->query($target); 1681 # send() returns a Net::DNS::Packet which may or may not be entirely empty, we'll see in the loop below 1682 my $arecs = $res->send($target, 'A'); 1683 my $aaaarecs = $res->send($target,'AAAA'); 1682 1684 1683 1685 my $liveips = ''; 1684 if ($reply) {1685 # default to a one-hour TTL, which should be variously modified down the chain. Arguably this could1686 # default even lower, since "The Cloud" often uses sub-1-minute TTLs on the final A records.1687 my $minttl = 3600;1688 my @newlist;1689 foreach my $rr ($reply->answer) { #@alist) {1690 next unless $rr->type eq "A" || $rr->type eq "AAAA";1691 push @newlist, $rr->address;1692 $minttl = $rr->ttl if $rr->ttl < $minttl;1693 }1686 # default to a one-hour TTL, which should be variously modified down the chain. Arguably this could 1687 # default even lower, since "The Cloud" often uses sub-1-minute TTLs on the final A records. 1688 my $minttl = 3600; 1689 my @newlist; 1690 foreach my $rr ($arecs->answer, $aaaarecs->answer) { 1691 next unless $rr->type eq "A" || $rr->type eq "AAAA"; 1692 push @newlist, $rr->address; 1693 $minttl = $rr->ttl if $rr->ttl < $minttl; 1694 } 1695 if (@newlist) { 1694 1696 # safety limit. could arguably take this lower, or for extra 1695 1697 # complexity, reference off the zone SOA minTTL 1696 1698 $minttl = 60 if $minttl < 60; 1697 1699 # we don't need this to be perfectly correct IP address order, just consistent. 1698 $liveips = "$minttl :".join(';', sort(@newlist)) if @newlist;1699 #fixme: should it be a formal error case if there are no A records returned?1700 $liveips = "$minttl;".join(';', sort(@newlist)) if @newlist; 1701 #fixme: should it be a formal error case if there are no A/AAAA records returned? 1700 1702 } else { 1701 1703 $errstr = "Lookup failure retrieving ALIAS IP list: ".$res->errorstring; … … 7189 7191 my $attl = shift @asubs; 7190 7192 7191 # output a plain old A record for each IP the target name really points to.7192 # in the event that, for whatever reason, no A records are available for $val, nothing will be output.7193 # output a plain old A or AAAA record for each IP the target name really points to. 7194 # in the event that, for whatever reason, no A/AAAA records are available for $val, nothing will be output. 7193 7195 foreach my $subip (@asubs) { 7194 print $datafile "+$host:$subip:$attl:$stamp:$loc\n" or die $!; 7196 if ($subip =~ /\d+\.\d+\.\d+\.\d+/) { 7197 print $datafile "+$host:$subip:$attl:$stamp:$loc\n" or die $!; 7198 } else { 7199 $self->_printrec_tiny($datafile, $recid, 'n', $recflags, $self->domainName($self->_hostparent($host)), 7200 $host, 28, $subip, $dist, $weight, $port, $attl, $loc, $stamp); 7201 } 7195 7202 } 7196 7203 } # ALIAS
Note:
See TracChangeset
for help on using the changeset viewer.