diff options
Diffstat (limited to 'test/packetdrill/tests/tldk')
7 files changed, 264 insertions, 0 deletions
diff --git a/test/packetdrill/tests/tldk/delay_ack/delay-ack-tldk.pkt b/test/packetdrill/tests/tldk/delay_ack/delay-ack-tldk.pkt new file mode 100644 index 0000000..17889b7 --- /dev/null +++ b/test/packetdrill/tests/tldk/delay_ack/delay-ack-tldk.pkt @@ -0,0 +1,26 @@ +// Test delay ack and quick ack + +// Establish a connection. +0 socket(..., SOCK_STREAM, IPPROTO_TCP) = 3 ++0 setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0 + ++0 bind(3, ..., ...) = 0 ++0 listen(3, 1) = 0 + ++0 < S 0:0(0) win 32792 <mss 1000,sackOK,nop,nop,nop,wscale 7> ++0 > S. 0:0(0) ack 1 <...> + ++.1 < . 1:1(0) ack 1 win 32792 ++0 accept(3, ..., ...) = 4 + +//receive 1 pkt and ack immediately (quickack) ++0 < . 1:1001(1000) ack 1 win 32792 ++0 > . 1:1(0) ack 1001 + +//receive 1 pkt and delayack ++0 < . 1001:2001(1000) ack 1 win 32792 ++0.1 ~ +0.2 > . 1:1(0) ack 2001 + +//receive 1 pkt and ack immediately (quickack) ++0 < . 2001:3001(1000) ack 1 win 32792 ++0 > . 1:1(0) ack 3001 diff --git a/test/packetdrill/tests/tldk/fast_retransmit/fr-4pkt-tldk.pkt b/test/packetdrill/tests/tldk/fast_retransmit/fr-4pkt-tldk.pkt new file mode 100644 index 0000000..f665547 --- /dev/null +++ b/test/packetdrill/tests/tldk/fast_retransmit/fr-4pkt-tldk.pkt @@ -0,0 +1,35 @@ +// Test fast retransmit with 4 packets outstanding, receiver sending SACKs. +// In this variant the receiver supports SACK. + +// Establish a connection. +0 socket(..., SOCK_STREAM, IPPROTO_TCP) = 3 ++0 setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0 + ++0 bind(3, ..., ...) = 0 ++0 listen(3, 1) = 0 + ++0 < S 0:0(0) win 32792 <mss 1000,sackOK,nop,nop,nop,wscale 7> ++0 > S. 0:0(0) ack 1 <...> + ++.1 < . 1:1(0) ack 1 win 32792 ++0 accept(3, ..., ...) = 4 + +// Send 1 data segment and get an ACK, so cwnd is now 4. ++0 write(4, ..., 1000) = 1000 ++0 > . 1:1001(1000) ack 1 + ++.1 < . 1:1(0) ack 1001 win 32792 + +// Write 4 data segments. ++0 write(4, ..., 4000) = 4000 ++0 > . 1001:5001(4000) ack 1 + +// Get 3 SACKs. ++.1 < . 1:1(0) ack 1001 win 32792 <sack 2001:3001,nop,nop> ++0 < . 1:1(0) ack 1001 win 32792 <sack 2001:4001,nop,nop> ++0 < . 1:1(0) ack 1001 win 32792 <sack 2001:5001,nop,nop> +// We've received 3 duplicate ACKs, so we do a fast retransmit. ++0 > . 1001:3049(2048) ack 1 + +// Receiver ACKs all data. ++.1 < . 1:1(0) ack 6001 win 32792 diff --git a/test/packetdrill/tests/tldk/keep_alive/keep-alive-after-accept-tldk.pkt b/test/packetdrill/tests/tldk/keep_alive/keep-alive-after-accept-tldk.pkt new file mode 100644 index 0000000..09ff2cb --- /dev/null +++ b/test/packetdrill/tests/tldk/keep_alive/keep-alive-after-accept-tldk.pkt @@ -0,0 +1,50 @@ +// Test set keepalive after accept + +// Establish a connection. +0 socket(..., SOCK_STREAM, IPPROTO_TCP) = 3 ++0 setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0 + ++0 bind(3, ..., ...) = 0 ++0 listen(3, 1) = 0 + ++0 < S 0:0(0) win 32792 <mss 1000,sackOK,nop,nop,nop,wscale 7> ++0 > S. 0:0(0) ack 1 <...> + ++.1 < . 1:1(0) ack 1 win 32792 ++0 accept(3, ..., ...) = 4 + +// enable keepalive and set args ++0 setsockopt(4, SOL_SOCKET, SO_KEEPALIVE, [1], 4) = 0 +// extra ack, it's not needed, fix it later ++0 ~ +100 > . 1:1(0) ack 1 + ++0 setsockopt(4, IPPROTO_TCP, TCP_KEEPIDLE, [5], 4) = 0 +// extra ack, it's not needed, fix it later ++0 ~ +100 > . 1:1(0) ack 1 + ++0 setsockopt(4, IPPROTO_TCP, TCP_KEEPINTVL, [2], 4) = 0 +// extra ack, it's not needed, fix it later ++0 ~ +100 > . 1:1(0) ack 1 + ++0 setsockopt(4, IPPROTO_TCP, TCP_KEEPCNT, [2], 4) = 0 + +// first keep-alive pkt, idle = 5 ++4 ~ +6 > . 0:0(0) ack 1 + +// second keep-alive pkt, interval = 2 ++1 ~ +3 > . 0:0(0) ack 1 + +// get response, idle = 5 ++0 < . 1:1(0) ack 1 win 32792 + +// first keep-alive pkt again, idle = 5 ++4 ~ +6 > . 0:0(0) ack 1 + +// second keep-alive pkt, interval = 2 ++1 ~ +3 > . 0:0(0) ack 1 + +// get no response, send rst ++1 ~ +3 > R. 1:1(0) ack 1 + ++1 read(4, ..., 10) = -1 ETIMEDOUT (Connection timed out) ++0 close(4) = 0
\ No newline at end of file diff --git a/test/packetdrill/tests/tldk/keep_alive/keep-alive-before-connect-tldk.pkt b/test/packetdrill/tests/tldk/keep_alive/keep-alive-before-connect-tldk.pkt new file mode 100644 index 0000000..1e68f97 --- /dev/null +++ b/test/packetdrill/tests/tldk/keep_alive/keep-alive-before-connect-tldk.pkt @@ -0,0 +1,37 @@ +// Test set keepalive before connect + +// enable keepalive and set args +0 socket(..., SOCK_STREAM, IPPROTO_TCP) = 3 ++0 setsockopt(3, SOL_SOCKET, SO_KEEPALIVE, [1], 4) = 0 ++0 setsockopt(3, IPPROTO_TCP, TCP_KEEPIDLE, [5], 4) = 0 ++0 setsockopt(3, IPPROTO_TCP, TCP_KEEPINTVL, [2], 4) = 0 ++0 setsockopt(3, IPPROTO_TCP, TCP_KEEPCNT, [2], 4) = 0 + +// Establish a connection. ++0 fcntl(3, F_GETFL) = 0x2 (flags O_RDWR) ++0 fcntl(3, F_SETFL, O_RDWR|O_NONBLOCK) = 0 ++0 connect(3, ..., ...) = -1 EINPROGRESS (Operation now in progress) ++0 > S 0:0(0) <...> ++0 < S. 0:0(0) ack 1 win 32792 <mss 1460> ++0 > . 1:1(0) ack 1 <...> + +// first keep-alive pkt, idle = 5 ++4 ~ +6 > . 0:0(0) ack 1 + +// second keep-alive pkt, interval = 2 ++1 ~ +3 > . 0:0(0) ack 1 + +// get response, idle = 5 ++0 < . 1:1(0) ack 1 win 32792 + +// first keep-alive pkt again, idle = 5 ++4 ~ +6 > . 0:0(0) ack 1 + +// second keep-alive pkt, interval = 2 ++1 ~ +3 > . 0:0(0) ack 1 + +// get no response, send rst ++1 ~ +3 > R. 1:1(0) ack 1 + ++1 read(3, ..., 10) = -1 ETIMEDOUT (Connection timed out) ++0 close(3) = 0
\ No newline at end of file diff --git a/test/packetdrill/tests/tldk/keep_alive/keep-alive-enable-disable-tldk.pkt b/test/packetdrill/tests/tldk/keep_alive/keep-alive-enable-disable-tldk.pkt new file mode 100644 index 0000000..5c0db20 --- /dev/null +++ b/test/packetdrill/tests/tldk/keep_alive/keep-alive-enable-disable-tldk.pkt @@ -0,0 +1,26 @@ +// Test set keepalive before connect + +// enable keepalive and set args +0 socket(..., SOCK_STREAM, IPPROTO_TCP) = 3 ++0 setsockopt(3, SOL_SOCKET, SO_KEEPALIVE, [1], 4) = 0 ++0 setsockopt(3, IPPROTO_TCP, TCP_KEEPIDLE, [5], 4) = 0 ++0 setsockopt(3, IPPROTO_TCP, TCP_KEEPINTVL, [2], 4) = 0 ++0 setsockopt(3, IPPROTO_TCP, TCP_KEEPCNT, [2], 4) = 0 + +// Establish a connection. ++0 fcntl(3, F_GETFL) = 0x2 (flags O_RDWR) ++0 fcntl(3, F_SETFL, O_RDWR|O_NONBLOCK) = 0 ++0 connect(3, ..., ...) = -1 EINPROGRESS (Operation now in progress) ++0 > S 0:0(0) <...> ++0 < S. 0:0(0) ack 1 win 32792 <mss 1460> ++0 > . 1:1(0) ack 1 <...> + +// first keep-alive pkt, idle = 5 ++4 ~ +6 > . 0:0(0) ack 1 + +// disable keepalive ++0 setsockopt(3, SOL_SOCKET, SO_KEEPALIVE, [0], 4) = 0 + +// no more keep-alive pkt ++10 read(3, ..., 10) = -1 EAGAIN (Resource temporarily unavailable) ++0 close(3) = 0 diff --git a/test/packetdrill/tests/tldk/out_of_order/ofo-simple-3pkt-tldk.pkt b/test/packetdrill/tests/tldk/out_of_order/ofo-simple-3pkt-tldk.pkt new file mode 100644 index 0000000..8629d79 --- /dev/null +++ b/test/packetdrill/tests/tldk/out_of_order/ofo-simple-3pkt-tldk.pkt @@ -0,0 +1,27 @@ +// Test reorder pkts received out of order, receiver sending correct ACK. + +// Establish a connection. +0 socket(..., SOCK_STREAM, IPPROTO_TCP) = 3 ++0 setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0 + ++0 bind(3, ..., ...) = 0 ++0 listen(3, 1) = 0 + ++0 < S 0:0(0) win 32792 <mss 1000,sackOK,nop,nop,nop,wscale 7> ++0 > S. 0:0(0) ack 1 <...> + ++.1 < . 1:1(0) ack 1 win 32792 ++0 accept(3, ..., ...) = 4 + +// receive 3 pkts out of order ++0 < . 1:1001(1000) ack 1 win 32792 ++0 > . 1:1(0) ack 1001 ++0 < . 2001:3001(1000) ack 1 win 32792 ++0 > . 1:1(0) ack 1001 + ++0.1 < . 1001:2001(1000) ack 1 win 32792 +// reorder pkts and ack them ++0.1 ~ +0.2 > . 1:1(0) ack 3001 + +// read received data ++0 read(4, ..., 3000) = 3000 diff --git a/test/packetdrill/tests/tldk/tso/tso-segment-split.pkt b/test/packetdrill/tests/tldk/tso/tso-segment-split.pkt new file mode 100644 index 0000000..6b98323 --- /dev/null +++ b/test/packetdrill/tests/tldk/tso/tso-segment-split.pkt @@ -0,0 +1,63 @@ +// Test TSO segment split + +// Establish a 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 5360 <mss 536,sackOK,nop,nop,nop,wscale 7> ++0 > S. 0:0(0) ack 1 <mss 1460,wscale 10,nop> + ++.1 < . 1:1(0) ack 1 win 5360 +0.200 accept(3, ..., ...) = 4 + +// Send 10 MSS. +0.200 write(4, ..., 5360) = 5360 +0.200 > . 1:5361(5360) ack 1 + +// Ack 1st mss (partial ack), and update rcv windows to 1 mss +0.200 < . 1:1(0) ack 537 win 536 + +// Get 3 dupacks, and reduce rcv window to only 1 mss +0.300 < . 1:1(0) ack 537 win 536 +0.300 < . 1:1(0) ack 537 win 536 +0.300 < . 1:1(0) ack 537 win 536 + +// We've received 3 duplicate ACKs, so we do a fast retransmit; +// Segment split happens here. +0.300 > . 537:1073(536) ack 1 + +// Ack 2nd mss (partial ack) +0.300 < . 1:1(0) ack 1073 win 536 + +// 3nd mss +0.300 > . 1073:1609(536) ack 1 + +// Now let's try ack somehere between (3*mss, 4*mss) +0.303 < . 1:1(0) ack 2049 win 536 + +// We shall send from 2049, and send another mss. +0.303 > . 2049:2585(536) ack 1 + +// We send some more new data, but it cannot be sent for limited window. +0.303 write(4, ..., 5360) = 5360 + +0.305 < . 1:1(0) ack 2585 win 5360 + +0.306 > . 2585:5361(2776) ack 1 +0.306 < . 1:1(0) ack 5361 win 5360 + +// FIXME: the cwnd has been reduced to 2*mss +0.307 > . 5361:6433(1072) ack 1 +0.307 < . 1:1(0) ack 6433 win 5360 + +// FIXME: below behavisor makes no sense +0.307 > . 6433:7409(976) ack 1 +0.307 < . 1:1(0) ack 7409 win 5360 + +0.307 > . 7409:9457(2048) ack 1 +0.307 < . 1:1(0) ack 9457 win 5360 + +0.308 > . 9457:10721(1264) ack 1 +0.308 < . 1:1(0) ack 10721 win 5360 |