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

examples/dtls-echo: set address family for sessions

d424aaedac introduced address families to
the RIOT interpretation of tinydtls-`session_t`s. However, while fixing
the naming for the `addr` field, it did not set the `family` member for
the sessions in the `dtls-echo` example, having that example run into [an
assertion][1]. This patch fixes that.

[1]: bda40789a7/session.c (L146)
This commit is contained in:
Martine Lenders 2022-07-26 15:51:07 +02:00
parent be34719350
commit 2679fcafb1
No known key found for this signature in database
GPG Key ID: 2134D77A5336DD80
2 changed files with 3 additions and 0 deletions

View File

@ -121,6 +121,7 @@ static int dtls_handle_read(dtls_context_t *ctx)
dtls_session_init(&session);
session.addr.port = remote.port;
session.addr.family = AF_INET6;
if (remote.netif == SOCK_ADDR_ANY_NETIF) {
session.ifindex = SOCK_ADDR_ANY_NETIF;
}
@ -359,6 +360,7 @@ dtls_context_t *_init_dtls(sock_udp_t *sock, sock_udp_ep_t *local,
}
/* Second: We prepare the DTLS Session by means of ctx->app */
dst->addr.family = AF_INET6;
dst->addr.port = remote->port;
/* NOTE: remote.addr.ipv6 and dst->addr.ipv6 are different structures. */

View File

@ -116,6 +116,7 @@ static int dtls_handle_read(dtls_context_t *ctx)
/* (DTLS) session requires the remote peer address (IPv6:Port) and netif */
dtls_session_init(&session);
session.addr.port = remote_peer->remote->port;
session.addr.family = AF_INET6;
if (remote_peer->remote->netif == SOCK_ADDR_ANY_NETIF) {
session.ifindex = SOCK_ADDR_ANY_NETIF;
}