Subject: | Setting AA in Net::DNS::Nameserver does not work |
According to the documentation/manpage of Net::DNS::Nameserver one can set the AA bit on responses by adding { aa => 1 } to the return code. I tried this for a small script I did once but it does not work. See the attached script, when queried for something it should return NXDOMAIN with aa set, but dig and ethereal don't show it.
;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 51213
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 0
I hit the same hole with a bigger project I'm currently working on, but this one here is easier to reproduce.
Net-DNS-0.48
This is perl, v5.8.4 built for i686-linux-thread-multi
Linux majestix 2.6.7-gentoo-r11 #1 Wed Jul 28 01:04:54 CEST 2004 i686 Intel(R) Pentium(R) 4 CPU 2.80GHz GenuineIntel GNU/Linux
#!/usr/bin/perl -w
use Net::DNS::Nameserver;
use POSIX;
my $ns = Net::DNS::Nameserver->new(
LocalAddr => "81.92.174.18",
ReplyHandler => \&reply_handler,
Verbose => 1,
) || die "couldn't create nameserver object\n";
$ns->main_loop;
sub reply_handler {
my ($qname, $qclass, $qtype, $peerhost) = @_;
my ($rcode, @ans, @auth, @add);
my $time = asctime(localtime());
chomp($time);
open(SPFDNS, ">>/tmp/spfdns");
if ($qname =~ /^cl\.(.*)\.fr\.(.*)\.he\.(.*)\.null\.spf\.mucip\.net$/i) {
print SPFDNS "$time client=$1 from=<$2> helo=$3\n";
} else {
print SPFDNS "$time $qname not understood\n";
}
$rcode = "NXDOMAIN";
close(SPFDNS);
return ($rcode, \@ans, \@auth, \@add, { aa => 1 });
}