[address-resolver] use RLOC dest when send a/ae to child (#4811)

This commit is contained in:
Simon Lin
2020-04-12 23:01:21 -07:00
committed by GitHub
parent 0cd682f048
commit 0aa880e73c
3 changed files with 17 additions and 8 deletions
+1 -3
View File
@@ -765,9 +765,7 @@ void AddressResolver::HandleAddressError(Coap::Message &aMessage, const Ip6::Mes
if (child.RemoveIp6Address(target) == OT_ERROR_NONE)
{
destination.Clear();
destination.mFields.m16[0] = HostSwap16(0xfe80);
destination.SetIid(child.GetExtAddress());
SuccessOrExit(error = Get<Mle::Mle>().GetLocatorAddress(destination, child.GetRloc16()));
SendAddressError(target, meshLocalIid, &destination);
ExitNow();
+2 -2
View File
@@ -1108,14 +1108,14 @@ exit:
return error;
}
otError Mle::GetAlocAddress(Ip6::Address &aAddress, uint16_t aAloc16) const
otError Mle::GetLocatorAddress(Ip6::Address &aAddress, uint16_t aLocator) const
{
otError error = OT_ERROR_NONE;
VerifyOrExit(GetRloc16() != Mac::kShortAddrInvalid, error = OT_ERROR_DETACHED);
memcpy(&aAddress, &mMeshLocal16.GetAddress(), 14);
aAddress.SetLocator(aAloc16);
aAddress.SetLocator(aLocator);
exit:
return error;
+14 -3
View File
@@ -779,7 +779,7 @@ public:
* @retval OT_ERROR_DETACHED The Thread interface is not currently attached to a Thread Partition.
*
*/
otError GetLeaderAloc(Ip6::Address &aAddress) const { return GetAlocAddress(aAddress, kAloc16Leader); }
otError GetLeaderAloc(Ip6::Address &aAddress) const { return GetLocatorAddress(aAddress, kAloc16Leader); }
/**
* This method computes the Commissioner's ALOC.
@@ -793,7 +793,7 @@ public:
*/
otError GetCommissionerAloc(Ip6::Address &aAddress, uint16_t aSessionId) const
{
return GetAlocAddress(aAddress, CommissionerAloc16FromId(aSessionId));
return GetLocatorAddress(aAddress, CommissionerAloc16FromId(aSessionId));
}
/**
@@ -973,6 +973,18 @@ public:
*/
void RequestShorterChildIdRequest(void);
/**
* This method gets the RLOC or ALOC of a given RLOC16 or ALOC16.
*
* @param[out] aAddress A reference to the RLOC or ALOC.
* @param[in] aLocator RLOC16 or ALOC16.
*
* @retval OT_ERROR_NONE If got the RLOC or ALOC successfully.
* @retval OT_ERROR_DETACHED If device is detached.
*
*/
otError GetLocatorAddress(Ip6::Address &aAddress, uint16_t aLocator) const;
protected:
/**
* States during attach (when searching for a parent).
@@ -1756,7 +1768,6 @@ private:
uint8_t aVersion);
bool IsNetworkDataNewer(const LeaderData &aLeaderData);
otError GetAlocAddress(Ip6::Address &aAddress, uint16_t aAloc16) const;
#if OPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE
/**
* This method scans for network data from the leader and updates IP addresses assigned to this