summaryrefslogtreecommitdiff
path: root/sys/netinet/tcp_var.h
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2022-08-11 09:13:22 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2022-08-11 09:13:22 +0000
commit068e2adeaf7d379a528fea6b3a900f385d86c9e7 (patch)
tree21a35422f220507c8a68ea50d2b0a33470cd929e /sys/netinet/tcp_var.h
parent8c51043e0c10c867a43b1404478bf9968ff9f197 (diff)
Add TCP_INFO support to getsockopt for tcp sessions.
TCP_INFO provides a lot of information about the TCP session of this socket. Many processes like to peek at the rtt of a connection but this also provides a lot of more special info for use by e.g. tcpbench(1). While the basic minimal info is available all the time the more specific data is only populated for privileged processes. This is done to not share data back to userland that may allow to attack a session. TCP_INFO is available to pledge "inet" since pledged processes like chrome tend to use TCP_INFO when available. OK bluhm@
Diffstat (limited to 'sys/netinet/tcp_var.h')
-rw-r--r--sys/netinet/tcp_var.h12
1 files changed, 10 insertions, 2 deletions
diff --git a/sys/netinet/tcp_var.h b/sys/netinet/tcp_var.h
index 7d8f615d4d2..29dcff81e0e 100644
--- a/sys/netinet/tcp_var.h
+++ b/sys/netinet/tcp_var.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: tcp_var.h,v 1.139 2022/02/25 23:51:03 guenther Exp $ */
+/* $OpenBSD: tcp_var.h,v 1.140 2022/08/11 09:13:21 claudio Exp $ */
/* $NetBSD: tcp_var.h,v 1.17 1996/02/13 23:44:24 christos Exp $ */
/*
@@ -161,6 +161,9 @@ struct tcpcb {
* "Variance" is actually smoothed difference.
*/
uint32_t t_rcvtime; /* time last segment received */
+ uint32_t t_rcvacktime; /* time last ack received */
+ uint32_t t_sndtime; /* time last segment sent */
+ uint32_t t_sndacktime; /* time last ack sent */
uint32_t t_rtttime; /* time we started measuring rtt */
tcp_seq t_rtseq; /* sequence number being timed */
short t_srtt; /* smoothed round-trip time */
@@ -182,7 +185,7 @@ struct tcpcb {
u_char requested_s_scale;
u_int32_t ts_recent; /* timestamp echo data */
u_int32_t ts_modulate; /* modulation on timestamp */
- u_int32_t ts_recent_age; /* when last updated */
+ u_int32_t ts_recent_age; /* when last updated */
tcp_seq last_ack_sent;
/* pointer for syn cache entries*/
@@ -197,6 +200,11 @@ struct tcpcb {
u_short t_pmtud_ip_hl; /* IP header length from ICMP payload */
int pf;
+
+/* maintain a few stats per connection: */
+ u_int t_rcvoopack; /* out-of-order packets received */
+ u_int t_sndrexmitpack; /* retransmit packets sent */
+ u_int t_sndzerowin; /* zero-window updates sent */
};
#define intotcpcb(ip) ((struct tcpcb *)(ip)->inp_ppcb)