20 Commits

Author SHA1 Message Date
Marvin Drees ab1a0c735a Add out-of-order segment reassembly (#148)
* 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>
2026-07-10 10:36:15 -03:00
TuteMthCD d5ea2efdf4 Retransmit active-open SYN after RTO (#130)
* added: sync packet retransmission

* test: sync packet retransmission

* refactor: remove packet time from tcppool

* fix: return comment

* refactor: move retrying to stackRetrying

* added: retries & timeout to stackGoConfig

* test: test retries stack

* refactor: move StackRetrying to stackBlocking

* fix: line gofmt

---------

Co-authored-by: Pat Whittingslow <graded.sp@gmail.com>
2026-06-23 00:19:16 -03:00
Pat Whittingslow 8f9d765cb0 Ack dropping - fix for #50 (#127)
* 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
2026-06-19 18:43:13 -03:00
Pat Whittingslow 6f5acd1948 persist issue #57 fix in test (#128)
* persist issue 57 fix in test

* have go fix output error on CI

* apply go fix required fix

* test no || for go fix command

* test no || for go fix command complete, it is needed

* forgot to fix
2026-06-18 18:23:15 -03:00
Marvin Drees f87761f777 chore: bump minimum Go version to 1.24 (#85)
Signed-off-by: Marvin Drees <marvin.drees@9elements.com>
2026-04-16 17:21:23 -03:00
Pat Whittingslow 75a812a8d7 Tcp buffer bug fix (#79)
* 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>
2026-04-14 19:11:29 -03:00
Pat Whittingslow 54bc52d9d8 Fuzz fixes (#73)
* remove old fuzz corpus and stick to using PCG for seeding fuzz test

* polish up drain logic and reduce action search space

* improve fuzzing debug prints

* more fuzz fixes also formatter capture printer fixes

* refactor StackSeeded test

* fix challenge ack infinite packet bug

* more expressive challenge satisfy

* remove printing
2026-04-11 18:01:05 -03:00
Pat Whittingslow 64b2647a5e tcp: retransmit logic rollback (#61)
* 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
2026-03-26 11:48:02 -03:00
Pat Whittingslow 270b8df043 Implement basic retransmit queue reset method (#52)
* implement basic retransmit queue reset method

* tcp: rto reset on new ack; accept ack after retransmit bugfix
2026-03-05 17:35:16 -03:00
Pat Whittingslow d5c4fa53c6 tcp: bugfix for seq not in snd/rcv.wnd error (#49)
* 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
2026-03-04 12:59:30 -03:00
Pat Whittingslow bd76ebe5ed tcp: bugfix for challenge ack panic edge case (#48) 2026-02-28 16:18:39 -03:00
Pat Whittingslow be949d960c tcp: mss honoring; accept syn with ECE/CWR flags; add RSTQueue type (#41)
* 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
2026-02-25 12:58:55 -03:00
Pat Whittingslow 7d323aae19 Tcp rst handling (#40)
* 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
2026-02-23 09:50:13 -03:00
Pat Whittingslow 08423d0dba add proactive window update (#39)
* add proactive window update

* fix xnet tests due to runt padding bug
2026-02-22 12:02:53 -03:00
Pat Whittingslow e13bb45854 attempt to fix #22 (#23) 2026-01-19 23:22:54 -03:00
Patricio Whittingslow 1a427323f2 fix bug being unable to read from closed tcp.Conn 2026-01-12 11:05:10 -03:00
soypat 39d5e4290e add TCPConn type 2025-04-04 19:16:26 -03:00
soypat 00cdf471f4 rewrite txqueue sequencing logic to use per-packet sequence numbers 2025-02-15 17:02:10 -03:00
soypat 2e823c0fd5 begin add tcp.Handler tests 2025-02-15 11:15:19 -03:00
soypat bbd74d04d8 rewrite ControlBlock.Open to only open passive connections; now use Send for active connections 2025-02-13 22:56:27 -03:00