Fix multicast from Ncp Host going back to host (#1910)

* fix multicast from Ncp Host going back to host

* rename SendFromNcpHost to SendRaw
This commit is contained in:
Buke Po
2017-06-16 23:58:13 -07:00
committed by Jonathan Hui
parent f067d68f38
commit d807d8d491
3 changed files with 40 additions and 7 deletions
+2 -2
View File
@@ -162,8 +162,8 @@ otError otIp6Send(otInstance *aInstance, otMessage *aMessage)
otLogFuncEntry();
error = aInstance->mIp6.HandleDatagram(*static_cast<Message *>(aMessage), NULL,
aInstance->mThreadNetif.GetInterfaceId(), NULL, true);
error = aInstance->mIp6.SendRaw(*static_cast<Message *>(aMessage),
aInstance->mThreadNetif.GetInterfaceId());
otLogFuncExitErr(error);
+26 -5
View File
@@ -654,6 +654,32 @@ exit:
return error;
}
otError Ip6::SendRaw(Message &aMessage, int8_t aInterfaceId)
{
otError error = OT_ERROR_NONE;
Header header;
MessageInfo messageInfo;
// check aMessage length
VerifyOrExit(aMessage.Read(0, sizeof(header), &header) == sizeof(header), error = OT_ERROR_DROP);
messageInfo.SetPeerAddr(header.GetSource());
messageInfo.SetSockAddr(header.GetDestination());
messageInfo.SetInterfaceId(aInterfaceId);
messageInfo.SetHopLimit(header.GetHopLimit());
messageInfo.SetLinkInfo(NULL);
if (header.GetDestination().IsMulticast())
{
SuccessOrExit(error = InsertMplOption(aMessage, header, messageInfo));
}
error = HandleDatagram(aMessage, NULL, aInterfaceId, NULL, true);
exit:
return error;
}
otError Ip6::HandleDatagram(Message &aMessage, Netif *aNetif, int8_t aInterfaceId, const void *aLinkMessageInfo,
bool aFromNcpHost)
{
@@ -711,11 +737,6 @@ otError Ip6::HandleDatagram(Message &aMessage, Netif *aNetif, int8_t aInterfaceI
else
{
forward = true;
if (aFromNcpHost)
{
SuccessOrExit(error = InsertMplOption(aMessage, header, messageInfo));
}
}
}
else
+12
View File
@@ -132,6 +132,18 @@ public:
*/
otError SendDatagram(Message &aMessage, MessageInfo &aMessageInfo, IpProto aIpProto);
/**
* This method sends a raw IPv6 datagram with a fully formed IPv6 header.
*
* @param[in] aMessage A reference to the message.
* @param[in] aInterfaceId The interface identifier of the network interface that received the message.
*
* @retval OT_ERROR_NONE Successfully processed the message.
* @retval OT_ERROR_DROP Message processing failed and the message should be dropped.
*
*/
otError SendRaw(Message &aMessage, int8_t aInterfaceId);
/**
* This method processes a received IPv6 datagram.
*