mirror of
https://github.com/espressif/openthread.git
synced 2026-08-03 09:27:47 +00:00
[mle] implement alternate RLOC16 usage during role transition (#10006)
This commit introduces a mechanism for a device transitioning from child to router role to keep receiving frames addressed to its previous short address for a brief period. A new radio platform API, `otPlatRadioSetAlternateShortAddress()`, is introduced. This allows the OT stack to configure an alternate short address. Radio platform support for this function is indicated by the `OT_RADIO_CAPS_ALT_SHORT_ADDR` capability in `otPlatRadioGetCaps()` The same function can be used with `OT_RADIO_INVALID_SHORT_ADDR` (`0xfffe`) to clear a previously set alternate short address. Support for the new API is implemented in RCP and `RadioSpinel`, ensuring backward compatibility by dynamically checking supported radio capabilities. MLE code is updated to instruct the radio to use the old child RLOC16 as an alternate address upon role transition. The MLE layer will automatically clear the alternate address after eight seconds, or if other state/mode changes occur. This eight-second window ensures the new router can transmit four MLE Advertisement messages.
This commit is contained in:
@@ -41,6 +41,15 @@ bool otMacFrameDoesAddrMatch(const otRadioFrame *aFrame,
|
||||
otPanId aPanId,
|
||||
otShortAddress aShortAddress,
|
||||
const otExtAddress *aExtAddress)
|
||||
{
|
||||
return otMacFrameDoesAddrMatchAny(aFrame, aPanId, aShortAddress, Mac::kShortAddrInvalid, aExtAddress);
|
||||
}
|
||||
|
||||
bool otMacFrameDoesAddrMatchAny(const otRadioFrame *aFrame,
|
||||
otPanId aPanId,
|
||||
otShortAddress aShortAddress,
|
||||
otShortAddress aAltShortAddress,
|
||||
const otExtAddress *aExtAddress)
|
||||
{
|
||||
const Mac::Frame &frame = *static_cast<const Mac::Frame *>(aFrame);
|
||||
bool rval = true;
|
||||
@@ -52,7 +61,9 @@ bool otMacFrameDoesAddrMatch(const otRadioFrame *aFrame,
|
||||
switch (dst.GetType())
|
||||
{
|
||||
case Mac::Address::kTypeShort:
|
||||
VerifyOrExit(dst.GetShort() == Mac::kShortAddrBroadcast || dst.GetShort() == aShortAddress, rval = false);
|
||||
VerifyOrExit(dst.GetShort() == Mac::kShortAddrBroadcast || dst.GetShort() == aShortAddress ||
|
||||
(aAltShortAddress != Mac::kShortAddrInvalid && dst.GetShort() == aAltShortAddress),
|
||||
rval = false);
|
||||
break;
|
||||
|
||||
case Mac::Address::kTypeExtended:
|
||||
|
||||
Reference in New Issue
Block a user