-
Notifications
You must be signed in to change notification settings - Fork 9
Open
Description
Summary
dimpl currently has no way for the application to initiate a graceful connection closure. The DTLS standards (RFC 9147 §5.10, RFC 8446 §6.1) define close_notify as the mechanism for this, and while dimpl can receive a close_notify alert, it cannot send one.
Background
Per RFC 8446 §6.1:
Each party MUST send a "close_notify" alert before closing its write side of the connection, unless it has already sent some error alert.
RFC 9147 §5.10 inherits this requirement with important caveats for unreliable transport:
- Alerts are not retransmitted
- Implementations SHOULD NOT depend on receiving alerts to signal connection closure
- Data ordering after closure uses epoch/sequence number, not receipt order
This makes close_notify a best-effort, fire-and-forget signal — but it is still a MUST-level requirement to send before closing the write side.
Current state
- Receiving: DTLS 1.3 handles incoming
close_notifyinengine.rsby returningError::SecurityError. DTLS 1.2 silently discards alerts. - Sending: No public API exists. There is no
close()orshutdown()method onDtls. - Tests:
dtls13_close_notify_graceful_shutdownanddtls12_close_notify_graceful_shutdownintests/*/edge.rsdocument this gap.
Proposed changes
- Add a
close(&mut self)method toDtlsthat queues aclose_notifyalert for transmission - After
close()is called,poll_outputshould yield the alert packet, then signal that the connection is closed - The alert MUST NOT be retransmitted (per RFC 9147 §5.10)
- Distinguish between a clean closure (
close_notifyreceived) and an abrupt one (no alert) on the receiving side
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels