diff options
Diffstat (limited to 'bin/tests/system/sortlist')
-rw-r--r-- | bin/tests/system/sortlist/clean.sh | 21 | ||||
-rw-r--r-- | bin/tests/system/sortlist/ns1/example.db | 43 | ||||
-rw-r--r-- | bin/tests/system/sortlist/ns1/named.conf | 53 | ||||
-rw-r--r-- | bin/tests/system/sortlist/ns1/root.db | 30 | ||||
-rw-r--r-- | bin/tests/system/sortlist/tests.sh | 60 |
5 files changed, 207 insertions, 0 deletions
diff --git a/bin/tests/system/sortlist/clean.sh b/bin/tests/system/sortlist/clean.sh new file mode 100644 index 0000000..bb71507 --- /dev/null +++ b/bin/tests/system/sortlist/clean.sh @@ -0,0 +1,21 @@ +#!/bin/sh +# +# Copyright (C) 2004, 2007 Internet Systems Consortium, Inc. ("ISC") +# Copyright (C) 2000, 2001 Internet Software Consortium. +# +# Permission to use, copy, modify, and/or distribute this software for any +# purpose with or without fee is hereby granted, provided that the above +# copyright notice and this permission notice appear in all copies. +# +# THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH +# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +# AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, +# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE +# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +# PERFORMANCE OF THIS SOFTWARE. + +# $Id: clean.sh,v 1.7 2007/09/26 03:22:44 marka Exp $ + +rm -f *.dig *.good +rm -f */named.memstats diff --git a/bin/tests/system/sortlist/ns1/example.db b/bin/tests/system/sortlist/ns1/example.db new file mode 100644 index 0000000..7e408db --- /dev/null +++ b/bin/tests/system/sortlist/ns1/example.db @@ -0,0 +1,43 @@ +; Copyright (C) 2004, 2007 Internet Systems Consortium, Inc. ("ISC") +; Copyright (C) 2000, 2001 Internet Software Consortium. +; +; Permission to use, copy, modify, and/or distribute this software for any +; purpose with or without fee is hereby granted, provided that the above +; copyright notice and this permission notice appear in all copies. +; +; THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH +; REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +; AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, +; INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +; LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE +; OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +; PERFORMANCE OF THIS SOFTWARE. + +; $Id: example.db,v 1.7 2007/06/19 23:47:05 tbox Exp $ + +$TTL 300 ; 5 minutes +@ IN SOA ns1.example. hostmaster.example. ( + 2000042795 ; serial + 20 ; refresh (20 seconds) + 20 ; retry (20 seconds) + 1814400 ; expire (3 weeks) + 3600 ; minimum (1 hour) + ) +example. NS ns1.example. +ns1.example. A 10.53.0.1 + +; Let's see what the sortlist picks out of this... +a A 1.1.1.1 +a A 1.1.1.5 +a A 1.1.1.2 +a A 192.168.3.1 +a A 1.1.1.3 +a A 192.168.1.1 +a A 1.1.1.4 + +b A 10.53.0.1 +b A 10.53.0.2 +b A 10.53.0.3 +b A 10.53.0.4 +b A 10.53.0.5 + diff --git a/bin/tests/system/sortlist/ns1/named.conf b/bin/tests/system/sortlist/ns1/named.conf new file mode 100644 index 0000000..5d149ec --- /dev/null +++ b/bin/tests/system/sortlist/ns1/named.conf @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2004, 2007 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2000, 2001 Internet Software Consortium. + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH + * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, + * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM + * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE + * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ + +/* $Id: named.conf,v 1.10 2007/06/19 23:47:05 tbox Exp $ */ + +controls { /* empty */ }; + +options { + query-source address 10.53.0.1; + notify-source 10.53.0.1; + transfer-source 10.53.0.1; + port 5300; + pid-file "named.pid"; + listen-on { 10.53.0.1; }; + listen-on-v6 { none; }; + recursion no; + notify yes; + + sortlist { + { 10.53.0.1; // IF 10.53.0.1 + { + !1.1.1.4; !1.1.1.2; !1.1.1.3; !1.1.1.1; // sort these last, + 192.168.3/24; // this first + { 192.168.2/24; 192.168.1/24; }; }; }; // and these next + { { 10.53.0.2; 10.53.0.3; }; }; // Prefer self + 10.53.0.4; // BIND 8 compat + { 10.53.0.5; 10.53.0.5; }; // BIND 8 compat + }; +}; + +zone "." { + type master; + file "root.db"; +}; + +zone "example" { + type master; + file "example.db"; +}; diff --git a/bin/tests/system/sortlist/ns1/root.db b/bin/tests/system/sortlist/ns1/root.db new file mode 100644 index 0000000..f300adc --- /dev/null +++ b/bin/tests/system/sortlist/ns1/root.db @@ -0,0 +1,30 @@ +; Copyright (C) 2004, 2007 Internet Systems Consortium, Inc. ("ISC") +; Copyright (C) 2000, 2001 Internet Software Consortium. +; +; Permission to use, copy, modify, and/or distribute this software for any +; purpose with or without fee is hereby granted, provided that the above +; copyright notice and this permission notice appear in all copies. +; +; THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH +; REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +; AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, +; INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +; LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE +; OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +; PERFORMANCE OF THIS SOFTWARE. + +; $Id: root.db,v 1.5 2007/06/19 23:47:05 tbox Exp $ + +$TTL 300 +. IN SOA gson.nominum.com. a.root.servers.nil. ( + 2000042100 ; serial + 600 ; refresh + 600 ; retry + 1200 ; expire + 600 ; minimum + ) +. NS a.root-servers.nil. +a.root-servers.nil. A 10.53.0.1 + +example. NS ns2.example. +ns2.example. A 10.53.0.2 diff --git a/bin/tests/system/sortlist/tests.sh b/bin/tests/system/sortlist/tests.sh new file mode 100644 index 0000000..06f175a --- /dev/null +++ b/bin/tests/system/sortlist/tests.sh @@ -0,0 +1,60 @@ +#!/bin/sh +# +# Copyright (C) 2004, 2007 Internet Systems Consortium, Inc. ("ISC") +# Copyright (C) 2000, 2001 Internet Software Consortium. +# +# Permission to use, copy, modify, and/or distribute this software for any +# purpose with or without fee is hereby granted, provided that the above +# copyright notice and this permission notice appear in all copies. +# +# THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH +# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +# AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, +# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE +# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +# PERFORMANCE OF THIS SOFTWARE. + +# $Id: tests.sh,v 1.9 2007/09/14 01:46:05 marka Exp $ + +SYSTEMTESTTOP=.. +. $SYSTEMTESTTOP/conf.sh + +status=0 + +echo "I:test 2-element sortlist statement" +cat <<EOF >test1.good +a.example. 300 IN A 192.168.3.1 +a.example. 300 IN A 192.168.1.1 +a.example. 300 IN A 1.1.1.5 +a.example. 300 IN A 1.1.1.1 +a.example. 300 IN A 1.1.1.3 +a.example. 300 IN A 1.1.1.2 +a.example. 300 IN A 1.1.1.4 +EOF +$DIG +tcp +noadd +nosea +nostat +noquest +noauth +nocomm +nocmd a.example. \ + @10.53.0.1 -b 10.53.0.1 -p 5300 >test1.dig +# Note that this can't use digcomp.pl because here, the ordering of the +# result RRs is significant. +diff test1.dig test1.good || status=1 + +echo "I:test 1-element sortlist statement and undocumented BIND 8 features" + cat <<EOF >test2.good +b.example. 300 IN A 10.53.0.$n +EOF + +$DIG +tcp +noadd +nosea +nostat +noquest +noauth +nocomm +nocmd \ + b.example. @10.53.0.1 -b 10.53.0.2 -p 5300 | sed 1q | \ + egrep '10.53.0.(2|3)$' > test2.out && +$DIG +tcp +noadd +nosea +nostat +noquest +noauth +nocomm +nocmd \ + b.example. @10.53.0.1 -b 10.53.0.3 -p 5300 | sed 1q | \ + egrep '10.53.0.(2|3)$' >> test2.out && +$DIG +tcp +noadd +nosea +nostat +noquest +noauth +nocomm +nocmd \ + b.example. @10.53.0.1 -b 10.53.0.4 -p 5300 | sed 1q | \ + egrep '10.53.0.4$' >> test2.out && +$DIG +tcp +noadd +nosea +nostat +noquest +noauth +nocomm +nocmd \ + b.example. @10.53.0.1 -b 10.53.0.5 -p 5300 | sed 1q | \ + egrep '10.53.0.5$' >> test2.out || status=1 + +echo "I:exit status: $status" +exit $status |