Differential D16046 Diff 45378 cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.ipv4localudp.ksh
Changeset View
Changeset View
Standalone View
Standalone View
cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.ipv4localudp.ksh
Show All 19 Lines | |||||
# CDDL HEADER END | # CDDL HEADER END | ||||
# | # | ||||
# | # | ||||
# Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. | # Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. | ||||
# | # | ||||
# | # | ||||
# Test ip:::{send,receive} of IPv4 UDP to a local address. | # Test {ip,udp}:::{send,receive} of IPv4 UDP to a local address. | ||||
# | # | ||||
# This may fail due to: | # This may fail due to: | ||||
# | # | ||||
# 1. A change to the ip stack breaking expected probe behavior, | # 1. A change to the ip stack breaking expected probe behavior, | ||||
# which is the reason we are testing. | # which is the reason we are testing. | ||||
# 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 rpcbind. | # 3. No other hosts on this subnet are reachable and listening on rpcbind. | ||||
# 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 sends a UDP message using perl and checks that at least the | # This test sends a UDP message using perl and checks that at least the | ||||
# following counts were traced: | # following counts were traced: | ||||
# | # | ||||
# 1 x ip:::send (UDP sent to UDP port 33434) | # 1 x ip:::send (UDP sent to UDP port 33434) | ||||
# 1 x udp:::send (UDP sent to UDP port 33434) | # 1 x udp:::send (UDP sent to UDP port 33434) | ||||
# 1 x ip:::receive (UDP received) | # 1 x ip:::receive (UDP received) | ||||
# 1 x udp:::receive (UDP received) | |||||
# | # | ||||
# No udp:::receive event is expected since the UDP packet elicts | # A udp:::receive event is expected even if the received UDP packet | ||||
# an ICMP PORT_UNREACHABLE response rather than a UDP packet, and locally | # elicts an ICMP PORT_UNREACHABLE message since there is no UDP | ||||
dteske: It looks like the original (pre-patch) code had a typo. Could you do us a favor and fix the… | |||||
Not Done Inline ActionsHave it in my local copy... tuexen: Have it in my local copy... | |||||
# the echo request UDP packet only reaches IP, so the udp:::receive probe | # socket for receiving the packet. | ||||
# is not triggered by it. | |||||
# | # | ||||
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 | ||||
Show All 14 Lines | cat > test.pl <<-EOPERL | ||||
send \$s, "Hello", 0; | send \$s, "Hello", 0; | ||||
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 = udpsend = ipreceive = 0; | ipsend = udpsend = ipreceive = udpreceive = 0; | ||||
} | } | ||||
ip:::send | ip:::send | ||||
/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_UDP/ | args[4]->ipv4_protocol == IPPROTO_UDP/ | ||||
{ | { | ||||
ipsend++; | ipsend++; | ||||
} | } | ||||
udp:::send | udp:::send | ||||
/args[2]->ip_saddr == "$local" && args[2]->ip_daddr == "$local"/ | /args[2]->ip_saddr == "$local" && args[2]->ip_daddr == "$local"/ | ||||
{ | { | ||||
udpsend++; | udpsend++; | ||||
} | } | ||||
ip:::receive | ip:::receive | ||||
/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_UDP/ | args[4]->ipv4_protocol == IPPROTO_UDP/ | ||||
{ | { | ||||
ipreceive++; | ipreceive++; | ||||
} | } | ||||
udp:::receive | |||||
/args[2]->ip_saddr == "$local" && args[2]->ip_daddr == "$local"/ | |||||
{ | |||||
udpreceive++; | |||||
} | |||||
END | END | ||||
{ | { | ||||
printf("Minimum UDP events seen\n\n"); | printf("Minimum UDP events seen\n\n"); | ||||
printf("ip:::send - %s\n", ipsend >= 1 ? "yes" : "no"); | printf("ip:::send - %s\n", ipsend >= 1 ? "yes" : "no"); | ||||
printf("ip:::receive - %s\n", ipreceive >= 1 ? "yes" : "no"); | printf("ip:::receive - %s\n", ipreceive >= 1 ? "yes" : "no"); | ||||
printf("udp:::send - %s\n", udpsend >= 1 ? "yes" : "no"); | printf("udp:::send - %s\n", udpsend >= 1 ? "yes" : "no"); | ||||
printf("udp:::receive - %s\n", udpreceive >= 1 ? "yes" : "no"); | |||||
} | } | ||||
EODTRACE | EODTRACE | ||||
status=$? | status=$? | ||||
cd / | cd / | ||||
/bin/rm -rf $DIR | /bin/rm -rf $DIR | ||||
exit $status | exit $status |
It looks like the original (pre-patch) code had a typo. Could you do us a favor and fix the typo while you're here? s/elicts/elicits/