[routing-manager] add mIsReachable to otBorderRoutingRouterEntry (#10388)

This commit adds `mIsReachable` to the `otBorderRoutingRouterEntry`
structure to indicate whether a router is reachable. A router is
marked unreachable after it fails to respond to multiple Neighbor
Solicitation (NS) probes. Additionally, the `br` CLI commands are
updated to display this information.
This commit is contained in:
Abtin Keshavarzian
2024-06-17 11:31:30 -07:00
committed by GitHub
parent 0fac5dcf0b
commit 4749aa2ae0
5 changed files with 12 additions and 4 deletions
+1
View File
@@ -102,6 +102,7 @@ typedef struct otBorderRoutingRouterEntry
bool mOtherConfigFlag : 1; ///< The router's Other Config flag (`O` flag).
bool mStubRouterFlag : 1; ///< The router's Stub Router flag.
bool mIsLocalDevice : 1; ///< This router is the local device (this BR).
bool mIsReachable : 1; ///< This router is reachable.
} otBorderRoutingRouterEntry;
/**
+1 -1
View File
@@ -53,7 +53,7 @@ extern "C" {
* @note This number versions both OpenThread platform and user APIs.
*
*/
#define OPENTHREAD_API_VERSION (421)
#define OPENTHREAD_API_VERSION (422)
/**
* @addtogroup api-instance
+3 -1
View File
@@ -352,9 +352,11 @@ Info per router:
- O: Other Config flag
- Stub: Stub Router flag (indicates whether the router is a stub router)
- Milliseconds since last received message from this router
- Reachability flag: A router is marked as unreachable if it fails to respond to multiple Neighbor Solicitation probes.
- `(this BR)` is appended when the router is the local device itself.
```bash
> br routers
ff02:0:0:0:0:0:0:1 (M:0 O:0 Stub:1) ms-since-rx:1505
ff02:0:0:0:0:0:0:1 (M:0 O:0 Stub:1) ms-since-rx:1505 reachable:yes
Done
```
+6 -2
View File
@@ -518,7 +518,7 @@ exit:
* @cli br routers
* @code
* br routers
* ff02:0:0:0:0:0:0:1 (M:0 O:0 Stub:1) ms-since-rx:1505
* ff02:0:0:0:0:0:0:1 (M:0 O:0 Stub:1) ms-since-rx:1505 reachable:yes
* Done
* @endcode
* @par
@@ -530,6 +530,9 @@ exit:
* - O: Other Config flag
* - Stub: Stub Router flag (indicates whether the router is a stub router)
* - Milliseconds since last received message from this router
* - Reachability flag: A router is marked as unreachable if it fails to respond to multiple Neighbor Solicitation
* probes.
* - `(this BR)` is appended when the router is the local device itself.
* @sa otBorderRoutingGetNextRouterEntry
*/
template <> otError Br::Process<Cmd("routers")>(Arg aArgs[])
@@ -559,7 +562,8 @@ void Br::OutputRouterInfo(const otBorderRoutingRouterEntry &aEntry, RouterOutput
if (aMode == kLongVersion)
{
OutputFormat(" ms-since-rx:%lu", ToUlong(aEntry.mMsecSinceLastUpdate));
OutputFormat(" ms-since-rx:%lu reachable:%s", ToUlong(aEntry.mMsecSinceLastUpdate),
aEntry.mIsReachable ? "yes" : "no");
if (aEntry.mIsLocalDevice)
{
@@ -1969,6 +1969,7 @@ void RoutingManager::RxRaTracker::Router::CopyInfoTo(RouterEntry &aEntry, TimeMi
aEntry.mOtherConfigFlag = mOtherConfigFlag;
aEntry.mStubRouterFlag = mStubRouterFlag;
aEntry.mIsLocalDevice = mIsLocalDevice;
aEntry.mIsReachable = IsReachable();
}
//---------------------------------------------------------------------------------------------------------------------