Author: tuexen
Date: Fri Jul 20 15:37:29 2018
New Revision: 336552
URL: https://svnweb.freebsd.org/changeset/base/336552

Log:
  Test that the dtrace UDP receive probe fires.
  
  This test ensures that the fix committed in
  https://svnweb.freebsd.org/changeset/base/336551
  actually works.
  
  Reviewed by:          dteske@, markj@, rrs@
  Sponsored by:         Netflix, Inc.
  Differential Revision:        https://reviews.freebsd.org/D16046

Modified:
  
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.ipv4localudp.ksh
  
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.ipv4localudp.ksh.out

Modified: 
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.ipv4localudp.ksh
==============================================================================
--- 
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.ipv4localudp.ksh
    Fri Jul 20 15:32:20 2018        (r336551)
+++ 
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.ipv4localudp.ksh
    Fri Jul 20 15:37:29 2018        (r336552)
@@ -25,7 +25,7 @@
 #
 
 #
-# 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:
 #
@@ -42,11 +42,11 @@
 # 1 x ip:::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 udp:::receive (UDP received)
 # 
-# No udp:::receive event is expected since the UDP packet elicts
-# an ICMP PORT_UNREACHABLE response rather than a UDP packet, and locally
-# the echo request UDP packet only reaches IP, so the udp:::receive probe
-# is not triggered by it.
+# A udp:::receive event is expected even if the received UDP packet
+# elicits an ICMP PORT_UNREACHABLE message since there is no UDP
+# socket for receiving the packet.
 #
 
 if (( $# != 1 )); then
@@ -77,7 +77,7 @@ EOPERL
 $dtrace -c 'perl test.pl' -qs /dev/stdin <<EODTRACE
 BEGIN
 {
-       ipsend = udpsend = ipreceive = 0;
+       ipsend = udpsend = ipreceive = udpreceive = 0;
 }
 
 ip:::send
@@ -100,12 +100,19 @@ ip:::receive
        ipreceive++;
 }
 
+udp:::receive
+/args[2]->ip_saddr == "$local" && args[2]->ip_daddr == "$local"/
+{
+       udpreceive++;
+}
+
 END
 {
        printf("Minimum UDP events seen\n\n");
        printf("ip:::send - %s\n", ipsend >= 1 ? "yes" : "no");
        printf("ip:::receive - %s\n", ipreceive >= 1 ? "yes" : "no");
        printf("udp:::send - %s\n", udpsend >= 1 ? "yes" : "no");
+       printf("udp:::receive - %s\n", udpreceive >= 1 ? "yes" : "no");
 }
 EODTRACE
 

Modified: 
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.ipv4localudp.ksh.out
==============================================================================
--- 
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.ipv4localudp.ksh.out
        Fri Jul 20 15:32:20 2018        (r336551)
+++ 
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.ipv4localudp.ksh.out
        Fri Jul 20 15:37:29 2018        (r336552)
@@ -3,4 +3,5 @@ Minimum UDP events seen
 ip:::send - yes
 ip:::receive - yes
 udp:::send - yes
+udp:::receive - yes
 
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to