Skip to content

Commit

Permalink
[Group] Remove MessagePermitted bypass for group message (#14717)
Browse files Browse the repository at this point in the history
* removed MessagePermitted bypass

* PR comments
  • Loading branch information
mkardous-silabs authored and pull[bot] committed Dec 12, 2023
1 parent ce78f6f commit 3536969
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 8 deletions.
8 changes: 2 additions & 6 deletions src/messaging/ExchangeContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -448,12 +448,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

0 comments on commit 3536969

Please sign in to comment.