1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-12-27 07:21:18 +01:00

cord_ep: allow not specify netif if only one interface exist

This commit is contained in:
M Aiman Ismail 2020-06-30 21:38:54 +02:00
parent e8389a5847
commit edc95679cd

View File

@ -32,8 +32,12 @@ static int make_sock_ep(sock_udp_ep_t *ep, const char *addr)
if (sock_udp_str2ep(ep, addr) < 0) {
return -1;
}
/* if netif not specified in addr */
if ((ep->netif == SOCK_ADDR_ANY_NETIF) && (gnrc_netif_numof() == 1)) {
/* assign the single interface found in gnrc_netif_numof() */
ep->netif = (uint16_t)gnrc_netif_iter(NULL)->pid;
}
ep->family = AF_INET6;
ep->netif = SOCK_ADDR_ANY_NETIF;
if (ep->port == 0) {
ep->port = COAP_PORT;
}