Differential D16288 Diff 45675 head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.ipv4remotetcp.ksh
Changeset View
Changeset View
Standalone View
Standalone View
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.ipv4remotetcp.ksh
Show All 33 Lines | |||||
# 2. No physical network interface is plumbed and up. | # 2. No physical network interface is plumbed and up. | ||||
# 3. No other hosts on this subnet are reachable and listening on ssh. | # 3. No other hosts on this subnet are reachable and listening on ssh. | ||||
# 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 and checks that at least the | # This test performs a TCP connection and checks that at least the | ||||
# following packet counts were traced: | # following packet counts were traced: | ||||
# | # | ||||
# 3 x ip:::send (2 during the TCP handshake, then a FIN) | # 4 x ip:::send (2 during connection setup, 2 during connection teardown) | ||||
# 3 x tcp:::send (2 during the TCP handshake, then a FIN) | # 4 x tcp:::send (2 during connection setup, 2 during connection teardown) | ||||
# 2 x ip:::receive (1 during the TCP handshake, then the FIN ACK) | # 5 x ip:::receive (1 during connection setup, the response, 1 window update, | ||||
# 2 x tcp:::receive (1 during the TCP handshake, 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) | |||||
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; | ||||
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 All 23 Lines | |||||
/args[2]->ip_saddr == "$dest" && args[2]->ip_daddr == "$source"/ | /args[2]->ip_saddr == "$dest" && args[2]->ip_daddr == "$source"/ | ||||
{ | { | ||||
tcpreceive++; | tcpreceive++; | ||||
} | } | ||||
END | END | ||||
{ | { | ||||
printf("Minimum TCP events seen\n\n"); | printf("Minimum TCP events seen\n\n"); | ||||
printf("ip:::send - %s\n", ipsend >= 3 ? "yes" : "no"); | printf("ip:::send - %s\n", ipsend >= 4 ? "yes" : "no"); | ||||
printf("ip:::receive - %s\n", ipreceive >= 2 ? "yes" : "no"); | printf("ip:::receive - %s\n", ipreceive >= 5 ? "yes" : "no"); | ||||
printf("tcp:::send - %s\n", tcpsend >= 3 ? "yes" : "no"); | printf("tcp:::send - %s\n", tcpsend >= 4 ? "yes" : "no"); | ||||
printf("tcp:::receive - %s\n", tcpreceive >= 2 ? "yes" : "no"); | printf("tcp:::receive - %s\n", tcpreceive >= 5 ? "yes" : "no"); | ||||
} | } | ||||
EODTRACE | EODTRACE | ||||
status=$? | status=$? | ||||
cd / | cd / | ||||
/bin/rm -rf $DIR | /bin/rm -rf $DIR | ||||
exit $status | exit $status |