Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Group] Remove MessagePermitted bypass for group message #14717

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions src/messaging/ExchangeContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -437,12 +437,8 @@ CHIP_ERROR ExchangeContext::HandleMessage(uint32_t messageCounter, const Payload
MessageHandled();
});

// TODO : Remove this bypass for group as to perform the MessagePermitted function Issue # 12101
if (!IsGroupExchangeContext())
{
ReturnErrorOnFailure(
mDispatch.OnMessageReceived(messageCounter, payloadHeader, peerAddress, msgFlags, GetReliableMessageContext()));
}
ReturnErrorOnFailure(
mDispatch.OnMessageReceived(messageCounter, payloadHeader, peerAddress, msgFlags, GetReliableMessageContext()));

if (IsAckPending() && !mDelegate)
{
Expand Down
2 changes: 1 addition & 1 deletion src/messaging/ExchangeMessageDispatch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ CHIP_ERROR ExchangeMessageDispatch::OnMessageReceived(uint32_t messageCounter, c
ReturnErrorCodeIf(!MessagePermitted(payloadHeader.GetProtocolID().GetProtocolId(), payloadHeader.GetMessageType()),
CHIP_ERROR_INVALID_ARGUMENT);

if (IsReliableTransmissionAllowed())
if (IsReliableTransmissionAllowed() && !reliableMessageContext->GetExchangeContext()->IsGroupExchangeContext())
{
if (!msgFlags.Has(MessageFlagValues::kDuplicateMessage) && payloadHeader.IsAckMsg() &&
payloadHeader.GetAckMessageCounter().HasValue())
Expand Down
1 change: 0 additions & 1 deletion src/messaging/tests/TestReliableMessageProtocol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,6 @@ void CheckFailedMessageRetainOnSend(nlTestSuite * inSuite, void * inContext)
});

mockSender.mMessageDispatch.mRetainMessageOnSend = false;

// Let's drop the initial message
gLoopback.mSentMessageCount = 0;
gLoopback.mNumMessagesToDrop = 1;
Expand Down
3 changes: 3 additions & 0 deletions src/transport/SessionManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -604,6 +604,8 @@ void SessionManager::SecureGroupMessageDispatch(const PacketHeader & packetHeade
// MCSP check
if (packetHeader.IsValidMCSPMsg())
{
// TODO: When MCSP Msg, create Secure Session instead of a Group session

// TODO
// if (packetHeader.GetDestinationNodeId().Value() == ThisDeviceNodeID)
// {
Expand Down Expand Up @@ -638,6 +640,7 @@ void SessionManager::SecureGroupMessageDispatch(const PacketHeader & packetHeade

if (mCB != nullptr)
{
// TODO : When MCSP is done, clean up session creation logique
Optional<SessionHandle> session = CreateGroupSession(groupContext.group_id, groupContext.fabric_index);

VerifyOrReturn(session.HasValue(), ChipLogError(Inet, "Error when creating group session handle."));
Expand Down