6 Verify that the server end of an SMB connection is correctly reset
10 * An active CTDB cluster with at least 2 nodes with public addresses.
12 * Test must be run on a real or virtual cluster rather than against
15 * Test must not be run from a cluster node.
17 * Clustered Samba must be listening on TCP port 445.
21 * CTDB should correctly record the connection and the releasing node
22 should reset the server end of the connection.
26 . "${TEST_SCRIPTS_DIR}/integration.bash"
32 ctdb_test_check_real_cluster
37 ctdb_restart_when_done
39 # We need this for later, so we know how long to sleep.
40 try_command_on_node 0 $CTDB getvar MonitorInterval
41 monitor_interval="${out#*= }"
43 select_test_node_and_ips
47 echo "Set NoIPTakeover=1 on all nodes"
48 try_command_on_node all $CTDB setvar NoIPTakeover 1
50 echo "Give the recovery daemon some time to reload tunables"
53 echo "Connecting to node ${test_node} on IP ${test_ip}:${test_port} with nc..."
55 sleep $((monitor_interval * 4)) | nc $test_ip $test_port &
57 ctdb_test_exit_hook_add "kill $nc_pid >/dev/null 2>&1"
59 wait_until_get_src_socket "tcp" "${test_ip}:${test_port}" $nc_pid "nc"
61 echo "Source socket is $src_socket"
63 # This should happen as soon as connection is up... but unless we wait
64 # we sometimes beat the registration.
65 echo "Checking if CIFS connection is tracked by CTDB on test node..."
66 wait_until 10 check_tickles $test_node $test_ip $test_port $src_socket
69 if [ "${out/SRC: ${src_socket} /}" != "$out" ] ; then
70 echo "GOOD: CIFS connection tracked OK by CTDB."
72 echo "BAD: Socket not tracked by CTDB."
76 # It would be nice if ss consistently used local/peer instead of src/dst
77 ss_filter="src ${test_ip}:${test_port} dst ${src_socket}"
79 try_command_on_node $test_node \
80 "ss -tn state established '${ss_filter}' | tail -n +2"
81 if [ -z "$out" ] ; then
82 echo "BAD: ss did not list the socket"
85 echo "GOOD: ss lists the socket:"
88 echo "Disabling node $test_node"
89 try_command_on_node 1 $CTDB disable -n $test_node
90 wait_until_node_has_status $test_node disabled
92 try_command_on_node $test_node \
93 "ss -tn state established '${ss_filter}' | tail -n +2"
94 if [ -n "$out" ] ; then
95 echo "BAD: ss listed the socket after failover"
98 echo "GOOD: ss no longer lists the socket"