From 1582d32a4edf108fb748dd94577bdb943f871229 Mon Sep 17 00:00:00 2001 From: Abtin Keshavarzian Date: Tue, 6 Jun 2017 11:30:25 -0700 Subject: [PATCH] Adding `mNextHopIsDevice` to `otExternalRouteConfig` (#1878) This commit adds a new field in `otExternalRouteConfig` to indicate if for the external route entry, the next hop is the device itself. --- include/openthread/types.h | 9 +++++++++ src/core/thread/network_data.cpp | 1 + 2 files changed, 10 insertions(+) diff --git a/include/openthread/types.h b/include/openthread/types.h index 95e84cfa5..7b7b20151 100644 --- a/include/openthread/types.h +++ b/include/openthread/types.h @@ -743,6 +743,15 @@ typedef struct otExternalRouteConfig * TRUE, if this configuration is considered Stable Network Data. FALSE, otherwise. */ bool mStable : 1; + + /** + * TRUE if the external route entry's next hop is this device itself (i.e., the route was added earlier by this + * device). FALSE otherwise. + * + * This value is ignored when adding an external route. For any added route the next hop is this device. + */ + bool mNextHopIsThisDevice : 1; + } otExternalRouteConfig; /** diff --git a/src/core/thread/network_data.cpp b/src/core/thread/network_data.cpp index 1a5261927..8e1526fee 100644 --- a/src/core/thread/network_data.cpp +++ b/src/core/thread/network_data.cpp @@ -202,6 +202,7 @@ otError NetworkData::GetNextExternalRoute(otNetworkDataIterator *aIterator, uint aConfig->mPrefix.mLength = prefix->GetPrefixLength(); aConfig->mPreference = hasRouteEntry->GetPreference(); aConfig->mStable = cur->IsStable(); + aConfig->mNextHopIsThisDevice = (hasRouteEntry->GetRloc() == mNetif.GetMle().GetRloc16()); *aIterator = static_cast(reinterpret_cast(cur->GetNext()) - mTlvs);