]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
[master] fix rpzrecurse test on windows
authorMark Andrews <marka@isc.org>
Thu, 8 Feb 2018 21:28:40 +0000 (13:28 -0800)
committerEvan Hunt <each@isc.org>
Thu, 8 Feb 2018 21:28:40 +0000 (13:28 -0800)
4887. [test] Enable the rpzrecurse test to run on Windows.
[RT #47093]

CHANGES
bin/named/control.c
bin/tests/system/conf.sh.in
bin/tests/system/conf.sh.win32
bin/tests/system/rpzrecurse/clean.sh
bin/tests/system/rpzrecurse/ns1/named.conf
bin/tests/system/rpzrecurse/setup.sh
bin/tests/system/rpzrecurse/tests.sh
win32utils/Configure

diff --git a/CHANGES b/CHANGES
index 4a77c00a7fb637c3d6eb65c64a79786cfbf41a7d..1f52d594ebf69a2ae646a7dc2699028fb6e4b45a 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,6 @@
+4887.  [test]          Enable the rpzrecurse test to run on Windows.
+                       [RT #47093]
+
 4886.  [doc]           Document dig -u in manpage. [RT #47150]
 
 4885.  [security]      update-policy rules that otherwise ignore the name
index 60f130bbc90548f6dcee70be4289a95c534a30a7..27e52957cd9d60009f2be7aa5c1e1c049f7b7d53 100644 (file)
@@ -114,7 +114,8 @@ named_control_docommand(isccc_sexpr_t *message, isc_boolean_t readonly,
        /*
         * Compare the 'command' parameter against all known control commands.
         */
-       if (command_compare(command, NAMED_COMMAND_NULL) ||
+       if ((command_compare(command, NAMED_COMMAND_NULL) &&
+            strlen(cmdline) == 4) ||
            command_compare(command, NAMED_COMMAND_STATUS))
        {
                log_level = ISC_LOG_DEBUG(1);
index 668341ac92788d1b32bbe3da7d44f0600a306455..bae8441a156823276818c4678c34af21adfea0c5 100644 (file)
@@ -125,6 +125,8 @@ else
         TESTSOCK6=false
 fi
 
+# Windows process management leave empty
+PSSUSPEND=
 
 PYTHON=@PYTHON@
 
@@ -231,6 +233,7 @@ export PIPEQUERIES
 export PK11DEL
 export PK11GEN
 export PK11LIST
+export PSSUSPEND
 export PYTHON
 export RANDFILE
 export RESOLVE
index b6f638c57d67d096818f841a2d49f9a3628aee58..9daf108c5d74fcd125c97b55e08f37372959fb03 100644 (file)
@@ -130,7 +130,11 @@ else
         TESTSOCK6=false
 fi
 
-
+#
+# PsSuspend is part of PSTools and can be downloaded from
+# https://download.sysinternals.com/files/PSTools.zip
+#
+PSSUSPEND=@PSSUSPEND@
 PYTHON=@PYTHON@
 
 #
@@ -221,6 +225,7 @@ export PIPEQUERIES
 export PK11DEL
 export PK11GEN
 export PK11LIST
+export PSSUSPEND
 export PYTHON
 export RANDFILE
 export RESOLVE
index 63997159e5033069ef66f7d94a5da6e1967d6d1d..99d5500619f33b231553eb9ddfdfa286f67f3904 100644 (file)
@@ -17,3 +17,4 @@ rm -f ns2/named.conf
 rm -f ns3/named.conf
 rm -f ns*/*core *core
 rm -f dnsrps*.conf dnsrpzd*
+rm -f ns*/session.key
index 0b0f268f59288423bac73eb1bab818ec78064d50..f7f4887b92de4694c96fc7af8670e34ad1adaa61 100644 (file)
@@ -19,6 +19,15 @@ options {
        querylog yes;
 };
 
+key rndc_key {
+        secret "1234abcd8765";
+        algorithm hmac-sha256;
+};
+
+controls {
+        inet 10.53.0.1 port 9953 allow { any; } keys { rndc_key; };
+};
+
 zone "." {
        type master;
        file "root.db";
index d4524043e9a7a03186c212bd006d9039bfd0e409..f5332044cbce91e048115ed202826a4520773003 100644 (file)
@@ -19,6 +19,7 @@ while getopts "xD" c; do
     case $c in
        x) set -x; DEBUG=-x;;
         D) TEST_DNSRPS="-D";;
+       N) NOCLEAN=set;;
        *) echo "$USAGE" 1>&2; exit 1;;
     esac
 done
@@ -28,7 +29,7 @@ if test "$#" -ne 0; then
     exit 1
 fi
 
-$SHELL clean.sh $DEBUG
+[ ${NOCLEAN:-unset} = unset ] && $SHELL clean.sh $DEBUG
 
 $PERL testgen.pl
 cp -f ns2/named.default.conf ns2/named.conf
index ac6fe954bfa40515e655543b9d2014b16f95bf20..38032175523d0c4272c356626d9803a8fad597a7 100644 (file)
@@ -40,41 +40,6 @@ trap 'exit 1' 1 2 15
 DNSRPSCMD=../rpz/dnsrps
 RNDCCMD="$RNDC -c $SYSTEMTESTTOP/common/rndc.conf -p 9953 -s"
 
-# Run the tests twice, first without DNSRPS and then with if it is available
-if [ -z "$DNSRPS_TEST_MODE" ]; then
-    if [ -e dnsrps-only ]; then
-        echo "I:'dnsrps-only' found: skipping native RPZ sub-test"
-    else
-        echo "I:running native RPZ sub-test"
-       $SHELL ./$0 -D1 $ARGS || status=1
-    fi
-
-    if [ -e dnsrps-off ]; then
-       echo "I:'dnsrps-off' found: skipping DNSRPS sub-test"
-    else
-       echo "I:attempting to configure servers with DNSRPS..."
-       $SHELL ./setup.sh -D $DEBUG
-       sed -n 's/^## /I:/p' dnsrps.conf
-       if grep '^#fail' dnsrps.conf >/dev/null; then
-           echo "I:exit status: 1"
-           exit 1
-       fi
-       if test -z "`grep '^#skip' dnsrps.conf`"; then
-           $RNDCCMD 10.53.0.2 reload
-           $RNDCCMD 10.53.0.3 reload
-           $RNDCCMD 10.53.0.2 flush
-           $RNDCCMD 10.53.0.3 flush
-           echo "I:running DNSRPS sub-test"
-           $SHELL ./$0 -D2 $ARGS || status=1
-        else
-            echo "I:DNSRPS sub-test skipped"
-       fi
-    fi
-
-    echo "I:exit status: $status"
-    exit $status
-fi
-
 # $1 = test name (such as 1a, 1b, etc. for which named.$1.conf exists)
 run_server() {
     TESTNAME=$1
@@ -109,6 +74,7 @@ expect_norecurse() {
     NAME=`sed -n -e "$LINE,"'$p' ns2/$TESTNAME.queries | head -n 1`
     t=`expr $t + 1`
     echo "I:testing $NAME doesn't recurse (${t})"
+    add_test_marker 10.53.0.2
     run_query $TESTNAME $LINE || {
        echo "I:test ${t} failed"
        status=1
@@ -124,339 +90,410 @@ expect_recurse() {
     NAME=`sed -n -e "$LINE,"'$p' ns2/$TESTNAME.queries | head -n 1`
     t=`expr $t + 1`
     echo "I:testing $NAME recurses (${t})"
+    add_test_marker 10.53.0.2
     run_query $TESTNAME $LINE && {
        echo "I:test ${t} failed"
        status=1
     }
 }
 
-# show whether and why DNSRPS is enabled or disabled
-sed -n 's/^## /I:/p' dnsrps.conf
+add_test_marker() {
+    for ns in $@
+    do
+       $RNDCCMD $ns null ---- test ${t} ----
+    done
+}
+
+case "$DNSRPS_TEST_MODE" in
+''|native|dnsrps);;
+*)
+  echo "bad test mode'${DNSRPS_TEST_MODE}' should be 'native' or 'dnsrps'"
+  exit 1
+  ;;
+esac
 
-t=`expr $t + 1`
-echo "I:testing that l1.l0 exists without RPZ (${t})"
-$DIG $DIGOPTS l1.l0 ns @10.53.0.2 -p 5300 > dig.out.${t}
-grep "status: NOERROR" dig.out.${t} > /dev/null 2>&1 || {
+for mode in ${DNSRPS_TEST_MODE:-native dnsrps}
+do
+  status=0
+  case $mode in
+  native)
+    if [ ${DNSRPS_TEST_MODE:-unset} = unset -a -e dnsrps-only ] ; then
+     echo "I:'dnsrps-only' found: skipping native RPZ sub-test"
+     continue
+    fi
+    ;;
+  dnsrps)
+    if [ ${DNSRPS_TEST_MODE:-unset} = unset -a -e dnsrps-off ] ; then
+      echo "I:'dnsrps-off' found: skipping DNSRPS sub-test"
+      continue
+    fi
+    if grep '^#skip' dnsrps.conf > /dev/null ; then
+      echo "I:DNSRPS sub-test skipped"
+      continue
+    fi
+    $SHELL ./setup.sh -N -D $DEBUG
+    $RNDCCMD 10.53.0.2 reload
+    $RNDCCMD 10.53.0.3 reload
+    $RNDCCMD 10.53.0.2 flush
+    $RNDCCMD 10.53.0.3 flush
+    ;;
+  esac
+
+  # show whether and why DNSRPS is enabled or disabled
+  sed -n 's/^## /I:/p' dnsrps.conf
+
+  t=`expr $t + 1`
+  echo "I:testing that l1.l0 exists without RPZ (${t})"
+  add_test_marker 10.53.0.2
+  $DIG $DIGOPTS l1.l0 ns @10.53.0.2 -p 5300 > dig.out.${t}
+  grep "status: NOERROR" dig.out.${t} > /dev/null 2>&1 || {
     echo "I:test ${t} failed"
     status=1
-}
+  }
 
-t=`expr $t + 1`
-echo "I:testing that l2.l1.l0 returns SERVFAIL without RPZ (${t})"
-$DIG $DIGOPTS l2.l1.l0 ns @10.53.0.2 -p 5300 > dig.out.${t}
-grep "status: SERVFAIL" dig.out.${t} > /dev/null 2>&1 || {
+  t=`expr $t + 1`
+  echo "I:testing that l2.l1.l0 returns SERVFAIL without RPZ (${t})"
+  add_test_marker 10.53.0.2
+  $DIG $DIGOPTS l2.l1.l0 ns @10.53.0.2 -p 5300 > dig.out.${t}
+  grep "status: SERVFAIL" dig.out.${t} > /dev/null 2>&1 || {
     echo "I:test ${t} failed"
     status=1
-}
-
-# Group 1
-run_server 1a
-expect_norecurse 1a 1
-run_server 1b
-expect_norecurse 1b 1
-expect_recurse 1b 2
-run_server 1c
-expect_norecurse 1c 1
-
-# Group 2
-run_server 2a
-for n in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
-do
+  }
+
+  # Group 1
+  run_server 1a
+  expect_norecurse 1a 1
+  run_server 1b
+  expect_norecurse 1b 1
+  expect_recurse 1b 2
+  run_server 1c
+  expect_norecurse 1c 1
+
+  # Group 2
+  run_server 2a
+  for n in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 \
+          21 22 23 24 25 26 27 28 29 30 31 32
+  do
     expect_norecurse 2a $n
-done
-expect_recurse 2a 33
-
-# Group 3
-run_server 3a
-expect_recurse 3a 1
-run_server 3b
-expect_recurse 3b 1
-run_server 3c
-expect_recurse 3c 1
-run_server 3d
-expect_norecurse 3d 1
-expect_recurse 3d 2
-run_server 3e
-expect_norecurse 3e 1
-expect_recurse 3e 2
-run_server 3f
-expect_norecurse 3f 1
-expect_recurse 3f 2
-
-# Group 4
-testlist="aa ap bf"
-values="1 16 32"
-# Uncomment the following to test every skip value instead of 
-# only a sample of values
-#
-#testlist="aa ab ac ad ae af ag ah ai aj ak al am an ao ap \
-#          aq ar as at au av aw ax ay az ba bb bc bd be bf"
-#values="1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 \
-#        21 22 23 24 25 26 27 28 29 30 31 32"
-set -- $values
-for n in $testlist; do
+  done
+  expect_recurse 2a 33
+
+  # Group 3
+  run_server 3a
+  expect_recurse 3a 1
+  run_server 3b
+  expect_recurse 3b 1
+  run_server 3c
+  expect_recurse 3c 1
+  run_server 3d
+  expect_norecurse 3d 1
+  expect_recurse 3d 2
+  run_server 3e
+  expect_norecurse 3e 1
+  expect_recurse 3e 2
+  run_server 3f
+  expect_norecurse 3f 1
+  expect_recurse 3f 2
+
+  # Group 4
+  testlist="aa ap bf"
+  values="1 16 32"
+  # Uncomment the following to test every skip value instead of
+  # only a sample of values
+  #
+  #testlist="aa ab ac ad ae af ag ah ai aj ak al am an ao ap \
+  #          aq ar as at au av aw ax ay az ba bb bc bd be bf"
+  #values="1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 \
+  #        21 22 23 24 25 26 27 28 29 30 31 32"
+  set -- $values
+  for n in $testlist; do
     run_server 4$n
     ni=$1
     t=`expr $t + 1`
     echo "I:testing that ${ni} of 33 queries skip recursion (${t})"
+    add_test_marker 10.53.0.2
     c=0
     for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 \
             17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
     do
-       run_query 4$n $i
-       c=`expr $c + $?`
+      run_query 4$n $i
+      c=`expr $c + $?`
     done
     skipped=`expr 33 - $c`
     if [ $skipped != $ni ]; then
-       echo "I:test $t failed (actual=$skipped, expected=$ni)"
-       status=1
+      echo "I:test $t failed (actual=$skipped, expected=$ni)"
+      status=1
     fi
     shift
-done
-
-# Group 5
-run_server 5a
-expect_norecurse 5a 1
-expect_norecurse 5a 2
-expect_recurse 5a 3
-expect_recurse 5a 4
-expect_recurse 5a 5
-expect_recurse 5a 6
-
-# Group 6
-echo "I:check recursive behavior consistency during policy update races"
-run_server 6a
-sleep 1
-t=`expr $t + 1`
-echo "I:running dig to cache CNAME record (${t})"
-$DIG $DIGOPTS @10.53.0.2 -p 5300 www.test.example.org CNAME > dig.out.${t}
-sleep 1
-echo "I:suspending authority server"
-if [ "$CYGWIN" ]; then
-    WINPID=`cat ns1/named.pid`
-    PID=`ps | sed 's/^..//' | awk '$4 == '$WINPID | awk '{print $1}'`
-else
-    PID=`cat ns1/named.pid`
-fi
-kill -TSTP $PID
-echo "I:adding an NSDNAME policy"
-cp ns2/db.6a.00.policy.local ns2/saved.policy.local
-cp ns2/db.6b.00.policy.local ns2/db.6a.00.policy.local
-$RNDC -c ../common/rndc.conf -s 10.53.0.2 -p 9953 reload 6a.00.policy.local 2>&1 | sed 's/^/I:ns2 /'
-test -f dnsrpzd.pid && kill -USR1 `cat dnsrpzd.pid`
-sleep 1
-t=`expr $t + 1`
-echo "I:running dig to follow CNAME (blocks, so runs in the background) (${t})"
-$DIG $DIGOPTS @10.53.0.2 -p 5300 www.test.example.org A > dig.out.${t} &
-sleep 1
-echo "I:removing the NSDNAME policy"
-cp ns2/db.6c.00.policy.local ns2/db.6a.00.policy.local
-$RNDC -c ../common/rndc.conf -s 10.53.0.2 -p 9953 reload 6a.00.policy.local 2>&1 | sed 's/^/I:ns2 /'
-test -f dnsrpzd.pid && kill -USR1 `cat dnsrpzd.pid`
-sleep 1
-echo "I:resuming authority server"
-if [ "$CYGWIN" ]; then
-    WINPID=`cat ns1/named.pid`
-    PID=`ps | sed 's/^..//' | awk '$4 == '$WINPID | awk '{print $1}'`
-else
+  done
+
+  # Group 5
+  run_server 5a
+  expect_norecurse 5a 1
+  expect_norecurse 5a 2
+  expect_recurse 5a 3
+  expect_recurse 5a 4
+  expect_recurse 5a 5
+  expect_recurse 5a 6
+
+  if [ ! "$CYGWIN" -o -n "$PSSUSPEND" ]
+  then
+    # Group 6
+    echo "I:check recursive behavior consistency during policy update races"
+    run_server 6a
+    sleep 1
+    t=`expr $t + 1`
+    echo "I:running dig to cache CNAME record (${t})"
+    add_test_marker 10.53.0.1 10.53.0.2
+    $DIG $DIGOPTS @10.53.0.2 -p 5300 www.test.example.org CNAME > dig.out.${t}
+    sleep 1
+    echo "I:suspending authority server"
     PID=`cat ns1/named.pid`
-fi
-kill -CONT $PID
-for n in 1 2 3 4 5 6 7 8 9; do
+    if [ "$CYGWIN" ]
+    then
+      $PSSUSPEND $PID
+    else
+      $KILL -STOP $PID
+    fi
+    echo "I:adding an NSDNAME policy"
+    cp ns2/db.6a.00.policy.local ns2/saved.policy.local
+    cp ns2/db.6b.00.policy.local ns2/db.6a.00.policy.local
+    $RNDC -c ../common/rndc.conf -s 10.53.0.2 -p 9953 reload 6a.00.policy.local 2>&1 | sed 's/^/I:ns2 /'
+    test -f dnsrpzd.pid && $KILL -USR1 `cat dnsrpzd.pid`
     sleep 1
-    [ -s dig.out.${t} ] || continue
-    grep "status: .*," dig.out.${t} > /dev/null 2>&1 && break
-done
-grep "status: NOERROR" dig.out.${t} > /dev/null 2>&1 || {
-    echo "I:test ${t} failed"
-    status=1
-}
-
-echo "I:check recursive behavior consistency during policy removal races"
-cp ns2/saved.policy.local ns2/db.6a.00.policy.local
-run_server 6a
-sleep 1
-t=`expr $t + 1`
-echo "I:running dig to cache CNAME record (${t})"
-$DIG $DIGOPTS @10.53.0.2 -p 5300 www.test.example.org CNAME > dig.out.${t}
-sleep 1
-echo "I:suspending authority server"
-if [ "$CYGWIN" ]; then
-    WINPID=`cat ns1/named.pid`
-    PID=`ps | sed 's/^..//' | awk '$4 == '$WINPID | awk '{print $1}'`
-else
+    t=`expr $t + 1`
+    echo "I:running dig to follow CNAME (blocks, so runs in the background) (${t})"
+    add_test_marker 10.53.0.2
+    $DIG $DIGOPTS @10.53.0.2 -p 5300 www.test.example.org A > dig.out.${t} &
+    sleep 1
+    echo "I:removing the NSDNAME policy"
+    cp ns2/db.6c.00.policy.local ns2/db.6a.00.policy.local
+    $RNDC -c ../common/rndc.conf -s 10.53.0.2 -p 9953 reload 6a.00.policy.local 2>&1 | sed 's/^/I:ns2 /'
+    test -f dnsrpzd.pid && $KILL -USR1 `cat dnsrpzd.pid`
+    sleep 1
+    echo "I:resuming authority server"
     PID=`cat ns1/named.pid`
-fi
-kill -TSTP $PID
-echo "I:adding an NSDNAME policy"
-cp ns2/db.6b.00.policy.local ns2/db.6a.00.policy.local
-$RNDC -c ../common/rndc.conf -s 10.53.0.2 -p 9953 reload 6a.00.policy.local 2>&1 | sed 's/^/I:ns2 /'
-test -f dnsrpzd.pid && kill -USR1 `cat dnsrpzd.pid`
-sleep 1
-t=`expr $t + 1`
-echo "I:running dig to follow CNAME (blocks, so runs in the background) (${t})"
-$DIG $DIGOPTS @10.53.0.2 -p 5300 www.test.example.org A > dig.out.${t} &
-sleep 1
-echo "I:removing the policy zone"
-cp ns2/named.default.conf ns2/named.conf
-$RNDC -c ../common/rndc.conf -s 10.53.0.2 -p 9953 reconfig 2>&1 | sed 's/^/I:ns2 /'
-test -f dnsrpzd.pid && kill -USR1 `cat dnsrpzd.pid`
-sleep 1
-echo "I:resuming authority server"
-if [ "$CYGWIN" ]; then
-    WINPID=`cat ns1/named.pid`
-    PID=`ps | sed 's/^..//' | awk '$4 == '$WINPID | awk '{print $1}'`
-else
+    if [ "$CYGWIN" ]
+    then
+      $PSSUSPEND -r $PID
+    else
+      $KILL -CONT $PID
+    fi
+    add_test_marker 10.53.0.1
+    for n in 1 2 3 4 5 6 7 8 9
+    do
+      sleep 1
+      [ -s dig.out.${t} ] || continue
+      grep "status: .*," dig.out.${t} > /dev/null 2>&1 && break
+    done
+    grep "status: NOERROR" dig.out.${t} > /dev/null 2>&1 || {
+      echo "I:test ${t} failed"
+      status=1
+    }
+
+    echo "I:check recursive behavior consistency during policy removal races"
+    cp ns2/saved.policy.local ns2/db.6a.00.policy.local
+    run_server 6a
+    sleep 1
+    t=`expr $t + 1`
+    echo "I:running dig to cache CNAME record (${t})"
+    add_test_marker 10.53.0.1 10.53.0.2
+    $DIG $DIGOPTS @10.53.0.2 -p 5300 www.test.example.org CNAME > dig.out.${t}
+    sleep 1
+    echo "I:suspending authority server"
     PID=`cat ns1/named.pid`
-fi
-kill -CONT $PID
-for n in 1 2 3 4 5 6 7 8 9; do
+    if [ "$CYGWIN" ]
+    then
+      $PSSUSPEND $PID
+    else
+      $KILL -STOP $PID
+    fi
+    echo "I:adding an NSDNAME policy"
+    cp ns2/db.6b.00.policy.local ns2/db.6a.00.policy.local
+    $RNDC -c ../common/rndc.conf -s 10.53.0.2 -p 9953 reload 6a.00.policy.local 2>&1 | sed 's/^/I:ns2 /'
+    test -f dnsrpzd.pid && $KILL -USR1 `cat dnsrpzd.pid`
     sleep 1
-    [ -s dig.out.${t} ] || continue
-    grep "status: .*," dig.out.${t} > /dev/null 2>&1 && break
-done
-grep "status: NOERROR" dig.out.${t} > /dev/null 2>&1 || {
-     echo "I:test ${t} failed"
-     status=1
-}
-
-# Check CLIENT-IP behavior
-t=`expr $t + 1`
-echo "I:testing CLIENT-IP behavior (${t})"
-run_server clientip
-$DIG $DIGOPTS l2.l1.l0 a @10.53.0.2 -p 5300 -b 10.53.0.4 > dig.out.${t}
-grep "status: NOERROR" dig.out.${t} > /dev/null 2>&1 || {
+    t=`expr $t + 1`
+    echo "I:running dig to follow CNAME (blocks, so runs in the background) (${t})"
+    add_test_marker 10.53.0.2
+    $DIG $DIGOPTS @10.53.0.2 -p 5300 www.test.example.org A > dig.out.${t} &
+    sleep 1
+    echo "I:removing the policy zone"
+    cp ns2/named.default.conf ns2/named.conf
+    $RNDC -c ../common/rndc.conf -s 10.53.0.2 -p 9953 reconfig 2>&1 | sed 's/^/I:ns2 /'
+    test -f dnsrpzd.pid && $KILL -USR1 `cat dnsrpzd.pid`
+    sleep 1
+    echo "I:resuming authority server"
+    PID=`cat ns1/named.pid`
+    if [ "$CYGWIN" ]
+    then
+      $PSSUSPEND -r $PID
+    else
+      $KILL -CONT $PID
+    fi
+    add_test_marker 10.53.0.1
+    for n in 1 2 3 4 5 6 7 8 9; do
+      sleep 1
+      [ -s dig.out.${t} ] || continue
+      grep "status: .*," dig.out.${t} > /dev/null 2>&1 && break
+    done
+    grep "status: NOERROR" dig.out.${t} > /dev/null 2>&1 || {
+      echo "I:test ${t} failed"
+      status=1
+    }
+  fi
+
+  # Check CLIENT-IP behavior
+  t=`expr $t + 1`
+  echo "I:testing CLIENT-IP behavior (${t})"
+  add_test_marker 10.53.0.2
+  run_server clientip
+  $DIG $DIGOPTS l2.l1.l0 a @10.53.0.2 -p 5300 -b 10.53.0.4 > dig.out.${t}
+  grep "status: NOERROR" dig.out.${t} > /dev/null 2>&1 || {
     echo "I:test $t failed: query failed"
     status=1
-}
-grep "^l2.l1.l0.[      ]*[0-9]*[       ]*IN[   ]*A[    ]*10.53.0.2" dig.out.${t} > /dev/null 2>&1 || {
+  }
+  grep "^l2.l1.l0.[    ]*[0-9]*[       ]*IN[   ]*A[    ]*10.53.0.2" dig.out.${t} > /dev/null 2>&1 || {
     echo "I:test $t failed: didn't get expected answer"
     status=1
-}
-
-# Check CLIENT-IP behavior #2
-t=`expr $t + 1`
-echo "I:testing CLIENT-IP behavior #2 (${t})"
-run_server clientip2
-$DIG $DIGOPTS l2.l1.l0 a @10.53.0.2 -p 5300 -b 10.53.0.1 > dig.out.${t}.1
-grep "status: SERVFAIL" dig.out.${t}.1 > /dev/null 2>&1 || {
+  }
+
+  # Check CLIENT-IP behavior #2
+  t=`expr $t + 1`
+  echo "I:testing CLIENT-IP behavior #2 (${t})"
+  add_test_marker 10.53.0.2
+  run_server clientip2
+  $DIG $DIGOPTS l2.l1.l0 a @10.53.0.2 -p 5300 -b 10.53.0.1 > dig.out.${t}.1
+  grep "status: SERVFAIL" dig.out.${t}.1 > /dev/null 2>&1 || {
     echo "I:test $t failed: query failed"
     status=1
-}
-$DIG $DIGOPTS l2.l1.l0 a @10.53.0.2 -p 5300 -b 10.53.0.2 > dig.out.${t}.2
-grep "status: NXDOMAIN" dig.out.${t}.2 > /dev/null 2>&1 || {
+  }
+  $DIG $DIGOPTS l2.l1.l0 a @10.53.0.2 -p 5300 -b 10.53.0.2 > dig.out.${t}.2
+  grep "status: NXDOMAIN" dig.out.${t}.2 > /dev/null 2>&1 || {
     echo "I:test $t failed: query failed"
     status=1
-}
-$DIG $DIGOPTS l2.l1.l0 a @10.53.0.2 -p 5300 -b 10.53.0.3 > dig.out.${t}.3
-grep "status: NOERROR" dig.out.${t}.3 > /dev/null 2>&1 || {
+  }
+  $DIG $DIGOPTS l2.l1.l0 a @10.53.0.2 -p 5300 -b 10.53.0.3 > dig.out.${t}.3
+  grep "status: NOERROR" dig.out.${t}.3 > /dev/null 2>&1 || {
     echo "I:test $t failed: query failed"
     status=1
-}
-grep "^l2.l1.l0.[      ]*[0-9]*[       ]*IN[   ]*A[    ]*10.53.0.1" dig.out.${t}.3 > /dev/null 2>&1 || {
+  }
+  grep "^l2.l1.l0.[    ]*[0-9]*[       ]*IN[   ]*A[    ]*10.53.0.1" dig.out.${t}.3 > /dev/null 2>&1 || {
     echo "I:test $t failed: didn't get expected answer"
     status=1
-}
-$DIG $DIGOPTS l2.l1.l0 a @10.53.0.2 -p 5300 -b 10.53.0.4 > dig.out.${t}.4
-grep "status: SERVFAIL" dig.out.${t}.4 > /dev/null 2>&1 || {
+  }
+  $DIG $DIGOPTS l2.l1.l0 a @10.53.0.2 -p 5300 -b 10.53.0.4 > dig.out.${t}.4
+  grep "status: SERVFAIL" dig.out.${t}.4 > /dev/null 2>&1 || {
     echo "I:test $t failed: query failed"
     status=1
-}
-
-# Check RPZ log clause
-t=`expr $t + 1`
-echo "I:testing RPZ log clause (${t})"
-run_server log
-cur=`awk 'BEGIN {l=0} /^/ {l++} END { print l }' ns2/named.run`
-$DIG $DIGOPTS l2.l1.l0 a @10.53.0.2 -p 5300 -b 10.53.0.4 > dig.out.${t}
-$DIG $DIGOPTS l2.l1.l0 a @10.53.0.2 -p 5300 -b 10.53.0.3 >> dig.out.${t}
-$DIG $DIGOPTS l2.l1.l0 a @10.53.0.2 -p 5300 -b 10.53.0.2 >> dig.out.${t}
-sed -n "$cur,"'$p' < ns2/named.run | grep "view recursive: rpz CLIENT-IP Local-Data rewrite l2.l1.l0 via 32.4.0.53.10.rpz-client-ip.log1" > /dev/null && {
+  }
+
+  # Check RPZ log clause
+  t=`expr $t + 1`
+  echo "I:testing RPZ log clause (${t})"
+  add_test_marker 10.53.0.2
+  run_server log
+  cur=`awk 'BEGIN {l=0} /^/ {l++} END { print l }' ns2/named.run`
+  $DIG $DIGOPTS l2.l1.l0 a @10.53.0.2 -p 5300 -b 10.53.0.4 > dig.out.${t}
+  $DIG $DIGOPTS l2.l1.l0 a @10.53.0.2 -p 5300 -b 10.53.0.3 >> dig.out.${t}
+  $DIG $DIGOPTS l2.l1.l0 a @10.53.0.2 -p 5300 -b 10.53.0.2 >> dig.out.${t}
+  sed -n "$cur,"'$p' < ns2/named.run | grep "view recursive: rpz CLIENT-IP Local-Data rewrite l2.l1.l0 via 32.4.0.53.10.rpz-client-ip.log1" > /dev/null && {
     echo "I: failed: unexpected rewrite message for policy zone log1 was logged"
     status=1
-}
-sed -n "$cur,"'$p' < ns2/named.run | grep "view recursive: rpz CLIENT-IP Local-Data rewrite l2.l1.l0 via 32.3.0.53.10.rpz-client-ip.log2" > /dev/null || {
+  }
+  sed -n "$cur,"'$p' < ns2/named.run | grep "view recursive: rpz CLIENT-IP Local-Data rewrite l2.l1.l0 via 32.3.0.53.10.rpz-client-ip.log2" > /dev/null || {
     echo "I: failed: expected rewrite message for policy zone log2 was not logged"
     status=1
-}
-sed -n "$cur,"'$p' < ns2/named.run | grep "view recursive: rpz CLIENT-IP Local-Data rewrite l2.l1.l0 via 32.2.0.53.10.rpz-client-ip.log3" > /dev/null || {
+  }
+  sed -n "$cur,"'$p' < ns2/named.run | grep "view recursive: rpz CLIENT-IP Local-Data rewrite l2.l1.l0 via 32.2.0.53.10.rpz-client-ip.log3" > /dev/null || {
     echo "I: failed: expected rewrite message for policy zone log3 was not logged"
     status=1
-}
+  }
 
-# Check wildcard behavior
+  # Check wildcard behavior
 
-t=`expr $t + 1`
-echo "I:testing wildcard behavior with 1 RPZ zone (${t})"
-run_server wildcard1
-$DIG $DIGOPTS www.test1.example.net a @10.53.0.2 -p 5300 > dig.out.${t}.1
-grep "status: NXDOMAIN" dig.out.${t}.1 > /dev/null || {
+  t=`expr $t + 1`
+  echo "I:testing wildcard behavior with 1 RPZ zone (${t})"
+  add_test_marker 10.53.0.2
+  run_server wildcard1
+  $DIG $DIGOPTS www.test1.example.net a @10.53.0.2 -p 5300 > dig.out.${t}.1
+  grep "status: NXDOMAIN" dig.out.${t}.1 > /dev/null || {
     echo "I:test ${t} failed"
     status=1
-}
-$DIG $DIGOPTS test1.example.net a @10.53.0.2 -p 5300 > dig.out.${t}.2
-grep "status: NXDOMAIN" dig.out.${t}.2 > /dev/null || {
+  }
+  $DIG $DIGOPTS test1.example.net a @10.53.0.2 -p 5300 > dig.out.${t}.2
+  grep "status: NXDOMAIN" dig.out.${t}.2 > /dev/null || {
     echo "I:test ${t} failed"
     status=1
-}
-
-t=`expr $t + 1`
-echo "I:testing wildcard behavior with 2 RPZ zones (${t})"
-run_server wildcard2
-$DIG $DIGOPTS www.test1.example.net a @10.53.0.2 -p 5300 > dig.out.${t}.1
-grep "status: NXDOMAIN" dig.out.${t}.1 > /dev/null || {
+  }
+
+  t=`expr $t + 1`
+  echo "I:testing wildcard behavior with 2 RPZ zones (${t})"
+  add_test_marker 10.53.0.2
+  run_server wildcard2
+  $DIG $DIGOPTS www.test1.example.net a @10.53.0.2 -p 5300 > dig.out.${t}.1
+  grep "status: NXDOMAIN" dig.out.${t}.1 > /dev/null || {
     echo "I:test ${t} failed"
     status=1
-}
-$DIG $DIGOPTS test1.example.net a @10.53.0.2 -p 5300 > dig.out.${t}.2
-grep "status: NXDOMAIN" dig.out.${t}.2 > /dev/null || {
+  }
+  $DIG $DIGOPTS test1.example.net a @10.53.0.2 -p 5300 > dig.out.${t}.2
+  grep "status: NXDOMAIN" dig.out.${t}.2 > /dev/null || {
     echo "I:test ${t} failed"
     status=1
-}
-
-t=`expr $t + 1`
-echo "I:testing wildcard behavior with 1 RPZ zone and no non-wildcard triggers (${t})"
-run_server wildcard3
-$DIG $DIGOPTS www.test1.example.net a @10.53.0.2 -p 5300 > dig.out.${t}.1
-grep "status: NXDOMAIN" dig.out.${t}.1 > /dev/null || {
+  }
+
+  t=`expr $t + 1`
+  echo "I:testing wildcard behavior with 1 RPZ zone and no non-wildcard triggers (${t})"
+  add_test_marker 10.53.0.2
+  run_server wildcard3
+  $DIG $DIGOPTS www.test1.example.net a @10.53.0.2 -p 5300 > dig.out.${t}.1
+  grep "status: NXDOMAIN" dig.out.${t}.1 > /dev/null || {
     echo "I:test ${t} failed"
     status=1
-}
-$DIG $DIGOPTS test1.example.net a @10.53.0.2 -p 5300 > dig.out.${t}.2
-grep "status: NOERROR" dig.out.${t}.2 > /dev/null || {
+  }
+  $DIG $DIGOPTS test1.example.net a @10.53.0.2 -p 5300 > dig.out.${t}.2
+  grep "status: NOERROR" dig.out.${t}.2 > /dev/null || {
     echo "I:test ${t} failed"
     status=1
-}
+  }
+
+  t=`expr $t + 1`
+  echo "I:checking 'nsip-wait-recurse no' is faster than 'nsip-wait-recurse yes' ($t)"
+  add_test_marker 10.53.0.2
+  echo "I:timing 'nsip-wait-recurse yes' (default)"
+  ret=0
+  t1=`$PERL -e 'print time()."\n";'`
+  $DIG -p 5300 @10.53.0.3 foo.child.example.tld a > dig.out.yes.$t
+  t2=`$PERL -e 'print time()."\n";'`
+  p1=`expr $t2 - $t1`
+  echo "I:elasped time $p1 seconds"
+
+  $RNDC  -c ../common/rndc.conf -s 10.53.0.3 -p 9953 flush
+  cp -f ns3/named2.conf ns3/named.conf
+  $RNDC  -c ../common/rndc.conf -s 10.53.0.3 -p 9953 reload > /dev/null
+
+  echo "I:timing 'nsip-wait-recurse no'"
+  t3=`$PERL -e 'print time()."\n";'`
+  $DIG -p 5300 @10.53.0.3 foo.child.example.tld a > dig.out.no.$t
+  t4=`$PERL -e 'print time()."\n";'`
+  p2=`expr $t4 - $t3`
+  echo "I:elasped time $p2 seconds"
+
+  if test $p1 -le $p2; then ret=1; fi
+  if test $ret != 0; then echo "I:failed"; fi
+  status=`expr $status + $ret`
+
+  [ $status -ne 0 ] && pf=fail || pf=pass
+  case $mode in
+  native)
+    native=$status
+    echo "I:status (native RPZ sub-test): $status ($pf)";;
+  dnsrps)
+    dnsrps=$status
+    echo "I:status (DNSRPS sub-test): $status ($pf)";;
+  *) echo "I:invalid test mode";;
+  esac
+done
+status=`expr ${native:-0} + ${dnsrps:-0}`
 
-t=`expr $t + 1`
-echo "I:checking 'nsip-wait-recurse no' is faster than 'nsip-wait-recurse yes' ($t)"
-echo "I:timing 'nsip-wait-recurse yes' (default)"
-ret=0
-t1=`$PERL -e 'print time()."\n";'`
-$DIG -p 5300 @10.53.0.3 foo.child.example.tld a > dig.out.yes.$t
-t2=`$PERL -e 'print time()."\n";'`
-p1=`expr $t2 - $t1`
-echo "I:elasped time $p1 seconds"
-
-$RNDC  -c ../common/rndc.conf -s 10.53.0.3 -p 9953 flush
-cp -f ns3/named2.conf ns3/named.conf
-$RNDC  -c ../common/rndc.conf -s 10.53.0.3 -p 9953 reload > /dev/null
-
-echo "I:timing 'nsip-wait-recurse no'"
-t3=`$PERL -e 'print time()."\n";'`
-$DIG -p 5300 @10.53.0.3 foo.child.example.tld a > dig.out.no.$t
-t4=`$PERL -e 'print time()."\n";'`
-p2=`expr $t4 - $t3`
-echo "I:elasped time $p2 seconds"
-
-if test $p1 -le $p2; then ret=1; fi
-if test $ret != 0; then echo "I:failed"; fi
-status=`expr $status + $ret`
-
-[ $status -ne 0 ] && pf=fail || pf=pass
-case $DNSRPS_TEST_MODE in
-        1) echo "I:status (native RPZ sub-test): $status ($pf)";;
-        2) echo "I:status (DNSRPS sub-test): $status ($pf)";;
-    *) echo "I:invalid test mode";;
-esac
 [ $status -eq 0 ] || exit 1
index bf57e4046b1f8f838d9c0e86b5f9751ea68e4933..771a8c0ba42a1e9506855ab0c8732c96c5fbe9a6 100644 (file)
@@ -344,6 +344,7 @@ my @substvar = ("BIND9_VERSION",
                 "PLATFORM",
                 "PKCS11_TOOLS",
                 "prefix",
+                "PSSUSPEND",
                 "PYTHON",
                 "PYTHON_INSTALL_DIR",
                 "VCREDIST_PATH"),
@@ -412,6 +413,7 @@ my @withlist = ("aes",
                 "openssl",
                 "libxml2",
                 "pkcs11",
+                "pssuspend",
                 "python",
                 "readline",
                 "samples",
@@ -469,6 +471,7 @@ my @help = (
 "  with-gssapi[=PATH]    build with MIT KfW GSSAPI yes|no|path\n",
 "  with-libxml2[=PATH]   build with libxml2 library yes|no|path\n",
 "  with-geoip[=PATH]     build with GeoIP support yes|no|path\n",
+"  with-pssuspend[=COMMAND] specify pssuspend command\n",
 "  with-python[=COMMAND] specify python interpreter python|command\n",
 "  with-readline[=PATH]  build with readline library support yes|no|path\n",
 "  with-idn[=PATH]       build with IDN kit support yes|no|path\n",
@@ -520,6 +523,8 @@ my $use_geoip = "no";
 my $geoip_path = "";
 my $use_libxml2 = "auto";
 my $libxml2_path = "..\\..\\";
+my $with_pssuspend = "no";
+my $pssuspend_command = "pssuspend.exe";
 my $use_python = "auto";
 my $python_command = "python.exe";
 my $use_readline = "no";
@@ -875,6 +880,14 @@ sub mywith {
                 $zlib_path = $val;
             }
         }
+    } elsif ($key =~ /^pssuspend$/i) {
+       if ($val =~ /^no$/i) {
+           $with_pssuspend = "no";
+       } else {
+           if ($val !~ /^yes$/i) {
+               $pssuspend_command = $val;
+           }
+        }
     } elsif ($key =~ /^python$/i) {
         if ($val =~ /^no$/i) {
             $use_python = "no";
@@ -1103,6 +1116,11 @@ if ($verbose) {
     } else {
         print "zlib-path: $zlib_path\n";
     }
+    if ($with_pssuspend eq "no") {
+        print "pssuspend: disabled\n";
+    } else {
+        print "pssuspend-command: $pssuspend_command\n";
+    }
     if ($use_python eq "no") {
         print "python: disabled\n";
     } else {
@@ -2487,6 +2505,10 @@ if ($use_zlib eq "no") {
     $configdll{"ZLIB_DLL"} = "$zlib_dll";
 }
 
+if ($with_pssuspend ne "no") {
+    $configvar{"PSSUSPEND"} = "$pssuspend_command";
+}
+
 # with-python
 if ($use_python eq "no") {
     if ($verbose) {