1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-12-24 14:03:55 +01:00

gnrc_sock: implicitly set netif if there is only a single one

This commit is contained in:
Benjamin Valentin 2022-05-05 23:56:24 +02:00
parent 7b827f405c
commit cbd48c23aa

View File

@ -125,13 +125,15 @@ static inline void gnrc_ep_set(sock_ip_ep_t *out, const sock_ip_ep_t *in,
size_t in_size)
{
memcpy(out, in, in_size);
if (gnrc_netif_highlander() && (out->netif == 0)) {
/* set interface implicitly */
gnrc_netif_t *netif = gnrc_netif_iter(NULL);
if (out->netif != SOCK_ADDR_ANY_NETIF) {
return;
}
if (netif != NULL) {
out->netif = netif->pid;
}
/* set interface implicitly */
gnrc_netif_t *netif = gnrc_netif_iter(NULL);
if ((netif != NULL) &&
(gnrc_netif_highlander() || (gnrc_netif_iter(netif) == NULL))) {
out->netif = netif->pid;
}
}