1*6878Sbrendan#!/usr/bin/ksh 2*6878Sbrendan# 3*6878Sbrendan# CDDL HEADER START 4*6878Sbrendan# 5*6878Sbrendan# The contents of this file are subject to the terms of the 6*6878Sbrendan# Common Development and Distribution License (the "License"). 7*6878Sbrendan# You may not use this file except in compliance with the License. 8*6878Sbrendan# 9*6878Sbrendan# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10*6878Sbrendan# or http://www.opensolaris.org/os/licensing. 11*6878Sbrendan# See the License for the specific language governing permissions 12*6878Sbrendan# and limitations under the License. 13*6878Sbrendan# 14*6878Sbrendan# When distributing Covered Code, include this CDDL HEADER in each 15*6878Sbrendan# file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16*6878Sbrendan# If applicable, add the following below this CDDL HEADER, with the 17*6878Sbrendan# fields enclosed by brackets "[]" replaced with your own identifying 18*6878Sbrendan# information: Portions Copyright [yyyy] [name of copyright owner] 19*6878Sbrendan# 20*6878Sbrendan# CDDL HEADER END 21*6878Sbrendan# 22*6878Sbrendan 23*6878Sbrendan# 24*6878Sbrendan# Copyright 2008 Sun Microsystems, Inc. All rights reserved. 25*6878Sbrendan# Use is subject to license terms. 26*6878Sbrendan# 27*6878Sbrendan#pragma ident "%Z%%M% %I% %E% SMI" 28*6878Sbrendan 29*6878Sbrendan# 30*6878Sbrendan# Test ip:::{send,receive} of IPv6 ICMP to a remote host. This test is 31*6878Sbrendan# skipped if there are no physical interfaces configured with IPv6, or no 32*6878Sbrendan# other IPv6 hosts are reachable. 33*6878Sbrendan# 34*6878Sbrendan# This may fail due to: 35*6878Sbrendan# 36*6878Sbrendan# 1. A change to the ip stack breaking expected probe behavior, 37*6878Sbrendan# which is the reason we are testing. 38*6878Sbrendan# 2. An unrelated ICMPv6 between these hosts was traced by accident. 39*6878Sbrendan# 40*6878Sbrendan 41*6878Sbrendanif (( $# != 1 )); then 42*6878Sbrendan print -u2 "expected one argument: <dtrace-path>" 43*6878Sbrendan exit 2 44*6878Sbrendanfi 45*6878Sbrendan 46*6878Sbrendandtrace=$1 47*6878Sbrendangetaddr=./get.ipv6remote.pl 48*6878Sbrendan 49*6878Sbrendanif [[ ! -x $getaddr ]]; then 50*6878Sbrendan print -u2 "could not find or execute sub program: $getaddr" 51*6878Sbrendan exit 3 52*6878Sbrendanfi 53*6878Sbrendan$getaddr | read source dest 54*6878Sbrendanif (( $? != 0 )); then 55*6878Sbrendan print -nu2 "Could not find a local IPv6 interface and a remote IPv6 " 56*6878Sbrendan print -u2 "host. Aborting test.\n" 57*6878Sbrendan print -nu2 "For this test to continue, a \"ping -ns -A inet6 FF02::1\" " 58*6878Sbrendan print -u2 "must respond with a\nremote IPv6 host." 59*6878Sbrendan exit 3 60*6878Sbrendanfi 61*6878Sbrendan 62*6878Sbrendan# 63*6878Sbrendan# Shake loose any ICMPv6 Neighbor advertisement messages before tracing. 64*6878Sbrendan# 65*6878Sbrendan/usr/sbin/ping $dest 3 > /dev/null 2>&1 66*6878Sbrendan 67*6878Sbrendan$dtrace -c "/usr/sbin/ping $dest 3" -qs /dev/stdin <<EOF | \ 68*6878Sbrendan grep -v 'is alive' | sort -n 69*6878Sbrendanip:::send 70*6878Sbrendan/args[2]->ip_saddr == "$source" && args[2]->ip_daddr == "$dest" && 71*6878Sbrendan args[5]->ipv6_nexthdr == IPPROTO_ICMPV6/ 72*6878Sbrendan{ 73*6878Sbrendan printf("1 ip:::send ("); 74*6878Sbrendan printf("args[2]: %d %d, ", args[2]->ip_ver, args[2]->ip_plength); 75*6878Sbrendan printf("args[5]: %d %d %d)\n", 76*6878Sbrendan args[5]->ipv6_ver, args[5]->ipv6_tclass, args[5]->ipv6_plen); 77*6878Sbrendan} 78*6878Sbrendan 79*6878Sbrendanip:::receive 80*6878Sbrendan/args[2]->ip_saddr == "$dest" && args[2]->ip_daddr == "$source" && 81*6878Sbrendan args[5]->ipv6_nexthdr == IPPROTO_ICMPV6/ 82*6878Sbrendan{ 83*6878Sbrendan printf("2 ip:::receive ("); 84*6878Sbrendan printf("args[2]: %d %d, ", args[2]->ip_ver, args[2]->ip_plength); 85*6878Sbrendan printf("args[5]: %d %d %d)\n", 86*6878Sbrendan args[5]->ipv6_ver, args[5]->ipv6_tclass, args[5]->ipv6_plen); 87*6878Sbrendan} 88*6878SbrendanEOF 89