Routing, VLANs & Overlays · tcp_anomalies_stall.frasm · 12 framesFrameAssembly v3.2.2

Reproduce TCP Retransmissions, Out-of-Order & Zero-Window Stalls

When an application team blames "random network packet loss" for API timeouts—or you need to test how an L7 proxy, middlebox, or APM agent handles TCP Zero-Window stalls and out-of-order segments—your OS kernel flatly refuses to emit broken TCP sequences on command.

Protocols in capture: tcp
Raw .md
Problem

The Catch

Linux tc netem can drop or reorder a random percentage of live packets, which means every capture is non-deterministic and impossible to assert against in a regression suite. Meanwhile, normal user-space sockets cannot advertise win 0 followed 25ms later by a win 65535 Window Update.

In FrameAssembly, automatic 4-tuple tracking handles the boring segments while explicit seq, acknum, and win overrides let you inject exact sequence holes, duplicate ACKs, fast retransmissions, Zero-Window probes, and rst ack aborts on specific lines.

Setup & Topology

Microservice TCP 8443 Sequence Hole, Fast Retransmit & Zero-Window Backpressure

App Client (10.44.1.15:54120) <-> Load Balancer / WAN <-> API Server (10.44.2.80:8443)

Twelve surgical TCP segments reproduce every classic Wireshark Expert Info alert in one trace: (1) a sackperm + wscale 7 3-way handshake; (2) CHUNK_01 at seq 1001 followed immediately by out-of-order CHUNK_03 at seq 1033 (skipping 1017..1033); (3) two server Duplicate ACKs (acknum 1017) triggering client Fast Retransmission of CHUNK_02 at seq 1017; and (4) server receive-buffer exhaustion (win 0), a 1-byte client Zero-Window Probe, a win 65535 Window Update, and rst ack teardown.

Adapt It for Your Network

  1. Change app_client, api_server, and dstport 8443 to match the service tuple your APM sensor or middlebox monitors.
  2. Adjust seq offsets by exact payload byte lengths (16 bytes per CHUNK_* in this template) to move or widen the sequence hole.
  3. Compile -> inspect tcp.analysis.flags in Wireshark or tshark -> feed into Suricata stream-reassembly or proxy tests.

.frasm -> .pcap

Preview frames inline or open in Playground ->

Emits 12 TCP segments exercising out-of-order delivery, duplicate ACKs, fast retransmission, Zero-Window (win 0) + probe + Window Update, and RST.

tcp_anomalies_stall.frasm
Open in Playground
host app_client { ip 10.44.1.15 mac 00:1b:21:44:01:15 }
host api_server { ip 10.44.2.80 mac 00:1c:73:44:02:80 }
flow tcp_retransmit_and_zerowin(c, s) {
// 1. 3-way handshake negotiating MSS 1460, Window Scale 7, and SACK Permitted
c -> s tcp syn srcport 54120 dstport 8443 seq 1000 win 64240 mss 1460 wscale 7 sackperm wait 1ms
c <- s tcp syn ack seq 5000 acknum 1001 win 65535 mss 1460 wscale 7 sackperm wait 1ms
c -> s tcp ack seq 1001 acknum 5001 win 64240 wait 1ms
// 2. CHUNK_01 (seq 1001..1017), then CHUNK_03 arrives out-of-order at seq 1033
c -> s tcp psh ack seq 1001 acknum 5001 win 64240 payload "CHUNK_01_16BYTES" wait 2ms
c -> s tcp psh ack seq 1033 acknum 5001 win 64240 payload "CHUNK_03_OUT_ORD" wait 1ms
// 3. Server sends 2 Duplicate ACKs for 1017 -> Client fast-retransmits missing CHUNK_02
c <- s tcp ack seq 5001 acknum 1017 win 65535 wait 1ms
c <- s tcp ack seq 5001 acknum 1017 win 65535 wait 1ms
c -> s tcp psh ack seq 1017 acknum 5001 win 64240 payload "CHUNK_02_RETRANS" wait 2ms
// 4. Server buffer fills (ZeroWindow win 0) -> Client 1B probe -> Window Update -> RST
c <- s tcp ack seq 5001 acknum 1049 win 0 wait 25ms
c -> s tcp ack seq 1049 acknum 5001 win 64240 payload "Z" wait 5ms
c <- s tcp ack seq 5001 acknum 1050 win 65535 wait 2ms
c <- s tcp rst ack seq 5001 acknum 1050 win 0 wait 1ms
}
compile {
tcp_retransmit_and_zerowin(app_client, api_server)
}
Local CLI Build, Inspect & Replay Commands
# 1. Preview the 12-frame TCP retransmission & Zero-Window timeline
frameassembly show tcp_anomalies_stall.frasm

# 2. Compile to .pcap and verify Wireshark tcp.analysis flags in tshark
frameassembly tcp_anomalies_stall.frasm tcp_anomalies_stall.pcap
tshark -r tcp_anomalies_stall.pcap -Y "tcp.analysis.flags"

# 3. Feed into Suricata stream engine or APM / middlebox parser tests
suricata -r tcp_anomalies_stall.pcap -k none -l ./suricata_tcp/
Browser Tab -> Local Terminal & VS Code

Keep tcp_anomalies_stall.frasm in Git and build .pcap in under 1ms

Single rootless binary + VS Code extension with live squiggles, quick-fixes, and side-by-side packet ladders ready for Wireshark.

Grab CLI + VS Code ->

Related Examples

All 81 Protocols ->