From 3a87ff3dfe12a6dcb54ba8f54519d9d5f8df77a8 Mon Sep 17 00:00:00 2001 From: Mark Andrews Date: Tue, 6 Aug 2019 17:28:02 +1000 Subject: [PATCH] Test resolver-use-dns64 Test resolver-use-dns64 by simulating a connection to an IPv4-only server through a NAT64. This test uses EXTRAPORT1 rather than PORT for DNS traffic exchanged between ns3 and ns4. Both servers also listen on PORT on their IPv4 addresses to support server startup testing in start.pl. --- bin/tests/system/dns64/ns3/hints | 14 ++++++++ bin/tests/system/dns64/ns3/named.conf.in | 46 ++++++++++++++++++++++++ bin/tests/system/dns64/ns4/named.conf.in | 36 +++++++++++++++++++ bin/tests/system/dns64/ns4/root.db | 17 +++++++++ bin/tests/system/dns64/setup.sh | 2 ++ bin/tests/system/dns64/tests.sh | 14 ++++++++ 6 files changed, 129 insertions(+) create mode 100644 bin/tests/system/dns64/ns3/hints create mode 100644 bin/tests/system/dns64/ns3/named.conf.in create mode 100644 bin/tests/system/dns64/ns4/named.conf.in create mode 100644 bin/tests/system/dns64/ns4/root.db diff --git a/bin/tests/system/dns64/ns3/hints b/bin/tests/system/dns64/ns3/hints new file mode 100644 index 0000000000..3685f54166 --- /dev/null +++ b/bin/tests/system/dns64/ns3/hints @@ -0,0 +1,14 @@ +; Copyright (C) Internet Systems Consortium, Inc. ("ISC") +; +; SPDX-License-Identifier: MPL-2.0 +; +; 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 https://mozilla.org/MPL/2.0/. +; +; See the COPYRIGHT file distributed with this work for additional +; information regarding copyright ownership. + +$TTL 999999 +. IN NS a.root-servers.nil. +a.root-servers.nil. IN A 10.53.0.4 diff --git a/bin/tests/system/dns64/ns3/named.conf.in b/bin/tests/system/dns64/ns3/named.conf.in new file mode 100644 index 0000000000..4491de1b6e --- /dev/null +++ b/bin/tests/system/dns64/ns3/named.conf.in @@ -0,0 +1,46 @@ +/* + * Copyright (C) Internet Systems Consortium, Inc. ("ISC") + * + * SPDX-License-Identifier: MPL-2.0 + * + * 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 https://mozilla.org/MPL/2.0/. + * + * See the COPYRIGHT file distributed with this work for additional + * information regarding copyright ownership. + */ + + +// NS3 + +acl rfc1918 { 10/8; 192.168/16; 172.16/12; }; + +options { + query-source address 10.53.0.3; + query-source-v6 address fd92:7065:b8e:ffff::3; + notify-source 10.53.0.3; + notify-source-v6 fd92:7065:b8e:ffff::3; + transfer-source 10.53.0.3; + transfer-source-v6 fd92:7065:b8e:ffff::3; + port @EXTRAPORT1@; + pid-file "named.pid"; + listen-on port @PORT@ { 10.53.0.3; }; // for start.pl + listen-on { 10.53.0.3; }; + listen-on-v6 { fd92:7065:b8e:ffff::3; }; + notify yes; + dnssec-validation yes; + allow-recursion { any; }; + resolver-use-dns64 yes; + + dns64 fd92:7065:b8e:fffe::/96 { + clients { any; }; + mapped { 10.53.0.4; !rfc1918; any; }; + suffix ::; + }; +}; + +zone "." { + type hint; + file "hints"; +}; diff --git a/bin/tests/system/dns64/ns4/named.conf.in b/bin/tests/system/dns64/ns4/named.conf.in new file mode 100644 index 0000000000..ca831f9264 --- /dev/null +++ b/bin/tests/system/dns64/ns4/named.conf.in @@ -0,0 +1,36 @@ +/* + * Copyright (C) Internet Systems Consortium, Inc. ("ISC") + * + * SPDX-License-Identifier: MPL-2.0 + * + * 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 https://mozilla.org/MPL/2.0/. + * + * See the COPYRIGHT file distributed with this work for additional + * information regarding copyright ownership. + */ + + +// NS4 + +options { + query-source address 10.53.0.4; + query-source-v6 address fd92:7065:b8e:fffe::10.53.0.4; + notify-source 10.53.0.4; + notify-source-v6 fd92:7065:b8e:fffe::10.53.0.4; + transfer-source 10.53.0.4; + transfer-source-v6 fd92:7065:b8e:fffe::10.53.0.4; + port @EXTRAPORT1@; + pid-file "named.pid"; + listen-on port @PORT@ { 10.53.0.4; }; // for start.pl + listen-on-v6 { fd92:7065:b8e:fffe::10.53.0.4; }; + notify yes; + dnssec-validation yes; + recursion no; +}; + +zone "." { + type master; + file "root.db"; +}; diff --git a/bin/tests/system/dns64/ns4/root.db b/bin/tests/system/dns64/ns4/root.db new file mode 100644 index 0000000000..afa7c8a0d8 --- /dev/null +++ b/bin/tests/system/dns64/ns4/root.db @@ -0,0 +1,17 @@ +; Copyright (C) Internet Systems Consortium, Inc. ("ISC") +; +; SPDX-License-Identifier: MPL-2.0 +; +; 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 https://mozilla.org/MPL/2.0/. +; +; See the COPYRIGHT file distributed with this work for additional +; information regarding copyright ownership. + +$TTL 999999 +. IN SOA a.root-servers.nil. . 0 0 0 0 0 +. IN NS a.root-servers.nil. +a.root-servers.nil. IN A 10.53.0.4 +no-aaaa IN A 1.2.3.4 +have-aaaa IN AAAA 2002::1 diff --git a/bin/tests/system/dns64/setup.sh b/bin/tests/system/dns64/setup.sh index 6771f3f2b2..e6df4d0c12 100644 --- a/bin/tests/system/dns64/setup.sh +++ b/bin/tests/system/dns64/setup.sh @@ -15,5 +15,7 @@ copy_setports ns1/named.conf1.in ns1/named.conf copy_setports ns2/named.conf.in ns2/named.conf +copy_setports ns3/named.conf.in ns3/named.conf +copy_setports ns4/named.conf.in ns4/named.conf cd ns1 && $SHELL sign.sh diff --git a/bin/tests/system/dns64/tests.sh b/bin/tests/system/dns64/tests.sh index 4ee42dce4c..87d4bf157d 100644 --- a/bin/tests/system/dns64/tests.sh +++ b/bin/tests/system/dns64/tests.sh @@ -1452,5 +1452,19 @@ n=$((n + 1)) if [ $ret != 0 ]; then echo_i "failed"; fi status=$((status + ret)) +if $PERL ../testsock6.pl fd92:7065:b8e:fffe::10.53.0.4 2> /dev/null +then + echo_i "checking resolver-use-dns64 ($n)" + ret=0 + $DIG $DIGOPTS @10.53.0.3 no-aaaa aaaa > dig.out.ns3.test$n || ret=1 + grep "status: NOERROR" dig.out.ns3.test$n > /dev/null || ret=1 + grep "fd92:7065:b8e:fffe::102:304" dig.out.ns3.test$n > /dev/null || ret=1 + n=$((n + 1)) + if [ $ret != 0 ]; then echo_i "failed"; fi + status=$((status + ret)) +else + echo_i "skipped use-dns64 test - fd92:7065:b8e:fffe::10.53.0.4 not configured ($n)" +fi + echo_i "exit status: $status" [ $status -eq 0 ] || exit 1