mirror of
https://github.com/espressif/openthread.git
synced 2026-08-15 07:07:46 +00:00
[ip6] use Ip6::Address::Clear() replacing memset to zero (#4315)
This commit is contained in:
committed by
Jonathan Hui
parent
f830a8b1ba
commit
69d5e084e0
@@ -571,7 +571,7 @@ void Joiner::SendJoinerEntrustResponse(const Coap::Message &aRequest, const Ip6:
|
||||
SuccessOrExit(error = message->SetDefaultResponseHeader(aRequest));
|
||||
message->SetSubType(Message::kSubTypeJoinerEntrust);
|
||||
|
||||
memset(&responseInfo.mSockAddr, 0, sizeof(responseInfo.mSockAddr));
|
||||
responseInfo.GetSockAddr().Clear();
|
||||
SuccessOrExit(error = Get<Coap::Coap>().SendMessage(*message, responseInfo));
|
||||
|
||||
SetState(OT_JOINER_STATE_JOINED);
|
||||
|
||||
@@ -227,7 +227,7 @@ otError Ip6::AddTunneledMplOption(Message &aMessage, Header &aHeader, MessageInf
|
||||
MessageInfo messageInfo(aMessageInfo);
|
||||
|
||||
// Use IP-in-IP encapsulation (RFC2473) and ALL_MPL_FORWARDERS address.
|
||||
memset(&messageInfo.GetPeerAddr(), 0, sizeof(Address));
|
||||
messageInfo.GetPeerAddr().Clear();
|
||||
messageInfo.GetPeerAddr().mFields.m16[0] = HostSwap16(0xff03);
|
||||
messageInfo.GetPeerAddr().mFields.m16[7] = HostSwap16(0x00fc);
|
||||
|
||||
|
||||
@@ -268,7 +268,7 @@ otError Address::FromString(const char *aBuf)
|
||||
char ch;
|
||||
uint8_t d;
|
||||
|
||||
memset(mFields.m8, 0, 16);
|
||||
Clear();
|
||||
|
||||
dst--;
|
||||
|
||||
|
||||
@@ -61,6 +61,14 @@ public:
|
||||
*/
|
||||
MessageInfo(void) { memset(this, 0, sizeof(*this)); }
|
||||
|
||||
/**
|
||||
* This method returns a reference to the local socket address.
|
||||
*
|
||||
* @returns A reference to the local socket address.
|
||||
*
|
||||
*/
|
||||
Address &GetSockAddr(void) { return *static_cast<Address *>(&mSockAddr); }
|
||||
|
||||
/**
|
||||
* This method returns a reference to the local socket address.
|
||||
*
|
||||
|
||||
@@ -616,7 +616,7 @@ void AddressResolver::HandleAddressError(Coap::Message &aMessage, const Ip6::Mes
|
||||
|
||||
if (child.RemoveIp6Address(GetInstance(), targetTlv.GetTarget()) == OT_ERROR_NONE)
|
||||
{
|
||||
memset(&destination, 0, sizeof(destination));
|
||||
destination.Clear();
|
||||
destination.mFields.m16[0] = HostSwap16(0xfe80);
|
||||
destination.SetIid(child.GetExtAddress());
|
||||
|
||||
|
||||
@@ -562,7 +562,7 @@ otError Mle::Discover(const Mac::ChannelMask &aScanChannels,
|
||||
tlv.SetLength(static_cast<uint8_t>(message->GetLength() - startOffset));
|
||||
message->Write(startOffset - sizeof(tlv), sizeof(tlv), &tlv);
|
||||
|
||||
memset(&destination, 0, sizeof(destination));
|
||||
destination.Clear();
|
||||
destination.mFields.m16[0] = HostSwap16(0xff02);
|
||||
destination.mFields.m16[7] = HostSwap16(0x0002);
|
||||
SuccessOrExit(error = SendMessage(*message, destination));
|
||||
@@ -1985,7 +1985,7 @@ otError Mle::SendParentRequest(ParentRequestType aType)
|
||||
SuccessOrExit(error = AppendTimeRequest(*message));
|
||||
#endif
|
||||
|
||||
memset(&destination, 0, sizeof(destination));
|
||||
destination.Clear();
|
||||
destination.mFields.m16[0] = HostSwap16(0xff02);
|
||||
destination.mFields.m16[7] = HostSwap16(0x0002);
|
||||
SuccessOrExit(error = SendMessage(*message, destination));
|
||||
@@ -2070,7 +2070,7 @@ otError Mle::SendChildIdRequest(void)
|
||||
|
||||
mParentCandidate.SetState(Neighbor::kStateValid);
|
||||
|
||||
memset(&destination, 0, sizeof(destination));
|
||||
destination.Clear();
|
||||
destination.mFields.m16[0] = HostSwap16(0xfe80);
|
||||
destination.SetIid(mParentCandidate.GetExtAddress());
|
||||
SuccessOrExit(error = SendMessage(*message, destination));
|
||||
@@ -2216,7 +2216,7 @@ void Mle::HandleMessageTransmissionTimer(void)
|
||||
|
||||
VerifyOrExit(mDataRequestAttempts < kMaxChildKeepAliveAttempts, BecomeDetached());
|
||||
|
||||
memset(&destination, 0, sizeof(destination));
|
||||
destination.Clear();
|
||||
destination.mFields.m16[0] = HostSwap16(0xfe80);
|
||||
destination.SetIid(mParent.GetExtAddress());
|
||||
|
||||
@@ -2306,7 +2306,7 @@ otError Mle::SendChildUpdateRequest(void)
|
||||
break;
|
||||
}
|
||||
|
||||
memset(&destination, 0, sizeof(destination));
|
||||
destination.Clear();
|
||||
destination.mFields.m16[0] = HostSwap16(0xfe80);
|
||||
destination.SetIid(mParent.GetExtAddress());
|
||||
SuccessOrExit(error = SendMessage(*message, destination));
|
||||
@@ -2385,7 +2385,7 @@ otError Mle::SendChildUpdateResponse(const uint8_t *aTlvs, uint8_t aNumTlvs, con
|
||||
}
|
||||
}
|
||||
|
||||
memset(&destination, 0, sizeof(destination));
|
||||
destination.Clear();
|
||||
destination.mFields.m16[0] = HostSwap16(0xfe80);
|
||||
destination.SetIid(mParent.GetExtAddress());
|
||||
SuccessOrExit(error = SendMessage(*message, destination));
|
||||
@@ -2411,7 +2411,7 @@ otError Mle::SendAnnounce(uint8_t aChannel, bool aOrphanAnnounce)
|
||||
{
|
||||
Ip6::Address destination;
|
||||
|
||||
memset(&destination, 0, sizeof(destination));
|
||||
destination.Clear();
|
||||
destination.mFields.m16[0] = HostSwap16(0xff02);
|
||||
destination.mFields.m16[7] = HostSwap16(0x0001);
|
||||
|
||||
|
||||
@@ -445,7 +445,7 @@ otError MleRouter::SendAdvertisement(void)
|
||||
break;
|
||||
}
|
||||
|
||||
memset(&destination, 0, sizeof(destination));
|
||||
destination.Clear();
|
||||
destination.mFields.m16[0] = HostSwap16(0xff02);
|
||||
destination.mFields.m16[7] = HostSwap16(0x0001);
|
||||
SuccessOrExit(error = SendMessage(*message, destination));
|
||||
@@ -471,7 +471,7 @@ otError MleRouter::SendLinkRequest(Neighbor *aNeighbor)
|
||||
Message * message;
|
||||
Ip6::Address destination;
|
||||
|
||||
memset(&destination, 0, sizeof(destination));
|
||||
destination.Clear();
|
||||
|
||||
VerifyOrExit((message = NewMleMessage()) != NULL, error = OT_ERROR_NO_BUFS);
|
||||
SuccessOrExit(error = AppendHeader(*message, Header::kCommandLinkRequest));
|
||||
@@ -1925,7 +1925,7 @@ void MleRouter::SendParentResponse(Child *aChild, const ChallengeTlv &aChallenge
|
||||
SuccessOrExit(error = AppendConnectivity(*message));
|
||||
SuccessOrExit(error = AppendVersion(*message));
|
||||
|
||||
memset(&destination, 0, sizeof(destination));
|
||||
destination.Clear();
|
||||
destination.mFields.m16[0] = HostSwap16(0xfe80);
|
||||
destination.SetIid(aChild->GetExtAddress());
|
||||
|
||||
@@ -2554,7 +2554,7 @@ void MleRouter::HandleNetworkDataUpdateRouter(void)
|
||||
|
||||
VerifyOrExit(mRole == OT_DEVICE_ROLE_ROUTER || mRole == OT_DEVICE_ROLE_LEADER);
|
||||
|
||||
memset(&destination, 0, sizeof(destination));
|
||||
destination.Clear();
|
||||
destination.mFields.m16[0] = HostSwap16(0xff02);
|
||||
destination.mFields.m16[7] = HostSwap16(0x0001);
|
||||
|
||||
@@ -2892,7 +2892,7 @@ otError MleRouter::SendChildIdResponse(Child &aChild)
|
||||
}
|
||||
#endif
|
||||
|
||||
memset(&destination, 0, sizeof(destination));
|
||||
destination.Clear();
|
||||
destination.mFields.m16[0] = HostSwap16(0xfe80);
|
||||
destination.SetIid(aChild.GetExtAddress());
|
||||
SuccessOrExit(error = SendMessage(*message, destination));
|
||||
@@ -2954,7 +2954,7 @@ otError MleRouter::SendChildUpdateRequest(Child &aChild)
|
||||
SuccessOrExit(error = AppendChallenge(*message, aChild.GetChallenge(), aChild.GetChallengeSize()));
|
||||
}
|
||||
|
||||
memset(&destination, 0, sizeof(destination));
|
||||
destination.Clear();
|
||||
destination.mFields.m16[0] = HostSwap16(0xfe80);
|
||||
destination.SetIid(aChild.GetExtAddress());
|
||||
SuccessOrExit(error = SendMessage(*message, destination));
|
||||
@@ -4692,7 +4692,7 @@ otError MleRouter::SendTimeSync(void)
|
||||
|
||||
message->SetTimeSync(true);
|
||||
|
||||
memset(&destination, 0, sizeof(destination));
|
||||
destination.Clear();
|
||||
destination.mFields.m16[0] = HostSwap16(0xff02);
|
||||
destination.mFields.m16[7] = HostSwap16(0x0001);
|
||||
SuccessOrExit(error = SendMessage(*message, destination));
|
||||
|
||||
Reference in New Issue
Block a user