[routing-manager] new API to get list of discovered routers (#9601)

This commit adds `otBorderRoutingGetNextRouterEntry` as a new API to
iterate over discovered routers on the infrastructure link and get
information about them such as their address, their Managed Address
Configuration (`M`), Other Configuration (`O`), and Stub Router
flags.

The `otBorderRoutingPrefixTableEntry` is also updated to contain
the same information.

This commit also updates the CLI `br` sub-commands to provide this
information, adding `br routers` to obtain a list of discovered
routers.
This commit is contained in:
Abtin Keshavarzian
2023-11-20 11:49:26 -08:00
committed by GitHub
parent 0bb9eeb500
commit 6f3b4317d6
9 changed files with 253 additions and 44 deletions
+4 -4
View File
@@ -945,7 +945,7 @@ void VerifyPrefixTable(const OnLinkPrefix *aOnLinkPrefixes,
{
Log(" on-link prefix:%s, valid:%u, preferred:%u, router:%s, age:%u",
AsCoreType(&entry.mPrefix).ToString().AsCString(), entry.mValidLifetime, entry.mPreferredLifetime,
AsCoreType(&entry.mRouterAddress).ToString().AsCString(), entry.mMsecSinceLastUpdate / 1000);
AsCoreType(&entry.mRouter.mAddress).ToString().AsCString(), entry.mMsecSinceLastUpdate / 1000);
onLinkPrefixCount++;
@@ -954,7 +954,7 @@ void VerifyPrefixTable(const OnLinkPrefix *aOnLinkPrefixes,
const OnLinkPrefix &onLinkPrefix = aOnLinkPrefixes[index];
if ((onLinkPrefix.mPrefix == AsCoreType(&entry.mPrefix)) &&
(AsCoreType(&entry.mRouterAddress) == onLinkPrefix.mRouterAddress))
(AsCoreType(&entry.mRouter.mAddress) == onLinkPrefix.mRouterAddress))
{
VerifyOrQuit(entry.mValidLifetime == onLinkPrefix.mValidLifetime);
VerifyOrQuit(entry.mPreferredLifetime == onLinkPrefix.mPreferredLifetime);
@@ -967,7 +967,7 @@ void VerifyPrefixTable(const OnLinkPrefix *aOnLinkPrefixes,
{
Log(" route prefix:%s, valid:%u, prf:%s, router:%s, age:%u",
AsCoreType(&entry.mPrefix).ToString().AsCString(), entry.mValidLifetime,
PreferenceToString(entry.mRoutePreference), AsCoreType(&entry.mRouterAddress).ToString().AsCString(),
PreferenceToString(entry.mRoutePreference), AsCoreType(&entry.mRouter.mAddress).ToString().AsCString(),
entry.mMsecSinceLastUpdate / 1000);
routePrefixCount++;
@@ -977,7 +977,7 @@ void VerifyPrefixTable(const OnLinkPrefix *aOnLinkPrefixes,
const RoutePrefix &routePrefix = aRoutePrefixes[index];
if ((routePrefix.mPrefix == AsCoreType(&entry.mPrefix)) &&
(AsCoreType(&entry.mRouterAddress) == routePrefix.mRouterAddress))
(AsCoreType(&entry.mRouter.mAddress) == routePrefix.mRouterAddress))
{
VerifyOrQuit(entry.mValidLifetime == routePrefix.mValidLifetime);
VerifyOrQuit(static_cast<int8_t>(entry.mRoutePreference) == routePrefix.mPreference);