TCP retransmission fixes and fuzz failure fixes (#59)

* 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
This commit is contained in:
Pat Whittingslow
2026-03-20 14:25:31 +01:00
committed by GitHub
parent 493446244f
commit faae7ab076
216 changed files with 1299 additions and 35 deletions
+3 -3
View File
@@ -231,8 +231,8 @@ func TestExchange_rfc9293_figure12(t *testing.T) {
Incoming: &tcp.Segment{SEQ: issB, ACK: issA + 1, Flags: tcp.FlagACK, WND: windowB},
WantState: tcp.StateFinWait2,
WantPeerState: tcp.StateCloseWait,
// TODO(soypat): WantPending should be nil here? Perhaps fix test by modifying rcvFinWait1 pending result.
WantPending: &tcp.Segment{SEQ: issA + 1, ACK: issB, Flags: tcp.FlagACK, WND: windowA},
// RFC Figure 12: no response from A here — bare ACK must not elicit ACK.
WantPending: nil,
},
2: { // A receives FIN|ACK from B.
Incoming: &tcp.Segment{SEQ: issB, ACK: issA + 1, Flags: FINACK, WND: windowB},
@@ -496,7 +496,7 @@ func TestExchange_helloworld(t *testing.T) {
11: { // A receives B's ACK of FIN.
Incoming: &tcp.Segment{SEQ: issB + 1 + 2*datalen, ACK: issA + 2 + 2*datalen, Flags: tcp.FlagACK, WND: windowB},
WantState: tcp.StateFinWait2,
WantPending: &tcp.Segment{SEQ: issA + 2 + 2*datalen, ACK: issB + 1 + 2*datalen, Flags: tcp.FlagACK, WND: windowA},
WantPending: nil, // Bare ACK must not elicit ACK (same as Figure 12 fix).
WantPeerState: tcp.StateCloseWait,
},
}