Commit 7821d5b8 authored by Michael Stapelberg's avatar Michael Stapelberg
Browse files

Return an empty NOERROR response for non-AAAA records

Previously, we returned NXDOMAIN, which would cause host(1) from looking up an
AAAA record afterwards when using just 'host ipv6-…' (without -t AAAA).
parent 6c6484d0
......@@ -79,6 +79,10 @@ sub handle_aaaa_query {
my ($digits) = ($qname =~ /$regexp/);
return ('NXDOMAIN', undef, undef, undef) unless defined($digits);
if ($qtype ne 'AAAA') {
return ('NOERROR', [ ], [], [], { aa => 1 });
}
# Pad with zeros so that we can match 4 digits each.
$digits = "0$digits" while (length($digits) % 4) != 0;
......@@ -114,8 +118,7 @@ sub reply_handler {
return handle_ptr_query($querylog, $zone, $qname, $qclass, $qtype);
}
if ($qtype eq 'AAAA' &&
defined(my $zone = $config->zone_for_aaaa($qname))) {
if (defined(my $zone = $config->zone_for_aaaa($qname))) {
return handle_aaaa_query($zone, $qname, $qclass, $qtype);
}
......
......@@ -56,6 +56,18 @@ is(scalar @$ans, 1, 'one answer RR');
is($rr->type, 'AAAA', 'RR type is AAAA');
is($rr->rdatastr, '2001:4d88:100e:ccc0:219:dbff:fe43:2ec7', 'RR ok');
################################################################################
# Check resolving hostnames to A records
################################################################################
$qname = 'ipv6-0219dbfffe432ec7-blah.nutzer.raumzeitlabor.de';
$qclass = 'IN';
$qtype = 'A';
$peerhost = 'testsuite';
($rcode, $ans, $auth, $add) = reply_handler($config, 0, $qname, $qclass, $qtype, $peerhost);
is($rcode, 'NOERROR', 'no error when handling query');
is(scalar @$ans, 0, 'zero answer RRs');
################################################################################
# A pathetic example for resolving hostname to AAAA record: a /112 net
################################################################################
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment