mirror of
https://github.com/espressif/openthread.git
synced 2026-08-12 21:57:47 +00:00
[netif] simplify adding external unicast/multicast addresses (#4520)
This commit is contained in:
committed by
Jonathan Hui
parent
8729bc4dac
commit
2f075974b5
+10
-15
@@ -378,16 +378,14 @@ otError Netif::SubscribeExternalMulticast(const Address &aAddress)
|
||||
{
|
||||
if (!entry->IsInUse())
|
||||
{
|
||||
break;
|
||||
entry->mAddress = aAddress;
|
||||
mMulticastAddresses.Push(*entry);
|
||||
Get<Notifier>().Signal(OT_CHANGED_IP6_MULTICAST_SUBSCRIBED);
|
||||
ExitNow();
|
||||
}
|
||||
}
|
||||
|
||||
VerifyOrExit(entry < OT_ARRAY_END(mExtMulticastAddresses), error = OT_ERROR_NO_BUFS);
|
||||
|
||||
// Copy the address into the available entry and add it to the list.
|
||||
entry->mAddress = aAddress;
|
||||
mMulticastAddresses.Push(*entry);
|
||||
Get<Notifier>().Signal(OT_CHANGED_IP6_MULTICAST_SUBSCRIBED);
|
||||
error = OT_ERROR_NO_BUFS;
|
||||
|
||||
exit:
|
||||
return error;
|
||||
@@ -504,17 +502,14 @@ otError Netif::AddExternalUnicastAddress(const NetifUnicastAddress &aAddress)
|
||||
{
|
||||
if (!entry->IsInUse())
|
||||
{
|
||||
break;
|
||||
*entry = aAddress;
|
||||
mUnicastAddresses.Push(*entry);
|
||||
Get<Notifier>().Signal(OT_CHANGED_IP6_ADDRESS_ADDED);
|
||||
ExitNow();
|
||||
}
|
||||
}
|
||||
|
||||
VerifyOrExit(entry < OT_ARRAY_END(mExtUnicastAddresses), error = OT_ERROR_NO_BUFS);
|
||||
|
||||
// Copy the new address into the available entry and insert it in linked-list.
|
||||
*entry = aAddress;
|
||||
mUnicastAddresses.Push(*entry);
|
||||
|
||||
Get<Notifier>().Signal(OT_CHANGED_IP6_ADDRESS_ADDED);
|
||||
error = OT_ERROR_NO_BUFS;
|
||||
|
||||
exit:
|
||||
return error;
|
||||
|
||||
Reference in New Issue
Block a user