[ncp] set message origin to host untrusted (#9825)

The IPv6 packets received from host is from a different network stack,
which is untrusted.
This commit is contained in:
Yakun Xu
2024-02-02 11:43:31 -08:00
committed by GitHub
parent 890da2c1b8
commit b5b9a62db7
+2
View File
@@ -2269,6 +2269,7 @@ template <> otError NcpBase::HandlePropertySet<SPINEL_PROP_STREAM_NET>(void)
// STREAM_NET requires layer 2 security.
message = otIp6NewMessageFromBuffer(mInstance, framePtr, frameLen, nullptr);
VerifyOrExit(message != nullptr, error = OT_ERROR_NO_BUFS);
otMessageSetOrigin(message, OT_MESSAGE_ORIGIN_HOST_UNTRUSTED);
error = otIp6Send(mInstance, message);
@@ -3303,6 +3304,7 @@ template <> otError NcpBase::HandlePropertySet<SPINEL_PROP_STREAM_NET_INSECURE>(
// STREAM_NET_INSECURE packets are not secured at layer 2.
message = otIp6NewMessageFromBuffer(mInstance, framePtr, frameLen, &msgSettings);
VerifyOrExit(message != nullptr, error = OT_ERROR_NO_BUFS);
otMessageSetOrigin(message, OT_MESSAGE_ORIGIN_HOST_UNTRUSTED);
// Ensure the insecure message is forwarded using direct transmission.
otMessageSetDirectTransmission(message, true);