[routing-manager] advert local on-link prefix if same as discovered prefix (#8079)

This commit updates the `RoutingManager` such that if we see that that
current favored discovered on-link prefix (from processed RAs from
other router) matches our local on-link prefix, we start/continue
advertising it as well. The local on-link prefix is derived from
extended PAN ID and therefore is the same for all BRs on the same
Thread mesh. Having multiple BRs advertise the same on-link prefix
adds redundancy (in case one BR goes offline).
This commit is contained in:
Abtin Keshavarzian
2022-08-25 11:09:42 -07:00
committed by GitHub
parent 989a56e96d
commit d72c10eed3
+11 -3
View File
@@ -525,10 +525,16 @@ void RoutingManager::EvaluateOnLinkPrefix(void)
mDiscoveredPrefixTable.FindFavoredOnLinkPrefix(mFavoredDiscoveredOnLinkPrefix);
if (mFavoredDiscoveredOnLinkPrefix.GetLength() == 0)
if ((mFavoredDiscoveredOnLinkPrefix.GetLength() == 0) ||
(mFavoredDiscoveredOnLinkPrefix == mLocalOnLinkPrefix.GetPrefix()))
{
// We need to advertise our local on-link prefix since there is
// no discovered on-link prefix.
// We need to advertise our local on-link prefix when there is
// no discovered on-link prefix. If the favored discovered
// prefix is the same as our local on-link prefix we also
// start advertising the local prefix to add redundancy. Note
// that local on-link prefix is derived from extended PAN ID
// and therefore is the same for all BRs on the same Thread
// mesh.
SuccessOrExit(mLocalOnLinkPrefix.Advertise());
@@ -544,6 +550,8 @@ void RoutingManager::EvaluateOnLinkPrefix(void)
mDiscoveredPrefixTable.RemoveOnLinkPrefix(mLocalOnLinkPrefix.GetPrefix(),
DiscoveredPrefixTable::kKeepInNetData);
mFavoredDiscoveredOnLinkPrefix.Clear();
}
else if (mLocalOnLinkPrefix.IsAdvertising())
{