Differential D16288 Diff 45628 cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.remotetcpstate.ksh
Changeset View
Changeset View
Standalone View
Standalone View
cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.remotetcpstate.ksh
Show All 37 Lines | |||||
# 2. The lo0 interface missing or not up. | # 2. The lo0 interface missing or not up. | ||||
# 3. The remote ssh service is not online. | # 3. The remote ssh service is not online. | ||||
# 4. An unlikely race causes the unlocked global send/receive | # 4. An unlikely race causes the unlocked global send/receive | ||||
# variables to be corrupted. | # variables to be corrupted. | ||||
# | # | ||||
# This test performs a TCP connection to the ssh service (port 22) and | # This test performs a TCP connection to the ssh service (port 22) and | ||||
# checks that at least the following packet counts were traced: | # checks that at least the following packet counts were traced: | ||||
# | # | ||||
# 4 x ip:::send (2 during the TCP handshake, the message, then a FIN) | # 4 x ip:::send (2 during connection setup, 2 during connection teardown) | ||||
# 4 x tcp:::send (2 during the TCP handshake, the messages, then a FIN) | # 4 x tcp:::send (2 during connection setup, 2 during connection teardown) | ||||
# 3 x ip:::receive (1 during the TCP handshake, the response, then the FIN ACK) | # 5 x ip:::receive (1 during connection setup, the response, 1 window update, | ||||
# 3 x tcp:::receive (1 during the TCP handshake, the response, then the FIN ACK) | # 1 banner line, 2 during connection teardown) | ||||
# 5 x tcp:::receive (1 during connection setup, the response, 1 window update, | |||||
# 1 banner line, 2 during connection teardown) | |||||
# | # | ||||
# For this test to work, we are assuming that the TCP handshake and | |||||
# TCP close will enter the IP code path and not use tcp fusion. | |||||
# | |||||
if (( $# != 1 )); then | if (( $# != 1 )); then | ||||
print -u2 "expected one argument: <dtrace-path>" | print -u2 "expected one argument: <dtrace-path>" | ||||
exit 2 | exit 2 | ||||
fi | fi | ||||
dtrace=$1 | dtrace=$1 | ||||
getaddr=./get.ipv4remote.pl | getaddr=./get.ipv4remote.pl | ||||
Show All 15 Lines | |||||
cat > test.pl <<-EOPERL | cat > test.pl <<-EOPERL | ||||
use IO::Socket; | use IO::Socket; | ||||
my \$s = IO::Socket::INET->new( | my \$s = IO::Socket::INET->new( | ||||
Proto => "tcp", | Proto => "tcp", | ||||
PeerAddr => "$dest", | PeerAddr => "$dest", | ||||
PeerPort => $tcpport, | PeerPort => $tcpport, | ||||
Timeout => 3); | Timeout => 3); | ||||
die "Could not connect to host $dest port $tcpport" unless \$s; | die "Could not connect to host $dest port $tcpport" unless \$s; | ||||
print \$s "testing state machine transitions"; | readline \$s; | ||||
close \$s; | close \$s; | ||||
sleep(2); | sleep(2); | ||||
EOPERL | EOPERL | ||||
$dtrace -c 'perl test.pl' -qs /dev/stdin <<EODTRACE | $dtrace -c 'perl test.pl' -qs /dev/stdin <<EODTRACE | ||||
BEGIN | BEGIN | ||||
{ | { | ||||
ipsend = tcpsend = ipreceive = tcpreceive = 0; | ipsend = tcpsend = ipreceive = tcpreceive = 0; | ||||
▲ Show 20 Lines • Show All 46 Lines • ▼ Show 20 Lines | |||||
{ | { | ||||
connest++; | connest++; | ||||
} | } | ||||
END | END | ||||
{ | { | ||||
printf("Minimum TCP events seen\n\n"); | printf("Minimum TCP events seen\n\n"); | ||||
printf("ip:::send - %s\n", ipsend >= 4 ? "yes" : "no"); | printf("ip:::send - %s\n", ipsend >= 4 ? "yes" : "no"); | ||||
printf("ip:::receive - %s\n", ipreceive >= 3 ? "yes" : "no"); | printf("ip:::receive - %s\n", ipreceive >= 5 ? "yes" : "no"); | ||||
printf("tcp:::send - %s\n", tcpsend >= 4 ? "yes" : "no"); | printf("tcp:::send - %s\n", tcpsend >= 4 ? "yes" : "no"); | ||||
printf("tcp:::receive - %s\n", tcpreceive >= 3 ? "yes" : "no"); | printf("tcp:::receive - %s\n", tcpreceive >= 5 ? "yes" : "no"); | ||||
printf("tcp:::state-change to syn-sent - %s\n", | printf("tcp:::state-change to syn-sent - %s\n", | ||||
state_event[TCP_STATE_SYN_SENT] >=1 ? "yes" : "no"); | state_event[TCP_STATE_SYN_SENT] >=1 ? "yes" : "no"); | ||||
printf("tcp:::state-change to established - %s\n", | printf("tcp:::state-change to established - %s\n", | ||||
state_event[TCP_STATE_ESTABLISHED] >= 1 ? "yes" : "no"); | state_event[TCP_STATE_ESTABLISHED] >= 1 ? "yes" : "no"); | ||||
printf("tcp:::state-change to fin-wait-1 - %s\n", | printf("tcp:::state-change to fin-wait-1 - %s\n", | ||||
state_event[TCP_STATE_FIN_WAIT_1] >= 1 ? "yes" : "no"); | state_event[TCP_STATE_FIN_WAIT_1] >= 1 ? "yes" : "no"); | ||||
printf("tcp:::state-change to fin-wait-2 - %s\n", | printf("tcp:::state-change to fin-wait-2 - %s\n", | ||||
state_event[TCP_STATE_FIN_WAIT_2] >= 1 ? "yes" : "no"); | state_event[TCP_STATE_FIN_WAIT_2] >= 1 ? "yes" : "no"); | ||||
Show All 15 Lines |