1// SPDX-License-Identifier: GPL-2.0 2// Test TCP fastopen behavior with NULL as buffer pointer, but a non-zero 3// buffer length. 4`./defaults.sh 5./set_sysctls.py /proc/sys/net/ipv4/tcp_timestamps=0` 6 7// Cache warmup: send a Fast Open cookie request 8 0 socket(..., SOCK_STREAM, IPPROTO_TCP) = 3 9+0 fcntl(3, F_SETFL, O_RDWR|O_NONBLOCK) = 0 10+0 setsockopt(3, SOL_TCP, TCP_FASTOPEN_CONNECT, [1], 4) = 0 11+0 connect(3, ..., ...) = -1 EINPROGRESS (Operation is now in progress) 12+0 > S 0:0(0) <mss 1460,nop,nop,sackOK,nop,wscale 8,FO,nop,nop> 13+0 < S. 123:123(0) ack 1 win 14600 <mss 1460,nop,nop,sackOK,nop,wscale 6,FO abcd1234,nop,nop> 14+0 > . 1:1(0) ack 1 15+0 close(3) = 0 16+0 > F. 1:1(0) ack 1 17+0 < F. 1:1(0) ack 2 win 92 18+0 > . 2:2(0) ack 2 19 20// Test with MSG_FASTOPEN without TCP_FASTOPEN_CONNECT. 21+0 socket(..., SOCK_STREAM, IPPROTO_TCP) = 4 22+0 fcntl(4, F_SETFL, O_RDWR|O_NONBLOCK) = 0 23+0 sendto(4, NULL, 1, MSG_FASTOPEN, ..., ...) = -1 24+0 close(4) = 0 25 26// Test with TCP_FASTOPEN_CONNECT without MSG_FASTOPEN. 27+0 socket(..., SOCK_STREAM, IPPROTO_TCP) = 5 28+0 fcntl(5, F_SETFL, O_RDWR|O_NONBLOCK) = 0 29+0 setsockopt(5, SOL_TCP, TCP_FASTOPEN_CONNECT, [1], 4) = 0 30+0 connect(5, ..., ...) = 0 31+0 sendto(5, NULL, 1, 0, ..., ...) = -1 32+0 close(5) = 0 33 34// Test with both TCP_FASTOPEN_CONNECT and MSG_FASTOPEN. 35+0 socket(..., SOCK_STREAM, IPPROTO_TCP) = 6 36+0 fcntl(6, F_SETFL, O_RDWR|O_NONBLOCK) = 0 37+0 setsockopt(6, SOL_TCP, TCP_FASTOPEN_CONNECT, [1], 4) = 0 38+0 connect(6, ..., ...) = 0 39+0 sendto(6, NULL, 1, MSG_FASTOPEN, ..., ...) = -1 40+0 close(6) = 0 41 42`/tmp/sysctl_restore_${PPID}.sh` 43