[meshcop] use joiner id when enabling discovery response filter (#2426)

This commit is contained in:
Jonathan Hui
2017-12-20 05:32:04 +00:00
committed by GitHub
parent 38b7d9e652
commit debf68dd09
4 changed files with 20 additions and 13 deletions
+1 -1
View File
@@ -303,7 +303,7 @@ otError otThreadSetSteeringData(otInstance *aInstance, const otExtAddress *aExtA
#if OPENTHREAD_CONFIG_ENABLE_STEERING_DATA_SET_OOB
Instance &instance = *static_cast<Instance *>(aInstance);
error = instance.GetThreadNetif().GetMle().SetSteeringData(aExtAddress);
error = instance.GetThreadNetif().GetMle().SetSteeringData(static_cast<const Mac::ExtAddress *>(aExtAddress));
#else
OT_UNUSED_VARIABLE(aInstance);
OT_UNUSED_VARIABLE(aExtAddress);
+8 -6
View File
@@ -48,6 +48,7 @@
#include "common/settings.hpp"
#include "crypto/aes_ccm.hpp"
#include "mac/mac_frame.hpp"
#include "meshcop/meshcop.hpp"
#include "meshcop/meshcop_tlvs.hpp"
#include "net/netif.hpp"
#include "net/udp6.hpp"
@@ -3249,18 +3250,19 @@ otError Mle::HandleDiscoveryResponse(const Message &aMessage, const Ip6::Message
// or if it matches the factory set EUI64.
if (mEnableEui64Filtering)
{
otExtAddress mfgEUI64;
Mac::ExtAddress extaddr;
Crc16 ccitt(Crc16::kCcitt);
Crc16 ansi(Crc16::kAnsi);
// Get Factory set EUI64
otPlatRadioGetIeeeEui64(&GetInstance(), mfgEUI64.m8);
otPlatRadioGetIeeeEui64(&GetInstance(), extaddr.m8);
MeshCoP::ComputeJoinerId(extaddr, extaddr);
// Compute bloom filter
for (size_t i = 0; i < sizeof(mfgEUI64.m8); i++)
for (size_t i = 0; i < sizeof(extaddr.m8); i++)
{
ccitt.Update(mfgEUI64.m8[i]);
ansi.Update(mfgEUI64.m8[i]);
ccitt.Update(extaddr.m8[i]);
ansi.Update(extaddr.m8[i]);
}
// Drop responses that don't match the bloom filter
+10 -5
View File
@@ -47,6 +47,7 @@
#include "common/owner-locator.hpp"
#include "common/settings.hpp"
#include "mac/mac_frame.hpp"
#include "meshcop/meshcop.hpp"
#include "net/icmp6.hpp"
#include "thread/thread_netif.hpp"
#include "thread/thread_tlvs.hpp"
@@ -2635,11 +2636,11 @@ exit:
}
#if OPENTHREAD_CONFIG_ENABLE_STEERING_DATA_SET_OOB
otError MleRouter::SetSteeringData(const otExtAddress *aExtAddress)
otError MleRouter::SetSteeringData(const Mac::ExtAddress *aExtAddress)
{
otError error = OT_ERROR_NONE;
ExtAddress nullExtAddr;
ExtAddress allowAnyExtAddr;
Mac::ExtAddress nullExtAddr;
Mac::ExtAddress allowAnyExtAddr;
memset(nullExtAddr.m8, 0, sizeof(nullExtAddr.m8));
memset(allowAnyExtAddr.m8, 0xFF, sizeof(allowAnyExtAddr.m8));
@@ -2659,8 +2660,12 @@ otError MleRouter::SetSteeringData(const otExtAddress *aExtAddress)
}
else
{
// Set bloom filter with the extended address passed in
mSteeringData.ComputeBloomFilter(*aExtAddress);
Mac::ExtAddress joinerId;
// compute Joiner ID
MeshCoP::ComputeJoinerId(*aExtAddress, joinerId);
// compute Bloom Filter
mSteeringData.ComputeBloomFilter(joinerId);
}
return error;
+1 -1
View File
@@ -674,7 +674,7 @@ public:
* @retval OT_ERROR_NONE Steering data was set
*
*/
otError SetSteeringData(const otExtAddress *aExtAddress);
otError SetSteeringData(const Mac::ExtAddress *aExtAddress);
#endif // OPENTHREAD_CONFIG_ENABLE_STEERING_DATA_SET_OOB
/**