5 # The contents of this file are subject to the terms of the
6 # Common Development and Distribution License (the "License").
7 # You may not use this file except in compliance with the License.
9 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 # or http://www.opensolaris.org/os/licensing.
11 # See the License for the specific language governing permissions
12 # and limitations under the License.
14 # When distributing Covered Code, include this CDDL HEADER in each
15 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 # If applicable, add the following below this CDDL HEADER, with the
17 # fields enclosed by brackets "[]" replaced with your own identifying
18 # information: Portions Copyright [yyyy] [name of copyright owner]
24 # Copyright 2008 Sun Microsystems, Inc. All rights reserved.
25 # Use is subject to license terms.
27 #pragma ident "%Z%%M% %I% %E% SMI"
30 # Test ip:::{send,receive} of IPv6 ICMP to a local address. This creates a
31 # temporary lo0/inet6 interface if one doesn't already exist.
33 # This may fail due to:
35 # 1. A change to the ip stack breaking expected probe behavior,
36 # which is the reason we are testing.
37 # 2. Unrelated ICMPv6 on lo0 traced by accident.
40 if (( $# != 1 )); then
41 print -u2 "expected one argument: <dtrace-path>"
48 if ! ifconfig lo0 inet6 > /dev/null 2>&1; then
49 if ! ifconfig lo0 inet6 plumb up; then
50 print -u2 "could not plumb lo0 inet6 for testing"
58 $dtrace -c "/sbin/ping6 -q -c 1 -t 3 $local" -qs /dev/stdin <<EOF | sort -n | \
59 grep -v -e '^round-trip ' -e '^--- '
61 /args[2]->ip_saddr == "$local" && args[2]->ip_daddr == "$local" &&
62 args[5]->ipv6_nexthdr == IPPROTO_ICMPV6/
64 printf("2 ip:::send (");
65 printf("args[2]: %d %d, ", args[2]->ip_ver, args[2]->ip_plength);
66 printf("args[5]: %d %d %d)\n",
67 args[5]->ipv6_ver, args[5]->ipv6_tclass, args[5]->ipv6_plen);
71 /args[2]->ip_saddr == "$local" && args[2]->ip_daddr == "$local" &&
72 args[5]->ipv6_nexthdr == IPPROTO_ICMPV6/
74 printf("3 ip:::receive (");
75 printf("args[2]: %d %d, ", args[2]->ip_ver, args[2]->ip_plength);
76 printf("args[5]: %d %d %d)\n",
77 args[5]->ipv6_ver, args[5]->ipv6_tclass, args[5]->ipv6_plen);
81 if (( removeinet6 )); then
82 ifconfig lo0 inet6 unplumb