mirror of
https://github.com/espressif/openthread.git
synced 2026-10-11 02:07:40 +00:00
[netif] change UnsubscribeMulticast() to return void (#4942)
This commit is contained in:
@@ -228,7 +228,7 @@ void Local::SetState(BackboneRouterState aState)
|
||||
}
|
||||
else if (aState == OT_BACKBONE_ROUTER_STATE_DISABLED)
|
||||
{
|
||||
IgnoreError(Get<ThreadNetif>().UnsubscribeMulticast(mAllNetworkBackboneRouters));
|
||||
Get<ThreadNetif>().UnsubscribeMulticast(mAllNetworkBackboneRouters);
|
||||
}
|
||||
|
||||
if (mState == OT_BACKBONE_ROUTER_STATE_PRIMARY)
|
||||
@@ -351,7 +351,7 @@ void Local::ApplyMeshLocalPrefix(void)
|
||||
{
|
||||
VerifyOrExit(IsEnabled(), OT_NOOP);
|
||||
|
||||
IgnoreError(Get<ThreadNetif>().UnsubscribeMulticast(mAllNetworkBackboneRouters));
|
||||
Get<ThreadNetif>().UnsubscribeMulticast(mAllNetworkBackboneRouters);
|
||||
mAllNetworkBackboneRouters.GetAddress().SetMulticastNetworkPrefix(Get<Mle::MleRouter>().GetMeshLocalPrefix());
|
||||
Get<ThreadNetif>().SubscribeMulticast(mAllNetworkBackboneRouters);
|
||||
|
||||
@@ -370,13 +370,13 @@ void Local::UpdateAllDomainBackboneRouters(Leader::DomainPrefixState aState)
|
||||
{
|
||||
if (!IsEnabled())
|
||||
{
|
||||
IgnoreError(Get<ThreadNetif>().UnsubscribeMulticast(mAllDomainBackboneRouters));
|
||||
Get<ThreadNetif>().UnsubscribeMulticast(mAllDomainBackboneRouters);
|
||||
ExitNow();
|
||||
}
|
||||
|
||||
if (aState == Leader::kDomainPrefixRemoved || aState == Leader::kDomainPrefixRefreshed)
|
||||
{
|
||||
IgnoreError(Get<ThreadNetif>().UnsubscribeMulticast(mAllDomainBackboneRouters));
|
||||
Get<ThreadNetif>().UnsubscribeMulticast(mAllDomainBackboneRouters);
|
||||
}
|
||||
|
||||
if (aState == Leader::kDomainPrefixAdded || aState == Leader::kDomainPrefixRefreshed)
|
||||
|
||||
@@ -316,11 +316,9 @@ exit:
|
||||
return;
|
||||
}
|
||||
|
||||
otError Netif::UnsubscribeMulticast(const NetifMulticastAddress &aAddress)
|
||||
void Netif::UnsubscribeMulticast(const NetifMulticastAddress &aAddress)
|
||||
{
|
||||
otError error;
|
||||
|
||||
SuccessOrExit(error = mMulticastAddresses.Remove(aAddress));
|
||||
SuccessOrExit(mMulticastAddresses.Remove(aAddress));
|
||||
|
||||
Get<Notifier>().Signal(OT_CHANGED_IP6_MULTICAST_UNSUBSCRIBED);
|
||||
|
||||
@@ -328,7 +326,7 @@ otError Netif::UnsubscribeMulticast(const NetifMulticastAddress &aAddress)
|
||||
mAddressCallback(&aAddress.mAddress, kMulticastPrefixLength, /* IsAdded */ false, mAddressCallbackContext);
|
||||
|
||||
exit:
|
||||
return error;
|
||||
return;
|
||||
}
|
||||
|
||||
otError Netif::GetNextExternalMulticast(uint8_t &aIterator, Address &aAddress) const
|
||||
|
||||
@@ -317,11 +317,8 @@ public:
|
||||
*
|
||||
* @param[in] aAddress A reference to the multicast address.
|
||||
*
|
||||
* @retval OT_ERROR_NONE Successfully unsubscribed @p aAddress.
|
||||
* @retval OT_ERROR_NOT_FOUND The multicast address was not found.
|
||||
*
|
||||
*/
|
||||
otError UnsubscribeMulticast(const NetifMulticastAddress &aAddress);
|
||||
void UnsubscribeMulticast(const NetifMulticastAddress &aAddress);
|
||||
|
||||
/**
|
||||
* This method provides the next external multicast address that the network interface subscribed.
|
||||
|
||||
@@ -301,8 +301,8 @@ void Mle::Stop(bool aClearNetworkDatasets)
|
||||
|
||||
Get<KeyManager>().Stop();
|
||||
SetStateDetached();
|
||||
IgnoreError(Get<ThreadNetif>().UnsubscribeMulticast(mRealmLocalAllThreadNodes));
|
||||
IgnoreError(Get<ThreadNetif>().UnsubscribeMulticast(mLinkLocalAllThreadNodes));
|
||||
Get<ThreadNetif>().UnsubscribeMulticast(mRealmLocalAllThreadNodes);
|
||||
Get<ThreadNetif>().UnsubscribeMulticast(mLinkLocalAllThreadNodes);
|
||||
Get<ThreadNetif>().RemoveUnicastAddress(mMeshLocal16);
|
||||
Get<ThreadNetif>().RemoveUnicastAddress(mMeshLocal64);
|
||||
|
||||
@@ -914,8 +914,8 @@ void Mle::SetMeshLocalPrefix(const MeshLocalPrefix &aMeshLocalPrefix)
|
||||
// We must remove the old addresses before adding the new ones.
|
||||
Get<ThreadNetif>().RemoveUnicastAddress(mMeshLocal64);
|
||||
Get<ThreadNetif>().RemoveUnicastAddress(mMeshLocal16);
|
||||
IgnoreError(Get<ThreadNetif>().UnsubscribeMulticast(mLinkLocalAllThreadNodes));
|
||||
IgnoreError(Get<ThreadNetif>().UnsubscribeMulticast(mRealmLocalAllThreadNodes));
|
||||
Get<ThreadNetif>().UnsubscribeMulticast(mLinkLocalAllThreadNodes);
|
||||
Get<ThreadNetif>().UnsubscribeMulticast(mRealmLocalAllThreadNodes);
|
||||
}
|
||||
|
||||
mMeshLocal64.GetAddress().SetPrefix(aMeshLocalPrefix);
|
||||
|
||||
@@ -185,11 +185,11 @@ void TestNetifMulticastAddresses(void)
|
||||
netif.UnsubscribeAllExternalMulticastAddresses();
|
||||
VerifyMulticastAddressList(netif, &addresses[2], 4);
|
||||
|
||||
SuccessOrQuit(netif.UnsubscribeMulticast(netifAddress), "UnsubscribeMulticast() failed");
|
||||
netif.UnsubscribeMulticast(netifAddress);
|
||||
VerifyMulticastAddressList(netif, &addresses[2], 3);
|
||||
|
||||
VerifyOrQuit(netif.UnsubscribeMulticast(netifAddress) == OT_ERROR_NOT_FOUND,
|
||||
"UnsubscribeMulticast() did not fail when address was not subscribed");
|
||||
netif.UnsubscribeMulticast(netifAddress);
|
||||
VerifyMulticastAddressList(netif, &addresses[2], 3);
|
||||
|
||||
SuccessOrQuit(netif.UnsubscribeAllNodesMulticast(), "UnsubscribeAllNodesMulticast() failed");
|
||||
VerifyMulticastAddressList(netif, NULL, 0);
|
||||
|
||||
Reference in New Issue
Block a user