Compare commits

...

2 Commits

Author SHA1 Message Date
Evan Hunt
3063f34e47 put A and AAAA in additional section when responding to type=ANAME queries 2018-03-18 14:27:22 +00:00
Evan Hunt
8c0f8a7c0c initial implementation of ANAME rrtype, using type code point 65532
- this is only the bare type represetation, with no special processing
2018-03-18 11:40:51 +00:00
17 changed files with 649 additions and 93 deletions

View File

@@ -0,0 +1,15 @@
# Copyright (C) Internet Systems Consortium, Inc. ("ISC")
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
# See the COPYRIGHT file distributed with this work for additional
# information regarding copyright ownership.
rm -f */named.memstats
rm -f */named.run
rm -f */named.conf
rm -f dig.out.test*
rm -f ns2/example.com.bk
rm -f ns2/example.net.bk

View File

@@ -0,0 +1,30 @@
; Copyright (C) Internet Systems Consortium, Inc. ("ISC")
;
; This Source Code Form is subject to the terms of the Mozilla Public
; License, v. 2.0. If a copy of the MPL was not distributed with this
; file, You can obtain one at http://mozilla.org/MPL/2.0/.
;
; See the COPYRIGHT file distributed with this work for additional
; information regarding copyright ownership.
$TTL 300 ; 5 minutes
@ IN SOA ns root (
2018010100 ; serial
1800 ; refresh (30 minutes)
1800 ; retry (30 minutes)
1814400 ; expire (3 weeks)
3600 ; minimum (1 hour)
)
NS ns
ns A 10.53.0.1
a A 10.53.0.1
aname-both ANAME fake-aname-target.
aname-both A 192.0.2.1
aname-both AAAA 2001:db8::a
aname-a ANAME fake-aname-target.
aname-a A 192.0.2.2
aname-aaaa ANAME fake-aname-target.
aname-aaaa AAAA 2001:db8::b

View File

@@ -0,0 +1,27 @@
/*
* Copyright (C) Internet Systems Consortium, Inc. ("ISC")
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* See the COPYRIGHT file distributed with this work for additional
* information regarding copyright ownership.
*/
options {
query-source address 10.53.0.1;
notify-source 10.53.0.1;
transfer-source 10.53.0.1;
port @PORT@;
pid-file "named.pid";
listen-on { 10.53.0.1; };
listen-on-v6 { none; };
recursion no;
notify yes;
};
zone example {
type master;
file "example.db";
};

View File

@@ -0,0 +1,28 @@
/*
* Copyright (C) Internet Systems Consortium, Inc. ("ISC")
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* See the COPYRIGHT file distributed with this work for additional
* information regarding copyright ownership.
*/
options {
query-source address 10.53.0.1;
notify-source 10.53.0.1;
transfer-source 10.53.0.1;
port @PORT@;
pid-file "named.pid";
listen-on { 10.53.0.1; };
listen-on-v6 { none; };
recursion no;
notify yes;
minimal-responses yes;
};
zone example {
type master;
file "example.db";
};

View File

@@ -0,0 +1,28 @@
/*
* Copyright (C) Internet Systems Consortium, Inc. ("ISC")
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* See the COPYRIGHT file distributed with this work for additional
* information regarding copyright ownership.
*/
options {
query-source address 10.53.0.1;
notify-source 10.53.0.1;
transfer-source 10.53.0.1;
port @PORT@;
pid-file "named.pid";
listen-on { 10.53.0.1; };
listen-on-v6 { none; };
recursion no;
notify yes;
minimal-responses no;
};
zone example {
type master;
file "example.db";
};

View File

@@ -0,0 +1,17 @@
#!/bin/sh
#
# Copyright (C) Internet Systems Consortium, Inc. ("ISC")
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
# See the COPYRIGHT file distributed with this work for additional
# information regarding copyright ownership.
SYSTEMTESTTOP=..
. $SYSTEMTESTTOP/conf.sh
$SHELL clean.sh
copy_setports ns1/named1.conf.in ns1/named.conf

View File

@@ -0,0 +1,136 @@
#!/bin/sh
#
# Copyright (C) Internet Systems Consortium, Inc. ("ISC")
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
# See the COPYRIGHT file distributed with this work for additional
# information regarding copyright ownership.
SYSTEMTESTTOP=..
. $SYSTEMTESTTOP/conf.sh
DIGOPTS="+tcp -p ${PORT}"
RNDCCMD="$RNDC -c $SYSTEMTESTTOP/common/rndc.conf -p ${CONTROLPORT} -s"
status=0
n=0
echo_i "minimal responses: default"
n=`expr $n + 1`
echo_i "check that ANAME query returns A and AAAA (if both are present) in additional ($n)"
ret=0
$DIG $DIGOPTS @10.53.0.1 aname-both.example aname > dig.out.test$n || ret=1
grep "ANSWER: 1," dig.out.test$n > /dev/null || ret=1
grep "ADDITIONAL: 3" dig.out.test$n > /dev/null || ret=1
grep "flags:.*aa" dig.out.test$n > /dev/null || ret=1
grep "192.0.2.1" dig.out.test$n > /dev/null || ret=1
grep "2001:db8::a" dig.out.test$n > /dev/null || ret=1
[ $ret -eq 0 ] || echo_i "failed"
status=`expr $status + $ret`
n=`expr $n + 1`
echo_i "check that ANAME query returns A (if only A present) in additional ($n)"
ret=0
$DIG $DIGOPTS @10.53.0.1 aname-a.example aname > dig.out.test$n || ret=1
grep "ANSWER: 1," dig.out.test$n > /dev/null || ret=1
grep "ADDITIONAL: 2" dig.out.test$n > /dev/null || ret=1
grep "flags:.*aa" dig.out.test$n > /dev/null || ret=1
grep "192.0.2.2" dig.out.test$n > /dev/null || ret=1
[ $ret -eq 0 ] || echo_i "failed"
status=`expr $status + $ret`
n=`expr $n + 1`
echo_i "check that ANAME query returns AAAA (if only AAAA present) in additional ($n)"
ret=0
$DIG $DIGOPTS @10.53.0.1 aname-aaaa.example aname > dig.out.test$n || ret=1
grep "ANSWER: 1," dig.out.test$n > /dev/null || ret=1
grep "ADDITIONAL: 2" dig.out.test$n > /dev/null || ret=1
grep "flags:.*aa" dig.out.test$n > /dev/null || ret=1
grep "2001:db8::b" dig.out.test$n > /dev/null || ret=1
[ $ret -eq 0 ] || echo_i "failed"
status=`expr $status + $ret`
copy_setports ns1/named2.conf.in ns1/named.conf
$RNDCCMD 10.53.0.1 reconfig 2>&1 | sed 's/^/ns1 /' | cat_i
echo_i "minimal responses: yes"
n=`expr $n + 1`
echo_i "check that ANAME query returns A and AAAA (if both are present) in additional ($n)"
ret=0
$DIG $DIGOPTS @10.53.0.1 aname-both.example aname > dig.out.test$n || ret=1
grep "ANSWER: 1," dig.out.test$n > /dev/null || ret=1
grep "ADDITIONAL: 3" dig.out.test$n > /dev/null || ret=1
grep "flags:.*aa" dig.out.test$n > /dev/null || ret=1
grep "192.0.2.1" dig.out.test$n > /dev/null || ret=1
grep "2001:db8::a" dig.out.test$n > /dev/null || ret=1
[ $ret -eq 0 ] || echo_i "failed"
status=`expr $status + $ret`
n=`expr $n + 1`
echo_i "check that ANAME query returns A (if only A present) in additional ($n)"
ret=0
$DIG $DIGOPTS @10.53.0.1 aname-a.example aname > dig.out.test$n || ret=1
grep "ANSWER: 1," dig.out.test$n > /dev/null || ret=1
grep "ADDITIONAL: 2" dig.out.test$n > /dev/null || ret=1
grep "flags:.*aa" dig.out.test$n > /dev/null || ret=1
grep "192.0.2.2" dig.out.test$n > /dev/null || ret=1
[ $ret -eq 0 ] || echo_i "failed"
status=`expr $status + $ret`
n=`expr $n + 1`
echo_i "check that ANAME query returns AAAA (if only AAAA present) in additional ($n)"
ret=0
$DIG $DIGOPTS @10.53.0.1 aname-aaaa.example aname > dig.out.test$n || ret=1
grep "ANSWER: 1," dig.out.test$n > /dev/null || ret=1
grep "ADDITIONAL: 2" dig.out.test$n > /dev/null || ret=1
grep "flags:.*aa" dig.out.test$n > /dev/null || ret=1
grep "2001:db8::b" dig.out.test$n > /dev/null || ret=1
[ $ret -eq 0 ] || echo_i "failed"
status=`expr $status + $ret`
copy_setports ns1/named3.conf.in ns1/named.conf
$RNDCCMD 10.53.0.1 reconfig 2>&1 | sed 's/^/ns1 /' | cat_i
echo_i "minimal responses: no"
n=`expr $n + 1`
echo_i "check that ANAME query returns A and AAAA (if both are present) in additional ($n)"
ret=0
$DIG $DIGOPTS @10.53.0.1 aname-both.example aname > dig.out.test$n || ret=1
grep "ANSWER: 1," dig.out.test$n > /dev/null || ret=1
grep "ADDITIONAL: 3" dig.out.test$n > /dev/null || ret=1
grep "flags:.*aa" dig.out.test$n > /dev/null || ret=1
grep "192.0.2.1" dig.out.test$n > /dev/null || ret=1
grep "2001:db8::a" dig.out.test$n > /dev/null || ret=1
[ $ret -eq 0 ] || echo_i "failed"
status=`expr $status + $ret`
n=`expr $n + 1`
echo_i "check that ANAME query returns A (if only A present) in additional ($n)"
ret=0
$DIG $DIGOPTS @10.53.0.1 aname-a.example aname > dig.out.test$n || ret=1
grep "ANSWER: 1," dig.out.test$n > /dev/null || ret=1
grep "ADDITIONAL: 2" dig.out.test$n > /dev/null || ret=1
grep "flags:.*aa" dig.out.test$n > /dev/null || ret=1
grep "192.0.2.2" dig.out.test$n > /dev/null || ret=1
[ $ret -eq 0 ] || echo_i "failed"
status=`expr $status + $ret`
n=`expr $n + 1`
echo_i "check that ANAME query returns AAAA (if only AAAA present) in additional ($n)"
ret=0
$DIG $DIGOPTS @10.53.0.1 aname-aaaa.example aname > dig.out.test$n || ret=1
grep "ANSWER: 1," dig.out.test$n > /dev/null || ret=1
grep "ADDITIONAL: 2" dig.out.test$n > /dev/null || ret=1
grep "flags:.*aa" dig.out.test$n > /dev/null || ret=1
grep "2001:db8::b" dig.out.test$n > /dev/null || ret=1
[ $ret -eq 0 ] || echo_i "failed"
status=`expr $status + $ret`
echo_i "exit status: $status"
[ $status -eq 0 ] || exit 1

View File

@@ -86,7 +86,7 @@ SEQUENTIALDIRS="ecdsa eddsa gost @PKCS11_TEST@ tkey"
# test, these tests can be run in parallel.
#
# This symbol must be kept in step with the PARALLEL macro in Makefile.in
PARALLELDIRS="acl additional addzone allow-query auth autosign \
PARALLELDIRS="acl additional addzone allow-query aname auth autosign \
builtin cacheclean case catz cds chain \
checkconf checknames checkzone \
@CHECKDS@ @COVERAGE@ @KEYMGR@ \
@@ -96,16 +96,16 @@ PARALLELDIRS="acl additional addzone allow-query auth autosign \
fetchlimit filter-aaaa formerr forward \
geoip glue inline integrity ixfr keepalive \
legacy limits logfileconfig \
masterfile masterformat metadata mkeys \
names notify nslookup nsupdate nzd2nzf \
padding pending pipelined \
reclimit redirect resolver rndc rpz rpzrecurse \
rrchecker rrl rrsetorder rsabigexponent runtime \
serve-stale sfcache smartsign sortlist \
spf staticstub statistics statschannel stub synthfromdnssec \
tcp tools tsig tsiggss \
unknown upforwd verify views wildcard \
xfer xferquota zero zonechecks"
masterfile masterformat metadata mkeys \
names notify nslookup nsupdate nzd2nzf \
padding pending pipelined \
reclimit redirect resolver rndc rpz rpzrecurse \
rrchecker rrl rrsetorder rsabigexponent runtime \
serve-stale sfcache smartsign sortlist \
spf staticstub statistics statschannel stub synthfromdnssec \
tcp tools tsig tsiggss \
unknown upforwd verify views wildcard \
xfer xferquota zero zonechecks"
SUBDIRS="$SEQUENTIALDIRS $PARALLELDIRS"
@@ -142,9 +142,9 @@ else
fi
if grep "^#define WANT_IPV6 1" $TOP/config.h > /dev/null 2>&1 ; then
TESTSOCK6="$TESTSOCK6"
TESTSOCK6="$TESTSOCK6"
else
TESTSOCK6=false
TESTSOCK6=false
fi
# Windows process management leave empty
@@ -257,7 +257,7 @@ nextpart () {
[ -f $1.prev ] || echo "0" > $1.prev
prev=`cat $1.prev`
awk "NR > $prev "'{ print }
END { print NR > "/dev/stderr" }' $1 2> $1.prev
END { print NR > "/dev/stderr" }' $1 2> $1.prev
}
# copy_setports - Copy Configuration File and Replace Ports
@@ -272,15 +272,15 @@ nextpart () {
copy_setports() {
sed -e "s/@PORT@/${PORT}/g" \
-e "s/@EXTRAPORT1@/${EXTRAPORT1}/g" \
-e "s/@EXTRAPORT2@/${EXTRAPORT2}/g" \
-e "s/@EXTRAPORT3@/${EXTRAPORT3}/g" \
-e "s/@EXTRAPORT4@/${EXTRAPORT4}/g" \
-e "s/@EXTRAPORT5@/${EXTRAPORT5}/g" \
-e "s/@EXTRAPORT6@/${EXTRAPORT6}/g" \
-e "s/@EXTRAPORT7@/${EXTRAPORT7}/g" \
-e "s/@EXTRAPORT8@/${EXTRAPORT8}/g" \
-e "s/@CONTROLPORT@/${CONTROLPORT}/g" $1 > $2
-e "s/@EXTRAPORT1@/${EXTRAPORT1}/g" \
-e "s/@EXTRAPORT2@/${EXTRAPORT2}/g" \
-e "s/@EXTRAPORT3@/${EXTRAPORT3}/g" \
-e "s/@EXTRAPORT4@/${EXTRAPORT4}/g" \
-e "s/@EXTRAPORT5@/${EXTRAPORT5}/g" \
-e "s/@EXTRAPORT6@/${EXTRAPORT6}/g" \
-e "s/@EXTRAPORT7@/${EXTRAPORT7}/g" \
-e "s/@EXTRAPORT8@/${EXTRAPORT8}/g" \
-e "s/@CONTROLPORT@/${CONTROLPORT}/g" $1 > $2
}
#

View File

@@ -85,27 +85,33 @@ KRB5_CONFIG=NUL
#
# List of tests that use ports 5300 and 9953. For this reason, these must
# be run sequentially.
SEQUENTIALDIRS="acl additional addzone autosign builtin \
cacheclean case \
checkconf @CHECKDS@ checknames checkzone cookie @COVERAGE@ \
database digdelv dlv dlvauto dlz dlzexternal dname \
dns64 dnssec @DNSTAP@ dscp dsdigest dyndb ecdsa eddsa \
ednscompliance emptyzones \
fetchlimit filter-aaaa formerr forward geoip glue gost inline ixfr \
keepalive @KEYMGR@ legacy limits logfileconfig masterfile \
masterformat metadata mkeys names notify nslookup nsupdate \
nzd2nzf padding pending pipelined @PKCS11_TEST@ reclimit \
redirect resolver rndc rpz rrchecker rrl \
rrsetorder rsabigexponent runtime sfcache smartsign sortlist \
spf staticstub statistics statschannel stub tcp tkey tsig \
tsiggss unknown upforwd verify views wildcard xfer xferquota \
zero zonechecks"
SEQUENTIALDIRS="ecdsa eddsa gost @PKCS11_TEST@ tkey"
# List of tests that use unique ports (other than 5300 and 9953). These
# tests can be run in parallel.
# List of tests that use ports assigned by caller (other than 5300
# and 9953). Because separate blocks of ports can be used for teach
# test, these tests can be run in parallel.
#
# This symbol must be kept in step with the PARALLEL macro in Makefile.in
PARALLELDIRS="allow_query catz rpzrecurse serve-stale"
PARALLELDIRS="acl additional addzone allow-query aname auth autosign \
builtin cacheclean case catz cds chain \
checkconf checknames checkzone \
@CHECKDS@ @COVERAGE@ @KEYMGR@ \
cookie database digdelv dlv dlz dlzexternal \
dns64 dnssec @DNSTAP@ dscp dsdigest dyndb \
ednscompliance emptyzones \
fetchlimit filter-aaaa formerr forward \
geoip glue inline integrity ixfr keepalive \
legacy limits logfileconfig \
masterfile masterformat metadata mkeys \
names notify nslookup nsupdate nzd2nzf \
padding pending pipelined \
reclimit redirect resolver rndc rpz rpzrecurse \
rrchecker rrl rrsetorder rsabigexponent runtime \
serve-stale sfcache smartsign sortlist \
spf staticstub statistics statschannel stub synthfromdnssec \
tcp tools tsig tsiggss \
unknown upforwd verify views wildcard \
xfer xferquota zero zonechecks"
SUBDIRS="$SEQUENTIALDIRS $PARALLELDIRS"
@@ -139,9 +145,9 @@ else
fi
if grep "^#define WANT_IPV6 1" $TOP/config.h > /dev/null 2>&1 ; then
TESTSOCK6="$TESTSOCK6"
TESTSOCK6="$TESTSOCK6"
else
TESTSOCK6=false
TESTSOCK6=false
fi
#
@@ -185,22 +191,22 @@ else
fi
echofail () {
printf "${COLOR_FAIL}%s${COLOR_NONE}\n" "$*"
printf "${COLOR_FAIL}%s${COLOR_NONE}\n" "$*"
}
echowarn () {
printf "${COLOR_WARN}%s${COLOR_NONE}\n" "$*"
printf "${COLOR_WARN}%s${COLOR_NONE}\n" "$*"
}
echopass () {
printf "${COLOR_PASS}%s${COLOR_NONE}\n" "$*"
printf "${COLOR_PASS}%s${COLOR_NONE}\n" "$*"
}
echoinfo () {
printf "${COLOR_INFO}%s${COLOR_NONE}\n" "$*"
printf "${COLOR_INFO}%s${COLOR_NONE}\n" "$*"
}
echostart () {
printf "${COLOR_START}%s${COLOR_NONE}\n" "$*"
printf "${COLOR_START}%s${COLOR_NONE}\n" "$*"
}
echoend () {
printf "${COLOR_END}%s${COLOR_NONE}\n" "$*"
printf "${COLOR_END}%s${COLOR_NONE}\n" "$*"
}
TESTNAME="`basename $PWD`"
@@ -234,7 +240,7 @@ nextpart () {
[ -f $1.prev ] || echo "0" > $1.prev
prev=`cat $1.prev`
awk "NR > $prev "'{ print }
END { print NR > "/dev/stderr" }' $1 2> $1.prev
END { print NR > "/dev/stderr" }' $1 2> $1.prev
}
# copy_setports - Copy Configuration File and Replace Ports
@@ -255,15 +261,15 @@ copy_setports() {
# tokens when it processes this file and produces conf.sh.
atsign="@"
sed -e "s/${atsign}PORT${atsign}/${PORT}/g" \
-e "s/${atsign}EXTRAPORT1${atsign}/${EXTRAPORT1}/g" \
-e "s/${atsign}EXTRAPORT2${atsign}/${EXTRAPORT2}/g" \
-e "s/${atsign}EXTRAPORT3${atsign}/${EXTRAPORT3}/g" \
-e "s/${atsign}EXTRAPORT4${atsign}/${EXTRAPORT4}/g" \
-e "s/${atsign}EXTRAPORT5${atsign}/${EXTRAPORT5}/g" \
-e "s/${atsign}EXTRAPORT6${atsign}/${EXTRAPORT6}/g" \
-e "s/${atsign}EXTRAPORT7${atsign}/${EXTRAPORT7}/g" \
-e "s/${atsign}EXTRAPORT8${atsign}/${EXTRAPORT8}/g" \
-e "s/${atsign}CONTROLPORT${atsign}/${CONTROLPORT}/g" $1 > $2
-e "s/${atsign}EXTRAPORT1${atsign}/${EXTRAPORT1}/g" \
-e "s/${atsign}EXTRAPORT2${atsign}/${EXTRAPORT2}/g" \
-e "s/${atsign}EXTRAPORT3${atsign}/${EXTRAPORT3}/g" \
-e "s/${atsign}EXTRAPORT4${atsign}/${EXTRAPORT4}/g" \
-e "s/${atsign}EXTRAPORT5${atsign}/${EXTRAPORT5}/g" \
-e "s/${atsign}EXTRAPORT6${atsign}/${EXTRAPORT6}/g" \
-e "s/${atsign}EXTRAPORT7${atsign}/${EXTRAPORT7}/g" \
-e "s/${atsign}EXTRAPORT8${atsign}/${EXTRAPORT8}/g" \
-e "s/${atsign}CONTROLPORT${atsign}/${CONTROLPORT}/g" $1 > $2
}
#

View File

@@ -457,6 +457,10 @@ dlv DLV 30795 1 1 (
; type 32770 -- 65279 (unassigned)
; type 65280-65534 (private use)
aname01 ANAME aname-target.
aname02 ANAME aname-target
aname03 ANAME aname.example.
aname04 ANAME .
; keydata (internal type used for managed-keys)
keydata TYPE65533 \# 0

View File

@@ -0,0 +1 @@
ANAME

View File

@@ -9,6 +9,10 @@ a601.example. 3600 IN A6 127 ::1 foo.
a601.example. 3600 IN A6 128 .
aaaa01.example. 3600 IN AAAA ::1
aaaa02.example. 3600 IN AAAA fd92:7065:b8e:ffff::5
aname01.example. 3600 IN ANAME aname-target.
aname02.example. 3600 IN ANAME aname-target.example.
aname03.example. 3600 IN ANAME aname.example.
aname04.example. 3600 IN ANAME .
afsdb01.example. 3600 IN AFSDB 0 hostname.example.
afsdb02.example. 3600 IN AFSDB 65535 .
apl01.example. 3600 IN APL !1:10.0.0.1/32 1:10.0.0.0/24

View File

@@ -9,6 +9,10 @@ a601.example. 3600 IN A6 127 ::1 foo.
a601.example. 3600 IN A6 128 .
aaaa01.example. 3600 IN AAAA ::1
aaaa02.example. 3600 IN AAAA fd92:7065:b8e:ffff::5
aname01.example. 3600 IN ANAME aname-target.
aname02.example. 3600 IN ANAME aname-target.example.
aname03.example. 3600 IN ANAME aname.example.
aname04.example. 3600 IN ANAME .
afsdb01.example. 3600 IN AFSDB 0 hostname.example.
afsdb02.example. 3600 IN AFSDB 65535 .
apl01.example. 3600 IN APL !1:10.0.0.1/32 1:10.0.0.1/24

View File

@@ -0,0 +1,224 @@
/*
* Copyright (C) Internet Systems Consortium, Inc. ("ISC")
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* See the COPYRIGHT file distributed with this work for additional
* information regarding copyright ownership.
*/
#ifndef RDATA_GENERIC_ANAME_65532_C
#define RDATA_GENERIC_ANAME_65532_C
#define RRTYPE_ANAME_ATTRIBUTES \
(DNS_RDATATYPEATTR_EXCLUSIVE | DNS_RDATATYPEATTR_SINGLETON)
static inline isc_result_t
fromtext_aname(ARGS_FROMTEXT) {
isc_token_t token;
dns_name_t name;
isc_buffer_t buffer;
REQUIRE(type == dns_rdatatype_aname);
UNUSED(type);
UNUSED(rdclass);
UNUSED(callbacks);
RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string,
ISC_FALSE));
dns_name_init(&name, NULL);
buffer_fromregion(&buffer, &token.value.as_region);
if (origin == NULL)
origin = dns_rootname;
RETTOK(dns_name_fromtext(&name, &buffer, origin, options, target));
return (ISC_R_SUCCESS);
}
static inline isc_result_t
totext_aname(ARGS_TOTEXT) {
isc_region_t region;
dns_name_t name;
dns_name_t prefix;
isc_boolean_t sub;
REQUIRE(rdata->type == dns_rdatatype_aname);
REQUIRE(rdata->length != 0);
dns_name_init(&name, NULL);
dns_name_init(&prefix, NULL);
dns_rdata_toregion(rdata, &region);
dns_name_fromregion(&name, &region);
sub = name_prefix(&name, tctx->origin, &prefix);
return (dns_name_totext(&prefix, sub, target));
}
static inline isc_result_t
fromwire_aname(ARGS_FROMWIRE) {
dns_name_t name;
REQUIRE(type == dns_rdatatype_aname);
UNUSED(type);
UNUSED(rdclass);
dns_decompress_setmethods(dctx, DNS_COMPRESS_GLOBAL14);
dns_name_init(&name, NULL);
return (dns_name_fromwire(&name, source, dctx, options, target));
}
static inline isc_result_t
towire_aname(ARGS_TOWIRE) {
dns_name_t name;
dns_offsets_t offsets;
isc_region_t region;
REQUIRE(rdata->type == dns_rdatatype_aname);
REQUIRE(rdata->length != 0);
dns_compress_setmethods(cctx, DNS_COMPRESS_GLOBAL14);
dns_name_init(&name, offsets);
dns_rdata_toregion(rdata, &region);
dns_name_fromregion(&name, &region);
return (dns_name_towire(&name, cctx, target));
}
static inline int
compare_aname(ARGS_COMPARE) {
dns_name_t name1;
dns_name_t name2;
isc_region_t region1;
isc_region_t region2;
REQUIRE(rdata1->type == rdata2->type);
REQUIRE(rdata1->rdclass == rdata2->rdclass);
REQUIRE(rdata1->type == dns_rdatatype_aname);
REQUIRE(rdata1->length != 0);
REQUIRE(rdata2->length != 0);
dns_name_init(&name1, NULL);
dns_name_init(&name2, NULL);
dns_rdata_toregion(rdata1, &region1);
dns_rdata_toregion(rdata2, &region2);
dns_name_fromregion(&name1, &region1);
dns_name_fromregion(&name2, &region2);
return (dns_name_rdatacompare(&name1, &name2));
}
static inline isc_result_t
fromstruct_aname(ARGS_FROMSTRUCT) {
dns_rdata_aname_t *aname = source;
isc_region_t region;
REQUIRE(type == dns_rdatatype_aname);
REQUIRE(source != NULL);
REQUIRE(aname->common.rdtype == type);
REQUIRE(aname->common.rdclass == rdclass);
UNUSED(type);
UNUSED(rdclass);
dns_name_toregion(&aname->target, &region);
return (isc_buffer_copyregion(target, &region));
}
static inline isc_result_t
tostruct_aname(ARGS_TOSTRUCT) {
isc_region_t region;
dns_rdata_aname_t *aname = target;
dns_name_t name;
REQUIRE(rdata->type == dns_rdatatype_aname);
REQUIRE(target != NULL);
REQUIRE(rdata->length != 0);
aname->common.rdclass = rdata->rdclass;
aname->common.rdtype = rdata->type;
ISC_LINK_INIT(&aname->common, link);
dns_name_init(&name, NULL);
dns_rdata_toregion(rdata, &region);
dns_name_fromregion(&name, &region);
dns_name_init(&aname->target, NULL);
RETERR(name_duporclone(&name, mctx, &aname->target));
aname->mctx = mctx;
return (ISC_R_SUCCESS);
}
static inline void
freestruct_aname(ARGS_FREESTRUCT) {
dns_rdata_aname_t *aname = source;
REQUIRE(source != NULL);
if (aname->mctx == NULL)
return;
dns_name_free(&aname->target, aname->mctx);
aname->mctx = NULL;
}
static inline isc_result_t
additionaldata_aname(ARGS_ADDLDATA) {
REQUIRE(rdata->type == dns_rdatatype_aname);
return ((add)(arg, dns_rootname, dns_rdatatype_aname));
}
static inline isc_result_t
digest_aname(ARGS_DIGEST) {
isc_region_t r;
dns_name_t name;
REQUIRE(rdata->type == dns_rdatatype_aname);
dns_rdata_toregion(rdata, &r);
dns_name_init(&name, NULL);
dns_name_fromregion(&name, &r);
return (dns_name_digest(&name, digest, arg));
}
static inline isc_boolean_t
checkowner_aname(ARGS_CHECKOWNER) {
REQUIRE(type == dns_rdatatype_aname);
UNUSED(name);
UNUSED(type);
UNUSED(rdclass);
UNUSED(wildcard);
return (ISC_TRUE);
}
static inline isc_boolean_t
checknames_aname(ARGS_CHECKNAMES) {
REQUIRE(rdata->type == dns_rdatatype_aname);
UNUSED(rdata);
UNUSED(owner);
UNUSED(bad);
return (ISC_TRUE);
}
static inline int
casecompare_aname(ARGS_COMPARE) {
return (compare_aname(rdata1, rdata2));
}
#endif /* RDATA_GENERIC_ANAME_65532_C */

View File

@@ -0,0 +1,21 @@
/*
* Copyright (C) Internet Systems Consortium, Inc. ("ISC")
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* See the COPYRIGHT file distributed with this work for additional
* information regarding copyright ownership.
*/
#ifndef GENERIC_ANAME_65532_H
#define GENERIC_ANAME_65532_H 1
typedef struct dns_rdata_aname {
dns_rdatacommon_t common;
isc_mem_t *mctx;
dns_name_t target;
} dns_rdata_aname_t;
#endif /* GENERIC_ANAME_65532_H */

View File

@@ -95,6 +95,7 @@ struct ns_query {
#define NS_QUERYATTR_DNS64EXCLUDE 0x8000
#define NS_QUERYATTR_RRL_CHECKED 0x10000
#define NS_QUERYATTR_REDIRECT 0x20000
#define NS_QUERYATTR_ANAME 0x40000
/* query context structure */

View File

@@ -162,6 +162,9 @@ do { \
#define STALE(r) (((r)->attributes & \
DNS_RDATASETATTR_STALE) != 0)
#define ANAME(c) (((c)->query.attributes & \
NS_QUERYATTR_ANAME) != 0)
#ifdef WANT_QUERYTRACE
static inline void
client_trace(ns_client_t *client, int level, const char *message) {
@@ -1595,57 +1598,53 @@ query_isduplicate(ns_client_t *client, dns_name_t *name,
static isc_result_t
query_addadditional(void *arg, const dns_name_t *name, dns_rdatatype_t qtype) {
ns_client_t *client = arg;
isc_result_t result, eresult;
dns_dbnode_t *node;
dns_db_t *db;
dns_name_t *fname, *mname;
dns_rdataset_t *rdataset, *sigrdataset, *trdataset;
isc_buffer_t *dbuf;
isc_result_t result, eresult = ISC_R_SUCCESS;
dns_dbnode_t *node = NULL;
dns_db_t *db = NULL;
dns_name_t *fname = NULL, *mname = NULL;
dns_rdataset_t *rdataset = NULL, *sigrdataset = NULL;
dns_rdataset_t *trdataset = NULL;
isc_buffer_t *dbuf = NULL;
isc_buffer_t b;
ns_dbversion_t *dbversion;
dns_dbversion_t *version;
isc_boolean_t added_something, need_addname;
ns_dbversion_t *dbversion = NULL;
dns_dbversion_t *version = NULL;
isc_boolean_t added_something = ISC_FALSE;
isc_boolean_t need_addname = ISC_FALSE;
dns_rdatatype_t type;
dns_clientinfomethods_t cm;
dns_clientinfo_t ci;
dns_rdatasetadditional_t additionaltype;
dns_rdatasetadditional_t additionaltype =
dns_rdatasetadditional_fromauth;
REQUIRE(NS_CLIENT_VALID(client));
REQUIRE(qtype != dns_rdatatype_any);
if (!WANTDNSSEC(client) && dns_rdatatype_isdnssec(qtype))
return (ISC_R_SUCCESS);
CTRACE(ISC_LOG_DEBUG(3), "query_addadditional");
/*
* Initialization.
*/
eresult = ISC_R_SUCCESS;
fname = NULL;
rdataset = NULL;
sigrdataset = NULL;
trdataset = NULL;
db = NULL;
version = NULL;
node = NULL;
added_something = ISC_FALSE;
need_addname = ISC_FALSE;
additionaltype = dns_rdatasetadditional_fromauth;
dns_clientinfomethods_init(&cm, ns_client_sourceip);
dns_clientinfo_init(&ci, client, NULL);
if (qtype == dns_rdatatype_aname) {
client->query.attributes |= NS_QUERYATTR_ANAME;
return (query_addadditional(arg, client->query.qname,
dns_rdatatype_a));
}
/*
* We treat type A additional section processing as if it
* were "any address type" additional section processing.
* To avoid multiple lookups, we do an 'any' database
* lookup and iterate over the node.
*/
if (qtype == dns_rdatatype_a)
if (qtype == dns_rdatatype_a) {
type = dns_rdatatype_any;
else
} else {
type = qtype;
}
/*
* Get some resources.
@@ -1664,11 +1663,14 @@ query_addadditional(void *arg, const dns_name_t *name, dns_rdatatype_t qtype) {
}
/*
* If we want only minimal responses and are here, then it must
* If we want only jinimal responses and are here, then it must
* be for glue.
*/
if (client->view->minimalresponses == dns_minimal_yes)
if (client->view->minimalresponses == dns_minimal_yes &&
!ANAME(client))
{
goto try_glue;
}
/*
* Look within the same zone database for authoritative
@@ -2015,15 +2017,22 @@ query_addadditional(void *arg, const dns_name_t *name, dns_rdatatype_t qtype) {
cleanup:
CTRACE(ISC_LOG_DEBUG(3), "query_addadditional: cleanup");
if (ANAME(client)) {
client->query.attributes &= ~NS_QUERYATTR_ANAME;
}
query_putrdataset(client, &rdataset);
if (sigrdataset != NULL)
if (sigrdataset != NULL) {
query_putrdataset(client, &sigrdataset);
if (fname != NULL)
}
if (fname != NULL) {
query_releasename(client, &fname);
if (node != NULL)
}
if (node != NULL) {
dns_db_detachnode(db, &node);
if (db != NULL)
}
if (db != NULL) {
dns_db_detach(&db);
}
CTRACE(ISC_LOG_DEBUG(3), "query_addadditional: done");
return (eresult);
@@ -2050,8 +2059,9 @@ query_addrdataset(ns_client_t *client, dns_section_t section,
rdataset->rdclass);
rdataset->attributes |= DNS_RDATASETATTR_LOADORDER;
if (NOADDITIONAL(client))
if (NOADDITIONAL(client) && rdataset->type != dns_rdatatype_aname) {
return;
}
/*
* Try to process glue directly.