Repository navigation
dtls: peer address fixes - #11663
dtls: peer address fixes#11663gasbytes wants to merge 3 commits into
Conversation
|
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
The send path can still race with peer updates when using write duplicates.
Review effort: Balanced
Findings: 2
Open (4)
What changed in this PR
Hardens wolfSSL’s DTLS peer-address handling during session export/import, allocation failures, and concurrent updates.
Changes:
- Rejects IPv6 peer export/import when IPv6 support is disabled.
- Preserves addresses on allocation failure and copies destinations before sending.
- Adds regression tests and updates concurrency comments.
| File | Description |
|---|---|
| tests/api/test_dtls.h | Declares and registers three regression tests. |
| tests/api/test_dtls.c | Tests unsupported IPv6, allocation failure, and concurrent migration. |
| src/wolfio.c | Copies send destinations under a lock and rejects unsupported IPv6 peers. |
| src/ssl_api_dtls.c | Allocates replacement storage before freeing the existing address. |
| src/internal.c | Updates comments describing send-path concurrency; no functional changes. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
f09773a to
333f221
Compare
…rent peer change can't alter or free it mid-send (also updated the stale comments regarding this)
333f221 to
0a287ed
Compare
rizlik
left a comment
There was a problem hiding this comment.
On wolfssl_local_SockAddrSet:
Keeping the previous address when an update fails means we carry on with stale data. I'd rather wipe the address on failure and fail hard.
We should stop EmbedReceiveFrom from re-learning the peer when peer.sa == NULL, by gating that on !dtlsStateful instead.


Description
Testing
Added a test associated with each fix (test_dtls_export_peer_ipv6_not_compiled, test_wolfSSL_dtls_set_peer_oom, and test_dtls_send_to_peer_migration).
Checklist