diff --git a/src/core/net/netif.cpp b/src/core/net/netif.cpp index 57d1e7197..4932e4339 100644 --- a/src/core/net/netif.cpp +++ b/src/core/net/netif.cpp @@ -321,6 +321,7 @@ otError Netif::SubscribeExternalMulticast(const Address &aAddress) const_cast(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)