common_tests.sh.in 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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 is used in a couple of IXFR tests.
  18. #
  19. # Preconditions:\n
  20. # The BIND 9 nameserver (ns1, 10.53.0.1, acting as the IXFR server) is loaded
  21. # with the N-4 version of the zone. (It may hold prior versions as well.)
  22. # Notifications are disabled.
  23. #
  24. # The BIND 10 nameserver (nsx2, 10.53.0.2, acting as the IXFR client) is loaded
  25. # with an earlier (unspecified) version of the zone.
  26. #
  27. # Actions:\n
  28. # This script updates the IXFR server with the N-2 and N-0 versions of the zone.
  29. # It then updates the BIND 10 configuration so that it looks for IXFRs from
  30. # the IXFR server and causes the server to send the client a NOTIFY. After
  31. # waiting for the client to update from the server, it compares ther zones of
  32. # the two system, reporting an error if they are different.
  33. #
  34. # Caller Actions:\n
  35. # The caller can pre-load the BIND 10 IXFR client with whatever version of the
  36. # zone it requires. It can also load the BIND 9 IXFR server with zones earlier
  37. # than N-4.
  38. #
  39. # After this test has finished, it is up to the caller to check the logs
  40. # to see if they report the expected behavior.
  41. #
  42. # \return 0 if the script executed successfully, non-zero otherwise
  43. # Set up variables etc.
  44. . @abs_top_builddir@/tests/system/conf.sh
  45. . $IXFR_TOP/ixfr_init.sh
  46. set -e
  47. # Store the SOA serial number of the BIND 10 client for later use.
  48. old_client_serial=`$DIG_SOA @$CLIENT_IP | $AWK '{print $3}'`
  49. echo "I:$CLIENT_NAME SOA serial of IXFR client is $old_client_serial"
  50. # Load the BIND 9 system (the IXFR server) with the "n - 2" and "n" version of
  51. # the zones. With ixfr-from-differences set to "yes", the nameserver should
  52. # generate the differences between them.
  53. echo "I:$SERVER_NAME updating IXFR-server for ixfr-in tests"
  54. update_server_zone $SERVER_NAME $SERVER_IP $IXFR_TOP/db.example.n2
  55. # Wait a bit - it seems that if two updates are loaded in quick succession,
  56. # the second sometimes gets lost.
  57. sleep 5
  58. update_server_zone $SERVER_NAME $SERVER_IP $IXFR_TOP/db.example.n0
  59. echo "I:$CLIENT_NAME forcing IXFR client to retrieve new version of the zone"
  60. $RUN_BINDCTL << .
  61. Xfrin retransfer zone_name="example"
  62. .
  63. # Wait for the client to update itself.
  64. wait_for_update $CLIENT_NAME $CLIENT_IP $old_client_serial
  65. # Has updated, compare the client and server's versions of the zone s- they
  66. # should be the same.
  67. compare_zones $SERVER_NAME $SERVER_IP $CLIENT_NAME $CLIENT_IP
  68. set +e