xref: /linux/tools/testing/selftests/net/packetdrill/tcp_nagle_https_client.pkt (revision 0ad9617c78acbc71373fb341a6f75d4012b01d69)
1// SPDX-License-Identifier: GPL-2.0
2// This is a test inspired by an Android client app using SSL. This
3// test verifies using TCP_NODELAY would save application latency
4// (Perhaps even better with TCP_NAGLE).
5//
6`./defaults.sh
7ethtool -K tun0 tso off gso off
8./set_sysctls.py /proc/sys/net/ipv4/tcp_timestamps=0`
9
10    0 socket(..., SOCK_STREAM, IPPROTO_TCP) = 4
11   +0 fcntl(4, F_SETFL, O_RDWR|O_NONBLOCK) = 0
12   +0 setsockopt(4, SOL_TCP, TCP_NODELAY, [1], 4) = 0
13
14   +0 connect(4, ..., ...) = -1 EINPROGRESS (Operation now in progress)
15   +0 > S 0:0(0) <mss 1460,nop,nop,sackOK,nop,wscale 8>
16  +.1 < S. 0:0(0) ack 1 win 5792 <mss 974,nop,nop,sackOK,nop,wscale 7>
17   +0 > . 1:1(0) ack 1
18
19// SSL handshake (resumed session)
20   +0 write(4, ..., 517) = 517
21   +0 > P. 1:518(517) ack 1
22  +.1 < . 1:1(0) ack 518 win 229
23
24   +0 < P. 1:144(143) ack 1 win 229
25   +0 > . 518:518(0) ack 144
26   +0 read(4, ..., 1000) = 143
27
28// Application POST header (51B) and body (2002B)
29   +0 write(4, ..., 51) = 51
30   +0 > P. 518:569(51) ack 144
31 +.03 write(4, ..., 2002) = 2002
32   +0 > . 569:1543(974) ack 144
33   +0 > P. 1543:2517(974) ack 144
34// Without disabling Nagle, this packet will not happen until the remote ACK.
35   +0 > P. 2517:2571(54) ack 144
36
37  +.1 < . 1:1(0) ack 2571 win 229
38
39// Reset sysctls
40`/tmp/sysctl_restore_${PPID}.sh`
41