From: Martin Schwenke Date: Thu, 20 Sep 2018 05:26:08 +0000 (+1000) Subject: ctdb-tests: Be more careful when building public IP addresses X-Git-Tag: tdb-1.3.17~1428 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=0dfb3c87b50745012c6c8bab5e0af262ce3f5f87;p=thirdparty%2Fsamba.git 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 Reviewed-by: Amitay Isaacs --- 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 }