Fix NetX I/O porting layer - #11287
Open
embhorn wants to merge 3 commits into
Open
Conversation
embhorn
requested review from
wolfSSL-Fenrir-bot
and
a lite review from Copilot
August 26, 2026 13:47
Contributor
There was a problem hiding this comment.
Pull request overview
Improves the ThreadX NetX/NetX Duo I/O porting layer so non-blocking and expiring-wait configurations don’t get treated as fatal TLS I/O errors, enabling correct retry behavior for transient network conditions.
Changes:
- Adds
NetX_TranslateReturnCode()and uses it across NetX TCP/UDP send/receive callbacks to returnWANT_READ/WANT_WRITE(and other appropriate CBIO errors) instead of alwaysERR_GENERAL. - Fixes NetX
SOCKET_E*aliases inwolfssl/wolfio.hto better reflect “would block” and “interrupted” conditions. - Fixes DTLS NetX Duo IPv4-only build issues by guarding
NXD_ADDRESSunion access and usingnxd_udp_socket_send()without direct union member access.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| wolfssl/wolfio.h | Corrects NetX SOCKET_E* mappings to align with NetX status codes for non-blocking / interrupted behavior. |
| src/wolfio.c | Introduces NetX status-to-CBIO translation and updates NetX TCP/UDP callbacks; hardens DTLS peer address handling for IPv4-only/IPv6 builds. |
| doc/dox_comments/header_files/wolfio.h | Updates doxygen guidance to describe NX_NO_WAIT / expiring-wait retry semantics for NetX callbacks. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
wolfSSL-Fenrir-bot
left a comment
There was a problem hiding this comment.
Fenrir Automated Review — PR #11287
Scan targets checked: wolfcrypt-rs-bugs, wolfssl-bugs, wolfssl-src
Fenrir result: Approved ✅
No new issues found in the changed files.
Advisory only — this automated result does not count as a GitHub approval.
Member
Author
|
retest this please |
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.
Description
The native NetX callbacks mapped every non-NX_SUCCESS status to
WOLFSSL_CBIO_ERR_GENERAL, which the TLS layer treats as fatal. Non-blocking operation (nxWaitset toNX_NO_WAITor any expiring wait option) was therefore impossible: a "no data yet" from the stack killed the connection.Adds
NetX_TranslateReturnCode()and uses it inNetX_Receive,NetX_Send,NetX_ReceiveFrom, andNetX_SendTo:NX_NO_PACKET,NX_WINDOW_OVERFLOW,NX_TX_QUEUE_DEPTH->WANT_READ/WANT_WRITENX_WAIT_ABORTED->ERR_ISRNX_NOT_CONNECTED->ERR_CONN_CLOSEERR_GENERAL, unchangedAlso fixes the
HAVE_NETX SOCKET_E*aliases in wolfssl/wolfio.h, which all mapped toNX_NOT_CONNECTED, and enables DTLS in the ThreadX CI job so the NetX Duo UDP callbacks get compile coverage.Blocking users (
NX_WAIT_FOREVER) see no behavior change.Also fix build error with DTLS / IPv4-only config.
Fixes
Testing
Compiled locally, customer confirmed
Checklist