-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathshutdown-rd.pkt
More file actions
40 lines (31 loc) · 1.16 KB
/
shutdown-rd.pkt
File metadata and controls
40 lines (31 loc) · 1.16 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
// Borrowed from https://github.com/google/packetdrill
// This test checks for the behavior of sequence
// shutdown(SHUT_RD), read, write
// After shutdown(SHUT_RD), FreeBSD still accepts data
// (and sends ACK) but discards them.
--tolerance_usecs=100000
// Establish the connection
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
0.250 shutdown(4, SHUT_RD) = 0
// Verify if read works
0.250 read(4, ..., 1000) = 0
// Client sends one data segment
0.260 < P. 1:1001(1000) ack 1 win 65535
// We respond with an ACK
0.360 > . 1:1(0) ack 1001 <...>
// Making another call to read() at this state still returns 0
// which suggests that the previous data segment sent by the client
// was thrown away.
0.360 read(4, ..., 1000) = 0
// Verify whether writing and sending works
// We send 1 data segment
0.370 write(4, ..., 1000) = 1000
0.370 > P. 1:1001(1000) ack 1001 <...>
0.400 < . 1001:1001(0) ack 1001 win 65535