* 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>
This adds a small in-repo tool and updates the ci.yml file in order
to make benchmark and most importantly allocation results visible in a
PR. It also drops the 3rdparty action we had commented out.
Signed-off-by: Marvin Drees <marvin.drees@9elements.com>
* use ltesto as package to contain scheduler/goroutine testing logic
* add sched usage to another test
* testCloseTransmitsPending rewrite
* replace deadline with context
- 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>
* start working on tracking down tcp buffer bug
* mtu refactor
* modularize test
* more precise testing
* tests fail, but is it the failure we are looking for?
* fix typo in espradio link (#76)
* implement a new backoff abstraction (#75)
* rewrite backoff api
* rewrite tcp.Conn.Write
* keep fixing small things
* much better Conn.Read implementation
* fix critical overflow bug in internal.ConnRWBackoff
---------
Co-authored-by: Joel Wetzell <jwetzell@yahoo.com>
* begin adding better fuzz test
* finish adding working fuzzer
* implement mutateipv4
* fuzzer finds a panic in ICMP client on receive empty payload
* rename fuzz tests to reflect fuzz methodology
* begin adding icmp client
* rely on anon structs
* add tests
* tests passing
* icmp fleshed out
* rework icmp to include ip addr
* rename StackAsync.Demux/Encapsulate to RecvEthernet and SendEthernet
* remove legacy unreachable TCP tests
* remove uses of deprecated internet.StackNode in preference of lneto.StackNode
* documentation
* rename methods to signal no I/O happening
* 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
* add mdns
* define mdns.Client
* fix some mdns stuff
* refine dns package for use with mdns
* remove Querier and Responder and replace with Client
* add record setting methods on dns.record to reuse record buffer
* protect against unbounded client answer growth
* round off sharp mdns edges; reduce allocs
* add mutlicast to stacks; add xnet tests for mdns
* fix documentation on acceptmulticast field
* mdns working
* 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
* 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
* reuse function for reclaiming frames among all protocols for lower memory usage
* remove extraneous code
* claude suggests a way forward
* add timing to capture printer
* add pcap.Flags
* fix ICMP CRC calculation and add test
* bugfix: still send data on half-close state(close-wait)
* fix pcap test
* Simplified checksum calculation and verification
* Fixed tests
* UDP: using NewBoundedFrame to create a Frame instance limited to the actual frame size.
* Minor: renamed some functions
* Commented and made more readable consecutive SetCRC calls.
* Fixed icmp checksum calculation after rebase
* Replaced NewBoundedFrame with explicit validation
* Repeating select if it is interrupted
* Restrict retries for syscall.EINTR to 10
Limit the number of retries on syscall.EINTR to 10.
---------
Co-authored-by: Pat Whittingslow <graded.sp@gmail.com>
* 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
* add prints to investigate slowness
* add loop sleep for blocking Stack
* add connection close http attribute and detect end of HTML page
* add timeout to bridge read
* examples/xnet: add ntp timestamp to prints and show output in readme
* add polling to http tap interface
* more digits in ntp format
* prevent crashes on non-8 timestamp