Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Sebastian Schrader
Kea
Commits
8724a537
Commit
8724a537
authored
Oct 10, 2011
by
Stephen Morris
Browse files
[1213] Compare zones after update instead of just the SOA serial
parent
f5b0e46b
Changes
3
Hide whitespace changes
Inline
Side-by-side
tests/system/ixfr/clean.sh
View file @
8724a537
...
...
@@ -23,3 +23,6 @@ rm -f ns1/named.memstats
rm
-f
nsx2/bind10.run
rm
-f
nsx2/zone.sqlite3
rm
-f
client.dig
rm
-f
server.dig
tests/system/ixfr/common_tests.sh.in
View file @
8724a537
...
...
@@ -81,6 +81,6 @@ do_rndc $SERVER_NAME $SERVER_IP notify example
# Wait for the client to update itself.
wait_for_update
$CLIENT_NAME
$CLIENT_IP
$old_client_serial
# Has updated,
get the latest serial of the client and server
- they
# Has updated,
compare the client and server's versions of the zone s
- they
# should be the same.
compare_
soa
$SERVER_NAME
$SERVER_IP
$CLIENT_NAME
$CLIENT_IP
compare_
zones
$SERVER_NAME
$SERVER_IP
$CLIENT_NAME
$CLIENT_IP
tests/system/ixfr/ixfr_init.sh.in
View file @
8724a537
...
...
@@ -94,19 +94,18 @@ do_rndc () {
|
sed
"s/^/I:
$name
/"
}
#
w
ait
_
for
_
update
#
\brief W
ait
for
update
#
# Given a serial number and a server, poll the nameserver until the SOA serial
# number is different from that given. The poll takes place every five seconds
# for a minute.
#
# $1 - Name of the server
# $2 - IP address of the server
# $3 - Serial number to check against
#
\arg
$1 - Name of the server
#
\arg
$2 - IP address of the server
#
\arg
$3 - Serial number to check against
#
# Returns:
# 0 - Serial number is different (requires another poll to obtain it)
# 1 - Serial number has not changed
# \return 0 if the serial number is different (requires another poll to obtain
# it), 1 if the serial number has not changed.
wait_for_update
()
{
# If the following checks fail, the code is wrong.
...
...
@@ -115,7 +114,8 @@ wait_for_update() {
if
[
$?
-ne
0
]
;
then
echo
"R:FAIL wait_for_update - name or ip address of system not supplied"
return
1
return
1t
fi
name
=
$1
...
...
@@ -133,7 +133,8 @@ wait_for_update() {
# Now poll the server looking for the new serial number
for
i
in
1 2 3 4 5 6 7 8 9 10 11 12
echo
"I:waiting for SOA serial of
$name
to change from
$serial
"
for
i
in
`
seq
1 12
`
do
if
[
$i
-gt
1
]
;
then
...
...
@@ -153,15 +154,15 @@ wait_for_update() {
#
u
pdate
_
server
_
zone
#
\brief U
pdate
server
zone
#
# Reloads the example. zone in the BIND 9 IXFR server and waits a maximum of
# one minute for it to be served.
#
# $1 - Name of the server (ns1, nsx2 etc.)
# $2 - IP address of the server
# $3 - Zone file to load
# $* - Command to execute (which may be multiple tokens)
#
\arg
$1 - Name of the server (ns1, nsx2 etc.)
#
\arg
$2 - IP address of the server
#
\arg
$3 - Zone file to load
#
\arg
$* - Command to execute (which may be multiple tokens)
update_server_zone
()
{
# If the following checks fail, the code is wrong.
...
...
@@ -263,3 +264,59 @@ compare_soa() {
return
0
}
# \brief Compare client and server zones
#
# Checks the zones of two systems and reports if they are not identical.
#
# The check is simplistic. The zones are listed via "dig" and comment lines,
# blank lines and spaces/tabs are removed, then the output sorted. The two
# files are then compared. They should be identical.
#
# \arg $1 Name of the IXFR server
# \arg $2 IP of the IXFR server
# \arg $3 Name of the IXFR client
# \arg $4 IP of the IXFR client
#
# \return 0 if the zones are the same, 1 if not.
compare_zones
()
{
# If the following checks fail, the code is wrong.
check_name_ip
$*
if
[
$?
-ne
0
]
;
then
echo
"R:FAIL compare_zones - name or ip address of server not supplied"
return
1
fi
server_name
=
$1
shift
server_ip
=
$1
shift
check_name_ip
$*
if
[
$?
-ne
0
]
;
then
echo
"R:FAIL compare_zones - name or ip address of client not supplied"
return
1
fi
client_name
=
$1
shift
client_ip
=
$1
shift
$DIG
@
$client_ip
example. axfr |
grep
-v
'^;'
|
grep
-v
'^$'
\
|
sed
-e
's/ //g'
-e
's/\t//g'
>
client.dig
$DIG
@
$server_ip
example. axfr |
grep
-v
'^;'
|
grep
-v
'^$'
\
|
sed
-e
's/ //g'
-e
's/\t//g'
>
server.dig
diff client.dig server.dig
if
[
$?
-ne
0
]
;
then
echo
"R:FAIL client
$client_name
zone not same as server
$server_name
zone"
return
1
fi
return
0
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment