summaryrefslogtreecommitdiff
path: root/ctdb/tests
diff options
context:
space:
mode:
authorMartin Schwenke <martin@meltin.net>2018-09-20 15:26:08 +1000
committerAmitay Isaacs <amitay@samba.org>2018-10-08 02:46:23 +0200
commit0dfb3c87b50745012c6c8bab5e0af262ce3f5f87 (patch)
tree822b99ed4a3287e90864fb26b19932f69b73bbe5 /ctdb/tests
parent36eb7388775f7e931d102d71b867c4985830df17 (diff)
downloadsamba-0dfb3c87b50745012c6c8bab5e0af262ce3f5f87.tar.gz
ctdb-tests: Be more careful when building public IP addresses
The goal is to allow more local daemons by expanding the address range rather than generating invalid addresses. For IPv6, use a separate address space instead of an offset for the 2nd address. For IPv4, use the last 2 octets with addresses starting at 192.168.100.1 and 192.168.200.1. Avoid addresses with 0 and 255 in the last octet by using a maximum of 100 addresses per "subnet" starting at .1. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
Diffstat (limited to 'ctdb/tests')
-rw-r--r--ctdb/tests/simple/scripts/local_daemons.bash16
1 files changed, 9 insertions, 7 deletions
diff --git a/ctdb/tests/simple/scripts/local_daemons.bash b/ctdb/tests/simple/scripts/local_daemons.bash
index 5b58dda05fc..116fa40f424 100644
--- a/ctdb/tests/simple/scripts/local_daemons.bash
+++ b/ctdb/tests/simple/scripts/local_daemons.bash
@@ -67,20 +67,22 @@ setup_public_addresses ()
local pnn_no_ips="$1"
local i
- for i in $(seq 1 $TEST_LOCAL_DAEMONS) ; do
- if [ $((i - 1)) -eq $pnn_no_ips ] ; then
+ for i in $(seq 0 $((TEST_LOCAL_DAEMONS - 1)) ) ; do
+ if [ $i -eq $pnn_no_ips ] ; then
continue
fi
# 2 public addresses on most nodes, just to make
# things interesting
- local j=$((i + TEST_LOCAL_DAEMONS))
if [ -n "$CTDB_USE_IPV6" ]; then
- printf "fc00:10::1:%x/64 lo\n" "$i"
- printf "fc00:10::1:%x/64 lo\n" "$j"
+ printf "fc00:10::1:%x/64 lo\n" $((1 + i))
+ printf "fc00:10::2:%x/64 lo\n" $((1 + i))
else
- printf "192.168.234.${i}/24 lo\n"
- printf "192.168.234.${j}/24 lo\n"
+ local c1=$(( 100 + (i / 100) ))
+ local c2=$(( 200 + (i / 100) ))
+ local d=$(( 1 + (i % 100) ))
+ printf "192.168.${c1}.${d}/24 lo\n"
+ printf "192.168.${c2}.${d}/24 lo\n"
fi
done
}