From 3063f34e470aee08567e69746e2d8ae78c5d17fd Mon Sep 17 00:00:00 2001 From: Evan Hunt Date: Sun, 18 Mar 2018 14:22:19 +0000 Subject: [PATCH] put A and AAAA in additional section when responding to type=ANAME queries --- bin/tests/system/aname/clean.sh | 15 +++ bin/tests/system/aname/ns1/example.db | 30 +++++ bin/tests/system/aname/ns1/named1.conf.in | 27 +++++ bin/tests/system/aname/ns1/named2.conf.in | 28 +++++ bin/tests/system/aname/ns1/named3.conf.in | 28 +++++ bin/tests/system/aname/setup.sh | 17 +++ bin/tests/system/aname/tests.sh | 136 ++++++++++++++++++++++ bin/tests/system/conf.sh.in | 46 ++++---- bin/tests/system/conf.sh.win32 | 80 +++++++------ lib/dns/rdata/generic/aname_65532.c | 6 +- lib/ns/include/ns/query.h | 1 + lib/ns/query.c | 78 +++++++------ 12 files changed, 393 insertions(+), 99 deletions(-) create mode 100644 bin/tests/system/aname/clean.sh create mode 100644 bin/tests/system/aname/ns1/example.db create mode 100644 bin/tests/system/aname/ns1/named1.conf.in create mode 100644 bin/tests/system/aname/ns1/named2.conf.in create mode 100644 bin/tests/system/aname/ns1/named3.conf.in create mode 100644 bin/tests/system/aname/setup.sh create mode 100644 bin/tests/system/aname/tests.sh diff --git a/bin/tests/system/aname/clean.sh b/bin/tests/system/aname/clean.sh new file mode 100644 index 00000000000..f18041d5f43 --- /dev/null +++ b/bin/tests/system/aname/clean.sh @@ -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 diff --git a/bin/tests/system/aname/ns1/example.db b/bin/tests/system/aname/ns1/example.db new file mode 100644 index 00000000000..15539b1216c --- /dev/null +++ b/bin/tests/system/aname/ns1/example.db @@ -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 diff --git a/bin/tests/system/aname/ns1/named1.conf.in b/bin/tests/system/aname/ns1/named1.conf.in new file mode 100644 index 00000000000..c484006b67d --- /dev/null +++ b/bin/tests/system/aname/ns1/named1.conf.in @@ -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"; +}; diff --git a/bin/tests/system/aname/ns1/named2.conf.in b/bin/tests/system/aname/ns1/named2.conf.in new file mode 100644 index 00000000000..73d170ff0c4 --- /dev/null +++ b/bin/tests/system/aname/ns1/named2.conf.in @@ -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"; +}; diff --git a/bin/tests/system/aname/ns1/named3.conf.in b/bin/tests/system/aname/ns1/named3.conf.in new file mode 100644 index 00000000000..d7d7a67d93e --- /dev/null +++ b/bin/tests/system/aname/ns1/named3.conf.in @@ -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"; +}; diff --git a/bin/tests/system/aname/setup.sh b/bin/tests/system/aname/setup.sh new file mode 100644 index 00000000000..87d0a57fd7a --- /dev/null +++ b/bin/tests/system/aname/setup.sh @@ -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 diff --git a/bin/tests/system/aname/tests.sh b/bin/tests/system/aname/tests.sh new file mode 100644 index 00000000000..6a4d9fb69ab --- /dev/null +++ b/bin/tests/system/aname/tests.sh @@ -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 diff --git a/bin/tests/system/conf.sh.in b/bin/tests/system/conf.sh.in index 32cec849d95..1023f6748c3 100644 --- a/bin/tests/system/conf.sh.in +++ b/bin/tests/system/conf.sh.in @@ -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 } # diff --git a/bin/tests/system/conf.sh.win32 b/bin/tests/system/conf.sh.win32 index 146303af243..e027af6b3ff 100644 --- a/bin/tests/system/conf.sh.win32 +++ b/bin/tests/system/conf.sh.win32 @@ -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" - -# List of tests that use unique ports (other than 5300 and 9953). These -# tests can be run in parallel. +SEQUENTIALDIRS="ecdsa eddsa gost @PKCS11_TEST@ tkey" + +# 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 } # diff --git a/lib/dns/rdata/generic/aname_65532.c b/lib/dns/rdata/generic/aname_65532.c index a7c2c1c62a0..3098dbd9a3d 100644 --- a/lib/dns/rdata/generic/aname_65532.c +++ b/lib/dns/rdata/generic/aname_65532.c @@ -172,13 +172,9 @@ freestruct_aname(ARGS_FREESTRUCT) { static inline isc_result_t additionaldata_aname(ARGS_ADDLDATA) { - UNUSED(rdata); - UNUSED(add); - UNUSED(arg); - REQUIRE(rdata->type == dns_rdatatype_aname); - return (ISC_R_SUCCESS); + return ((add)(arg, dns_rootname, dns_rdatatype_aname)); } static inline isc_result_t diff --git a/lib/ns/include/ns/query.h b/lib/ns/include/ns/query.h index 87c0a638edb..ae6bcc6532f 100644 --- a/lib/ns/include/ns/query.h +++ b/lib/ns/include/ns/query.h @@ -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 */ diff --git a/lib/ns/query.c b/lib/ns/query.c index 7cea53515d5..47af963ae03 100644 --- a/lib/ns/query.c +++ b/lib/ns/query.c @@ -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. -- 2.47.3