1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-12-26 06:53:52 +01:00

grnc_sock_udp: implement SOCK_AUX_SET_LOCAL

This commit is contained in:
Benjamin Valentin 2022-05-04 10:03:42 +02:00
parent 2197f9c16a
commit cc8b4f52aa

View File

@ -346,6 +346,16 @@ ssize_t sock_udp_sendv_aux(sock_udp_t *sock,
src_port = sock->local.port;
memcpy(&local, &sock->local, sizeof(local));
}
#if IS_USED(MODULE_SOCK_AUX_LOCAL)
/* user supplied local endpoint takes precedent */
if ((aux != NULL) && (aux->flags & SOCK_AUX_SET_LOCAL)) {
local.family = aux->local.family;
local.netif = aux->local.netif;
memcpy(&local.addr, &aux->local.addr, sizeof(local.addr));
aux->flags &= ~SOCK_AUX_SET_LOCAL;
}
#endif
/* sock can't be NULL at this point */
if (remote == NULL) {
rem = (sock_ip_ep_t *)&sock->remote;