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

examples/dtls-echo: Use passed interface if present

This commit is contained in:
Leandro Lanzieri 2019-11-07 17:34:32 +01:00
parent 85e16cf55a
commit c96b85da02

View File

@ -341,12 +341,13 @@ dtls_context_t *_init_dtls(sock_udp_t *sock, sock_udp_ep_t *local,
}
}
else {
if (gnrc_netif_get_by_pid(iface) == NULL) {
gnrc_netif_t *netif = gnrc_netif_get_by_pid(iface);
if (netif == NULL) {
puts("ERROR: interface not valid");
return new_context;
}
dst->ifindex = (uint16_t)gnrc_netif_iter(NULL)->pid;
remote->netif = (uint16_t)gnrc_netif_iter(NULL)->pid;
dst->ifindex = (uint16_t)netif->pid;
remote->netif = (uint16_t)netif->pid;
}
if (ipv6_addr_from_str((ipv6_addr_t *)remote->addr.ipv6, addr_str) == NULL) {