mirror of
https://github.com/espressif/openthread.git
synced 2026-07-30 15:47:46 +00:00
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:
@@ -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
@@ -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
|
||||
|
||||
@@ -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.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user