mirror of
https://github.com/espressif/openthread.git
synced 2026-07-29 07:07:47 +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);
|
||||
}
|
||||
|
||||
#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);
|
||||
|
||||
if (getsockname(sSocket, (struct sockaddr *)&sockAddr, &sockLen) == -1)
|
||||
|
||||
Reference in New Issue
Block a user