tcptickle_sniff_start $src_socket "${test_ip}:${test_port}"
# We need to be nasty to make that the node being failed out doesn't
-# get a chance to send any tickles and confuse our sniff.
+# get a chance to send any tickles and confuse our sniff. IPs also
+# need to be dropped because we're simulating a dead node rather than
+# a CTDB failure. To properly handle a CTDB failure we would need a
+# watchdog to drop the IPs when CTDB disappears.
echo "Killing ctdbd on ${test_node}..."
-try_command_on_node $test_node killall -9 ctdbd
+try_command_on_node -v $test_node "killall -9 ctdbd ; $CTDB_TEST_WRAPPER drop_ips ${test_node_ips}"
wait_until_node_has_status $test_node disconnected
echo "Killing node $test_node"
try_command_on_node $test_node $CTDB getpid
pid=${out#*:}
-try_command_on_node $test_node kill -9 $pid
+# We need to be nasty to make that the node being failed out doesn't
+# get a chance to send any tickles or doing anything else clever. IPs
+# also need to be dropped because we're simulating a dead node rather
+# than a CTDB failure. To properly handle a CTDB failure we would
+# need a watchdog to drop the IPs when CTDB disappears.
+try_command_on_node -v $test_node "kill -9 $pid ; $CTDB_TEST_WRAPPER drop_ips ${test_node_ips}"
wait_until_node_has_status $test_node disconnected
gratarp_sniff_wait_show
#######################################
+# If the given IP is hosted then print 2 items: maskbits and iface
+ip_maskbits_iface ()
+{
+ _addr="$1"
+
+ case "$_addr" in
+ *:*) _family="inet6" ; _bits=128 ;;
+ *) _family="inet" ; _bits=32 ;;
+ esac
+
+ ip addr show to "${_addr}/${_bits}" 2>/dev/null | \
+ awk -v family="${_family}" \
+ 'NR == 1 { iface = gensub(":$", "", 1, $2) } \
+ $1 ~ /inet/ { print gensub(".*/", "", 1, $2), iface, family }'
+}
+
+drop_ip ()
+{
+ _addr="${1%/*}" # Remove optional maskbits
+
+ set -- $(ip_maskbits_iface $_addr)
+ if [ -n "$1" ] ; then
+ _maskbits="$1"
+ _iface="$2"
+ echo "Removing public address $_addr/$_maskbits from device $_iface"
+ ip addr del "$_ip/$_maskbits" dev "$_iface" >/dev/null 2>&1 || true
+ fi
+}
+
+drop_ips ()
+{
+ for _ip ; do
+ drop_ip "$_ip"
+ done
+}
+
+#######################################
+
# $1: pnn, $2: DB name
db_get_path ()
{