mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
pkg/tinydtls: destroy session after sending close notification
This commit is contained in:
parent
08f1f9768d
commit
c016b843d6
@ -561,7 +561,11 @@ int sock_dtls_session_init(sock_dtls_t *sock, const sock_udp_ep_t *ep,
|
||||
|
||||
void sock_dtls_session_destroy(sock_dtls_t *sock, sock_dtls_session_t *remote)
|
||||
{
|
||||
dtls_close(sock->dtls_ctx, &remote->dtls_session);
|
||||
dtls_peer_t *peer = dtls_get_peer(sock->dtls_ctx, &remote->dtls_session);
|
||||
if (peer) {
|
||||
/* dtls_reset_peer() also sends close_notify if not already sent */
|
||||
dtls_reset_peer(sock->dtls_ctx, peer);
|
||||
}
|
||||
}
|
||||
|
||||
void sock_dtls_session_get_udp_ep(const sock_dtls_session_t *session,
|
||||
|
@ -702,6 +702,11 @@ int sock_dtls_session_init(sock_dtls_t *sock, const sock_udp_ep_t *ep,
|
||||
*
|
||||
* @param[in] sock @ref sock_dtls_t, which the session is created on
|
||||
* @param[in] remote Remote session to destroy
|
||||
*
|
||||
* @note For tinyDTLS this function destroys the session object right after notifying the remote
|
||||
* peer about the closing. This is an interim solution, preventing endlessly blocked session
|
||||
* slots, but allows as a consequence truncation attacks.
|
||||
* More details in the [issue](https://github.com/eclipse/tinydtls/issues/95).
|
||||
*/
|
||||
void sock_dtls_session_destroy(sock_dtls_t *sock, sock_dtls_session_t *remote);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user