1// SPDX-License-Identifier: GPL-2.0 2// 3// Send a RST to a TFO socket after it has been accepted. 4// 5// First read() will return all the data and this is consistent 6// with the non-TFO case. Second read will return -1 7 8`./defaults.sh` 9 10 0 socket(..., SOCK_STREAM|SOCK_NONBLOCK, IPPROTO_TCP) = 3 11 +0 setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0 12 +0 bind(3, ..., ...) = 0 13 +0 listen(3, 1) = 0 14 +0 setsockopt(3, SOL_TCP, TCP_FASTOPEN, [1], 4) = 0 15 16 +0 < S 0:10(10) win 32792 <mss 1460,sackOK,nop,nop,FO TFO_COOKIE,nop,nop> 17 +0 > S. 0:0(0) ack 11 <mss 1460,nop,nop,sackOK> 18 19 +0 accept(3, ..., ...) = 4 20 +0 %{ assert (tcpi_options & TCPI_OPT_SYN_DATA) != 0, tcpi_options }% 21 +0 %{ assert tcpi_state == TCP_SYN_RECV, tcpi_state }% 22 23// 1st read will return the data from SYN. 24// tcp_reset() sets sk->sk_err to ECONNRESET for SYN_RECV. 25 +0 < R. 11:11(0) win 32792 26 +0 %{ assert tcpi_state == TCP_CLOSE, tcpi_state }% 27 28// This one w/o ACK bit will cause the same effect. 29// +0 < R 11:11(0) win 32792 30// See Step 2 in tcp_validate_incoming(). 31 32// found_ok_skb in tcp_recvmsg_locked() 33 +0 read(4, ..., 512) = 10 34 35// !copied && sk->sk_err -> sock_error(sk) 36 +0 read(4, ..., 512) = -1 ECONNRESET (Connection reset by peer) 37 +0 close(4) = 0 38