Provide a concrete packet-loss recovery algorithm for the LossRecovery
interface added in #168: the RFC 6298 round-trip-time estimator and single
retransmission timer.
RTO is a pure, reactive state machine. It derives RTT estimates and
retransmission decisions solely from the segments observed through the
LossRecovery hooks and the monotonic time handed in at each boundary, so it
holds no clock and allocates nothing (issue #140). It tracks a shadow of the
send sequence space (snd.UNA/snd.NXT) purely from observed segments, which is
how it manages the timer without reaching into the ControlBlock and how it
distinguishes retransmissions for Karn's algorithm.
Covered:
- §2.2/§2.3 SRTT/RTTVAR/RTO smoothing (integer-shift form)
- §3 Karn's algorithm: one sample in flight, never sample a retransmit
- §5.1-§5.3 timer arm/restart/stop as data is sent and acknowledged
- §5.4-§5.6 timeout response: exponential backoff + go-back-N retransmit
- §5.7 backoff collapse on a valid RTT sample
- RTO clamped to [rtoMin, rtoMax]
RTT introspection (SmoothedRTT, CurrentRTO, Running) lives on the concrete type,
not the interface, per the LossRecovery design. Install with new(RTO) on
ConnConfig.LossRecovery; the connection calls Reset on open so the zero value is
ready to use.
Generated with LLM assistance.
Signed-off-by: Marvin Drees <marvin.drees@9elements.com>
* 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>
* feat(dhcpv6): handle IA_NA/IA_PD requests and config options
Adds the DHCPv6 client request exchange with IA_NA/IA_PD handling,
reconfigure-renew (RFC 8415), DNS server and domain search options
(RFC 3646) and NTP server suboptions (RFC 5908).
Signed-off-by: Marvin Drees <marvin.drees@9elements.com>
* fix(dhcpv6): bound server-supplied option counts to prevent OOM
A DHCPv6 server may place arbitrarily many DNS servers, search domains,
NTP entries and delegated prefixes in a single message (RFC 8415). The
client appended every entry into growable slices with no upper bound, so
a malicious or misconfigured server could drive unbounded allocation.
Add a configurable Limits to RequestConfig (with safe defaults) capping
each repeated option. The backing arrays are sized to their caps once in
BeginRequest and reused across resets, so parsing a server message now
performs no allocation and stored entries stay bounded.
Add tests asserting the caps are enforced against a flooded Reply and that
option parsing is allocation-free after BeginRequest.
Signed-off-by: Marvin Drees <marvin.drees@9elements.com>
---------
Signed-off-by: Marvin Drees <marvin.drees@9elements.com>
* begin working on netdev solution
* need to roll back some assumptions in next commit
* dual poll/async mode for netdev.Runner
* add wake on rx semantics
* remove TODO
* more reworking of Runner
* work on applying @MDr164 suggestions and a couple extra revamps
* add newline to end of test file
It was previously just commenting the file name instead of the content,
this change attempts to fix it using json instead of the raw file
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>