mirror of
https://github.com/espressif/openthread.git
synced 2026-09-14 13:10:08 +00:00
[mesh-forwarder] send all message fragments to the same mesh dest (#4879)
All fragments for a given IPv6 datagram must be sent to the same destination. Otherwise, there is not much point in transmitting the messages.
This commit is contained in:
@@ -93,8 +93,9 @@ struct MessageInfo
|
||||
uint16_t mOffset; ///< A byte offset within the message.
|
||||
RssAverager mRssAverager; ///< The averager maintaining the received signal strength (RSS) average.
|
||||
|
||||
uint8_t mChildMask[kChildMaskBytes]; ///< A bit-vector to indicate which sleepy children need to receive this.
|
||||
uint8_t mTimeout; ///< Seconds remaining before dropping the message.
|
||||
uint8_t mChildMask[kChildMaskBytes]; ///< A bit-vector to indicate which sleepy children need to receive this.
|
||||
uint16_t mMeshDest; ///< Used for unicast non-link-local messages.
|
||||
uint8_t mTimeout; ///< Seconds remaining before dropping the message.
|
||||
union
|
||||
{
|
||||
uint16_t mPanId; ///< Used for MLE Discover Request and Response messages.
|
||||
@@ -516,6 +517,26 @@ public:
|
||||
*/
|
||||
bool IsChildPending(void) const;
|
||||
|
||||
/**
|
||||
* This method returns the RLOC16 of the mesh destination.
|
||||
*
|
||||
* @note Only use this for non-link-local unicast messages.
|
||||
*
|
||||
* @returns The IEEE 802.15.4 Destination PAN ID.
|
||||
*
|
||||
*/
|
||||
uint16_t GetMeshDest(void) const { return mBuffer.mHead.mInfo.mMeshDest; }
|
||||
|
||||
/**
|
||||
* This method sets the RLOC16 of the mesh destination.
|
||||
*
|
||||
* @note Only use this when sending non-link-local unicast messages.
|
||||
*
|
||||
* @param[in] aMeshDest The IEEE 802.15.4 Destination PAN ID.
|
||||
*
|
||||
*/
|
||||
void SetMeshDest(uint16_t aMeshDest) { mBuffer.mHead.mInfo.mMeshDest = aMeshDest; }
|
||||
|
||||
/**
|
||||
* This method returns the IEEE 802.15.4 Destination PAN ID.
|
||||
*
|
||||
|
||||
@@ -392,7 +392,7 @@ private:
|
||||
void SendMesh(Message &aMessage, Mac::TxFrame &aFrame);
|
||||
void SendDestinationUnreachable(uint16_t aMeshSource, const Message &aMessage);
|
||||
otError UpdateIp6Route(Message &aMessage);
|
||||
otError UpdateIp6RouteFtd(Ip6::Header &ip6Header, const Message &aMessage);
|
||||
otError UpdateIp6RouteFtd(Ip6::Header &ip6Header, Message &aMessage);
|
||||
otError UpdateMeshRoute(Message &aMessage);
|
||||
bool UpdateReassemblyList(void);
|
||||
bool UpdateFragmentLifetime(void);
|
||||
|
||||
@@ -404,13 +404,17 @@ exit:
|
||||
return error;
|
||||
}
|
||||
|
||||
otError MeshForwarder::UpdateIp6RouteFtd(Ip6::Header &ip6Header, const Message &aMessage)
|
||||
otError MeshForwarder::UpdateIp6RouteFtd(Ip6::Header &ip6Header, Message &aMessage)
|
||||
{
|
||||
Mle::MleRouter &mle = Get<Mle::MleRouter>();
|
||||
otError error = OT_ERROR_NONE;
|
||||
Neighbor * neighbor;
|
||||
|
||||
if (mle.IsRoutingLocator(ip6Header.GetDestination()))
|
||||
if (aMessage.GetOffset() > 0)
|
||||
{
|
||||
mMeshDest = aMessage.GetMeshDest();
|
||||
}
|
||||
else if (mle.IsRoutingLocator(ip6Header.GetDestination()))
|
||||
{
|
||||
uint16_t rloc16 = ip6Header.GetDestination().GetLocator();
|
||||
VerifyOrExit(mle.IsRouterIdValid(Mle::Mle::RouterIdFromRloc16(rloc16)), error = OT_ERROR_DROP);
|
||||
@@ -485,6 +489,7 @@ otError MeshForwarder::UpdateIp6RouteFtd(Ip6::Header &ip6Header, const Message &
|
||||
mMeshSource = Get<Mac::Mac>().GetShortAddress();
|
||||
|
||||
SuccessOrExit(error = mle.CheckReachability(mMeshDest, ip6Header));
|
||||
aMessage.SetMeshDest(mMeshDest);
|
||||
mMacDest.SetShort(mle.GetNextHop(mMeshDest));
|
||||
|
||||
if (mMacDest.GetShort() != mMeshDest)
|
||||
|
||||
Reference in New Issue
Block a user