summaryrefslogtreecommitdiffstats
path: root/sys/netinet/tcp_output.c
diff options
context:
space:
mode:
authormarkj <markj@FreeBSD.org>2013-08-25 21:54:41 +0000
committermarkj <markj@FreeBSD.org>2013-08-25 21:54:41 +0000
commit29e4661920638221bbffb4c527fb24daa4702b4c (patch)
treec2b1016fdbcd18b8a7c9f33a21b6c2bb2b755348 /sys/netinet/tcp_output.c
parent03a89a5fe0a80e1df50027d7d94266daffa41805 (diff)
downloadFreeBSD-src-29e4661920638221bbffb4c527fb24daa4702b4c.zip
FreeBSD-src-29e4661920638221bbffb4c527fb24daa4702b4c.tar.gz
Implement the ip, tcp, and udp DTrace providers. The probe definitions use
dynamic translation so that their arguments match the definitions for these providers in Solaris and illumos. Thus, existing scripts for these providers should work unmodified on FreeBSD. Tested by: gnn, hiren MFC after: 1 month
Diffstat (limited to 'sys/netinet/tcp_output.c')
-rw-r--r--sys/netinet/tcp_output.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/sys/netinet/tcp_output.c b/sys/netinet/tcp_output.c
index b4342f3..00d5415 100644
--- a/sys/netinet/tcp_output.c
+++ b/sys/netinet/tcp_output.c
@@ -35,6 +35,7 @@ __FBSDID("$FreeBSD$");
#include "opt_inet.h"
#include "opt_inet6.h"
#include "opt_ipsec.h"
+#include "opt_kdtrace.h"
#include "opt_tcpdebug.h"
#include <sys/param.h>
@@ -46,6 +47,7 @@ __FBSDID("$FreeBSD$");
#include <sys/mbuf.h>
#include <sys/mutex.h>
#include <sys/protosw.h>
+#include <sys/sdt.h>
#include <sys/socket.h>
#include <sys/socketvar.h>
#include <sys/sysctl.h>
@@ -56,6 +58,7 @@ __FBSDID("$FreeBSD$");
#include <netinet/cc.h>
#include <netinet/in.h>
+#include <netinet/in_kdtrace.h>
#include <netinet/in_systm.h>
#include <netinet/ip.h>
#include <netinet/in_pcb.h>
@@ -1174,6 +1177,18 @@ send:
*/
ip6->ip6_hlim = in6_selecthlim(tp->t_inpcb, NULL);
+ /*
+ * Set the packet size here for the benefit of DTrace probes.
+ * ip6_output() will set it properly; it's supposed to include
+ * the option header lengths as well.
+ */
+ ip6->ip6_plen = htons(m->m_pkthdr.len - sizeof(*ip6));
+
+ if (tp->t_state == TCPS_SYN_SENT)
+ TCP_PROBE5(connect_request, NULL, tp, ip6, tp, th);
+
+ TCP_PROBE5(send, NULL, tp, ip6, tp, th);
+
/* TODO: IPv6 IP6TOS_ECT bit on */
error = ip6_output(m, tp->t_inpcb->in6p_outputopts, &ro,
((so->so_options & SO_DONTROUTE) ? IP_ROUTETOIF : 0),
@@ -1208,6 +1223,11 @@ send:
if (V_path_mtu_discovery && tp->t_maxopd > V_tcp_minmss)
ip->ip_off |= htons(IP_DF);
+ if (tp->t_state == TCPS_SYN_SENT)
+ TCP_PROBE5(connect_request, NULL, tp, ip, tp, th);
+
+ TCP_PROBE5(send, NULL, tp, ip, tp, th);
+
error = ip_output(m, tp->t_inpcb->inp_options, &ro,
((so->so_options & SO_DONTROUTE) ? IP_ROUTETOIF : 0), 0,
tp->t_inpcb);
OpenPOWER on IntegriCloud