Repository navigation
Conversation
There was a problem hiding this comment.
🟢 Approval recommended
There are no active review issues for the POSIX connection-waiting and timeout-handling changes.
No open issues 🎉
What changed in this PR
Updates wolfCert’s built-in POSIX transport to wait for interrupted connections without reissuing connect() or extending configured timeouts.
Changes:
- Uses non-blocking connect and polling for both blocking and timed calls, recalculating the remaining timeout after signals.
- Adds regression tests for signal-interrupted timeouts and preservation of blocking socket mode.
- Limits the
nettest to 30 seconds in CTest.
| File | Description |
|---|---|
tests/unit/test_net.c |
Adds signal-driven timeout and blocking-mode regression tests. |
tests/CMakeLists.txt |
Sets a 30-second timeout for the net test. |
src/net_posix.c |
Unifies connection waiting and preserves deadlines across EINTR. |
Review effort: Balanced
wolfSSL-Fenrir-bot
left a comment
There was a problem hiding this comment.
Fenrir Automated Review — PR #66
Scan targets checked: wolfcert-bugs
Not reviewed (no scan target covers them): src/net_posix.c, tests/CMakeLists.txt
Coverage: 1 of 1 in-scope changed file(s) opened by the reviewer
Fenrir result: Approved ✅
No new issues found in the changed files.
Advisory only — this automated result does not count as a GitHub approval.
Review tier: Max
Member
Author
|
@claude review |
Frauschi
force-pushed
the
connect-eintr
branch
from
November 13, 2026 15:05
26ac5dd to
21f1174
Compare
With no timeout, connect_timeout() retried connect() after EINTR. POSIX lets an interrupted connect() finish in the background, and BSD-derived kernels (macOS, FreeBSD) answer the second call with EALREADY while it is in progress or EISCONN once it is done, so a signal during the connect failed a connection that was about to succeed. On Linux the reissued call waits, which hid this. With a timeout, the poll() loop retried with the full timeout after each EINTR, so a steady stream of signals kept the connect waiting forever. With no timeout the connect stays blocking, so the platform's own limit still applies (Zephyr bounds it by CONFIG_NET_SOCKETS_CONNECT_TIMEOUT), and after EINTR it polls for writability instead of reissuing connect(). With a timeout it connects non-blocking and polls; after EINTR the poll resumes with the time left before the deadline. A signal that lands right at the deadline gets one last zero-wait poll, so a connect that finished meanwhile still counts. test_net runs a 300 ms connect to an unroutable address under a SIGALRM every 20 ms and requires it back after 250 ms and within 3 s; the old code never returned. On a host that refuses the address rather than dropping it, the case is skipped and says so. A blocking connect to a loopback listener must succeed and leave the socket blocking. The net test gets a 30 s ctest timeout, so a regression fails instead of hanging. Fixes F-17353. Fixes F-11054.
Frauschi
force-pushed
the
connect-eintr
branch
from
November 16, 2026 08:47
21f1174 to
6e0af29
Compare
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.
The built-in transport mishandled
EINTRduring connect: the blocking path reissuedconnect(), which BSD kernels answer withEALREADY/EISCONN, and the timed path restartedpoll()with the full timeout after every signal.Changes
EINTRinstead of reissuingconnect()EINTRthe poll resumes with the time leftTesting
test_net: a 300 ms connect to an unroutable address under a SIGALRM every 20 ms returns at its deadline, not before or aftertest_net: a blocking connect leaves the socket blocking;netgets a 30 s ctest timeoutFixes F-17353 and F-11054.