-
Notifications
You must be signed in to change notification settings - Fork 920
Dtls13: Fix handshake hangs on WANT_WRITE I/O error #9330
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR fixes a handshake hang issue in DTLS 1.3 that occurred when a WANT_WRITE I/O error was encountered. The core fix ensures the internal buffer index pointer is updated before error handling, preventing infinite loops. Additionally, the PR corrects bugs in test infrastructure where client/server force-want-write flags were swapped, and adds comprehensive test coverage for non-blocking I/O scenarios.
Key Changes:
- Moved buffer index update in
_Dtls13HandshakeRecvto occur before error checking - Fixed swapped client/server
forceWantWritereferences in test I/O callbacks - Added two new test cases to verify proper handling of WANT_WRITE conditions during DTLS 1.3 handshakes
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/dtls13.c | Fixes buffer index update timing to prevent handshake hangs on WANT_WRITE errors |
| tests/utils.c | Corrects swapped client/server force-want-write flag assignments in I/O callback |
| tests/api/test_dtls.h | Declares two new test functions for DTLS 1.3 WANT_WRITE scenarios |
| tests/api/test_dtls.c | Implements comprehensive tests for HRR and every-write WANT_WRITE cases |
| tests/api.c | Fixes incorrect side parameter in test_memio_simulate_want_write calls |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
|
🛟 Devin Lifeguard found 1 likely issues in this PR
@rizlik |
|
retest this please |
68a43c1 to
292aee5
Compare
|
retest this please |
292aee5 to
27fff1e
Compare
27fff1e to
33be31a
Compare
Description
The internal buffer index pointer wasn't incremented in case of error inside
_Dtls13HandshakeRecv, causing an hangs.Fixes zd#20686
Added tests to increase coverage from non-blocking I/O.