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