mirror of
https://github.com/espressif/openthread.git
synced 2026-08-01 16:47:47 +00:00
[border-router] more strict state check before evaluating routing policy (#6336)
This commit is contained in:
@@ -313,7 +313,7 @@ void RoutingManager::HandleNotifierEvents(Events aEvents)
|
||||
EvaluateState();
|
||||
}
|
||||
|
||||
if (aEvents.Contains(kEventThreadNetdataChanged))
|
||||
if (mIsRunning && aEvents.Contains(kEventThreadNetdataChanged))
|
||||
{
|
||||
StartRoutingPolicyEvaluationDelay();
|
||||
}
|
||||
@@ -576,12 +576,12 @@ exit:
|
||||
// OMR prefix in the Thread network.
|
||||
void RoutingManager::EvaluateRoutingPolicy(void)
|
||||
{
|
||||
OT_ASSERT(mIsRunning);
|
||||
|
||||
const Ip6::Prefix *newOnLinkPrefix = nullptr;
|
||||
Ip6::Prefix newOmrPrefixes[kMaxOmrPrefixNum];
|
||||
uint8_t newOmrPrefixNum = 0;
|
||||
|
||||
VerifyOrExit(mIsRunning);
|
||||
|
||||
otLogInfoBr("evaluating routing policy");
|
||||
|
||||
// 0. Evaluate on-link & OMR prefixes.
|
||||
@@ -618,13 +618,12 @@ void RoutingManager::EvaluateRoutingPolicy(void)
|
||||
static_assert(sizeof(mAdvertisedOmrPrefixes) == sizeof(newOmrPrefixes), "invalid new OMR prefix array size");
|
||||
memcpy(mAdvertisedOmrPrefixes, newOmrPrefixes, sizeof(newOmrPrefixes[0]) * newOmrPrefixNum);
|
||||
mAdvertisedOmrPrefixNum = newOmrPrefixNum;
|
||||
|
||||
exit:
|
||||
return;
|
||||
}
|
||||
|
||||
void RoutingManager::StartRoutingPolicyEvaluationDelay(void)
|
||||
{
|
||||
OT_ASSERT(mIsRunning);
|
||||
|
||||
uint32_t randomDelay;
|
||||
|
||||
static_assert(kMaxRoutingPolicyDelay > 0, "invalid maximum routing policy evaluation delay");
|
||||
@@ -917,6 +916,7 @@ void RoutingManager::HandleRouterAdvertisement(const Ip6::Address &aSrcAddress,
|
||||
const uint8_t * aBuffer,
|
||||
uint16_t aBufferLength)
|
||||
{
|
||||
OT_ASSERT(mIsRunning);
|
||||
OT_UNUSED_VARIABLE(aSrcAddress);
|
||||
|
||||
using RouterAdv::Option;
|
||||
|
||||
Reference in New Issue
Block a user