1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +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,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;
}
}