From f7ae14ffd9269c66f3431ea4399e595d670a44a1 Mon Sep 17 00:00:00 2001 From: rongli Date: Sat, 11 Nov 2017 18:37:45 -0600 Subject: [PATCH] [dhcp] invert u/l bit of link-layer address when allocating dhcp address (#2340) --- src/core/net/dhcp6_server.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/core/net/dhcp6_server.cpp b/src/core/net/dhcp6_server.cpp index f5bb225c6..6e85b1ce4 100644 --- a/src/core/net/dhcp6_server.cpp +++ b/src/core/net/dhcp6_server.cpp @@ -555,7 +555,8 @@ otError Dhcp6Server::AddIaAddress(Message &aMessage, otIp6Prefix &aIp6Prefix, Cl option.Init(); memcpy((option.GetAddress()->mFields.m8), &(aIp6Prefix.mPrefix), 8); - memcpy(&(option.GetAddress()->mFields.m8[8]), aClient.GetDuidLinkLayerAddress(), sizeof(Mac::ExtAddress)); + static_cast(option.GetAddress())->SetIid( + *reinterpret_cast(aClient.GetDuidLinkLayerAddress())); option.SetPreferredLifetime(OT_DHCP6_DEFAULT_PREFERRED_LIFETIME); option.SetValidLifetime(OT_DHCP6_DEFAULT_VALID_LIFETIME); SuccessOrExit(error = aMessage.Append(&option, sizeof(option)));