* [RFC PATCH net-next 0/2] TCP: Fast-Open observability
@ 2025-03-13 14:45 Jeremy Harris
2025-03-13 14:45 ` [RFC PATCH net-next 1/2] TCP: note received valid-cookie Fast Open option Jeremy Harris
2025-03-13 14:45 ` [RFC PATCH net-next 2/2] TCP: pass accepted-TFO indication through getsockopt Jeremy Harris
0 siblings, 2 replies; 3+ messages in thread
From: Jeremy Harris @ 2025-03-13 14:45 UTC (permalink / raw)
To: netdev; +Cc: Jeremy Harris
Whether TCP Fast Open was used, or not, for a connection is not reliably
observable by an accepting application.
Fix this by noting during SYN processing that an acceptable Fast Open option
was used, and provide this to userland via getsockopt TCP_INFO.
Jeremy Harris (2):
TCP: note received valid-cookie Fast Open option
TCP: pass accepted-TFO indication through getsockopt
include/linux/tcp.h | 3 ++-
include/uapi/linux/tcp.h | 1 +
net/ipv4/tcp.c | 2 ++
net/ipv4/tcp_fastopen.c | 1 +
4 files changed, 6 insertions(+), 1 deletion(-)
base-commit: 5a1dddd2944492edb1e61c5db1cc386e5419fcf4
--
2.48.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* [RFC PATCH net-next 1/2] TCP: note received valid-cookie Fast Open option
2025-03-13 14:45 [RFC PATCH net-next 0/2] TCP: Fast-Open observability Jeremy Harris
@ 2025-03-13 14:45 ` Jeremy Harris
2025-03-13 14:45 ` [RFC PATCH net-next 2/2] TCP: pass accepted-TFO indication through getsockopt Jeremy Harris
1 sibling, 0 replies; 3+ messages in thread
From: Jeremy Harris @ 2025-03-13 14:45 UTC (permalink / raw)
To: netdev; +Cc: Jeremy Harris
Signed-off-by: Jeremy Harris <jgh@exim.org>
---
include/linux/tcp.h | 3 ++-
net/ipv4/tcp_fastopen.c | 1 +
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/include/linux/tcp.h b/include/linux/tcp.h
index 159b2c59e..c32c8ba59 100644
--- a/include/linux/tcp.h
+++ b/include/linux/tcp.h
@@ -382,7 +382,8 @@ struct tcp_sock {
syn_fastopen:1, /* SYN includes Fast Open option */
syn_fastopen_exp:1,/* SYN includes Fast Open exp. option */
syn_fastopen_ch:1, /* Active TFO re-enabling probe */
- syn_data_acked:1;/* data in SYN is acked by SYN-ACK */
+ syn_data_acked:1,/* data in SYN is acked by SYN-ACK */
+ syn_fastopen_in:1; /* Received SYN includes Fast Open option */
u8 keepalive_probes; /* num of allowed keep alive probes */
u32 tcp_tx_delay; /* delay (in usec) added to TX packets */
diff --git a/net/ipv4/tcp_fastopen.c b/net/ipv4/tcp_fastopen.c
index 1a6b1bc54..004d0024c 100644
--- a/net/ipv4/tcp_fastopen.c
+++ b/net/ipv4/tcp_fastopen.c
@@ -401,6 +401,7 @@ struct sock *tcp_try_fastopen(struct sock *sk, struct sk_buff *skb,
}
NET_INC_STATS(sock_net(sk),
LINUX_MIB_TCPFASTOPENPASSIVE);
+ tcp_sk(child)->syn_fastopen_in = 1;
return child;
}
NET_INC_STATS(sock_net(sk),
--
2.48.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [RFC PATCH net-next 2/2] TCP: pass accepted-TFO indication through getsockopt
2025-03-13 14:45 [RFC PATCH net-next 0/2] TCP: Fast-Open observability Jeremy Harris
2025-03-13 14:45 ` [RFC PATCH net-next 1/2] TCP: note received valid-cookie Fast Open option Jeremy Harris
@ 2025-03-13 14:45 ` Jeremy Harris
1 sibling, 0 replies; 3+ messages in thread
From: Jeremy Harris @ 2025-03-13 14:45 UTC (permalink / raw)
To: netdev; +Cc: Jeremy Harris
Signed-off-by: Jeremy Harris <jgh@exim.org>
---
include/uapi/linux/tcp.h | 1 +
net/ipv4/tcp.c | 2 ++
2 files changed, 3 insertions(+)
diff --git a/include/uapi/linux/tcp.h b/include/uapi/linux/tcp.h
index 32a27b4a5..e958a145d 100644
--- a/include/uapi/linux/tcp.h
+++ b/include/uapi/linux/tcp.h
@@ -179,6 +179,7 @@ enum tcp_fastopen_client_fail {
#define TCPI_OPT_ECN_SEEN 16 /* we received at least one packet with ECT */
#define TCPI_OPT_SYN_DATA 32 /* SYN-ACK acked data in SYN sent or rcvd */
#define TCPI_OPT_USEC_TS 64 /* usec timestamps */
+#define TCPI_OPT_TFO_SEEN 128 /* we accepted a Fast Open option on SYN */
/*
* Sender's congestion state indicating normal or abnormal situations
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index 46951e749..407bdfb12 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -4146,6 +4146,8 @@ void tcp_get_info(struct sock *sk, struct tcp_info *info)
info->tcpi_options |= TCPI_OPT_SYN_DATA;
if (tp->tcp_usec_ts)
info->tcpi_options |= TCPI_OPT_USEC_TS;
+ if (tp->syn_fastopen_in)
+ info->tcpi_options |= TCPI_OPT_TFO_SEEN;
info->tcpi_rto = jiffies_to_usecs(icsk->icsk_rto);
info->tcpi_ato = jiffies_to_usecs(min_t(u32, icsk->icsk_ack.ato,
--
2.48.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-03-13 14:46 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-13 14:45 [RFC PATCH net-next 0/2] TCP: Fast-Open observability Jeremy Harris
2025-03-13 14:45 ` [RFC PATCH net-next 1/2] TCP: note received valid-cookie Fast Open option Jeremy Harris
2025-03-13 14:45 ` [RFC PATCH net-next 2/2] TCP: pass accepted-TFO indication through getsockopt Jeremy Harris
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).