| 1 |
// SPDX-License-Identifier: GPL-2.0 |
| 2 |
// Test the MSG_MORE flag will correctly corks the tiny writes |
| 3 |
`./defaults.sh` |
| 4 |
|
| 5 |
0 socket(..., SOCK_STREAM, IPPROTO_TCP) = 3 |
| 6 |
+0 setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0 |
| 7 |
+0 bind(3, ..., ...) = 0 |
| 8 |
+0 listen(3, 1) = 0 |
| 9 |
|
| 10 |
+0 < S 0:0(0) win 32792 <mss 1000,nop,wscale 7> |
| 11 |
+0 > S. 0:0(0) ack 1 <mss 1460,nop,wscale 8> |
| 12 |
+.01 < . 1:1(0) ack 1 win 257 |
| 13 |
+0 accept(3, ..., ...) = 4 |
| 14 |
// Disable Nagle by default on this socket. |
| 15 |
+0 setsockopt(4, SOL_TCP, TCP_NODELAY, [1], 4) = 0 |
| 16 |
|
| 17 |
// Test the basic case: MSG_MORE overwrites TCP_NODELAY and enables Nagle. |
| 18 |
+0 sendmsg(4, {msg_name(...)=..., |
| 19 |
msg_iov(1)=[{..., 40}], msg_flags=0}, MSG_MORE) = 40 |
| 20 |
+.21~+.215 > P. 1:41(40) ack 1 |
| 21 |
+.01 < . 1:1(0) ack 41 win 257 |
| 22 |
|
| 23 |
// Test unsetting MSG_MORE releases the packet |
| 24 |
+0 sendmsg(4, {msg_name(...)=..., |
| 25 |
msg_iov(1)=[{..., 100}], msg_flags=0}, MSG_MORE) = 100 |
| 26 |
+.005 sendmsg(4, {msg_name(...)=..., |
| 27 |
msg_iov(1)=[{..., 160}], msg_flags=0}, MSG_MORE) = 160 |
| 28 |
+.01 sendmsg(4, {msg_name(...)=..., |
| 29 |
msg_iov(3)=[{..., 100}, {..., 200}, {..., 195}], |
| 30 |
msg_flags=0}, MSG_MORE) = 495 |
| 31 |
+.008 sendmsg(4, {msg_name(...)=..., |
| 32 |
msg_iov(1)=[{..., 5}], msg_flags=0}, 0) = 5 |
| 33 |
+0 > P. 41:801(760) ack 1 |
| 34 |
+.02 < . 1:1(0) ack 801 win 257 |
| 35 |
|
| 36 |
|
| 37 |
// Test >MSS write will unleash MSS packets but hold on the remaining data. |
| 38 |
+.1 sendmsg(4, {msg_name(...)=..., |
| 39 |
msg_iov(1)=[{..., 3100}], msg_flags=0}, MSG_MORE) = 3100 |
| 40 |
+0 > . 801:3801(3000) ack 1 |
| 41 |
+.003 sendmsg(4, {msg_name(...)=..., |
| 42 |
msg_iov(1)=[{..., 50}], msg_flags=0}, MSG_MORE) = 50 |
| 43 |
|
| 44 |
+.01 < . 1:1(0) ack 2801 win 257 |
| 45 |
// Err... we relase the remaining right after the ACK? note that PUSH is reset |
| 46 |
+0 > . 3801:3951(150) ack 1 |
| 47 |
|
| 48 |
// Test we'll hold on the subsequent writes when inflight (3801:3951) > 0 |
| 49 |
+.001 sendmsg(4, {msg_name(...)=..., |
| 50 |
msg_iov(1)=[{..., 1}], msg_flags=0}, MSG_MORE) = 1 |
| 51 |
+.002 sendmsg(4, {msg_name(...)=..., |
| 52 |
msg_iov(1)=[{..., 2}], msg_flags=0}, MSG_MORE) = 2 |
| 53 |
+.003 sendmsg(4, {msg_name(...)=..., |
| 54 |
msg_iov(1)=[{..., 3}], msg_flags=0}, MSG_MORE) = 3 |
| 55 |
+.004 sendmsg(4, {msg_name(...)=..., |
| 56 |
msg_iov(1)=[{..., 4}], msg_flags=0}, MSG_MORE) = 4 |
| 57 |
+.02 < . 1:1(0) ack 3951 win 257 |
| 58 |
+0 > . 3951:3961(10) ack 1 |
| 59 |
+.02 < . 1:1(0) ack 3961 win 257 |
| 60 |
|
| 61 |
|
| 62 |
// Test the case a MSG_MORE send followed by a write flushes the data |
| 63 |
+0 sendmsg(4, {msg_name(...)=..., |
| 64 |
msg_iov(1)=[{..., 20}], msg_flags=0}, MSG_MORE) = 20 |
| 65 |
+.05 write(4, ..., 20) = 20 |
| 66 |
+0 > P. 3961:4001(40) ack 1 |