Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F108368550
D40834.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
7 KB
Referenced Files
None
Subscribers
None
D40834.diff
View Options
diff --git a/cddl/lib/libdtrace/siftr.d b/cddl/lib/libdtrace/siftr.d
--- a/cddl/lib/libdtrace/siftr.d
+++ b/cddl/lib/libdtrace/siftr.d
@@ -21,6 +21,7 @@
* $FreeBSD$
*/
+#pragma D depends_on library ip.d
#pragma D depends_on module kernel
#pragma D depends_on module siftr
#pragma D depends_on provider tcp
@@ -44,20 +45,22 @@
struct timeval tval;
uint8_t direction;
uint8_t ipver;
- uint16_t tcp_localport;
- uint16_t tcp_foreignport;
+ uint16_t lport;
+ uint16_t rport;
+ string laddr;
+ string raddr;
uint32_t snd_cwnd;
uint32_t snd_wnd;
uint32_t rcv_wnd;
uint32_t t_flags2;
uint32_t snd_ssthresh;
int conn_state;
- u_int max_seg_size;
+ uint32_t mss;
uint32_t srtt;
u_char sack_enabled;
u_char snd_scale;
u_char rcv_scale;
- u_int flags;
+ u_int t_flags;
uint32_t rto;
u_int snd_buf_hiwater;
u_int snd_buf_cc;
@@ -73,20 +76,28 @@
translator siftrinfo_t < struct pkt_node *p > {
direction = p == NULL ? 0 : p->direction;
ipver = p == NULL ? 0 : p->ipver;
- tcp_localport = p == NULL ? 0 : ntohs(p->tcp_localport);
- tcp_foreignport = p == NULL ? 0 : ntohs(p->tcp_foreignport);
+ lport = p == NULL ? 0 : ntohs(p->lport);
+ rport = p == NULL ? 0 : ntohs(p->fport);
+ laddr = p == NULL ? "<unknown>" :
+ p->ipver == INP_IPV4 ?
+ inet_ntoa(&p->laddr.id46_addr.ia46_addr4.s_addr) :
+ inet_ntoa6(&p->laddr.id6_addr);
+ raddr = p == NULL ? "<unknown>" :
+ p->ipver == INP_IPV4 ?
+ inet_ntoa(&p->faddr.id46_addr.ia46_addr4.s_addr) :
+ inet_ntoa6(&p->faddr.id6_addr);
snd_cwnd = p == NULL ? 0 : p->snd_cwnd;
snd_wnd = p == NULL ? 0 : p->snd_wnd;
rcv_wnd = p == NULL ? 0 : p->rcv_wnd;
t_flags2 = p == NULL ? 0 : p->t_flags2;
snd_ssthresh = p == NULL ? 0 : p->snd_ssthresh;
conn_state = p == NULL ? 0 : p->conn_state;
- max_seg_size = p == NULL ? 0 : p->max_seg_size;
+ mss = p == NULL ? 0 : p->mss;
srtt = p == NULL ? 0 : p->srtt;
sack_enabled = p == NULL ? 0 : p->sack_enabled;
snd_scale = p == NULL ? 0 : p->snd_scale;
rcv_scale = p == NULL ? 0 : p->rcv_scale;
- flags = p == NULL ? 0 : p->flags;
+ t_flags = p == NULL ? 0 : p->t_flags;
rto = p == NULL ? 0 : p->rto;
snd_buf_hiwater = p == NULL ? 0 : p->snd_buf_hiwater;
snd_buf_cc = p == NULL ? 0 : p->snd_buf_cc;
diff --git a/share/man/man4/dtrace_tcp.4 b/share/man/man4/dtrace_tcp.4
--- a/share/man/man4/dtrace_tcp.4
+++ b/share/man/man4/dtrace_tcp.4
@@ -24,7 +24,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd July 1, 2023
+.Dd July 2, 2023
.Dt DTRACE_TCP 4
.Os
.Sh NAME
@@ -319,10 +319,14 @@
for IPv4, or
.Qq 2
for IPv6.
-.It Vt uint16_t tcp_localport
+.It Vt uint16_t lport
The TCP port that the local host is communicating via.
-.It Vt uint16_t tcp_foreignport
-The TCP port that the foreign host is communicating via.
+.It Vt uint16_t rport
+The TCP port that the remote host is communicating via.
+.It Vt string laddr
+The IPv4 or IPv6 address of the local host.
+.It Vt string raddr
+The IPv4 or IPv6 address of the remote host.
.It Vt uint32_t snd_cwnd
The current congestion window (CWND) for the flow, in bytes.
.It Vt uint32_t snd_wnd
@@ -342,8 +346,8 @@
.Ql TCPS_
in
.Pa /usr/lib/dtrace/tcp.d .
-.It Vt u_int max_seg_size
-The maximum segment size for the flow, in bytes.
+.It Vt uint32_t mss
+The maximum segment size (MSS) for the flow, in bytes.
.It Vt uint32_t srtt
The current smoothed RTT (SRTT) for the flow in microseconds.
.It Vt u_char sack_enabled
@@ -352,7 +356,7 @@
The current window scaling factor for the sending window.
.It Vt u_char rcv_scale
The current window scaling factor for the receiving window.
-.It Vt u_int flags
+.It Vt u_int t_flags
The current value of the t_flags for the flow.
.It Vt uint32_t rto
The current retransmission timeout (RTO) for the flow in microseconds.
@@ -480,15 +484,15 @@
dtrace:::BEGIN
{
- printf(" %3s %5s %5s %10s %10s\\n",
- "DIR", "LPORT", "RPORT", "CWND", "SSTHRESH");
+ printf(" %3s %16s:%-5s %16s:%-5s %10s %10s\\n",
+ "DIR", "LADDR", "LPORT", "RADDR", "RPORT", "CWND", "SSTHRESH");
}
tcp:::siftr
{
- printf(" %3s %5d %5d %10d %10d\\n",
+ printf(" %3s %16s:%-5d %16s:%-5d %10u %10u\\n",
siftr_dir_string[args[0]->direction],
- args[0]->tcp_localport, args[0]->tcp_foreignport,
+ args[0]->laddr, args[0]->lport, args[0]->raddr, args[0]->rport,
args[0]->snd_cwnd, args[0]->snd_ssthresh);
}
.Ed
diff --git a/sys/netinet/siftr.c b/sys/netinet/siftr.c
--- a/sys/netinet/siftr.c
+++ b/sys/netinet/siftr.c
@@ -163,9 +163,13 @@
/* IP version pkt_node relates to; either INP_IPV4 or INP_IPV6. */
uint8_t ipver;
/* Local TCP port. */
- uint16_t tcp_localport;
+ uint16_t lport;
/* Foreign TCP port. */
- uint16_t tcp_foreignport;
+ uint16_t fport;
+ /* Local address. */
+ union in_dependaddr laddr;
+ /* Foreign address. */
+ union in_dependaddr faddr;
/* Congestion Window (bytes). */
uint32_t snd_cwnd;
/* Sending Window (bytes). */
@@ -179,7 +183,7 @@
/* Current state of the TCP FSM. */
int conn_state;
/* Max Segment Size (bytes). */
- u_int max_seg_size;
+ uint32_t mss;
/* Smoothed RTT (usecs). */
uint32_t srtt;
/* Is SACK enabled? */
@@ -189,7 +193,7 @@
/* Window scaling for recv window. */
u_char rcv_scale;
/* TCP control block flags. */
- u_int flags;
+ u_int t_flags;
/* Retransmission timeout (usec). */
uint32_t rto;
/* Size of the TCP send buffer in bytes. */
@@ -223,7 +227,6 @@
#endif
uint16_t lport; /* local TCP port */
uint16_t fport; /* foreign TCP port */
- uint8_t ipver; /* IP version */
uint32_t key; /* flowid of the connection */
};
@@ -427,10 +430,10 @@
pkt_node->snd_scale,
pkt_node->rcv_scale,
pkt_node->conn_state,
- pkt_node->max_seg_size,
+ pkt_node->mss,
pkt_node->srtt,
pkt_node->sack_enabled,
- pkt_node->flags,
+ pkt_node->t_flags,
pkt_node->rto,
pkt_node->snd_buf_hiwater,
pkt_node->snd_buf_cc,
@@ -642,8 +645,10 @@
int ipver, int dir, int inp_locally_locked)
{
pn->ipver = ipver;
- pn->tcp_localport = inp->inp_lport;
- pn->tcp_foreignport = inp->inp_fport;
+ pn->lport = inp->inp_lport;
+ pn->fport = inp->inp_fport;
+ pn->laddr = inp->inp_inc.inc_ie.ie_dependladdr;
+ pn->faddr = inp->inp_inc.inc_ie.ie_dependfaddr;
pn->snd_cwnd = tp->snd_cwnd;
pn->snd_wnd = tp->snd_wnd;
pn->rcv_wnd = tp->rcv_wnd;
@@ -652,10 +657,10 @@
pn->snd_scale = tp->snd_scale;
pn->rcv_scale = tp->rcv_scale;
pn->conn_state = tp->t_state;
- pn->max_seg_size = tp->t_maxseg;
+ pn->mss = tp->t_maxseg;
pn->srtt = ((uint64_t)tp->t_srtt * tick) >> TCP_RTT_SHIFT;
pn->sack_enabled = (tp->t_flags & TF_SACK_PERMIT) != 0;
- pn->flags = tp->t_flags;
+ pn->t_flags = tp->t_flags;
pn->rto = tp->t_rxtcur * tick;
pn->snd_buf_hiwater = inp->inp_socket->so_snd.sb_hiwat;
pn->snd_buf_cc = sbused(&inp->inp_socket->so_snd);
@@ -796,7 +801,6 @@
info.lport = ntohs(inp->inp_lport);
info.fport = ntohs(inp->inp_fport);
info.key = hash_id;
- info.ipver = INP_IPV4;
hash_node = siftr_new_hash_node(info, dir, ss);
}
@@ -946,7 +950,6 @@
info.lport = ntohs(inp->inp_lport);
info.fport = ntohs(inp->inp_fport);
info.key = hash_id;
- info.ipver = INP_IPV6;
hash_node = siftr_new_hash_node(info, dir, ss);
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Jan 25, 5:29 AM (20 h, 41 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
16126363
Default Alt Text
D40834.diff (7 KB)
Attached To
Mode
D40834: dtrace: improve siftr probe
Attached
Detach File
Event Timeline
Log In to Comment