Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F146708933
D3530.id8724.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
21 KB
Referenced Files
None
Subscribers
None
D3530.id8724.diff
View Options
Index: cddl/lib/libdtrace/tcp.d
===================================================================
--- cddl/lib/libdtrace/tcp.d
+++ cddl/lib/libdtrace/tcp.d
@@ -103,11 +103,15 @@
int32_t tcps_state; /* TCP state */
uint32_t tcps_iss; /* Initial sequence # sent */
uint32_t tcps_suna; /* sequence # sent but unacked */
+ uint32_t tcps_smax; /* highest sequence number sent */
uint32_t tcps_snxt; /* next sequence # to send */
uint32_t tcps_rack; /* sequence # we have acked */
uint32_t tcps_rnxt; /* next sequence # expected */
uint32_t tcps_swnd; /* send window size */
int32_t tcps_snd_ws; /* send window scaling */
+ uint32_t tcps_swl1; /* window update seg seq number */
+ uint32_t tcps_swl2; /* window update seg ack number */
+ uint32_t tcps_rup; /* receive urgent pointer */
uint32_t tcps_rwnd; /* receive window size */
int32_t tcps_rcv_ws; /* receive window scaling */
uint32_t tcps_cwnd; /* congestion window */
@@ -117,7 +121,8 @@
uint32_t tcps_rto; /* round-trip timeout, msec */
uint32_t tcps_mss; /* max segment size */
int tcps_retransmit; /* retransmit send event, boolean */
- int tcps_srtt; /* smoothed RTT in units of (TCP_RTT_SCALE*hz) */
+ int tcps_srtt; /* smoothed RTT in units of (TCP_RTT_SCALE*hz) */
+ int tcps_debug; /* socket has SO_DEBUG set */
} tcpsinfo_t;
/*
@@ -188,12 +193,16 @@
tcps_state = p == NULL ? -1 : p->t_state;
tcps_iss = p == NULL ? 0 : p->iss;
tcps_suna = p == NULL ? 0 : p->snd_una;
+ tcps_smax = p == NULL ? 0 : p->snd_max;
tcps_snxt = p == NULL ? 0 : p->snd_nxt;
tcps_rack = p == NULL ? 0 : p->last_ack_sent;
tcps_rnxt = p == NULL ? 0 : p->rcv_nxt;
tcps_swnd = p == NULL ? -1 : p->snd_wnd;
tcps_snd_ws = p == NULL ? -1 : p->snd_scale;
+ tcps_swl1 = p == NULL ? -1 : p->snd_wl1;
+ tcps_swl2 = p == NULL ? -1 : p->snd_wl2;
tcps_rwnd = p == NULL ? -1 : p->rcv_wnd;
+ tcps_rup = p == NULL ? -1 : p->rcv_up;
tcps_rcv_ws = p == NULL ? -1 : p->rcv_scale;
tcps_cwnd = p == NULL ? -1 : p->snd_cwnd;
tcps_cwnd_ssthresh = p == NULL ? -1 : p->snd_ssthresh;
@@ -203,6 +212,8 @@
tcps_mss = p == NULL ? -1 : p->t_maxseg;
tcps_retransmit = p == NULL ? -1 : p->t_rxtshift > 0 ? 1 : 0;
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;
};
#pragma D binding "1.6.3" translator
@@ -242,3 +253,123 @@
translator tcplsinfo_t < int s > {
tcps_state = s;
};
+
+
+/* Support for TCP debug */
+
+#pragma D binding "1.12.1" TA_INPUT
+inline int TA_INPUT = 0;
+#pragma D binding "1.12.1" TA_OUTPUT
+inline int TA_OUTPUT = 1;
+#pragma D binding "1.12.1" TA_USER
+inline int TA_USER = 2;
+#pragma D binding "1.12.1" TA_RESPOND
+inline int TA_RESPOND = 3;
+#pragma D binding "1.12.1" TA_DROP
+inline int TA_DROP = 4;
+
+/* direction strings. */
+
+#pragma D binding "1.12.1" tcpdebug_dir_string
+inline string tcpdebug_dir_string[uint8_t direction] =
+ direction == TA_INPUT ? "input" :
+ direction == TA_OUTPUT ? "output" :
+ direction == TA_USER ? "user" :
+ direction == TA_RESPOND ? "respond" :
+ direction == TA_OUTPUT ? "drop" :
+ "unknown" ;
+
+#pragma D binding "1.12.1" tcpflag_string
+inline string tcpflag_string[uint8_t flags] =
+ flags & TH_FIN ? "FIN" :
+ flags & TH_SYN ? "SYN" :
+ flags & TH_RST ? "RST" :
+ flags & TH_PUSH ? "PUSH" :
+ flags & TH_ACK ? "ACK" :
+ flags & TH_URG ? "URG" :
+ flags & TH_ECE ? "ECE" :
+ flags & TH_CWR ? "CWR" :
+ "unknown" ;
+
+#pragma D binding "1.12.1" PRU_ATTACH
+inline int PRU_ATTACH = 0;
+#pragma D binding "1.12.1" PRU_DETACH
+inline int PRU_DETACH = 1;
+#pragma D binding "1.12.1" PRU_BIND
+inline int PRU_BIND = 2;
+#pragma D binding "1.12.1" PRU_LISTEN
+inline int PRU_LISTEN = 3;
+#pragma D binding "1.12.1" PRU_CONNECT
+inline int PRU_CONNECT = 4;
+#pragma D binding "1.12.1" PRU_ACCEPT
+inline int PRU_ACCEPT = 5 ;
+#pragma D binding "1.12.1" PRU_DISCONNECT
+inline int PRU_DISCONNECT= 6;
+#pragma D binding "1.12.1" PRU_SHUTDOWN
+inline int PRU_SHUTDOWN = 7;
+#pragma D binding "1.12.1" PRU_RCVD
+inline int PRU_RCVD = 8;
+#pragma D binding "1.12.1" PRU_SEND
+inline int PRU_SEND = 9;
+#pragma D binding "1.12.1" PRU_ABORT
+inline int PRU_ABORT = 10;
+#pragma D binding "1.12.1" PRU_CONTROL
+inline int PRU_CONTROL = 11;
+#pragma D binding "1.12.1" PRU_SENSE
+inline int PRU_SENSE = 12;
+#pragma D binding "1.12.1" PRU_RCVOOB
+inline int PRU_RCVOOB = 13;
+#pragma D binding "1.12.1" PRU_SENDOOB
+inline int PRU_SENDOOB = 14;
+#pragma D binding "1.12.1" PRU_SOCKADDR
+inline int PRU_SOCKADDR = 15;
+#pragma D binding "1.12.1" PRU_PEERADDR
+inline int PRU_PEERADDR = 16;
+#pragma D binding "1.12.1" PRU_CONNECT2
+inline int PRU_CONNECT2 = 17;
+#pragma D binding "1.12.1" PRU_FASTTIMO
+inline int PRU_FASTTIMO = 18;
+#pragma D binding "1.12.1" PRU_SLOWTIMO
+inline int PRU_SLOWTIMO = 19;
+#pragma D binding "1.12.1" PRU_PROTORCV
+inline int PRU_PROTORCV = 20;
+#pragma D binding "1.12.1" PRU_PROTOSEND
+inline int PRU_PROTOSEND = 21;
+#pragma D binding "1.12.1" PRU_SEND_EOF
+inline int PRU_SEND_EOF = 22;
+#pragma D binding "1.12.1" PRU_SOSETLABEL
+inline int PRU_SOSETLABEL = 23;
+#pragma D binding "1.12.1" PRU_CLOSE
+inline int PRU_CLOSE = 24;
+#pragma D binding "1.12.1" PRU_FLUSH
+inline int PRU_FLUSH = 25;
+
+#pragma D binding "1.12.1" prureq_string
+inline string prureq_string[uint8_t req] =
+ req == PRU_ATTACH ? "ATTACH" :
+ req == PRU_DETACH ? "DETACH" :
+ req == PRU_BIND ? "BIND" :
+ req == PRU_LISTEN ? "LISTEN" :
+ req == PRU_CONNECT ? "CONNECT" :
+ req == PRU_ACCEPT ? "ACCEPT" :
+ req == PRU_DISCONNECT ? "DISCONNECT" :
+ req == PRU_SHUTDOWN ? "SHUTDOWN" :
+ req == PRU_RCVD ? "RCVD" :
+ req == PRU_SEND ? "SEND" :
+ req == PRU_ABORT ? "ABORT" :
+ req == PRU_CONTROL ? "CONTROL" :
+ req == PRU_SENSE ? "SENSE" :
+ req == PRU_RCVOOB ? "RCVOOB" :
+ req == PRU_SENDOOB ? "SENDOOB" :
+ req == PRU_SOCKADDR ? "SOCKADDR" :
+ req == PRU_PEERADDR ? "PEERADDR" :
+ req == PRU_CONNECT2 ? "CONNECT2" :
+ req == PRU_FASTTIMO ? "FASTTIMO" :
+ req == PRU_SLOWTIMO ? "SLOWTIMO" :
+ req == PRU_PROTORCV ? "PROTORCV" :
+ req == PRU_PROTOSEND ? "PROTOSEND" :
+ req == PRU_SEND ? "SEND_EOF" :
+ req == PRU_SOSETLABEL ? "SOSETLABEL" :
+ req == PRU_CLOSE ? "CLOSE" :
+ req == PRU_FLUSH ? "FLUSE" :
+ "unknown" ;
Index: share/dtrace/tcpdebug
===================================================================
--- /dev/null
+++ share/dtrace/tcpdebug
@@ -0,0 +1,163 @@
+#!/usr/sbin/dtrace -s
+/*
+ * Copyright (c) 2015 George V. Neville-Neil
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * The tcpdebug D script uses the tcp:kernel::debug tracepoints
+ * to replicate the action of turning on TCPDEBUG in a kernel configuration.
+ *
+ * A TCP debug statement shows a connection's
+ *
+ * direction: input, output, user, drop
+ * state: CLOSED, LISTEN, SYN_SENT, SYN_RCVD, ESTABLISHED,
+ * CLOSE_WAIT, FIN_WAIT_1, CLOSING, LAST_ACK, FIN_WAIT_2,TIME_WAIT
+ * sequence: sequence space
+ *
+ * congestion: rcv_nxt, rcv_wnd, rcv_up, snd_una, snd_nxt, snx_max,
+ * snd_wl1, snd_wl2, snd_wnd
+ *
+ * NOTE: Only sockets with SO_DEBUG set will be shown.
+ *
+ * Usage: tcpdebug
+ */
+
+#pragma D option quiet
+tcp:kernel::debug-input
+/args[0]->tcps_debug/
+{
+ seq = args[1]->tcp_seq;
+ ack = args[1]->tcp_ack;
+ len = args[2]->ip_plength - sizeof(struct tcphdr);
+ flags = args[1]->tcp_flags;
+
+ printf("%p %s: input [%xu..%xu]", arg0,
+ tcp_state_string[args[0]->tcps_state], seq, seq + len);
+
+ printf("@%x, urp=%x", ack, args[1]->tcp_urgent);
+
+ printf("%s", flags != 0 ? "<" : "");
+ printf("%s", flags & TH_SYN ? "SYN," :"");
+ printf("%s", flags & TH_ACK ? "ACK," :"");
+ printf("%s", flags & TH_FIN ? "FIN," :"");
+ printf("%s", flags & TH_RST ? "RST," :"");
+ printf("%s", flags & TH_PUSH ? "PUSH," :"");
+ printf("%s", flags & TH_URG ? "URG," :"");
+ printf("%s", flags & TH_ECE ? "ECE," :"");
+ printf("%s", flags & TH_CWR ? "CWR" :"");
+ printf("%s", flags != 0 ? ">" : "");
+
+ printf("\n");
+ printf("\trcv_(nxt,wnd,up) (%x,%x,%x) snd_(una,nxt,max) (%x,%x,%x)\n",
+ args[0]->tcps_rnxt, args[0]->tcps_rwnd, args[0]->tcps_rup,
+ args[0]->tcps_suna, args[0]->tcps_snxt, args[0]->tcps_smax);
+ printf("\tsnd_(wl1,wl2,wnd) (%x,%x,%x)\n",
+ args[0]->tcps_swl1, args[0]->tcps_swl2, args[0]->tcps_swnd);
+
+}
+
+tcp:kernel::debug-output
+/args[0]->tcps_debug/
+{
+ seq = args[1]->tcp_seq;
+ ack = args[1]->tcp_ack;
+ len = args[2]->ip_plength - 20;
+
+ printf("%p %s: output [%x..%x]", arg0,
+ tcp_state_string[args[0]->tcps_state], seq, seq + len);
+
+ printf("@%x, urp=%x", ack, args[1]->tcp_urgent);
+
+ printf("%s", flags != 0 ? "<" : "");
+ printf("%s", flags & TH_SYN ? "SYN," :"");
+ printf("%s", flags & TH_ACK ? "ACK," :"");
+ printf("%s", flags & TH_FIN ? "FIN," :"");
+ printf("%s", flags & TH_RST ? "RST," :"");
+ printf("%s", flags & TH_PUSH ? "PUSH," :"");
+ printf("%s", flags & TH_URG ? "URG," :"");
+ printf("%s", flags & TH_ECE ? "ECE," :"");
+ printf("%s", flags & TH_CWR ? "CWR" :"");
+ printf("%s", flags != 0 ? ">" : "");
+
+ printf("\n");
+ printf("\trcv_(nxt,wnd,up) (%u,%x,%x) snd_(una,nxt,max) (%x,%x,%x)\n",
+ args[0]->tcps_rnxt, args[0]->tcps_rwnd, args[0]->tcps_rup,
+ args[0]->tcps_suna, args[0]->tcps_snxt, args[0]->tcps_smax);
+ printf("\tsnd_(wl1,wl2,wnd) (%x,%x,%x)\n",
+ args[0]->tcps_swl1, args[0]->tcps_swl2, args[0]->tcps_swnd);
+
+}
+
+tcp:kernel::debug-drop
+/args[0]->tcps_debug/
+{
+ printf("%p %s: output [x..x] @%x, urp=%x\n", arg0,
+ tcp_state_string[args[0]->tcps_state],
+ args[1]->tcp_ack,
+ args[1]->tcp_urgent);
+
+ seq = args[1]->tcp_seq;
+ ack = args[1]->tcp_ack;
+ len = args[2]->ip_plength;
+
+ printf("%p %s: drop [%x..%x]", arg0,
+ tcp_state_string[args[0]->tcps_state], seq, seq + len);
+
+ printf("@%x, urp=%x", ack, args[1]->tcp_urgent);
+
+ printf("%s", flags != 0 ? "<" : "");
+ printf("%s", flags & TH_SYN ? "SYN," :"");
+ printf("%s", flags & TH_ACK ? "ACK," :"");
+ printf("%s", flags & TH_FIN ? "FIN," :"");
+ printf("%s", flags & TH_RST ? "RST," :"");
+ printf("%s", flags & TH_PUSH ? "PUSH," :"");
+ printf("%s", flags & TH_URG ? "URG," :"");
+ printf("%s", flags & TH_ECE ? "ECE," :"");
+ printf("%s", flags & TH_CWR ? "CWR" :"");
+ printf("%s", flags != 0 ? ">" : "");
+
+ printf("\n");
+ printf("\trcv_(nxt,wnd,up) (%x,%x,%x) snd_(una,nxt,max) (%x,%x,%x)\n",
+ args[0]->tcps_rnxt, args[0]->tcps_rwnd, args[0]->tcps_rup,
+ args[0]->tcps_suna, args[0]->tcps_snxt, args[0]->tcps_smax);
+ printf("\tsnd_(wl1,wl2,wnd) (%x,%x,%x)\n",
+ args[0]->tcps_swl1, args[0]->tcps_swl2, args[0]->tcps_swnd);
+
+}
+
+tcp:kernel::debug-user
+/args[0]->tcps_debug/
+{
+ printf("%p %s: user ", arg0,
+ tcp_state_string[args[0]->tcps_state]);
+
+ printf("%s", prureq_string[arg1]);
+ printf("\n");
+ printf("\trcv_(nxt,wnd,up) (%x,%x,%x) snd_(una,nxt,max) (%x,%x,%x)\n",
+ args[0]->tcps_rnxt, args[0]->tcps_rwnd, args[0]->tcps_rup,
+ args[0]->tcps_suna, args[0]->tcps_snxt, args[0]->tcps_smax);
+ printf("\tsnd_(wl1,wl2,wnd) (%x,%x,%x)\n",
+ args[0]->tcps_swl1, args[0]->tcps_swl2, args[0]->tcps_swnd);
+
+}
+
Index: sys/netinet/in_kdtrace.h
===================================================================
--- sys/netinet/in_kdtrace.h
+++ sys/netinet/in_kdtrace.h
@@ -34,6 +34,12 @@
SDT_PROBE5(udp, , , probe, arg0, arg1, arg2, arg3, arg4)
#define TCP_PROBE1(probe, arg0) \
SDT_PROBE1(tcp, , , probe, arg0)
+#define TCP_PROBE2(probe, arg0, arg1) \
+ SDT_PROBE2(tcp, , , probe, arg0, arg1)
+#define TCP_PROBE3(probe, arg0, arg1, arg2) \
+ SDT_PROBE3(tcp, , , probe, arg0, arg1, arg2)
+#define TCP_PROBE4(probe, arg0, arg1, arg2, arg3) \
+ SDT_PROBE4(tcp, , , probe, arg0, arg1, arg2, arg3)
#define TCP_PROBE5(probe, arg0, arg1, arg2, arg3, arg4) \
SDT_PROBE5(tcp, , , probe, arg0, arg1, arg2, arg3, arg4)
#define TCP_PROBE6(probe, arg0, arg1, arg2, arg3, arg4, arg5) \
@@ -55,6 +61,10 @@
SDT_PROBE_DECLARE(tcp, , , send);
SDT_PROBE_DECLARE(tcp, , , siftr);
SDT_PROBE_DECLARE(tcp, , , state__change);
+SDT_PROBE_DECLARE(tcp, , , debug__input);
+SDT_PROBE_DECLARE(tcp, , , debug__output);
+SDT_PROBE_DECLARE(tcp, , , debug__user);
+SDT_PROBE_DECLARE(tcp, , , debug__drop);
SDT_PROBE_DECLARE(udp, , , receive);
SDT_PROBE_DECLARE(udp, , , send);
Index: sys/netinet/in_kdtrace.c
===================================================================
--- sys/netinet/in_kdtrace.c
+++ sys/netinet/in_kdtrace.c
@@ -105,6 +105,25 @@
SDT_PROBE_DEFINE1_XLATE(tcp, , , siftr,
"struct pkt_node *", "siftrinfo_t *");
+SDT_PROBE_DEFINE3_XLATE(tcp, , , debug__input,
+ "struct tcpcb *", "tcpsinfo_t *" ,
+ "struct tcphdr *", "tcpinfo_t *",
+ "uint8_t *", "ipinfo_t *");
+
+SDT_PROBE_DEFINE3_XLATE(tcp, , , debug__output,
+ "struct tcpcb *", "tcpsinfo_t *" ,
+ "struct tcphdr *", "tcpinfo_t *",
+ "uint8_t *", "ipinfo_t *");
+
+SDT_PROBE_DEFINE2_XLATE(tcp, , , debug__user,
+ "struct tcpcb *", "tcpsinfo_t *" ,
+ "int", "int");
+
+SDT_PROBE_DEFINE3_XLATE(tcp, , , debug__drop,
+ "struct tcpcb *", "tcpsinfo_t *" ,
+ "struct tcphdr *", "tcpinfo_t *",
+ "uint8_t *", "ipinfo_t *")
+
SDT_PROBE_DEFINE6_XLATE(tcp, , , state__change,
"void *", "void *",
"struct tcpcb *", "csinfo_t *",
Index: sys/netinet/tcp_input.c
===================================================================
--- sys/netinet/tcp_input.c
+++ sys/netinet/tcp_input.c
@@ -1377,6 +1377,7 @@
tcp_trace(TA_INPUT, ostate, tp,
(void *)tcp_saveipgen, &tcp_savetcp, 0);
#endif
+ TCP_PROBE3(debug__input, tp, th, mtod(m, const char *));
tcp_dooptions(&to, optp, optlen, TO_SYN);
syncache_add(&inc, &to, th, inp, &so, m, NULL, NULL);
/*
@@ -1779,6 +1780,8 @@
(void *)tcp_saveipgen,
&tcp_savetcp, 0);
#endif
+ TCP_PROBE3(debug__input, tp, th,
+ mtod(m, const char *));
if (tp->snd_una == tp->snd_max)
tcp_timer_activate(tp, TT_REXMT, 0);
else if (!tcp_timer_active(tp, TT_PERSIST))
@@ -1825,6 +1828,8 @@
tcp_trace(TA_INPUT, ostate, tp,
(void *)tcp_saveipgen, &tcp_savetcp, 0);
#endif
+ TCP_PROBE3(debug__input, tp, th, mtod(m, const char *));
+
/*
* Automatic sizing of receive socket buffer. Often the send
* buffer size is not optimally adjusted to the actual network
@@ -3022,6 +3027,7 @@
tcp_trace(TA_INPUT, ostate, tp, (void *)tcp_saveipgen,
&tcp_savetcp, 0);
#endif
+ TCP_PROBE3(debug__input, tp, th, mtod(m, const char *));
/*
* Return any desired output.
@@ -3069,6 +3075,7 @@
tcp_trace(TA_DROP, ostate, tp, (void *)tcp_saveipgen,
&tcp_savetcp, 0);
#endif
+ TCP_PROBE3(debug__input, tp, th, mtod(m, const char *));
if (ti_locked == TI_RLOCKED)
INP_INFO_RUNLOCK(&V_tcbinfo);
ti_locked = TI_UNLOCKED;
@@ -3109,6 +3116,7 @@
tcp_trace(TA_DROP, ostate, tp, (void *)tcp_saveipgen,
&tcp_savetcp, 0);
#endif
+ TCP_PROBE3(debug__input, tp, th, mtod(m, const char *));
if (tp != NULL)
INP_WUNLOCK(tp->t_inpcb);
m_freem(m);
Index: sys/netinet/tcp_output.c
===================================================================
--- sys/netinet/tcp_output.c
+++ sys/netinet/tcp_output.c
@@ -1253,6 +1253,7 @@
ipov->ih_len = save;
}
#endif /* TCPDEBUG */
+ TCP_PROBE3(debug__input, tp, th, mtod(m, const char *));
/*
* Fill in IP length and desired time to live and
Index: sys/netinet/tcp_subr.c
===================================================================
--- sys/netinet/tcp_subr.c
+++ sys/netinet/tcp_subr.c
@@ -719,6 +719,7 @@
if (tp == NULL || (inp->inp_socket->so_options & SO_DEBUG))
tcp_trace(TA_OUTPUT, 0, tp, mtod(m, void *), th, 0);
#endif
+ TCP_PROBE3(debug__input, tp, th, mtod(m, const char *));
if (flags & TH_RST)
TCP_PROBE5(accept__refused, NULL, NULL, mtod(m, const char *),
tp, nth);
Index: sys/netinet/tcp_timer.c
===================================================================
--- sys/netinet/tcp_timer.c
+++ sys/netinet/tcp_timer.c
@@ -57,6 +57,7 @@
#include <netinet/cc.h>
#include <netinet/in.h>
+#include <netinet/in_kdtrace.h>
#include <netinet/in_pcb.h>
#include <netinet/in_rss.h>
#include <netinet/in_systm.h>
@@ -367,6 +368,8 @@
tcp_trace(TA_USER, ostate, tp, (void *)0, (struct tcphdr *)0,
PRU_SLOWTIMO);
#endif
+ TCP_PROBE2(debug__user, tp, PRU_SLOWTIMO);
+
if (tp != NULL)
INP_WUNLOCK(inp);
INP_INFO_RUNLOCK(&V_tcbinfo);
@@ -449,6 +452,7 @@
tcp_trace(TA_USER, ostate, tp, (void *)0, (struct tcphdr *)0,
PRU_SLOWTIMO);
#endif
+ TCP_PROBE2(debug__user, tp, PRU_SLOWTIMO);
INP_WUNLOCK(inp);
INP_INFO_RUNLOCK(&V_tcbinfo);
CURVNET_RESTORE();
@@ -463,6 +467,7 @@
tcp_trace(TA_USER, ostate, tp, (void *)0, (struct tcphdr *)0,
PRU_SLOWTIMO);
#endif
+ TCP_PROBE2(debug__user, tp, PRU_SLOWTIMO);
if (tp != NULL)
INP_WUNLOCK(tp->t_inpcb);
INP_INFO_RUNLOCK(&V_tcbinfo);
@@ -541,6 +546,7 @@
if (tp != NULL && tp->t_inpcb->inp_socket->so_options & SO_DEBUG)
tcp_trace(TA_USER, ostate, tp, NULL, NULL, PRU_SLOWTIMO);
#endif
+ TCP_PROBE2(debug__user, tp, PRU_SLOWTIMO);
if (tp != NULL)
INP_WUNLOCK(inp);
INP_INFO_RUNLOCK(&V_tcbinfo);
@@ -787,6 +793,7 @@
tcp_trace(TA_USER, ostate, tp, (void *)0, (struct tcphdr *)0,
PRU_SLOWTIMO);
#endif
+ TCP_PROBE2(debug__user, tp, PRU_SLOWTIMO);
if (tp != NULL)
INP_WUNLOCK(inp);
if (headlocked)
Index: sys/netinet/tcp_usrreq.c
===================================================================
--- sys/netinet/tcp_usrreq.c
+++ sys/netinet/tcp_usrreq.c
@@ -70,6 +70,7 @@
#include <netinet/cc.h>
#include <netinet/in.h>
+#include <netinet/in_kdtrace.h>
#include <netinet/in_pcb.h>
#include <netinet/in_systm.h>
#include <netinet/in_var.h>
@@ -146,6 +147,7 @@
tp = intotcpcb(inp);
out:
TCPDEBUG2(PRU_ATTACH);
+ TCP_PROBE2(debug__user, tp, PRU_ATTACH);
return error;
}
@@ -295,6 +297,7 @@
INP_HASH_WUNLOCK(&V_tcbinfo);
out:
TCPDEBUG2(PRU_BIND);
+ TCP_PROBE2(debug__user, tp, PRU_BIND);
INP_WUNLOCK(inp);
return (error);
@@ -355,6 +358,7 @@
INP_HASH_WUNLOCK(&V_tcbinfo);
out:
TCPDEBUG2(PRU_BIND);
+ TCP_PROBE2(debug__user, tp, PRU_BIND);
INP_WUNLOCK(inp);
return (error);
}
@@ -399,6 +403,7 @@
out:
TCPDEBUG2(PRU_LISTEN);
+ TCP_PROBE2(debug__user, tp, PRU_LISTEN);
INP_WUNLOCK(inp);
return (error);
}
@@ -444,6 +449,7 @@
out:
TCPDEBUG2(PRU_LISTEN);
+ TCP_PROBE2(debug__user, tp, PRU_LISTEN);
INP_WUNLOCK(inp);
return (error);
}
@@ -592,6 +598,7 @@
out:
TCPDEBUG2(PRU_CONNECT);
+ TCP_PROBE2(debug__user, tp, PRU_CONNECT);
INP_WUNLOCK(inp);
return (error);
}
@@ -631,6 +638,7 @@
tcp_disconnect(tp);
out:
TCPDEBUG2(PRU_DISCONNECT);
+ TCP_PROBE2(debug__user, tp, PRU_DISCONNECT);
INP_WUNLOCK(inp);
INP_INFO_RUNLOCK(&V_tcbinfo);
return (error);
@@ -674,6 +682,7 @@
out:
TCPDEBUG2(PRU_ACCEPT);
+ TCP_PROBE2(debug__user, tp, PRU_ACCEPT);
INP_WUNLOCK(inp);
if (error == 0)
*nam = in_sockaddr(port, &addr);
@@ -724,6 +733,7 @@
out:
TCPDEBUG2(PRU_ACCEPT);
+ TCP_PROBE2(debug__user, tp, PRU_ACCEPT);
INP_WUNLOCK(inp);
INP_INFO_RUNLOCK(&V_tcbinfo);
if (error == 0) {
@@ -764,6 +774,7 @@
out:
TCPDEBUG2(PRU_SHUTDOWN);
+ TCP_PROBE2(debug__user, tp, PRU_SHUTDOWN);
INP_WUNLOCK(inp);
INP_INFO_RUNLOCK(&V_tcbinfo);
@@ -799,6 +810,7 @@
out:
TCPDEBUG2(PRU_RCVD);
+ TCP_PROBE2(debug__user, tp, PRU_RCVD);
INP_WUNLOCK(inp);
return (error);
}
@@ -953,6 +965,8 @@
out:
TCPDEBUG2((flags & PRUS_OOB) ? PRU_SENDOOB :
((flags & PRUS_EOF) ? PRU_SEND_EOF : PRU_SEND));
+ TCP_PROBE2(debug__user, tp, (flags & PRUS_OOB) ? PRU_SENDOOB :
+ ((flags & PRUS_EOF) ? PRU_SEND_EOF : PRU_SEND));
INP_WUNLOCK(inp);
if (flags & PRUS_EOF)
INP_INFO_RUNLOCK(&V_tcbinfo);
@@ -1013,6 +1027,7 @@
TCPDEBUG1();
tcp_drop(tp, ECONNABORTED);
TCPDEBUG2(PRU_ABORT);
+ TCP_PROBE2(debug__user, tp, PRU_ABORT);
}
if (!(inp->inp_flags & INP_DROPPED)) {
SOCK_LOCK(so);
@@ -1052,6 +1067,7 @@
TCPDEBUG1();
tcp_disconnect(tp);
TCPDEBUG2(PRU_CLOSE);
+ TCP_PROBE2(debug__user, tp, PRU_CLOSE);
}
if (!(inp->inp_flags & INP_DROPPED)) {
SOCK_LOCK(so);
@@ -1101,6 +1117,7 @@
out:
TCPDEBUG2(PRU_RCVOOB);
+ TCP_PROBE2(debug__user, tp, PRU_RCVOOB);
INP_WUNLOCK(inp);
return (error);
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Mar 5, 10:06 PM (8 h, 7 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
29300155
Default Alt Text
D3530.id8724.diff (21 KB)
Attached To
Mode
D3530: Add DTrace probe points, translators and a corresponding script to replace the TCPDEBUG functionality with pure DTrace.
Attached
Detach File
Event Timeline
Log In to Comment