mirror of
https://github.com/isc-projects/bind9.git
synced 2026-06-11 05:09:59 -04:00
Renumber ans7->ans6 and ans8->ans7 in digdelv test
Since there was no 10.53.0.6 server in the test, renumber the remaining ones so that there's no gap in the server names. This commit simply moves the ans.py files without any changes and renumbers the IP addresses in tests.
This commit is contained in:
parent
6c69abf783
commit
9b63187a99
4 changed files with 94 additions and 94 deletions
40
bin/tests/system/digdelv/ans6/ans.py
Normal file
40
bin/tests/system/digdelv/ans6/ans.py
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
# 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.
|
||||
|
||||
from typing import AsyncGenerator
|
||||
|
||||
import dns.opcode
|
||||
import dns.rcode
|
||||
|
||||
from isctest.asyncserver import (
|
||||
AsyncDnsServer,
|
||||
DnsResponseSend,
|
||||
ResponseHandler,
|
||||
QueryContext,
|
||||
)
|
||||
|
||||
|
||||
class ReplyUpdateHandler(ResponseHandler):
|
||||
async def get_responses(
|
||||
self, qctx: QueryContext
|
||||
) -> AsyncGenerator[DnsResponseSend, None]:
|
||||
qctx.response.set_opcode(dns.opcode.UPDATE)
|
||||
yield DnsResponseSend(qctx.response)
|
||||
|
||||
|
||||
def main() -> None:
|
||||
server = AsyncDnsServer(default_aa=True, default_rcode=dns.rcode.NOERROR)
|
||||
server.install_response_handler(ReplyUpdateHandler())
|
||||
server.run()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
|
@ -11,28 +11,64 @@
|
|||
|
||||
from typing import AsyncGenerator
|
||||
|
||||
import dns.opcode
|
||||
import dns
|
||||
import dns.rcode
|
||||
|
||||
from isctest.asyncserver import (
|
||||
AsyncDnsServer,
|
||||
CloseConnection,
|
||||
DnsResponseSend,
|
||||
ResponseHandler,
|
||||
DomainHandler,
|
||||
IgnoreAllQueries,
|
||||
QueryContext,
|
||||
ResponseAction,
|
||||
ResponseDrop,
|
||||
)
|
||||
|
||||
|
||||
class ReplyUpdateHandler(ResponseHandler):
|
||||
class SilentHandler(DomainHandler, IgnoreAllQueries):
|
||||
"""Handler that doesn't respond."""
|
||||
|
||||
domains = ["silent.example"]
|
||||
|
||||
|
||||
class CloseHandler(DomainHandler):
|
||||
"""Handler that doesn't respond and closes TCP connection."""
|
||||
|
||||
domains = ["close.example"]
|
||||
|
||||
async def get_responses(
|
||||
self, qctx: QueryContext
|
||||
) -> AsyncGenerator[DnsResponseSend, None]:
|
||||
qctx.response.set_opcode(dns.opcode.UPDATE)
|
||||
yield DnsResponseSend(qctx.response)
|
||||
) -> AsyncGenerator[ResponseAction, None]:
|
||||
yield CloseConnection()
|
||||
|
||||
|
||||
class SilentThenServfailHandler(DomainHandler):
|
||||
"""Handler that drops one query and response to the next one with SERVFAIL."""
|
||||
|
||||
domains = ["silent-then-servfail.example"]
|
||||
counter = 0
|
||||
|
||||
async def get_responses(
|
||||
self, qctx: QueryContext
|
||||
) -> AsyncGenerator[ResponseAction, None]:
|
||||
if self.counter % 2 == 0:
|
||||
yield ResponseDrop()
|
||||
else:
|
||||
qctx.response.set_rcode(dns.rcode.SERVFAIL)
|
||||
yield DnsResponseSend(qctx.response, authoritative=False)
|
||||
self.counter += 1
|
||||
|
||||
|
||||
def main() -> None:
|
||||
server = AsyncDnsServer(default_aa=True, default_rcode=dns.rcode.NOERROR)
|
||||
server.install_response_handler(ReplyUpdateHandler())
|
||||
server = AsyncDnsServer()
|
||||
server.install_response_handlers(
|
||||
[
|
||||
CloseHandler(),
|
||||
SilentHandler(),
|
||||
SilentThenServfailHandler(),
|
||||
]
|
||||
)
|
||||
server.run()
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,76 +0,0 @@
|
|||
# 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.
|
||||
|
||||
from typing import AsyncGenerator
|
||||
|
||||
import dns
|
||||
import dns.rcode
|
||||
|
||||
from isctest.asyncserver import (
|
||||
AsyncDnsServer,
|
||||
CloseConnection,
|
||||
DnsResponseSend,
|
||||
DomainHandler,
|
||||
IgnoreAllQueries,
|
||||
QueryContext,
|
||||
ResponseAction,
|
||||
ResponseDrop,
|
||||
)
|
||||
|
||||
|
||||
class SilentHandler(DomainHandler, IgnoreAllQueries):
|
||||
"""Handler that doesn't respond."""
|
||||
|
||||
domains = ["silent.example"]
|
||||
|
||||
|
||||
class CloseHandler(DomainHandler):
|
||||
"""Handler that doesn't respond and closes TCP connection."""
|
||||
|
||||
domains = ["close.example"]
|
||||
|
||||
async def get_responses(
|
||||
self, qctx: QueryContext
|
||||
) -> AsyncGenerator[ResponseAction, None]:
|
||||
yield CloseConnection()
|
||||
|
||||
|
||||
class SilentThenServfailHandler(DomainHandler):
|
||||
"""Handler that drops one query and response to the next one with SERVFAIL."""
|
||||
|
||||
domains = ["silent-then-servfail.example"]
|
||||
counter = 0
|
||||
|
||||
async def get_responses(
|
||||
self, qctx: QueryContext
|
||||
) -> AsyncGenerator[ResponseAction, None]:
|
||||
if self.counter % 2 == 0:
|
||||
yield ResponseDrop()
|
||||
else:
|
||||
qctx.response.set_rcode(dns.rcode.SERVFAIL)
|
||||
yield DnsResponseSend(qctx.response, authoritative=False)
|
||||
self.counter += 1
|
||||
|
||||
|
||||
def main() -> None:
|
||||
server = AsyncDnsServer()
|
||||
server.install_response_handlers(
|
||||
[
|
||||
CloseHandler(),
|
||||
SilentHandler(),
|
||||
SilentThenServfailHandler(),
|
||||
]
|
||||
)
|
||||
server.run()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
|
@ -76,7 +76,7 @@ $PYTHON -c "import yaml" 2>/dev/null && HAS_PYYAML=1
|
|||
n=$((n + 1))
|
||||
echo_i "check nslookup handles UPDATE response ($n)"
|
||||
ret=0
|
||||
"$NSLOOKUP" -q=CNAME -timeout=1 "-port=$PORT" foo.bar 10.53.0.7 >nslookup.out.test$n 2>&1 && ret=1
|
||||
"$NSLOOKUP" -q=CNAME -timeout=1 "-port=$PORT" foo.bar 10.53.0.6 >nslookup.out.test$n 2>&1 && ret=1
|
||||
grep "Opcode mismatch" nslookup.out.test$n >/dev/null || ret=1
|
||||
if [ $ret -ne 0 ]; then echo_i "failed"; fi
|
||||
status=$((status + ret))
|
||||
|
|
@ -84,7 +84,7 @@ status=$((status + ret))
|
|||
n=$((n + 1))
|
||||
echo_i "check host handles UPDATE response ($n)"
|
||||
ret=0
|
||||
"$HOST" -W 1 -t CNAME -p $PORT foo.bar 10.53.0.7 >host.out.test$n 2>&1 && ret=1
|
||||
"$HOST" -W 1 -t CNAME -p $PORT foo.bar 10.53.0.6 >host.out.test$n 2>&1 && ret=1
|
||||
grep "Opcode mismatch" host.out.test$n >/dev/null || ret=1
|
||||
if [ $ret -ne 0 ]; then echo_i "failed"; fi
|
||||
status=$((status + ret))
|
||||
|
|
@ -94,7 +94,7 @@ echo_i "check nsupdate handles UPDATE response to QUERY ($n)"
|
|||
ret=0
|
||||
res=0
|
||||
$NSUPDATE <<EOF >nsupdate.out.test$n 2>&1 || res=$?
|
||||
server 10.53.0.7 ${PORT}
|
||||
server 10.53.0.6 ${PORT}
|
||||
add x.example.com 300 in a 1.2.3.4
|
||||
send
|
||||
EOF
|
||||
|
|
@ -107,7 +107,7 @@ if [ -x "$DIG" ]; then
|
|||
n=$((n + 1))
|
||||
echo_i "check dig handles UPDATE response ($n)"
|
||||
ret=0
|
||||
dig_with_opts @10.53.0.7 +tries=1 +timeout=1 cname foo.bar >dig.out.test$n 2>&1 && ret=1
|
||||
dig_with_opts @10.53.0.6 +tries=1 +timeout=1 cname foo.bar >dig.out.test$n 2>&1 && ret=1
|
||||
grep "Opcode mismatch" dig.out.test$n >/dev/null || ret=1
|
||||
if [ $ret -ne 0 ]; then echo_i "failed"; fi
|
||||
status=$((status + ret))
|
||||
|
|
@ -1276,7 +1276,7 @@ if [ -x "$DIG" ]; then
|
|||
n=$((n + 1))
|
||||
echo_i "check that dig handles UDP timeout followed by a SERVFAIL correctly ($n)"
|
||||
ret=0
|
||||
dig_with_opts +timeout=1 +nofail @10.53.0.8 silent-then-servfail.example >dig.out.test$n 2>&1 || ret=1
|
||||
dig_with_opts +timeout=1 +nofail @10.53.0.7 silent-then-servfail.example >dig.out.test$n 2>&1 || ret=1
|
||||
grep -F "status: SERVFAIL" dig.out.test$n >/dev/null || ret=1
|
||||
if [ $ret -ne 0 ]; then echo_i "failed"; fi
|
||||
status=$((status + ret))
|
||||
|
|
@ -1284,7 +1284,7 @@ if [ -x "$DIG" ]; then
|
|||
n=$((n + 1))
|
||||
echo_i "check that dig handles TCP timeout followed by a SERVFAIL correctly ($n)"
|
||||
ret=0
|
||||
dig_with_opts +timeout=1 +nofail +tcp @10.53.0.8 silent-then-servfail.example >dig.out.test$n 2>&1 || ret=1
|
||||
dig_with_opts +timeout=1 +nofail +tcp @10.53.0.7 silent-then-servfail.example >dig.out.test$n 2>&1 || ret=1
|
||||
grep -F "status: SERVFAIL" dig.out.test$n >/dev/null || ret=1
|
||||
if [ $ret -ne 0 ]; then echo_i "failed"; fi
|
||||
status=$((status + ret))
|
||||
|
|
@ -1318,7 +1318,7 @@ if [ -x "$DIG" ]; then
|
|||
n=$((n + 1))
|
||||
echo_i "check that dig tries the next server after a TCP socket read error ($n)"
|
||||
ret=0
|
||||
dig_with_opts +tcp @10.53.0.8 @10.53.0.3 close.example >dig.out.test$n 2>&1 || ret=1
|
||||
dig_with_opts +tcp @10.53.0.7 @10.53.0.3 close.example >dig.out.test$n 2>&1 || ret=1
|
||||
grep -F "status: NOERROR" dig.out.test$n >/dev/null || ret=1
|
||||
if [ $ret -ne 0 ]; then echo_i "failed"; fi
|
||||
status=$((status + ret))
|
||||
|
|
@ -1341,7 +1341,7 @@ if [ -x "$DIG" ]; then
|
|||
n=$((n + 1))
|
||||
echo_i "check that dig tries the next server after UDP socket read timeouts ($n)"
|
||||
ret=0
|
||||
dig_with_opts +timeout=1 @10.53.0.8 @10.53.0.3 silent.example >dig.out.test$n 2>&1 || ret=1
|
||||
dig_with_opts +timeout=1 @10.53.0.7 @10.53.0.3 silent.example >dig.out.test$n 2>&1 || ret=1
|
||||
grep -F "status: NOERROR" dig.out.test$n >/dev/null || ret=1
|
||||
if [ $ret -ne 0 ]; then echo_i "failed"; fi
|
||||
status=$((status + ret))
|
||||
|
|
@ -1349,7 +1349,7 @@ if [ -x "$DIG" ]; then
|
|||
n=$((n + 1))
|
||||
echo_i "check that dig tries the next server after TCP socket read timeouts ($n)"
|
||||
ret=0
|
||||
dig_with_opts +timeout=1 +tcp @10.53.0.8 @10.53.0.3 silent.example >dig.out.test$n 2>&1 || ret=1
|
||||
dig_with_opts +timeout=1 +tcp @10.53.0.7 @10.53.0.3 silent.example >dig.out.test$n 2>&1 || ret=1
|
||||
grep -F "status: NOERROR" dig.out.test$n >/dev/null || ret=1
|
||||
if [ $ret -ne 0 ]; then echo_i "failed"; fi
|
||||
status=$((status + ret))
|
||||
|
|
@ -1358,7 +1358,7 @@ if [ -x "$DIG" ]; then
|
|||
n=$((n + 1))
|
||||
echo_i "check that dig correctly refuses to use a server with a IPv4 mapped IPv6 address after failing with a regular IP address ($n)"
|
||||
ret=0
|
||||
dig_with_opts @10.53.0.8 @::ffff:10.53.0.8 silent.example >dig.out.test$n 2>&1 || ret=1
|
||||
dig_with_opts @10.53.0.7 @::ffff:10.53.0.7 silent.example >dig.out.test$n 2>&1 || ret=1
|
||||
grep -F ";; Skipping mapped address" dig.out.test$n >/dev/null || ret=1
|
||||
grep -F ";; No acceptable nameservers" dig.out.test$n >/dev/null || ret=1
|
||||
if [ $ret -ne 0 ]; then echo_i "failed"; fi
|
||||
|
|
|
|||
Loading…
Reference in a new issue