diff --git a/examples/dtls-echo/dtls-client.c b/examples/dtls-echo/dtls-client.c index 0f0bffda70..c1563252cb 100644 --- a/examples/dtls-echo/dtls-client.c +++ b/examples/dtls-echo/dtls-client.c @@ -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. */ diff --git a/examples/dtls-echo/dtls-server.c b/examples/dtls-echo/dtls-server.c index dbde10decb..4abdf833cf 100644 --- a/examples/dtls-echo/dtls-server.c +++ b/examples/dtls-echo/dtls-server.c @@ -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; }