tools/testing/selftests/net/packetdrill/tcp_rcv_wnd_shrink_nomem.pkt

Source file repositories/reference/linux-study-clean/tools/testing/selftests/net/packetdrill/tcp_rcv_wnd_shrink_nomem.pkt

File Facts

System
Linux kernel
Corpus path
tools/testing/selftests/net/packetdrill/tcp_rcv_wnd_shrink_nomem.pkt
Extension
.pkt
Size
5512 bytes
Lines
133
Domain
Support Tooling And Documentation
Bucket
tools
Inferred role
Support Tooling And Documentation: tools
Status
atlas-only

Why This File Exists

Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.

Dependency Surface

Detected Declarations

Annotated Snippet

// SPDX-License-Identifier: GPL-2.0
// When tcp_receive_window() < tcp_max_receive_window(), tcp_sequence() accepts
// packets that would be dropped under normal conditions (i.e. tcp_receive_window()
// equal to tcp_max_receive_window()).
// Test that such packets are handled as expected for RWIN == 0 and for RWIN > 0.

--mss=1000

`./defaults.sh`

    0 `nstat -n`

// Establish a connection.
   +0 socket(..., SOCK_STREAM, IPPROTO_TCP) = 3
   +0 setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
   +0 setsockopt(3, SOL_SOCKET, SO_RCVBUF, [1000000], 4) = 0
   +0 bind(3, ..., ...) = 0
   +0 listen(3, 1) = 0

   +0 < S 0:0(0) win 32792 <mss 1000,nop,nop,sackOK,nop,wscale 7>
   +0 > S. 0:0(0) ack 1 win 65535 <mss 1460,nop,nop,sackOK,nop,wscale 4>
   +0 < . 1:1(0) ack 1 win 257

   +0 accept(3, ..., ...) = 4

// Put 1040000 bytes into the receive buffer
   +0 < P. 1:65001(65000) ack 1 win 257
    * > .  1:1(0) ack 65001
   +0 < P. 65001:130001(65000) ack 1 win 257
    * > .  1:1(0) ack 130001
   +0 < P. 130001:195001(65000) ack 1 win 257
    * > .  1:1(0) ack 195001
   +0 < P. 195001:260001(65000) ack 1 win 257
    * > .  1:1(0) ack 260001
   +0 < P. 260001:325001(65000) ack 1 win 257
    * > .  1:1(0) ack 325001
   +0 < P. 325001:390001(65000) ack 1 win 257
    * > .  1:1(0) ack 390001
   +0 < P. 390001:455001(65000) ack 1 win 257
    * > .  1:1(0) ack 455001
   +0 < P. 455001:520001(65000) ack 1 win 257
    * > .  1:1(0) ack 520001
   +0 < P. 520001:585001(65000) ack 1 win 257
    * > .  1:1(0) ack 585001
   +0 < P. 585001:650001(65000) ack 1 win 257
    * > .  1:1(0) ack 650001
   +0 < P. 650001:715001(65000) ack 1 win 257
    * > .  1:1(0) ack 715001
   +0 < P. 715001:780001(65000) ack 1 win 257
    * > .  1:1(0) ack 780001
   +0 < P. 780001:845001(65000) ack 1 win 257
    * > .  1:1(0) ack 845001
   +0 < P. 845001:910001(65000) ack 1 win 257
    * > .  1:1(0) ack 910001
   +0 < P. 910001:975001(65000) ack 1 win 257
    * > .  1:1(0) ack 975001
   +0 < P. 975001:1040001(65000) ack 1 win 257
    * > .  1:1(0) ack 1040001

// Trigger an extreme memory squeeze by shrinking SO_RCVBUF
   +0 setsockopt(4, SOL_SOCKET, SO_RCVBUF, [16000], 4) = 0

   +0 < P. 1040001:1105001(65000) ack 1 win 257
    * > .  1:1(0) ack 1040001 win 0
// Check LINUX_MIB_TCPRCVQDROP has been incremented
   +0 `nstat -s | grep TcpExtTCPRcvQDrop| grep -q " 1 "`

// RWIN == 0: rcv_wup = 1040001, rcv_wnd = 0, rcv_mwnd_seq > 1105001 (significantly larger, typically ~1970000)

// Accept pure ack with seq in max adv. window

Annotation

Implementation Notes