Skip to content

Commit

Permalink
[radio] fix ClearSrcMatchExtEntry() Extended Address byte order (op…
Browse files Browse the repository at this point in the history
…enthread#11257)

This commit addresses an issue introduced in openthread#10892 where the Extended
Address byte order was not properly handled when calling
`otPlatRadio` APIs. OpenThread core uses big-endian encoding for
Extended Addresses, while the `otPlatRadio` APIs expect
little-endian, as per documented behavior.

PR openthread#10892 refactored the byte-order reversal code from
`SourceMatchController` and `LinkRaw` into the `Radio` class. While
`Radio::AddSrcMatchExtEntry()` was updated properly to reverse the
byte order, `Radio::ClearSrcMatchExtEntry()` was not. This leads to
Extended MAC addresses not being properly removed from the source
match table, potentially causing issues with indirect transmission.
This commit resolves the issue.

It is strongly recommended to cherry-pick this fix into builds that
include openthread#10892.
  • Loading branch information
abtink authored Feb 14, 2025
1 parent 6831210 commit c583554
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
9 changes: 9 additions & 0 deletions src/core/radio/radio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,15 @@ Error Radio::AddSrcMatchExtEntry(const Mac::ExtAddress &aExtAddress)
address.Set(aExtAddress.m8, Mac::ExtAddress::kReverseByteOrder);
return otPlatRadioAddSrcMatchExtEntry(GetInstancePtr(), &address);
}

Error Radio::ClearSrcMatchExtEntry(const Mac::ExtAddress &aExtAddress)
{
Mac::ExtAddress address;

address.Set(aExtAddress.m8, Mac::ExtAddress::kReverseByteOrder);
return otPlatRadioClearSrcMatchExtEntry(GetInstancePtr(), &address);
}

Error Radio::Transmit(Mac::TxFrame &aFrame)
{
#if (OPENTHREAD_MTD || OPENTHREAD_FTD) && OPENTHREAD_CONFIG_OTNS_ENABLE
Expand Down
5 changes: 0 additions & 5 deletions src/core/radio/radio.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1021,11 +1021,6 @@ inline Error Radio::ClearSrcMatchShortEntry(Mac::ShortAddress aShortAddress)
return otPlatRadioClearSrcMatchShortEntry(GetInstancePtr(), aShortAddress);
}

inline Error Radio::ClearSrcMatchExtEntry(const Mac::ExtAddress &aExtAddress)
{
return otPlatRadioClearSrcMatchExtEntry(GetInstancePtr(), &aExtAddress);
}

inline void Radio::ClearSrcMatchShortEntries(void) { otPlatRadioClearSrcMatchShortEntries(GetInstancePtr()); }

inline void Radio::ClearSrcMatchExtEntries(void) { otPlatRadioClearSrcMatchExtEntries(GetInstancePtr()); }
Expand Down

0 comments on commit c583554

Please sign in to comment.