[mesh-forwarder] do not forward mesh headers to MTD (#2464)

This commit is contained in:
Jonathan Hui
2018-01-11 17:03:28 +00:00
committed by GitHub
parent e25f97d0fb
commit 2c44b7f3f8
4 changed files with 32 additions and 1 deletions
+2 -1
View File
@@ -1981,7 +1981,8 @@ void MeshForwarder::HandleMesh(uint8_t *aFrame, uint8_t aFrameLength, const Mac:
UpdateRoutes(aFrame, aFrameLength, meshSource, meshDest);
#endif // OPENTHREAD_FTD
if (meshDest.mShortAddress == netif.GetMac().GetShortAddress())
if (meshDest.mShortAddress == netif.GetMac().GetShortAddress() ||
netif.GetMle().IsMinimalChild(meshDest.mShortAddress))
{
aFrame += meshHeader.GetHeaderLength();
aFrameLength -= meshHeader.GetHeaderLength();
+17
View File
@@ -3190,6 +3190,23 @@ Child *MleRouter::GetChildren(uint8_t *aNumChildren)
return mChildren;
}
bool MleRouter::IsMinimalChild(uint16_t aRloc16)
{
ThreadNetif &netif = GetNetif();
bool rval = false;
if (GetRouterId(aRloc16) == GetRouterId(netif.GetMac().GetShortAddress()))
{
Neighbor *neighbor;
neighbor = netif.GetMle().GetNeighbor(aRloc16);
rval = (neighbor != NULL) && (!neighbor->IsFullThreadDevice());
}
return rval;
}
otError MleRouter::SetMaxAllowedChildren(uint8_t aMaxChildren)
{
otError error = OT_ERROR_NONE;
+11
View File
@@ -532,6 +532,17 @@ public:
*/
otError GetChildInfoByIndex(uint8_t aChildIndex, otChildInfo &aChildInfo);
/**
* This method indicates whether or not the RLOC16 is an MTD child of this device.
*
* @param[in] aRloc16 The RLOC16.
*
* @retval TRUE if @p aRloc16 is an MTD child of this device.
* @retval FALSE if @p aRloc16 is not an MTD child of this device.
*
*/
bool IsMinimalChild(uint16_t aRloc16);
/**
* This method gets the next neighbor information. It is used to iterate through the entries of
* the neighbor table.
+2
View File
@@ -93,6 +93,8 @@ public:
return NULL;
}
bool IsMinimalChild(uint16_t) { return false; }
void RestoreChildren(void) { }
otError RemoveStoredChild(uint16_t) {return OT_ERROR_NOT_IMPLEMENTED; }
otError StoreChild(uint16_t) {return OT_ERROR_NOT_IMPLEMENTED; }