mirror of
https://github.com/espressif/openthread.git
synced 2026-09-01 23:09:53 +00:00
[border-routing] invalidate discovered OMR prefixes when Network Data change (#7246)
This commit enhances Border Routing to ignore discovered OMR Prefixes when Network Data change. It's possible that a BR may learn an OMR prefix from RA, and later learn the same OMR Prefix from Network Data. In such case, the BR should remove the discovered OMR Prefix.
This commit is contained in:
@@ -327,6 +327,8 @@ void RoutingManager::HandleNotifierEvents(Events aEvents)
|
||||
|
||||
if (mIsRunning && aEvents.Contains(kEventThreadNetdataChanged))
|
||||
{
|
||||
// Invalidate discovered prefixes because OMR Prefixes in Network Data may change.
|
||||
InvalidateDiscoveredPrefixes();
|
||||
StartRoutingPolicyEvaluationDelay();
|
||||
}
|
||||
|
||||
@@ -1177,6 +1179,9 @@ void RoutingManager::UpdateDiscoveredOmrPrefix(const RouterAdv::RouteInfoOption
|
||||
ExitNow();
|
||||
}
|
||||
|
||||
// Ignore own OMR prefix.
|
||||
VerifyOrExit(mLocalOmrPrefix != prefix);
|
||||
|
||||
// Ignore OMR prefixes advertised by ourselves or in current Thread Network Data.
|
||||
// The `mAdvertisedOmrPrefixes` and the OMR prefix set in Network Data should eventually
|
||||
// be equal, but there is time that they are not synchronized immediately:
|
||||
@@ -1251,8 +1256,14 @@ void RoutingManager::InvalidateDiscoveredPrefixes(const Ip6::Prefix *aPrefix, bo
|
||||
|
||||
for (const ExternalPrefix &prefix : mDiscoveredPrefixes)
|
||||
{
|
||||
if ((aPrefix != nullptr && prefix.mPrefix == *aPrefix && prefix.mIsOnLinkPrefix == aIsOnLinkPrefix) ||
|
||||
(prefix.GetExpireTime() <= now))
|
||||
if (
|
||||
// Invalidate specified prefix
|
||||
(aPrefix != nullptr && prefix.mPrefix == *aPrefix && prefix.mIsOnLinkPrefix == aIsOnLinkPrefix) ||
|
||||
// Invalidate expired prefix
|
||||
(prefix.GetExpireTime() <= now) ||
|
||||
// Invalidate Local OMR prefixes
|
||||
(!prefix.mIsOnLinkPrefix &&
|
||||
(mAdvertisedOmrPrefixes.Contains(prefix.mPrefix) || NetworkDataContainsOmrPrefix(prefix.mPrefix))))
|
||||
{
|
||||
RemoveExternalRoute(prefix.mPrefix);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user