summaryrefslogtreecommitdiffstats
path: root/cddl
diff options
context:
space:
mode:
authorhiren <hiren@FreeBSD.org>2016-11-15 22:18:52 +0000
committerhiren <hiren@FreeBSD.org>2016-11-15 22:18:52 +0000
commit678ff80a6f30aaf6f5d6e8e25a44be41543c47ca (patch)
treeeaaccab695175a1d749a942835c46c9de3a4407f /cddl
parent3e5ed759a126b9a43875396954cacba9d812eadd (diff)
downloadFreeBSD-src-678ff80a6f30aaf6f5d6e8e25a44be41543c47ca.zip
FreeBSD-src-678ff80a6f30aaf6f5d6e8e25a44be41543c47ca.tar.gz
MFC r302474 (By gnn)
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. Sponsored by: Limelight Networks
Diffstat (limited to 'cddl')
-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 9b27076..c5592d2 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;
OpenPOWER on IntegriCloud