mirror of
https://github.com/espressif/openthread.git
synced 2026-08-16 23:57:46 +00:00
[border-routing] decide Router Solicitation state with IsRouterSolicitationInProgress (#7242)
This commit is contained in:
@@ -499,7 +499,7 @@ const Ip6::Prefix *RoutingManager::EvaluateOnLinkPrefix(void)
|
||||
const Ip6::Prefix *smallestOnLinkPrefix = nullptr;
|
||||
|
||||
// We don't evaluate on-link prefix if we are doing Router Solicitation.
|
||||
VerifyOrExit(!mRouterSolicitTimer.IsRunning(),
|
||||
VerifyOrExit(!IsRouterSolicitationInProgress(),
|
||||
newOnLinkPrefix = (mIsAdvertisingLocalOnLinkPrefix ? &mLocalOnLinkPrefix : nullptr));
|
||||
|
||||
for (const ExternalPrefix &prefix : mDiscoveredPrefixes)
|
||||
@@ -636,7 +636,9 @@ void RoutingManager::StartRouterSolicitationDelay(void)
|
||||
{
|
||||
uint32_t randomDelay;
|
||||
|
||||
VerifyOrExit(!mRouterSolicitTimer.IsRunning() && mRouterSolicitCount == 0);
|
||||
VerifyOrExit(!IsRouterSolicitationInProgress());
|
||||
|
||||
OT_ASSERT(mRouterSolicitCount == 0);
|
||||
|
||||
mVicariousRouterSolicitTimer.Stop();
|
||||
|
||||
@@ -651,6 +653,11 @@ exit:
|
||||
return;
|
||||
}
|
||||
|
||||
bool RoutingManager::IsRouterSolicitationInProgress(void) const
|
||||
{
|
||||
return mRouterSolicitTimer.IsRunning() || mRouterSolicitCount > 0;
|
||||
}
|
||||
|
||||
Error RoutingManager::SendRouterSolicitation(void)
|
||||
{
|
||||
Ip6::Address destAddress;
|
||||
@@ -898,9 +905,10 @@ void RoutingManager::HandleRouterSolicitTimer(void)
|
||||
UpdateRouterAdvMessage(/* aRouterAdvMessage */ nullptr);
|
||||
}
|
||||
|
||||
mRouterSolicitCount = 0;
|
||||
|
||||
// Re-evaluate our routing policy and send Router Advertisement if necessary.
|
||||
EvaluateRoutingPolicy();
|
||||
mRouterSolicitCount = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -940,7 +948,7 @@ void RoutingManager::HandleRouterSolicit(const Ip6::Address &aSrcAddress,
|
||||
OT_UNUSED_VARIABLE(aBuffer);
|
||||
OT_UNUSED_VARIABLE(aBufferLength);
|
||||
|
||||
VerifyOrExit(!mRouterSolicitTimer.IsRunning());
|
||||
VerifyOrExit(!IsRouterSolicitationInProgress());
|
||||
otLogInfoBr("Received Router Solicitation from %s on interface %u", aSrcAddress.ToString().AsCString(),
|
||||
mInfraIfIndex);
|
||||
|
||||
|
||||
@@ -288,6 +288,7 @@ private:
|
||||
void StartRouterSolicitationDelay(void);
|
||||
Error SendRouterSolicitation(void);
|
||||
void SendRouterAdvertisement(const OmrPrefixArray &aNewOmrPrefixes, const Ip6::Prefix *aNewOnLinkPrefix);
|
||||
bool IsRouterSolicitationInProgress(void) const;
|
||||
|
||||
static void HandleRouterAdvertisementTimer(Timer &aTimer);
|
||||
void HandleRouterAdvertisementTimer(void);
|
||||
|
||||
Reference in New Issue
Block a user