mirror of
https://github.com/espressif/openthread.git
synced 2026-08-22 18:39:50 +00:00
[netif] check address type when adding addresses (#5297)
This commit is contained in:
@@ -321,6 +321,7 @@ otError Netif::SubscribeExternalMulticast(const Address &aAddress)
|
||||
const_cast<otNetifMulticastAddress &>(kLinkLocalAllRoutersMulticastAddress));
|
||||
ExternalNetifMulticastAddress *entry;
|
||||
|
||||
VerifyOrExit(aAddress.IsMulticast(), error = OT_ERROR_INVALID_ARGS);
|
||||
VerifyOrExit(!IsMulticastSubscribed(aAddress), error = OT_ERROR_ALREADY);
|
||||
|
||||
// Check that the address is not one of the fixed addresses:
|
||||
@@ -420,6 +421,8 @@ otError Netif::AddExternalUnicastAddress(const NetifUnicastAddress &aAddress)
|
||||
NetifUnicastAddress *entry;
|
||||
NetifUnicastAddress *prev;
|
||||
|
||||
VerifyOrExit(!aAddress.GetAddress().IsMulticast(), error = OT_ERROR_INVALID_ARGS);
|
||||
|
||||
entry = mUnicastAddresses.FindMatching(aAddress.GetAddress(), prev);
|
||||
|
||||
if (entry != nullptr)
|
||||
|
||||
Reference in New Issue
Block a user