[ip6] change aFromNcpHost to false in otIp6Send (#7187)

This commit is contained in:
Simon Lin
2021-12-22 09:49:36 -08:00
committed by GitHub
parent a8eeb231d0
commit 66dc0c3467
5 changed files with 19 additions and 7 deletions
+2 -1
View File
@@ -135,7 +135,8 @@ void otIp6SetReceiveFilterEnabled(otInstance *aInstance, bool aEnabled)
otError otIp6Send(otInstance *aInstance, otMessage *aMessage)
{
return AsCoreType(aInstance).Get<Ip6::Ip6>().SendRaw(AsCoreType(aMessage));
return AsCoreType(aInstance).Get<Ip6::Ip6>().SendRaw(AsCoreType(aMessage),
!OPENTHREAD_CONFIG_IP6_ALLOW_LOOP_BACK_HOST_DATAGRAMS);
}
otMessage *otIp6NewMessage(otInstance *aInstance, const otMessageSettings *aSettings)
+10
View File
@@ -187,4 +187,14 @@
#define OPENTHREAD_CONFIG_TCP_ENABLE 1
#endif
/**
* @def OPENTHREAD_CONFIG_IP6_ALLOW_LOOP_BACK_HOST_DATAGRAMS
*
* Define as 1 to allow IPv6 datagrams from Host to be looped back to Host.
*
*/
#ifndef OPENTHREAD_CONFIG_IP6_ALLOW_LOOP_BACK_HOST_DATAGRAMS
#define OPENTHREAD_CONFIG_IP6_ALLOW_LOOP_BACK_HOST_DATAGRAMS 1
#endif
#endif // CONFIG_IP6_H_
+4 -4
View File
@@ -307,7 +307,7 @@ Error Ip6::InsertMplOption(Message &aMessage, Header &aHeader, MessageInfo &aMes
if ((messageCopy = aMessage.Clone()) != nullptr)
{
IgnoreError(HandleDatagram(*messageCopy, nullptr, nullptr, true));
IgnoreError(HandleDatagram(*messageCopy, nullptr, nullptr, /* aFromNcpHost */ true));
otLogInfoIp6("Message copy for indirect transmission to sleepy children");
}
else
@@ -540,7 +540,7 @@ void Ip6::HandleSendQueue(void)
while ((message = mSendQueue.GetHead()) != nullptr)
{
mSendQueue.Dequeue(*message);
IgnoreError(HandleDatagram(*message, nullptr, nullptr, false));
IgnoreError(HandleDatagram(*message, nullptr, nullptr, /* aFromNcpHost */ false));
}
}
@@ -1084,7 +1084,7 @@ exit:
return error;
}
Error Ip6::SendRaw(Message &aMessage)
Error Ip6::SendRaw(Message &aMessage, bool aFromNcpHost)
{
Error error = kErrorNone;
Header header;
@@ -1103,7 +1103,7 @@ Error Ip6::SendRaw(Message &aMessage)
SuccessOrExit(error = InsertMplOption(aMessage, header, messageInfo));
}
error = HandleDatagram(aMessage, nullptr, nullptr, true);
error = HandleDatagram(aMessage, nullptr, nullptr, aFromNcpHost);
freed = true;
exit:
+2 -1
View File
@@ -196,6 +196,7 @@ public:
* processing is complete, including when a value other than `kErrorNone` is returned.
*
* @param[in] aMessage A reference to the message.
* @param[in] aFromNcpHost If the message was forwarded from the NCP Host.
*
* @retval kErrorNone Successfully processed the message.
* @retval kErrorDrop Message was well-formed but not fully processed due to packet processing rules.
@@ -204,7 +205,7 @@ public:
* @retval kErrorParse Encountered a malformed header when processing the message.
*
*/
Error SendRaw(Message &aMessage);
Error SendRaw(Message &aMessage, bool aFromNcpHost);
/**
* This method processes a received IPv6 datagram.
+1 -1
View File
@@ -203,7 +203,7 @@ Error MeshForwarder::ForwardDuaToBackboneLink(Message &aMessage, const Ip6::Addr
ttl++;
aMessage.Write(Ip6::Header::kHopLimitFieldOffset, ttl);
IgnoreError(Get<Ip6::Ip6>().HandleDatagram(aMessage, nullptr, nullptr, false));
IgnoreError(Get<Ip6::Ip6>().HandleDatagram(aMessage, nullptr, nullptr, /* aFromNcpHost */ false));
exit:
return error;