mirror of
https://github.com/espressif/openthread.git
synced 2026-09-02 07:10:08 +00:00
[netif] change UnsubscribeAllRoutersMulticast() to return void (#4942)
This commit is contained in:
@@ -258,9 +258,8 @@ exit:
|
||||
return;
|
||||
}
|
||||
|
||||
otError Netif::UnsubscribeAllRoutersMulticast(void)
|
||||
void Netif::UnsubscribeAllRoutersMulticast(void)
|
||||
{
|
||||
otError error;
|
||||
NetifMulticastAddress *prev;
|
||||
NetifMulticastAddress &linkLocalAllRoutersAddress = static_cast<NetifMulticastAddress &>(
|
||||
const_cast<otNetifMulticastAddress &>(kLinkLocalAllRoutersMulticastAddress));
|
||||
@@ -277,7 +276,7 @@ otError Netif::UnsubscribeAllRoutersMulticast(void)
|
||||
// to point to `LinkLocalAll` instead (so that tail contains the
|
||||
// three fixed addresses at end of the chain).
|
||||
|
||||
SuccessOrExit(error = mMulticastAddresses.Find(linkLocalAllRoutersAddress, prev));
|
||||
SuccessOrExit(mMulticastAddresses.Find(linkLocalAllRoutersAddress, prev));
|
||||
|
||||
if (prev == NULL)
|
||||
{
|
||||
@@ -299,7 +298,7 @@ otError Netif::UnsubscribeAllRoutersMulticast(void)
|
||||
}
|
||||
|
||||
exit:
|
||||
return error;
|
||||
return;
|
||||
}
|
||||
|
||||
void Netif::SubscribeMulticast(NetifMulticastAddress &aAddress)
|
||||
|
||||
@@ -287,11 +287,8 @@ public:
|
||||
/**
|
||||
* This method unsubscribes the network interface to the link-local and realm-local all routers address.
|
||||
*
|
||||
* @retval OT_ERROR_NONE Successfully unsubscribed from the link-local and realm-local all routers address
|
||||
* @retval OT_ERROR_NOT_FOUND The multicast addresses were not found.
|
||||
*
|
||||
*/
|
||||
otError UnsubscribeAllRoutersMulticast(void);
|
||||
void UnsubscribeAllRoutersMulticast(void);
|
||||
|
||||
/**
|
||||
* This method returns a pointer to the list of multicast addresses.
|
||||
|
||||
@@ -219,7 +219,7 @@ void MleRouter::StopLeader(void)
|
||||
Get<MeshCoP::PendingDataset>().StopLeader();
|
||||
StopAdvertiseTimer();
|
||||
Get<NetworkData::Leader>().Stop();
|
||||
IgnoreError(Get<ThreadNetif>().UnsubscribeAllRoutersMulticast());
|
||||
Get<ThreadNetif>().UnsubscribeAllRoutersMulticast();
|
||||
}
|
||||
|
||||
void MleRouter::HandleDetachStart(void)
|
||||
|
||||
@@ -169,7 +169,7 @@ void ThreadNetif::Down(void)
|
||||
IgnoreError(Get<Mle::MleRouter>().Disable());
|
||||
RemoveAllExternalUnicastAddresses();
|
||||
UnsubscribeAllExternalMulticastAddresses();
|
||||
IgnoreError(UnsubscribeAllRoutersMulticast());
|
||||
UnsubscribeAllRoutersMulticast();
|
||||
UnsubscribeAllNodesMulticast();
|
||||
|
||||
mIsUp = false;
|
||||
|
||||
@@ -128,11 +128,11 @@ void TestNetifMulticastAddresses(void)
|
||||
netif.SubscribeAllRoutersMulticast();
|
||||
VerifyMulticastAddressList(netif, &addresses[0], 5);
|
||||
|
||||
SuccessOrQuit(netif.UnsubscribeAllRoutersMulticast(), "UnsubscribeAllRoutersMulticast() failed");
|
||||
netif.UnsubscribeAllRoutersMulticast();
|
||||
VerifyMulticastAddressList(netif, &addresses[2], 3);
|
||||
|
||||
VerifyOrQuit(netif.UnsubscribeAllRoutersMulticast() == OT_ERROR_NOT_FOUND,
|
||||
"UnsubscribeAllRoutersMulticast() did not fail when not subscribed");
|
||||
netif.UnsubscribeAllRoutersMulticast();
|
||||
VerifyMulticastAddressList(netif, &addresses[2], 3);
|
||||
|
||||
IgnoreError(netifAddress.GetAddress().FromString(kTestAddress1));
|
||||
netif.SubscribeMulticast(netifAddress);
|
||||
@@ -175,11 +175,11 @@ void TestNetifMulticastAddresses(void)
|
||||
VerifyOrQuit(netif.UnsubscribeExternalMulticast(address) == OT_ERROR_INVALID_ARGS,
|
||||
"UnsubscribeExternalMulticast() did not fail when address was fixed address");
|
||||
|
||||
SuccessOrQuit(netif.UnsubscribeAllRoutersMulticast(), "UnsubscribeAllRoutersMulticast() failed");
|
||||
netif.UnsubscribeAllRoutersMulticast();
|
||||
VerifyMulticastAddressList(netif, &addresses[2], 6);
|
||||
|
||||
VerifyOrQuit(netif.UnsubscribeAllRoutersMulticast() == OT_ERROR_NOT_FOUND,
|
||||
"UnsubscribeAllRoutersMulticast() did not fail when not subscribed");
|
||||
netif.UnsubscribeAllRoutersMulticast();
|
||||
VerifyMulticastAddressList(netif, &addresses[2], 6);
|
||||
|
||||
netif.UnsubscribeAllExternalMulticastAddresses();
|
||||
VerifyMulticastAddressList(netif, &addresses[2], 4);
|
||||
|
||||
Reference in New Issue
Block a user