* feat(tcp): add out-of-order segment reassembly
Add an opt-in, bounded out-of-order reassembly buffer so a single lost
segment can be recovered by retransmitting the gap while later segments
are held and delivered once the gap fills.
The receiver also subtracts buffered out-of-order bytes from the
advertised receive window and avoids challenge-ACK aborts for in-window
future data. Reassembly is disabled by default.
Generated with LLM assistance.
Signed-off-by: Marvin Drees <marvin.drees@9elements.com>
* implement review feedback around rx buffer reuse
Signed-off-by: Marvin Drees <marvin.drees@9elements.com>
---------
Signed-off-by: Marvin Drees <marvin.drees@9elements.com>
* fix for #50
* fix remaining test
* revert changes and instead approach problem on full-duplex case
* fix merge messup
* fix @MDr164 note and upgrade documentation while at it
* gate full buffer exit on rx shutdown since no risk of full buffer error
* add log line to note issue is hit
* document CloseRead relationship with Close
- http/httpraw: cap header slice growth to pre-allocated capacity, fix
benchmark to reuse Header across iterations (0 allocs/op)
- internal/ring: replace TODO panic comments with invariant explanations
- tcp/conn: document truncated-frame offset check
- tcp/handler: replace TODO with net.ErrClosed on RST-closed connection
- internet/stack-udpport: filter incoming packets by remote IP address
when configured via SetStackNode; skip filter for IPv4 multicast
destinations (class D) so mDNS and similar protocols work correctly
Generated with LLM assistance.
Signed-off-by: Marvin Drees <marvin.drees@9elements.com>
* tcp: remove retransmit logic entirely; add duplicate ack counting to ControlBlock
* retransmit implemented in nice simple straightforward way
* narrow down retransmission cases
* remove old timing tests
* add ControlBlock retransmit test
* add failing handler test
* reworking payload length semantic meaning in code
* fix establish conn logic
* clean up tests and add TCB dupack generation and test it
* catch pending retransmit satisfy in test
* add fuzz test for control block
* bugfix: be more strict in what is considered dupack
* add IncomingIsDupACK docs
* limit queue of retransmits
* protect retransmit overflow from incorrectly updating nxt
* fix for #58
* add fixes for both retransmit and fuzz failure found
* fix infinite challenge ack due to RST+SYN+FIN corrupt packet in SYNRCV state
* fuzz: previous recovery ack path led to infinite transmit
* fuzz: calculate CRCs when fuzzing to reduce search space to non-CRC error cases
* add local fuzz corpus to tests
* add more cases to fuzz corpus
* tcp: bugfix for seq not in snd/rcv.wnd error
* accept dupe ACKs for window updates and prevent decrement of UNA
* add fixes for incorrect tcp functioning
* remove Conn.Available* methods in favor of Conn.Free* methods due to ambiguous name
* pcap: reuse Frame memory
* slog: reduce heap allocations of addresses; also prevent heap alloc of dhcp options in pcap
* dns: heapless improvement; add StackAsync buffer for more heapless operation; start thinking of errors
* errors: begin standardise errors in lneto
* errors: finish standardization of errors
* fix merge issues
* add more lneto errors to rest of package
* format errors.go
* reduce heap allocations in tcp logging; omit use of AppendFloat which allocates a metric sh*tton
* debugheaplog: better heap statistic logging
* heap: use string for pcap.Frame.Protocol
* add potential to eliminate Flags.String heap alloc, remove incorrect HEAP comments
* add StackAsync.DebugErr and httpraw.SetBytes
* many heap alloc reductions and replacement of bytes.Equal with internal.BytesEqual
* tcp: mss honoring; accept syn with ECE/CWR flags; add RSTQueue type
* tcp: move option logic to own file
* remove prints in pcap
* add MSS send threshold inspired by linux/freebsd/lwip thresh
* do not rely on unspecified Go behaviour; fix TCP ring buffer bug
* even more stricter error handling on tcp connections
* stricter lock copying in tcp.Conn, even though likely not a problem
* add listener and tcp pool logging
* forgot reqAddr unused
* add logging to TCPConn and friends
* begin reviewing TCP listener
* begin adding listener tests
* adding TestExchange implementation
* split out legacy and Step tests
* move listener to tcp package
* fix up tcp tests taking very long
* add xnet.TCPPool and work on TCPPool semantics
* xnet: TCPPool only accepts established connections
* xnet: getting to bottom of panic in xnet.Listener
* xnet: improve listener tests
* fix several data races in testing fixtures
* fix more synchronization things in listener test
* finalize tcplistener test