mirror of
https://github.com/espressif/openthread.git
synced 2026-08-31 22:39:54 +00:00
[routing-manager] don't reevaluate routing policy for OMR prefixes in RA messages (#7244)
Currently, we will start routing policy evaluation when new OMR prefixes are received as RIO options in RA messages. But it's not necessary to do so because whether we need to advertise our own OMR prefix is not depending on the discovered OMR prefixes from Wi-Fi link but the OMR prefixes in Thread network data.
This commit is contained in:
@@ -1022,7 +1022,7 @@ void RoutingManager::HandleRouterAdvertisement(const Ip6::Address &aSrcAddress,
|
||||
|
||||
if (pio->IsValid())
|
||||
{
|
||||
needReevaluate |= UpdateDiscoveredPrefixes(*pio);
|
||||
needReevaluate |= UpdateDiscoveredOnLinkPrefix(*pio);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -1033,7 +1033,7 @@ void RoutingManager::HandleRouterAdvertisement(const Ip6::Address &aSrcAddress,
|
||||
|
||||
if (rio->IsValid())
|
||||
{
|
||||
needReevaluate |= UpdateDiscoveredPrefixes(*rio);
|
||||
UpdateDiscoveredOmrPrefix(*rio);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -1059,7 +1059,10 @@ exit:
|
||||
return;
|
||||
}
|
||||
|
||||
bool RoutingManager::UpdateDiscoveredPrefixes(const RouterAdv::PrefixInfoOption &aPio)
|
||||
// Adds or deprecates a discovered on-link prefix (new external routes may be added
|
||||
// to the Thread network). Returns a boolean which indicates whether we need to do
|
||||
// routing policy evaluation.
|
||||
bool RoutingManager::UpdateDiscoveredOnLinkPrefix(const RouterAdv::PrefixInfoOption &aPio)
|
||||
{
|
||||
Ip6::Prefix prefix = aPio.GetPrefix();
|
||||
bool needReevaluate = false;
|
||||
@@ -1153,10 +1156,11 @@ exit:
|
||||
return needReevaluate;
|
||||
}
|
||||
|
||||
bool RoutingManager::UpdateDiscoveredPrefixes(const RouterAdv::RouteInfoOption &aRio)
|
||||
// Adds or removes a discovered OMR prefix (external route will be added to or removed
|
||||
// from the Thread network).
|
||||
void RoutingManager::UpdateDiscoveredOmrPrefix(const RouterAdv::RouteInfoOption &aRio)
|
||||
{
|
||||
Ip6::Prefix prefix = aRio.GetPrefix();
|
||||
bool needReevaluate = false;
|
||||
Ip6::Prefix prefix = aRio.GetPrefix();
|
||||
ExternalPrefix omrPrefix;
|
||||
ExternalPrefix *existingPrefix = nullptr;
|
||||
|
||||
@@ -1184,7 +1188,7 @@ bool RoutingManager::UpdateDiscoveredPrefixes(const RouterAdv::RouteInfoOption &
|
||||
|
||||
if (aRio.GetRouteLifetime() == 0)
|
||||
{
|
||||
needReevaluate = InvalidateDiscoveredPrefixes(&prefix, /* aIsOnLinkPrefix */ false);
|
||||
InvalidateDiscoveredPrefixes(&prefix, /* aIsOnLinkPrefix */ false);
|
||||
ExitNow();
|
||||
}
|
||||
|
||||
@@ -1215,7 +1219,6 @@ bool RoutingManager::UpdateDiscoveredPrefixes(const RouterAdv::RouteInfoOption &
|
||||
{
|
||||
SuccessOrExit(AddExternalRoute(prefix, omrPrefix.mRoutePreference));
|
||||
existingPrefix = mDiscoveredPrefixes.PushBack();
|
||||
needReevaluate = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1230,12 +1233,11 @@ bool RoutingManager::UpdateDiscoveredPrefixes(const RouterAdv::RouteInfoOption &
|
||||
mDiscoveredPrefixStaleTimer.FireAtIfEarlier(existingPrefix->GetStaleTime());
|
||||
|
||||
exit:
|
||||
return needReevaluate;
|
||||
return;
|
||||
}
|
||||
|
||||
bool RoutingManager::InvalidateDiscoveredPrefixes(const Ip6::Prefix *aPrefix, bool aIsOnLinkPrefix)
|
||||
void RoutingManager::InvalidateDiscoveredPrefixes(const Ip6::Prefix *aPrefix, bool aIsOnLinkPrefix)
|
||||
{
|
||||
bool didRemove = false;
|
||||
TimeMilli now = TimerMilli::GetNow();
|
||||
uint8_t remainingOnLinkPrefixNum = 0;
|
||||
ExternalPrefixArray remainingPrefixes;
|
||||
@@ -1248,7 +1250,6 @@ bool RoutingManager::InvalidateDiscoveredPrefixes(const Ip6::Prefix *aPrefix, bo
|
||||
(prefix.GetExpireTime() <= now))
|
||||
{
|
||||
RemoveExternalRoute(prefix.mPrefix);
|
||||
didRemove = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1271,8 +1272,6 @@ bool RoutingManager::InvalidateDiscoveredPrefixes(const Ip6::Prefix *aPrefix, bo
|
||||
// To discover more on-link prefixes or timeout to advertise my local on-link prefix.
|
||||
StartRouterSolicitationDelay();
|
||||
}
|
||||
|
||||
return didRemove; // If anything was removed we need to reevaluate.
|
||||
}
|
||||
|
||||
void RoutingManager::InvalidateAllDiscoveredPrefixes(void)
|
||||
|
||||
@@ -307,9 +307,9 @@ private:
|
||||
void DeprecateOnLinkPrefix(void);
|
||||
void HandleRouterSolicit(const Ip6::Address &aSrcAddress, const uint8_t *aBuffer, uint16_t aBufferLength);
|
||||
void HandleRouterAdvertisement(const Ip6::Address &aSrcAddress, const uint8_t *aBuffer, uint16_t aBufferLength);
|
||||
bool UpdateDiscoveredPrefixes(const RouterAdv::PrefixInfoOption &aPio);
|
||||
bool UpdateDiscoveredPrefixes(const RouterAdv::RouteInfoOption &aRio);
|
||||
bool InvalidateDiscoveredPrefixes(const Ip6::Prefix *aPrefix = nullptr, bool aIsOnLinkPrefix = true);
|
||||
bool UpdateDiscoveredOnLinkPrefix(const RouterAdv::PrefixInfoOption &aPio);
|
||||
void UpdateDiscoveredOmrPrefix(const RouterAdv::RouteInfoOption &aRio);
|
||||
void InvalidateDiscoveredPrefixes(const Ip6::Prefix *aPrefix = nullptr, bool aIsOnLinkPrefix = true);
|
||||
void InvalidateAllDiscoveredPrefixes(void);
|
||||
bool NetworkDataContainsOmrPrefix(const Ip6::Prefix &aPrefix) const;
|
||||
bool UpdateRouterAdvMessage(const RouterAdv::RouterAdvMessage *aRouterAdvMessage);
|
||||
|
||||
Reference in New Issue
Block a user