Skip to content

Fix NetX I/O: differentiate transient errors from fatal ones - #11257

Closed
embhorn wants to merge 2 commits into
wolfSSL:masterfrom
embhorn:zd23372
Closed

Fix NetX I/O: differentiate transient errors from fatal ones#11257
embhorn wants to merge 2 commits into
wolfSSL:masterfrom
embhorn:zd23372

Conversation

@embhorn

@embhorn embhorn commented Aug 25, 2026

Copy link
Copy Markdown
Member

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 (nxWait set to NX_NO_WAIT or any expiring wait option) was therefore impossible: a "no data yet" from the stack killed the connection.

Adds NetX_TranslateReturnCode() and uses it in NetX_Receive, NetX_Send, NetX_ReceiveFrom, and NetX_SendTo:

  • NX_NO_PACKET, NX_WINDOW_OVERFLOW, NX_TX_QUEUE_DEPTH -> WANT_READ/WANT_WRITE
  • NX_WAIT_ABORTED -> ERR_ISR
  • NX_NOT_CONNECTED -> ERR_CONN_CLOSE
  • everything else -> ERR_GENERAL, unchanged

Also fixes the HAVE_NETX SOCKET_E* aliases in wolfssl/wolfio.h, which all mapped to NX_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.

Fixes ZD22372

Testing

Compiled locally, customer confirmed

Checklist

  • added tests
  • updated/added doxygen
  • updated appropriate READMEs
  • Updated manual and documentation

@embhorn embhorn self-assigned this Aug 25, 2026
@embhorn
embhorn requested review from JacobBarthelmeh and a lite review from Copilot August 25, 2026 15:39

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Warning

Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.

Improves NetX Duo I/O integration by mapping transient NetX status codes to non-fatal wolfSSL CBIO “want read/write” errors, enabling reliable non-blocking and short-wait TLS/DTLS operation.

Changes:

  • Added NetX_TranslateReturnCode() and used it across NetX TLS/DTLS send/receive callbacks.
  • Fixed NetX SOCKET_E* aliases to better match NetX status codes (no errno).
  • Updated ThreadX CI configuration to compile DTLS/DTLS1.3 to cover UDP callback builds.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.

File Description
wolfssl/wolfio.h Corrects NetX SOCKET_E* aliases to map to more appropriate NetX status codes.
src/wolfio.c Introduces shared NetX status→CBIO translation and applies it to TCP/UDP callbacks.
doc/dox_comments/header_files/wolfio.h Documents non-blocking/expiring-wait behavior as WANT_READ/WANT_WRITE instead of fatal errors.
.github/workflows/threadx.yml Enables DTLS/DTLS1.3 in ThreadX CI job for compile coverage of UDP code paths.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/wolfio.c
Comment thread src/wolfio.c
Comment thread src/wolfio.c
Comment thread wolfssl/wolfio.h Outdated
@wolfSSL-Bot

Copy link
Copy Markdown

Can one of the admins verify this patch?

@embhorn embhorn closed this Aug 26, 2026
@embhorn
embhorn deleted the zd23372 branch August 26, 2026 12:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants