28 |
my ($qname, $qclass, $qtype, $peerhost,$query,$conn) = @_; |
my ($qname, $qclass, $qtype, $peerhost,$query,$conn) = @_; |
29 |
my ($rcode, @ans, @auth, @add); |
my ($rcode, @ans, @auth, @add); |
30 |
|
|
|
server->refresh; |
|
31 |
$debug = server::debug; |
$debug = server::debug; |
32 |
|
|
33 |
CouchDB::audit( 'request', { |
my $audit = { |
34 |
qname => $qname, |
qname => $qname, |
35 |
qclass => $qclass, |
qclass => $qclass, |
36 |
qtype => $qtype, |
qtype => $qtype, |
37 |
peerhost => $peerhost, |
peerhost => $peerhost, |
38 |
sockhost => $conn->{"sockhost"} |
sockhost => $conn->{"sockhost"}, |
39 |
}); |
source => 'unknown', |
40 |
|
}; |
41 |
|
|
42 |
$query->print if $debug; |
$query->print if $debug; |
43 |
|
|
46 |
|
|
47 |
my $ttl = 3600; |
my $ttl = 3600; |
48 |
|
|
|
my $audit = { source => 'unknown' }; |
|
|
|
|
49 |
if ( $local ) { |
if ( $local ) { |
50 |
warn "local[$local] $qname $qtype"; |
warn "local[$local] $qname $qtype"; |
51 |
$rcode = "NOERROR"; |
$rcode = "NOERROR"; |
100 |
sub start { |
sub start { |
101 |
my $ns = Net::DNS::Nameserver->new( |
my $ns = Net::DNS::Nameserver->new( |
102 |
LocalPort => 53, |
LocalPort => 53, |
103 |
ReplyHandler => \&reply_handler, |
ReplyHandler => sub { |
104 |
|
server->refresh; |
105 |
|
reply_handler(@_); |
106 |
|
}, |
107 |
Verbose => $debug, |
Verbose => $debug, |
108 |
) || die "couldn't create nameserver object\n"; |
) || die "couldn't create nameserver object\n"; |
109 |
|
|