[multi-radio] copy all TX buffers before encryption (#5957)

Performing MAC frame encryption immediately after each copy results in
copying the already-encrypted frame, rather than the original frame
before encryption.
This commit is contained in:
Jonathan Hui
2020-12-15 10:14:02 -08:00
committed by GitHub
parent 69e97581e7
commit bb94384d92
+15 -6
View File
@@ -1245,11 +1245,8 @@ void Mac::BeginTransmit(void)
{
#if OPENTHREAD_CONFIG_MULTI_RADIO
// Go through all selected radio link types for this tx and
// copy the frame into correct `TxFrame` for each radio type
// (if it is not already prepared), then process security for
// each radio type separately. This allows radio links to
// handle security differently, e.g., with different keys or
// link frame counters.
// copy the frame into correct `TxFrame` for each radio type
// (if it is not already prepared).
for (uint8_t index = 0; index < OT_ARRAY_LENGTH(RadioTypes::kAllRadioTypes); index++)
{
@@ -1263,8 +1260,20 @@ void Mac::BeginTransmit(void)
{
txFrame.CopyFrom(*frame);
}
}
}
ProcessTransmitSecurity(txFrame);
// Go through all selected radio link types for this tx and
// process security for each radio type separately. This
// allows radio links to handle security differently, e.g.,
// with different keys or link frame counters.
for (uint8_t index = 0; index < OT_ARRAY_LENGTH(RadioTypes::kAllRadioTypes); index++)
{
RadioType radio = RadioTypes::kAllRadioTypes[index];
if (txFrames.GetSelectedRadioTypes().Contains(radio))
{
ProcessTransmitSecurity(txFrames.GetTxFrame(radio));
}
}
#else