1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

net/sock/dtls: allow CREDMAN_TAG_EMPTY on sock creation

This commit is contained in:
Leandro Lanzieri 2021-03-17 13:09:38 +01:00
parent cff9a547af
commit 6428505017
No known key found for this signature in database
GPG Key ID: F4E9A721761C7593
2 changed files with 11 additions and 3 deletions

View File

@ -421,8 +421,14 @@ int sock_dtls_create(sock_dtls_t *sock, sock_udp_t *udp_sock,
#endif /* SOCK_HAS_ASYNC */
memset(sock->tags, CREDMAN_TAG_EMPTY, CONFIG_DTLS_CREDENTIALS_MAX * sizeof(credman_tag_t));
sock->tags_len = 1;
sock->tags[0] = tag;
if (tag != CREDMAN_TAG_EMPTY) {
sock->tags_len = 1;
sock->tags[0] = tag;
}
else {
sock->tags_len = 0;
}
sock->role = role;
sock->dtls_ctx = dtls_new_context(sock);

View File

@ -652,7 +652,9 @@ void sock_dtls_init(void);
* @param[in] udp_sock Existing UDP sock initialized with
* @ref sock_udp_create() to be used underneath.
* @param[in] tag Credential tag of @p sock. The sock will only use
* credentials with the same tag given here.
* credentials with the tags registered to it
* (see @ref sock_dtls_add_credential). Set to @ref CREDMAN_TAG_EMPTY to
* create a sock with an empty tag list.
* @param[in] version [DTLS version](@ref sock_dtls_prot_version) to use.
* @param[in] role [Role](@ref sock_dtls_role) of the endpoint.
*