Skip to content

Commit

Permalink
[ncp] set message origin to host untrusted (#9825)
Browse files Browse the repository at this point in the history
The IPv6 packets received from host is from a different network stack,
which is untrusted.
  • Loading branch information
bukepo authored Feb 2, 2024
1 parent 890da2c commit b5b9a62
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/ncp/ncp_base_mtd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit b5b9a62

Please sign in to comment.