mirror of
https://github.com/espressif/openthread.git
synced 2026-10-03 22:37:36 +00:00
[trel] bind the socket to TREL interface (#10957)
This commit is contained in:
@@ -194,6 +194,15 @@ static void PrepareSocket(uint16_t &aUdpPort)
|
|||||||
DieNow(OT_EXIT_ERROR_ERRNO);
|
DieNow(OT_EXIT_ERROR_ERRNO);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef __linux__
|
||||||
|
// Bind to the TREL interface
|
||||||
|
if (setsockopt(sSocket, SOL_SOCKET, SO_BINDTODEVICE, sInterfaceName, strlen(sInterfaceName)) < 0)
|
||||||
|
{
|
||||||
|
LogCrit("Failed to bind socket to the interface %s", sInterfaceName);
|
||||||
|
DieNow(OT_EXIT_ERROR_ERRNO);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
sockLen = sizeof(sockAddr);
|
sockLen = sizeof(sockAddr);
|
||||||
|
|
||||||
if (getsockname(sSocket, (struct sockaddr *)&sockAddr, &sockLen) == -1)
|
if (getsockname(sSocket, (struct sockaddr *)&sockAddr, &sockLen) == -1)
|
||||||
|
|||||||
Reference in New Issue
Block a user