-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathclose-unread-data-rst.pkt
More file actions
41 lines (31 loc) · 1.14 KB
/
close-unread-data-rst.pkt
File metadata and controls
41 lines (31 loc) · 1.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
// Borrowed from https://github.com/google/packetdrill
// Test for checking if RST is generated when we close()
// without read()'ing client's data.
--tolerance_usecs=100000
0.000 socket(..., SOCK_STREAM, IPPROTO_TCP) = 3
0.000 setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
0.000 bind(3, ..., ...) = 0
0.000 listen(3, 1) = 0
0.100 < S 0:0(0) win 65535 <mss 1460,sackOK,nop,nop,nop,wscale 7>
0.100 > S. 0:0(0) ack 1 <...>
0.200 < . 1:1(0) ack 1 win 65535
0.200 accept(3, ..., ...) = 4
// We receive first segment
0.210 < P. 1:1001(1000) ack 1 win 65535
// We send one ACK
0.310 > . 1:1(0) ack 1001
// Our application writes 1000 bytes
0.400 write(4, ..., 1000) = 1000
0.400 > P. 1:1001(1000) ack 1001
// Client sends one ACK
0.410 < . 1001:1001(0) ack 1001 win 65535
// Client closes connection
0.450 < F. 1001:1001(0) ack 1001 win 65535
0.460 > . 1001:1001(0) ack 1002
// We are now in CLOSE_WAIT state
// We close the connection
0.460 close(4) = 0
// Since we have not read() client's data, a RST is to be
// generated [expected behavior] instead of a FIN [observed behavior].
// Linux confirms to this behavior.
0.470 > R. 1001:1001(0) ack 1002