summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Schwenke <martin@meltin.net>2018-09-20 15:24:43 +1000
committerAmitay Isaacs <amitay@samba.org>2018-10-08 02:46:23 +0200
commit36eb7388775f7e931d102d71b867c4985830df17 (patch)
tree9099def48de17e114275253836b747e97ad9939c
parent03dddc37b5f0f7e9a56fbe5299816b31053c2480 (diff)
downloadsamba-36eb7388775f7e931d102d71b867c4985830df17.tar.gz
ctdb-tests: Be more careful when building node addresses
The goal is to allow more local daemons by expanding the address range rather than generating invalid addresses. For IPv6, use all 4 trailing hex digits. For IPv4, use the last 2 octets. Although 127.0.0.0 is a /8 network, avoid unexpected issues due to 0 and 255 in the last octet. Use a maximum of 100 addresses per "subnet" starting at .1. Keep the first group of addresses in 127.0.0.0/24 to continue to allow a reasonable number of nodes to be tested with socket-wrapper. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
-rw-r--r--ctdb/tests/simple/scripts/local_daemons.bash11
1 files changed, 6 insertions, 5 deletions
diff --git a/ctdb/tests/simple/scripts/local_daemons.bash b/ctdb/tests/simple/scripts/local_daemons.bash
index fa6e08029bb..5b58dda05fc 100644
--- a/ctdb/tests/simple/scripts/local_daemons.bash
+++ b/ctdb/tests/simple/scripts/local_daemons.bash
@@ -39,10 +39,10 @@ setup_nodes ()
{
local have_all_ips=true
local i
- for i in $(seq 1 $TEST_LOCAL_DAEMONS) ; do
+ for i in $(seq 0 $((TEST_LOCAL_DAEMONS - 1)) ) ; do
if [ -n "$CTDB_USE_IPV6" ]; then
- local j=$(printf "%02x" $i)
- local node_ip="fd00::5357:5f${j}"
+ local j=$(printf "%04x" $((0x5f00 + 1 + i)) )
+ local node_ip="fd00::5357:${j}"
if have_ip "$node_ip" ; then
echo "$node_ip"
else
@@ -52,8 +52,9 @@ EOF
have_all_ips=false
fi
else
- local j=$((i + 10))
- echo "127.0.0.${j}"
+ local c=$(( i / 100 ))
+ local d=$(( 1 + (i % 100) ))
+ echo "127.0.${c}.${d}"
fi
done