Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 20 Jul 2018 15:32:20 +0000 (UTC)
From:      Michael Tuexen <tuexen@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r336551 - in head: share/man/man4 sys/netinet sys/netinet6
Message-ID:  <201807201532.w6KFWKMP037229@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: tuexen
Date: Fri Jul 20 15:32:20 2018
New Revision: 336551
URL: https://svnweb.freebsd.org/changeset/base/336551

Log:
  Add missing dtrace probes for received UDP packets.
  
  Fire UDP receive probes when a packet is received and there is no
  endpoint consuming it. Fire the probe also if the TTL of the
  received packet is smaller than the minimum required by the endpoint.
  
  Clarify also in the man page, when the probe fires.
  
  Reviewed by:		dteske@, markj@, rrs@
  Sponsored by:		Netflix, Inc.
  Differential Revision:	https://reviews.freebsd.org/D16046

Modified:
  head/share/man/man4/dtrace_udp.4
  head/sys/netinet/udp_usrreq.c
  head/sys/netinet6/udp6_usrreq.c

Modified: head/share/man/man4/dtrace_udp.4
==============================================================================
--- head/share/man/man4/dtrace_udp.4	Fri Jul 20 15:31:51 2018	(r336550)
+++ head/share/man/man4/dtrace_udp.4	Fri Jul 20 15:32:20 2018	(r336551)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd April 18, 2015
+.Dd July 20, 2018
 .Dt DTRACE_UDP 4
 .Os
 .Sh NAME
@@ -45,7 +45,11 @@ The
 .Fn udp:::send
 probe fires whenever the kernel prepares to transmit a UDP packet, and the
 .Fn udp:::receive
-probe fires whenever the kernel receives a UDP packet.
+probe fires whenever the kernel receives a UDP packet, unless
+the UDP header is incomplete,
+the destination port is 0,
+the length field is invalid,
+or the checksum is wrong.
 The arguments to these probes can be used to obtain detailed information about
 the IP and UDP headers of the corresponding packet.
 .Sh ARGUMENTS

Modified: head/sys/netinet/udp_usrreq.c
==============================================================================
--- head/sys/netinet/udp_usrreq.c	Fri Jul 20 15:31:51 2018	(r336550)
+++ head/sys/netinet/udp_usrreq.c	Fri Jul 20 15:32:20 2018	(r336551)
@@ -685,6 +685,7 @@ udp_input(struct mbuf **mp, int *offp, int proto)
 			    inet_ntoa_r(ip->ip_dst, dst), ntohs(uh->uh_dport),
 			    inet_ntoa_r(ip->ip_src, src), ntohs(uh->uh_sport));
 		}
+		UDP_PROBE(receive, NULL, NULL, ip, NULL, uh);
 		UDPSTAT_INC(udps_noport);
 		if (m->m_flags & (M_BCAST | M_MCAST)) {
 			UDPSTAT_INC(udps_noportbcast);
@@ -704,6 +705,7 @@ udp_input(struct mbuf **mp, int *offp, int proto)
 	 */
 	INP_RLOCK_ASSERT(inp);
 	if (inp->inp_ip_minttl && inp->inp_ip_minttl > ip->ip_ttl) {
+		UDP_PROBE(receive, NULL, inp, ip, inp, uh);
 		INP_RUNLOCK(inp);
 		m_freem(m);
 		return (IPPROTO_DONE);

Modified: head/sys/netinet6/udp6_usrreq.c
==============================================================================
--- head/sys/netinet6/udp6_usrreq.c	Fri Jul 20 15:31:51 2018	(r336550)
+++ head/sys/netinet6/udp6_usrreq.c	Fri Jul 20 15:32:20 2018	(r336551)
@@ -483,6 +483,7 @@ udp6_input(struct mbuf **mp, int *offp, int proto)
 			    ip6_sprintf(ip6bufs, &ip6->ip6_src),
 			    ntohs(uh->uh_sport));
 		}
+		UDP_PROBE(receive, NULL, NULL, ip6, NULL, uh);
 		UDPSTAT_INC(udps_noport);
 		if (m->m_flags & M_MCAST) {
 			printf("UDP6: M_MCAST is set in a unicast packet.\n");



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201807201532.w6KFWKMP037229>