1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-12-22 21:13:52 +01:00

Merge pull request #18065 from benpicco/gnrc_sock-implicit_netif

gnrc_sock: implicitly set netif if there is only a single one
This commit is contained in:
benpicco 2022-05-10 00:16:42 +02:00 committed by GitHub
commit cb1aea03a0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

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