Skip to content

Commit

Permalink
[mle] fix uninitialized mLinkRequestAttempts (openthread#9689)
Browse files Browse the repository at this point in the history
mLinkRequestAttempts is not initialized to zero causing it to get a
random value during power cycle. This causes MTD thread device to send
linkrequest after power cycle.

Create a thread network with two devices with DUT with mode rn. Reset
both devices simultaneously, enable leader and then child device
(DUT). Because class member variable mLinkRequestAttempts is not
initialized to zero during initialization, it will get random value,
and value greater than zero will lead to send a link request message
which should not be the case for a MTD device.
  • Loading branch information
nbashirfr authored Dec 7, 2023
1 parent 97af664 commit 5318d42
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/core/thread/mle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,9 @@ Mle::Mle(Instance &aInstance)
, mDataRequestAttempts(0)
, mAnnounceChannel(0)
, mAlternateChannel(0)
#if OPENTHREAD_FTD
, mLinkRequestAttempts(0)
#endif
, mRloc16(Mac::kShortAddrInvalid)
, mPreviousParentRloc(Mac::kShortAddrInvalid)
, mAttachCounter(0)
Expand Down

0 comments on commit 5318d42

Please sign in to comment.