Skip to content

Commit

Permalink
[instance] init BackboneRouter::Local before Mle (openthread#9843)
Browse files Browse the repository at this point in the history
This commit moves the `mBackboneRouterLocal` before `mMleRouter` in
`Instance` class to ensure that it is initialized and its constructor
is called before. This ensures when `Mle()` constructor invokes the
`ApplyNewMeshLocalPrefix()` method on `BackboneRouter::Local`, it
is already initialized.
  • Loading branch information
abtink authored Feb 12, 2024
1 parent e092a17 commit 91acbdd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/core/instance/instance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,9 @@ Instance::Instance(void)
#endif
#if OPENTHREAD_CONFIG_SNTP_CLIENT_ENABLE
, mSntpClient(*this)
#endif
#if OPENTHREAD_FTD && OPENTHREAD_CONFIG_BACKBONE_ROUTER_ENABLE
, mBackboneRouterLocal(*this)
#endif
, mActiveDataset(*this)
, mPendingDataset(*this)
Expand Down Expand Up @@ -178,7 +181,6 @@ Instance::Instance(void)
, mBackboneRouterLeader(*this)
#endif
#if OPENTHREAD_FTD && OPENTHREAD_CONFIG_BACKBONE_ROUTER_ENABLE
, mBackboneRouterLocal(*this)
, mBackboneRouterManager(*this)
#endif
#if OPENTHREAD_CONFIG_MLR_ENABLE || (OPENTHREAD_FTD && OPENTHREAD_CONFIG_TMF_PROXY_MLR_ENABLE)
Expand Down
5 changes: 4 additions & 1 deletion src/core/instance/instance.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -510,6 +510,10 @@ class Instance : public otInstance, private NonCopyable
Sntp::Client mSntpClient;
#endif

#if OPENTHREAD_FTD && OPENTHREAD_CONFIG_BACKBONE_ROUTER_ENABLE
BackboneRouter::Local mBackboneRouterLocal;
#endif

MeshCoP::ActiveDatasetManager mActiveDataset;
MeshCoP::PendingDatasetManager mPendingDataset;
MeshCoP::ExtendedPanIdManager mExtendedPanIdManager;
Expand Down Expand Up @@ -578,7 +582,6 @@ class Instance : public otInstance, private NonCopyable
#endif

#if OPENTHREAD_FTD && OPENTHREAD_CONFIG_BACKBONE_ROUTER_ENABLE
BackboneRouter::Local mBackboneRouterLocal;
BackboneRouter::Manager mBackboneRouterManager;
#endif

Expand Down

0 comments on commit 91acbdd

Please sign in to comment.