aboutsummaryrefslogtreecommitdiff
path: root/cddl/lib
diff options
context:
space:
mode:
authorGeorge V. Neville-Neil <gnn@FreeBSD.org>2016-07-08 23:44:09 +0000
committerGeorge V. Neville-Neil <gnn@FreeBSD.org>2016-07-08 23:44:09 +0000
commit15dbc1605b09d8cda88ed4d0275c985e7ffc0233 (patch)
treef7c3b99ddc33f19c8a78554d4daa669c39f6dcbb /cddl/lib
parentaa0bf3d6061df500c2df1feb808a85af17bb4f8f (diff)
downloadsrc-15dbc1605b09d8cda88ed4d0275c985e7ffc0233.tar.gz
src-15dbc1605b09d8cda88ed4d0275c985e7ffc0233.zip
On FreeBSD there is a setsockopt option SO_USER_COOKIE which allows
setting a 32 bit value on each socket. This can be used by applications and DTrace as a rendezvous point so that an applicaton's data can more easily be captured at run time. Expose the user cookie via DTrace by updating the translator in tcp.d and add a quick test program, a TCP server, that sets the cookie on each connection accepted. Reviewed by: hiren MFC after: 1 week Sponsored by: Limelight Networks Differential Revision: https://reviews.freebsd.org/D7152
Notes
Notes: svn path=/head/; revision=302474
Diffstat (limited to 'cddl/lib')
-rw-r--r--cddl/lib/libdtrace/tcp.d3
1 files changed, 3 insertions, 0 deletions
diff --git a/cddl/lib/libdtrace/tcp.d b/cddl/lib/libdtrace/tcp.d
index 9b27076d8096..c5592d26396f 100644
--- a/cddl/lib/libdtrace/tcp.d
+++ b/cddl/lib/libdtrace/tcp.d
@@ -126,6 +126,7 @@ typedef struct tcpsinfo {
int tcps_retransmit; /* retransmit send event, boolean */
int tcps_srtt; /* smoothed RTT in units of (TCP_RTT_SCALE*hz) */
int tcps_debug; /* socket has SO_DEBUG set */
+ int tcps_cookie; /* expose the socket's SO_USER_COOKIE */
int32_t tcps_dupacks; /* consecutive dup acks received */
uint32_t tcps_rtttime; /* RTT measurement start time */
uint32_t tcps_rtseq; /* sequence # being timed */
@@ -224,6 +225,8 @@ translator tcpsinfo_t < struct tcpcb *p > {
tcps_srtt = p == NULL ? -1 : p->t_srtt; /* smoothed RTT in units of (TCP_RTT_SCALE*hz) */
tcps_debug = p == NULL ? 0 :
p->t_inpcb->inp_socket->so_options & 1;
+ tcps_cookie = p == NULL ? -1 :
+ p->t_inpcb->inp_socket->so_user_cookie;
tcps_dupacks = p == NULL ? -1 : p->t_dupacks;
tcps_rtttime = p == NULL ? -1 : p->t_rtttime;
tcps_rtseq = p == NULL ? -1 : p->t_rtseq;