Skip to content

Commit

Permalink
Fix logging of received message sizes. (#34649)
Browse files Browse the repository at this point in the history
For encrypted messages, we were not including the size of the MIC in the logged
size, so the sizes logged on the send and received side were off by 16 from each
other.
  • Loading branch information
bzbarsky-apple authored and pull[bot] committed Oct 29, 2024
1 parent b6923ff commit 1233723
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/messaging/ExchangeMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -223,15 +223,15 @@ void ExchangeManager::OnMessageReceived(const PacketHeader & packetHeader, const
//
// Legend that can be used to decode this log line can be found in README.md
//
ChipLogProgress(
ExchangeManager,
">>> [E:" ChipLogFormatExchangeId " S:%u M:" ChipLogFormatMessageCounter "%s] (%s) Msg RX from %u:" ChipLogFormatX64
" [%04X] --- Type %s (%s:%s) (B:%u)",
ChipLogValueExchangeIdFromReceivedHeader(payloadHeader), session->SessionIdForLogging(), packetHeader.GetMessageCounter(),
ackBuf, Transport::GetSessionTypeString(session), session->GetFabricIndex(),
ChipLogValueX64(session->GetPeer().GetNodeId()), static_cast<uint16_t>(compressedFabricId), typeStr, protocolName,
msgTypeName,
static_cast<unsigned>(msgBuf->TotalLength() + packetHeader.EncodeSizeBytes() + payloadHeader.EncodeSizeBytes()));
ChipLogProgress(ExchangeManager,
">>> [E:" ChipLogFormatExchangeId " S:%u M:" ChipLogFormatMessageCounter
"%s] (%s) Msg RX from %u:" ChipLogFormatX64 " [%04X] --- Type %s (%s:%s) (B:%u)",
ChipLogValueExchangeIdFromReceivedHeader(payloadHeader), session->SessionIdForLogging(),
packetHeader.GetMessageCounter(), ackBuf, Transport::GetSessionTypeString(session), session->GetFabricIndex(),
ChipLogValueX64(session->GetPeer().GetNodeId()), static_cast<uint16_t>(compressedFabricId), typeStr,
protocolName, msgTypeName,
static_cast<unsigned>(msgBuf->TotalLength() + packetHeader.EncodeSizeBytes() + packetHeader.MICTagLength() +
payloadHeader.EncodeSizeBytes()));
#endif

MessageFlags msgFlags;
Expand Down

0 comments on commit 1233723

Please sign in to comment.