Fix SYN-ACK retransmission bug in accept() causing CI timeouts #43
Merged
danielinux merged 3 commits intowolfSSL:masterfrom Feb 24, 2026
Merged
Fix SYN-ACK retransmission bug in accept() causing CI timeouts #43danielinux merged 3 commits intowolfSSL:masterfrom
danielinux merged 3 commits intowolfSSL:masterfrom
Conversation
The accepted socket was being set directly to TCP_ESTABLISHED state, which meant if the SYN-ACK was lost, no retransmission would occur because the RTO infrastructure only handles SYN_RCVD/SYN_SENT states. Changes: - Keep accepted socket in TCP_SYN_RCVD until final ACK received - Start RTO timer on accepted socket for SYN-ACK retransmission - Stop orphaned RTO timer on listening socket - Don't signal writable until connection fully established - Update test_native_wolfssl.c to use non-blocking connect with select() - Add unit tests for SYN-ACK retransmission behavior Fixes test-wolfssl and test-esp timeouts on Linux and FreeBSD CI.
- Update all workflow push triggers from specific branches to ['*']
so CI runs on feature/fix branches
- Fix 3 unit tests that assert TCP_ESTABLISHED after accept(); the
SYN-ACK retransmission fix correctly keeps accepted sockets in
TCP_SYN_RCVD until the final ACK completes the handshake
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes a TCP accept()/SYN-ACK reliability issue in wolfIP that could leave an orphaned control-RTO timer on the listening socket, preventing SYN-ACK retransmissions and causing CI hangs during host connect().
Changes:
- Update
wolfIP_sock_accept()to keep the accepted socket inTCP_SYN_RCVD, start control-RTO on the accepted socket, stop it on the listener, and deferCB_EVENT_WRITABLEuntil the final ACK. - Add/adjust unit tests to validate accepted-socket control-RTO behavior and the SYN_RCVD→ESTABLISHED transition on final ACK.
- Make the native wolfSSL test client use non-blocking
connect()with aselect()loop.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| src/wolfip.c | Moves accepted sockets to TCP_SYN_RCVD, fixes control-RTO ownership (accepted vs listener), defers writable event signaling. |
| src/test/unit/unit.c | Adds new tests around accept control-RTO and updates existing assertions for the new post-accept state. |
| src/test/test_native_wolfssl.c | Switches to non-blocking connect + select() to reduce risk of indefinite blocking in CI. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
danielinux
approved these changes
Feb 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Descritpion
Fixes
test-wolfsslhanging on both Linux and FreeBSD CI due to an orphanedRTO timer in
wolfIP_sock_accept()that prevented SYN-ACK retransmission.Root Cause
When a SYN arrived at the listening socket:
TCP_SYN_RCVDand got an RTO timeraccept()created a new socket and set it directly toTCP_ESTABLISHEDTCP_LISTEN, orphaning its RTO timerconnect()timed out → test hung foreverThe Fix (
src/wolfip.c)TCP_SYN_RCVDinstead of jumping toTCP_ESTABLISHED;the existing ACK handler at lines 3236-3247 completes the transition
TCP_LISTENCB_EVENT_WRITABLEuntil the final ACK completes the three-way handshakeaccepted socket so the connection starts with correct parameters
Test Changes
test_native_wolfssl.c: Replace blockingconnect()with non-blocking connectusing
select()loop for robustness (matches the pattern intest_eventloop.c)unit.c: Add 3 new unit tests verifying RTO timer is active on accepted socketsin
TCP_SYN_RCVD, stops after the final ACK, and the socket transitions toTCP_ESTABLISHEDwithCB_EVENT_WRITABLEsignaledunit.c: Fix 3 existing unit test assertions to expectTCP_SYN_RCVDafteraccept()instead ofTCP_ESTABLISHEDTest plan
test-wolfsslcompletes without timeouttest-wolfsslcompletes without timeout