1N/A# The contents of this file are subject to the terms of the 1N/A# Common Development and Distribution License (the "License"). 1N/A# You may not use this file except in compliance with the License. 1N/A# See the License for the specific language governing permissions 1N/A# and limitations under the License. 1N/A# When distributing Covered Code, include this CDDL HEADER in each 1N/A# If applicable, add the following below this CDDL HEADER, with the 1N/A# fields enclosed by brackets "[]" replaced with your own identifying 1N/A# information: Portions Copyright [yyyy] [name of copyright owner] 1N/A# Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. 1N/A# Test {ip,tcp}:::{send,receive} of IPv4 TCP to local host. 1N/A# This may fail due to: 1N/A# 1. A change to the ip stack breaking expected probe behavior, 1N/A# which is the reason we are testing. 1N/A# 2. The lo0 interface missing or not up. 1N/A# 3. The local ssh service is not online. 1N/A# variables to be corrupted. 1N/A# This test performs a TCP connection and checks that at least the 1N/A# following packet counts were traced: 1N/A# 3 x ip:::send (2 during the TCP handshake, then a FIN) 1N/A# 3 x tcp:::send (2 during the TCP handshake, then a FIN) 1N/A# 2 x ip:::receive (1 during the TCP handshake, then the FIN ACK) 1N/A# 2 x tcp:::receive (1 during the TCP handshake, then the FIN ACK) 1N/A# The actual count tested is 5 each way, since we are tracing both 1N/A# source and destination events. 1N/A# For this test to work, we are assuming that the TCP handshake and 1N/A# TCP close will enter the IP code path and not use tcp fusion. 1N/Aif (( $# != 1 ));
then 1N/A print -
u2 "expected one argument: <dtrace-path>" 1N/A my \$s = IO::Socket::INET->new( 1N/A PeerAddr => "$local", 1N/A PeerPort => $tcpport, die "Could not connect to host $local port $tcpport" unless \$s; ipsend = tcpsend = ipreceive = tcpreceive = 0; /args[2]->ip_saddr == "$local" && args[2]->ip_daddr == "$local" && args[4]->ipv4_protocol == IPPROTO_TCP/ /args[2]->ip_saddr == "$local" && args[2]->ip_daddr == "$local"/ /args[2]->ip_saddr == "$local" && args[2]->ip_daddr == "$local" && args[4]->ipv4_protocol == IPPROTO_TCP/ /args[2]->ip_saddr == "$local" && args[2]->ip_daddr == "$local"/ printf("Minimum TCP events seen\n\n"); printf("ip:::send - %s\n", ipsend >= 5 ? "yes" : "no"); printf("ip:::receive - %s\n", ipreceive >= 5 ? "yes" : "no"); printf("tcp:::send - %s\n", tcpsend >= 5 ? "yes" : "no"); printf("tcp:::receive - %s\n", tcpreceive >= 5 ? "yes" : "no");