summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Schwenke <martin@meltin.net>2014-11-26 21:32:22 +1100
committerMartin Schwenke <martins@samba.org>2014-12-05 21:02:40 +0100
commitd9d07fff34143d251b4987cdb1cff1e8b3384e64 (patch)
tree77a3141425b4b035662468225b935281acc07a1e
parent2a83b74597a3366536e1935e2e8ff23493503117 (diff)
downloadsamba-d9d07fff34143d251b4987cdb1cff1e8b3384e64.tar.gz
samba-d9d07fff34143d251b4987cdb1cff1e8b3384e64.tar.xz
samba-d9d07fff34143d251b4987cdb1cff1e8b3384e64.zip
ctdb-tests: Try to handle IPv6 addresses for local daemons
If CTDB_USE_IPV6 is set then use IPv6 addresses for nodes and public IPs. This can be useful for some simple tests. However, the node address actually needs to be on lo so that ctdbd can bind to the port on that address, so they actually need to be added as root before running tests, like this: for i in $(seq 1 10) ; do ip addr add "fc00:10::${i}/64" dev lo ; done IPv4 127.0.0.0/8 addresses are somehow magic and only one needs to be on lo so that many can be bound to. Also change the IPv4 node addresses to be (slightly) more exotic. For both IPv4 and IPv6, choose addresses that are compatible with socket wrapper. Signed-off-by: Martin Schwenke <martin@meltin.net> Signed-off-by: Amitay Isaacs <amitay@gmail.com> (socket wrapper fixes) Reviewed-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net> (socket wrapper fixes)
-rw-r--r--ctdb/tests/simple/scripts/local_daemons.bash14
1 files changed, 11 insertions, 3 deletions
diff --git a/ctdb/tests/simple/scripts/local_daemons.bash b/ctdb/tests/simple/scripts/local_daemons.bash
index 58d679a5c7..6015dd539d 100644
--- a/ctdb/tests/simple/scripts/local_daemons.bash
+++ b/ctdb/tests/simple/scripts/local_daemons.bash
@@ -67,10 +67,18 @@ setup_ctdb ()
local i
for i in $(seq 1 $TEST_LOCAL_DAEMONS) ; do
if [ "${CTDB_USE_IPV6}x" != "x" ]; then
- echo ::$i >>"$CTDB_NODES"
- ip addr add ::$i/128 dev lo
+ j=$((printf "%02x" $i))
+ echo "fd00::5357:5f${j}" >>"$CTDB_NODES"
+ # FIXME: need to add addresses to lo as root before running :-(
+ # ip addr add "fc00:10::${i}/64" dev lo
+ # 2 public addresses on most nodes, just to make things interesting.
+ if [ $(($i - 1)) -ne $no_public_ips ] ; then
+ echo "fc00:10::1:${i}/64 lo" >>"$public_addresses_all"
+ echo "fc00:10::1:$(($i + $TEST_LOCAL_DAEMONS))/64 lo" >>"$public_addresses_all"
+ fi
else
- echo 127.0.0.$i >>"$CTDB_NODES"
+ j=$(( $i + 10))
+ echo 127.0.0.$j >>"$CTDB_NODES"
# 2 public addresses on most nodes, just to make things interesting.
if [ $(($i - 1)) -ne $no_public_ips ] ; then
echo "192.168.234.$i/24 lo" >>"$public_addresses_all"