tests.sh 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. #!/bin/sh
  2. #
  3. # Copyright (C) 2011 Internet Systems Consortium, Inc. ("ISC")
  4. #
  5. # Permission to use, copy, modify, and/or distribute this software for any
  6. # purpose with or without fee is hereby granted, provided that the above
  7. # copyright notice and this permission notice appear in all copies.
  8. #
  9. # THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
  10. # REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
  11. # AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
  12. # INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
  13. # LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
  14. # OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  15. # PERFORMANCE OF THIS SOFTWARE.
  16. # \file
  17. # This script performs the third IXFR-IN test. A BIND 9 nameserver (the
  18. # "server") contains a version of the zone (version N) and has IXFRs disabled.
  19. # A BIND 10 nameserver (the "client") is loaded with version N-2 of the zone.
  20. # A NOTIFY is sent to it, and it is expected that it will send an IXFR to the
  21. # server; the server should not respond to the request, so the client should
  22. # then send an AXFR request and receive the latest copy of the zone.
  23. # TODO It seems bind9 still allows IXFR even when provide-ixfr on;
  24. . ../ixfr_init.sh
  25. status=$?
  26. # Store the SOA serial number of the BIND 10 client for later use.
  27. old_client_serial=`$DIG_SOA @$CLIENT_IP | $AWK '{print $3}'`
  28. echo "I:SOA serial of IXFR client $CLIENT_NAME is $old_client_serial"
  29. # If required, get the IXFR server to notify the IXFR client of the new zone.
  30. # Do this by allowing notifies and then triggering a re-notification of the
  31. # server.
  32. echo "I:notifying IXFR-client $CLIENT_NAME of presence of new version of zone"
  33. do_rndc $SERVER_NAME $SERVER_IP notify example
  34. status=`expr $status + $?`
  35. # Wait for the client to update itself.
  36. wait_for_update $CLIENT_NAME $CLIENT_IP $old_client_serial
  37. status=`expr $status + $?`
  38. # Has updated, get the latest serial of the client and server - they
  39. # should be the same.
  40. compare_soa $SERVER_NAME $SERVER_IP $CLIENT_NAME $CLIENT_IP
  41. status=`expr $status + $?`
  42. # Check the log there's the IXFR and fallback
  43. grep XFRIN_XFR_TRANSFER_STARTED nsx2/bind10.run | grep IXFR
  44. if [ $? -ne 0 ];
  45. then
  46. echo "R:$CLIENT_NAME FAIL no 'IXFR started' message in the BIND 10 log"
  47. exit 1
  48. fi
  49. grep XFRIN_XFR_TRANSFER_FALLBACK nsx2/bind10.run
  50. if [ $? -ne 0 ];
  51. then
  52. echo "R:$CLIENT_NAME FAIL no fallback message in BIND10 log"
  53. exit 1
  54. fi
  55. echo "I:exit status: $status"
  56. exit $status