mirror of
https://github.com/espressif/openthread.git
synced 2026-08-23 10:49:51 +00:00
[posix] verify in otPlatUdpBindToNetif if Backbone Interface is set. (#9696)
Commit adds check to `otPlatUdpBindToNetif` if backbone interface is set to correct value to prevent `setsockopt` from crashing the ot-daemon.
This commit is contained in:
@@ -323,6 +323,11 @@ otError otPlatUdpBindToNetif(otUdpSocket *aUdpSocket, otNetifIdentifier aNetifId
|
||||
case OT_NETIF_BACKBONE:
|
||||
{
|
||||
#if OPENTHREAD_CONFIG_BACKBONE_ROUTER_ENABLE
|
||||
if (otSysGetInfraNetifName() == nullptr || otSysGetInfraNetifName()[0] == '\0')
|
||||
{
|
||||
otLogWarnPlat("No backbone interface given, %s fails.", __func__);
|
||||
ExitNow(error = OT_ERROR_INVALID_ARGS);
|
||||
}
|
||||
#if __linux__
|
||||
VerifyOrExit(setsockopt(fd, SOL_SOCKET, SO_BINDTODEVICE, otSysGetInfraNetifName(),
|
||||
strlen(otSysGetInfraNetifName())) == 0,
|
||||
|
||||
Reference in New Issue
Block a user