arch/nrf91/modem: fix returned source address

This commit is contained in:
raiden00pl 2023-07-26 10:48:14 +02:00 committed by Xiang Xiao
parent 5ac8c71663
commit ef252fc0fc
1 changed files with 6 additions and 6 deletions

View File

@ -891,12 +891,6 @@ static int nrf91_usrsock_recvfrom_handler(struct nrf91_usrsock_s *usrsock,
buflen = sizeof(usrsock->out) - sizeof(*ack) - inaddrlen;
}
if (outaddrlen != 0)
{
tmp = (struct sockaddr *)(ack + 1);
nx2nrf_sockaddr(tmp, (struct nrf_sockaddr *)&address);
}
ret = nrf_recvfrom(req->usockid,
(void *)(ack + 1) + inaddrlen,
buflen,
@ -909,6 +903,12 @@ static int nrf91_usrsock_recvfrom_handler(struct nrf91_usrsock_s *usrsock,
ret = -errno;
}
if (outaddrlen != 0)
{
tmp = (struct sockaddr *)(ack + 1);
nrf2nx_sockaddr((struct nrf_sockaddr *)&address, tmp);
}
recvlen = ret;
if (ret > 0 && outaddrlen < inaddrlen)