mirror of
https://github.com/espressif/openthread.git
synced 2026-06-05 21:14:49 +00:00
[bbr] remove domain prefix support from stack and harness (#13203)
This commit removes all Domain Prefix configuration and management logic
from the OpenThread stack, CLI commands, unit tests, and GRL harness
THCI wrapper.
- Removed public Backbone Router Domain Prefix APIs.
- Removed Domain Prefix flag ('mDp') and 'D' flag parser/formatter
from core network data types, Spinel, and CLI.
- Cleaned up local Backbone Router and Leader logic to exclude Domain
Prefix configuration, tracking, and events.
- Updated RoutingManager prefix advertisement (RIO) to exclude
special handling for Domain Prefix.
- Updated CLI documentation to remove Domain Prefix references.
- Removed domain prefix helper methods from python test certification
scripts.
- Removed auto-addition of default domain prefix and D flag support
from GRL harness OpenThread.py.
This commit is contained in:
@@ -43,7 +43,6 @@
|
|||||||
#include <openthread/error.h>
|
#include <openthread/error.h>
|
||||||
#include <openthread/instance.h>
|
#include <openthread/instance.h>
|
||||||
#include <openthread/ip6.h>
|
#include <openthread/ip6.h>
|
||||||
#include <openthread/netdata.h>
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
@@ -175,17 +174,6 @@ uint8_t otBackboneRouterGetRegistrationJitter(otInstance *aInstance);
|
|||||||
*/
|
*/
|
||||||
void otBackboneRouterSetRegistrationJitter(otInstance *aInstance, uint8_t aJitter);
|
void otBackboneRouterSetRegistrationJitter(otInstance *aInstance, uint8_t aJitter);
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the local Domain Prefix configuration.
|
|
||||||
*
|
|
||||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
|
||||||
* @param[out] aConfig A pointer to the Domain Prefix configuration.
|
|
||||||
*
|
|
||||||
* @retval OT_ERROR_NONE Successfully got the Domain Prefix configuration.
|
|
||||||
* @retval OT_ERROR_NOT_FOUND No Domain Prefix was configured.
|
|
||||||
*/
|
|
||||||
otError otBackboneRouterGetDomainPrefix(otInstance *aInstance, otBorderRouterConfig *aConfig);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Configures the response status for the next Multicast Listener Registration.
|
* Configures the response status for the next Multicast Listener Registration.
|
||||||
*
|
*
|
||||||
@@ -300,37 +288,6 @@ otError otBackboneRouterMulticastListenerGetNext(otInstance
|
|||||||
otBackboneRouterMulticastListenerIterator *aIterator,
|
otBackboneRouterMulticastListenerIterator *aIterator,
|
||||||
otBackboneRouterMulticastListenerInfo *aListenerInfo);
|
otBackboneRouterMulticastListenerInfo *aListenerInfo);
|
||||||
|
|
||||||
/**
|
|
||||||
* Represents the Domain Prefix events.
|
|
||||||
*/
|
|
||||||
typedef enum
|
|
||||||
{
|
|
||||||
OT_BACKBONE_ROUTER_DOMAIN_PREFIX_ADDED = 0, ///< Domain Prefix was added.
|
|
||||||
OT_BACKBONE_ROUTER_DOMAIN_PREFIX_REMOVED = 1, ///< Domain Prefix was removed.
|
|
||||||
OT_BACKBONE_ROUTER_DOMAIN_PREFIX_CHANGED = 2, ///< Domain Prefix was changed.
|
|
||||||
} otBackboneRouterDomainPrefixEvent;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Pointer is called whenever the Domain Prefix changed.
|
|
||||||
*
|
|
||||||
* @param[in] aContext The user context pointer.
|
|
||||||
* @param[in] aEvent The Domain Prefix event.
|
|
||||||
* @param[in] aDomainPrefix The new Domain Prefix if added or changed, NULL otherwise.
|
|
||||||
*/
|
|
||||||
typedef void (*otBackboneRouterDomainPrefixCallback)(void *aContext,
|
|
||||||
otBackboneRouterDomainPrefixEvent aEvent,
|
|
||||||
const otIp6Prefix *aDomainPrefix);
|
|
||||||
/**
|
|
||||||
* Sets the Backbone Router Domain Prefix callback.
|
|
||||||
*
|
|
||||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
|
||||||
* @param[in] aCallback A pointer to the Domain Prefix callback.
|
|
||||||
* @param[in] aContext A user context pointer.
|
|
||||||
*/
|
|
||||||
void otBackboneRouterSetDomainPrefixCallback(otInstance *aInstance,
|
|
||||||
otBackboneRouterDomainPrefixCallback aCallback,
|
|
||||||
void *aContext);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @}
|
* @}
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -603,7 +603,6 @@ otError otBorderRoutingGetNextRouterEntry(otInstance *aI
|
|||||||
*
|
*
|
||||||
* - It has added at least one external route entry.
|
* - It has added at least one external route entry.
|
||||||
* - It has added at least one prefix entry with both the default-route and on-mesh flags set.
|
* - It has added at least one prefix entry with both the default-route and on-mesh flags set.
|
||||||
* - It has added at least one domain prefix (with both the domain and on-mesh flags set).
|
|
||||||
*
|
*
|
||||||
* The list of peer BRs specifically excludes the current device, even if it is itself acting as a BR.
|
* The list of peer BRs specifically excludes the current device, even if it is itself acting as a BR.
|
||||||
*
|
*
|
||||||
@@ -629,7 +628,6 @@ otError otBorderRoutingGetNextPeerBrEntry(otInstance *
|
|||||||
*
|
*
|
||||||
* - It has added at least one external route entry.
|
* - It has added at least one external route entry.
|
||||||
* - It has added at least one prefix entry with both the default-route and on-mesh flags set.
|
* - It has added at least one prefix entry with both the default-route and on-mesh flags set.
|
||||||
* - It has added at least one domain prefix (with both the domain and on-mesh flags set).
|
|
||||||
*
|
*
|
||||||
* The list of peer BRs specifically excludes the current device, even if it is itself acting as a BR.
|
* The list of peer BRs specifically excludes the current device, even if it is itself acting as a BR.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ extern "C" {
|
|||||||
*
|
*
|
||||||
* @note This number versions both OpenThread platform and user APIs.
|
* @note This number versions both OpenThread platform and user APIs.
|
||||||
*/
|
*/
|
||||||
#define OPENTHREAD_API_VERSION (602)
|
#define OPENTHREAD_API_VERSION (603)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @addtogroup api-instance
|
* @addtogroup api-instance
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ typedef struct otBorderRouterConfig
|
|||||||
bool mOnMesh : 1; ///< Whether this prefix is considered on-mesh.
|
bool mOnMesh : 1; ///< Whether this prefix is considered on-mesh.
|
||||||
bool mStable : 1; ///< Whether this configuration is considered Stable Network Data.
|
bool mStable : 1; ///< Whether this configuration is considered Stable Network Data.
|
||||||
bool mNdDns : 1; ///< Whether this border router can supply DNS information via ND.
|
bool mNdDns : 1; ///< Whether this border router can supply DNS information via ND.
|
||||||
bool mDp : 1; ///< Whether prefix is a Thread Domain Prefix (added since Thread 1.2).
|
bool mDp : 1; ///< Reserved (previously Thread Domain Prefix flag).
|
||||||
uint16_t mRloc16; ///< The border router's RLOC16 (value ignored on config add).
|
uint16_t mRloc16; ///< The border router's RLOC16 (value ignored on config add).
|
||||||
} otBorderRouterConfig;
|
} otBorderRouterConfig;
|
||||||
|
|
||||||
|
|||||||
+1
-4
@@ -3543,7 +3543,7 @@ Done
|
|||||||
|
|
||||||
### prefix
|
### prefix
|
||||||
|
|
||||||
Get the prefix list in the local Network Data. Note: For the Thread 1.2 border router with backbone capability, the local Domain Prefix would be listed as well (with flag `D`), with preceding `-` if backbone functionality is disabled.
|
Get the prefix list in the local Network Data.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
> prefix
|
> prefix
|
||||||
@@ -3556,8 +3556,6 @@ Done
|
|||||||
|
|
||||||
Add a valid prefix to the Network Data.
|
Add a valid prefix to the Network Data.
|
||||||
|
|
||||||
Note: The Domain Prefix flag (`D`) is only available for Thread 1.2.
|
|
||||||
|
|
||||||
- p: Preferred flag
|
- p: Preferred flag
|
||||||
- a: Stateless IPv6 Address Autoconfiguration flag
|
- a: Stateless IPv6 Address Autoconfiguration flag
|
||||||
- d: DHCPv6 IPv6 Address Configuration flag
|
- d: DHCPv6 IPv6 Address Configuration flag
|
||||||
@@ -3566,7 +3564,6 @@ Note: The Domain Prefix flag (`D`) is only available for Thread 1.2.
|
|||||||
- o: On Mesh flag
|
- o: On Mesh flag
|
||||||
- s: Stable flag
|
- s: Stable flag
|
||||||
- n: Nd Dns flag
|
- n: Nd Dns flag
|
||||||
- D: Domain Prefix flag
|
|
||||||
- prf: Default router preference, which may be 'high', 'med', or 'low'.
|
- prf: Default router preference, which may be 'high', 'med', or 'low'.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
|||||||
@@ -430,7 +430,6 @@ Peer BRs are other devices within the Thread mesh that provide external IP conne
|
|||||||
|
|
||||||
- It has added at least one external route entry.
|
- It has added at least one external route entry.
|
||||||
- It has added at least one prefix entry with both the default-route and on-mesh flags set.
|
- It has added at least one prefix entry with both the default-route and on-mesh flags set.
|
||||||
- It has added at least one domain prefix (with both the domain and on-mesh flags set).
|
|
||||||
|
|
||||||
The list of peer BRs specifically excludes the current device, even if it is itself acting as a BR.
|
The list of peer BRs specifically excludes the current device, even if it is itself acting as a BR.
|
||||||
|
|
||||||
|
|||||||
@@ -466,7 +466,6 @@ The flags are as follows:
|
|||||||
- `o`: On Mesh flag
|
- `o`: On Mesh flag
|
||||||
- `s`: Stable flag
|
- `s`: Stable flag
|
||||||
- `n`: Nd Dns flag
|
- `n`: Nd Dns flag
|
||||||
- `D`: Domain Prefix flag
|
|
||||||
|
|
||||||
Print the history as a table.
|
Print the history as a table.
|
||||||
|
|
||||||
|
|||||||
@@ -283,7 +283,6 @@ Publish an on-mesh prefix entry.
|
|||||||
- o: On Mesh flag
|
- o: On Mesh flag
|
||||||
- s: Stable flag
|
- s: Stable flag
|
||||||
- n: Nd Dns flag
|
- n: Nd Dns flag
|
||||||
- D: Domain Prefix flag (only available for Thread 1.2).
|
|
||||||
- prf: Preference, which may be 'high', 'med', or 'low'.
|
- prf: Preference, which may be 'high', 'med', or 'low'.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
@@ -352,7 +351,6 @@ On-mesh prefixes are listed under `Prefixes` header:
|
|||||||
- o: On Mesh flag
|
- o: On Mesh flag
|
||||||
- s: Stable flag
|
- s: Stable flag
|
||||||
- n: Nd Dns flag
|
- n: Nd Dns flag
|
||||||
- D: Domain Prefix flag (only available for Thread 1.2).
|
|
||||||
- Preference `high`, `med`, or `low`
|
- Preference `high`, `med`, or `low`
|
||||||
- RLOC16 of device which added the on-mesh prefix
|
- RLOC16 of device which added the on-mesh prefix
|
||||||
|
|
||||||
|
|||||||
@@ -5450,9 +5450,6 @@ template <> otError Interpreter::Process<Cmd("prefix")>(Arg aArgs[])
|
|||||||
* @endcode
|
* @endcode
|
||||||
* @par
|
* @par
|
||||||
* Get the prefix list in the local Network Data.
|
* Get the prefix list in the local Network Data.
|
||||||
* @note For the Thread 1.2 border router with backbone capability, the local Domain Prefix
|
|
||||||
* is listed as well and includes the `D` flag. If backbone functionality is disabled, a dash
|
|
||||||
* `-` is printed before the local Domain Prefix.
|
|
||||||
* @par
|
* @par
|
||||||
* For more information about #otBorderRouterConfig flags, refer to @overview.
|
* For more information about #otBorderRouterConfig flags, refer to @overview.
|
||||||
* @sa otBorderRouterGetNextOnMeshPrefix
|
* @sa otBorderRouterGetNextOnMeshPrefix
|
||||||
@@ -5466,15 +5463,6 @@ template <> otError Interpreter::Process<Cmd("prefix")>(Arg aArgs[])
|
|||||||
{
|
{
|
||||||
mNetworkData.OutputPrefix(config);
|
mNetworkData.OutputPrefix(config);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if OPENTHREAD_FTD && OPENTHREAD_CONFIG_BACKBONE_ROUTER_ENABLE
|
|
||||||
if (otBackboneRouterGetState(GetInstancePtr()) == OT_BACKBONE_ROUTER_STATE_DISABLED)
|
|
||||||
{
|
|
||||||
SuccessOrExit(otBackboneRouterGetDomainPrefix(GetInstancePtr(), &config));
|
|
||||||
OutputFormat("- ");
|
|
||||||
mNetworkData.OutputPrefix(config);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @cli prefix add
|
* @cli prefix add
|
||||||
|
|||||||
@@ -670,7 +670,6 @@ template <> otError Br::Process<Cmd("peers")>(Arg aArgs[])
|
|||||||
* Data entries:
|
* Data entries:
|
||||||
* - It has added at least one external route entry.
|
* - It has added at least one external route entry.
|
||||||
* - It has added at least one prefix entry with both the default-route and on-mesh flags set.
|
* - It has added at least one prefix entry with both the default-route and on-mesh flags set.
|
||||||
* - It has added at least one domain prefix (with both the domain and on-mesh flags set).
|
|
||||||
* The list of peer BRs specifically excludes the current device, even if its is itself acting as a BR.
|
* The list of peer BRs specifically excludes the current device, even if its is itself acting as a BR.
|
||||||
* Info per BR entry:
|
* Info per BR entry:
|
||||||
* - RLOC16 of the BR
|
* - RLOC16 of the BR
|
||||||
|
|||||||
@@ -1305,7 +1305,6 @@ void History::OutputRxTxEntryTableFormat(const otHistoryTrackerMessageInfo &aInf
|
|||||||
* * `o`: On mesh flag.
|
* * `o`: On mesh flag.
|
||||||
* * `s`: Stable flag.
|
* * `s`: Stable flag.
|
||||||
* * `n`: Nd Dns flag.
|
* * `n`: Nd Dns flag.
|
||||||
* * `D`: Domain prefix flag.
|
|
||||||
* * Pref: Preference. Values can be either `high`, `med`, or `low`.
|
* * Pref: Preference. Values can be either `high`, `med`, or `low`.
|
||||||
* * RLOC16
|
* * RLOC16
|
||||||
* @sa otHistoryTrackerIterateOnMeshPrefixHistory
|
* @sa otHistoryTrackerIterateOnMeshPrefixHistory
|
||||||
|
|||||||
@@ -96,11 +96,6 @@ void NetworkData::PrefixFlagsToString(const otBorderRouterConfig &aConfig, Flags
|
|||||||
*flagsPtr++ = 'n';
|
*flagsPtr++ = 'n';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (aConfig.mDp)
|
|
||||||
{
|
|
||||||
*flagsPtr++ = 'D';
|
|
||||||
}
|
|
||||||
|
|
||||||
*flagsPtr = '\0';
|
*flagsPtr = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -804,7 +799,6 @@ exit:
|
|||||||
* * o: On Mesh flag
|
* * o: On Mesh flag
|
||||||
* * s: Stable flag
|
* * s: Stable flag
|
||||||
* * n: Nd Dns flag
|
* * n: Nd Dns flag
|
||||||
* * D: Domain Prefix flag (only available for Thread 1.2).
|
|
||||||
* * Preference `high`, `med`, or `low`
|
* * Preference `high`, `med`, or `low`
|
||||||
* * RLOC16 of device which added the on-mesh prefix
|
* * RLOC16 of device which added the on-mesh prefix
|
||||||
* @par
|
* @par
|
||||||
|
|||||||
@@ -710,11 +710,6 @@ otError Utils::ParsePrefix(Arg aArgs[], otBorderRouterConfig &aConfig)
|
|||||||
aConfig.mNdDns = true;
|
aConfig.mNdDns = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#if OPENTHREAD_FTD && OPENTHREAD_CONFIG_BACKBONE_ROUTER_ENABLE
|
|
||||||
case 'D':
|
|
||||||
aConfig.mDp = true;
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
case '-':
|
case '-':
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|||||||
@@ -82,18 +82,6 @@ void otBackboneRouterSetRegistrationJitter(otInstance *aInstance, uint8_t aJitte
|
|||||||
return AsCoreType(aInstance).Get<BackboneRouter::Local>().SetRegistrationJitter(aJitter);
|
return AsCoreType(aInstance).Get<BackboneRouter::Local>().SetRegistrationJitter(aJitter);
|
||||||
}
|
}
|
||||||
|
|
||||||
otError otBackboneRouterGetDomainPrefix(otInstance *aInstance, otBorderRouterConfig *aConfig)
|
|
||||||
{
|
|
||||||
return AsCoreType(aInstance).Get<BackboneRouter::Local>().GetDomainPrefix(AsCoreType(aConfig));
|
|
||||||
}
|
|
||||||
|
|
||||||
void otBackboneRouterSetDomainPrefixCallback(otInstance *aInstance,
|
|
||||||
otBackboneRouterDomainPrefixCallback aCallback,
|
|
||||||
void *aContext)
|
|
||||||
{
|
|
||||||
return AsCoreType(aInstance).Get<BackboneRouter::Local>().SetDomainPrefixCallback(aCallback, aContext);
|
|
||||||
}
|
|
||||||
|
|
||||||
#if OPENTHREAD_CONFIG_BACKBONE_ROUTER_MULTICAST_ROUTING_ENABLE
|
#if OPENTHREAD_CONFIG_BACKBONE_ROUTER_MULTICAST_ROUTING_ENABLE
|
||||||
void otBackboneRouterSetMulticastListenerCallback(otInstance *aInstance,
|
void otBackboneRouterSetMulticastListenerCallback(otInstance *aInstance,
|
||||||
otBackboneRouterMulticastListenerCallback aCallback,
|
otBackboneRouterMulticastListenerCallback aCallback,
|
||||||
|
|||||||
@@ -49,36 +49,12 @@ otError otBorderRouterGetNetData(otInstance *aInstance, bool aStable, uint8_t *a
|
|||||||
|
|
||||||
otError otBorderRouterAddOnMeshPrefix(otInstance *aInstance, const otBorderRouterConfig *aConfig)
|
otError otBorderRouterAddOnMeshPrefix(otInstance *aInstance, const otBorderRouterConfig *aConfig)
|
||||||
{
|
{
|
||||||
Error error = kErrorNone;
|
return AsCoreType(aInstance).Get<NetworkData::Local>().AddOnMeshPrefix(AsCoreType(aConfig));
|
||||||
|
|
||||||
#if OPENTHREAD_FTD && OPENTHREAD_CONFIG_BACKBONE_ROUTER_ENABLE
|
|
||||||
if (aConfig->mDp)
|
|
||||||
{
|
|
||||||
error = AsCoreType(aInstance).Get<BackboneRouter::Local>().SetDomainPrefix(AsCoreType(aConfig));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
error = AsCoreType(aInstance).Get<NetworkData::Local>().AddOnMeshPrefix(AsCoreType(aConfig));
|
|
||||||
}
|
|
||||||
|
|
||||||
return error;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
otError otBorderRouterRemoveOnMeshPrefix(otInstance *aInstance, const otIp6Prefix *aPrefix)
|
otError otBorderRouterRemoveOnMeshPrefix(otInstance *aInstance, const otIp6Prefix *aPrefix)
|
||||||
{
|
{
|
||||||
Error error = kErrorNone;
|
return AsCoreType(aInstance).Get<NetworkData::Local>().RemoveOnMeshPrefix(AsCoreType(aPrefix));
|
||||||
|
|
||||||
#if OPENTHREAD_FTD && OPENTHREAD_CONFIG_BACKBONE_ROUTER_ENABLE
|
|
||||||
error = AsCoreType(aInstance).Get<BackboneRouter::Local>().RemoveDomainPrefix(AsCoreType(aPrefix));
|
|
||||||
|
|
||||||
if (error == kErrorNotFound)
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
error = AsCoreType(aInstance).Get<NetworkData::Local>().RemoveOnMeshPrefix(AsCoreType(aPrefix));
|
|
||||||
}
|
|
||||||
|
|
||||||
return error;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
otError otBorderRouterGetNextOnMeshPrefix(otInstance *aInstance,
|
otError otBorderRouterGetNextOnMeshPrefix(otInstance *aInstance,
|
||||||
|
|||||||
@@ -116,12 +116,10 @@ bool BackboneTmfAgent::IsBackboneTmfMessage(const Ip6::MessageInfo &aMessageInfo
|
|||||||
// A Backbone TMF message must comply with following rules:
|
// A Backbone TMF message must comply with following rules:
|
||||||
// The destination must be one of:
|
// The destination must be one of:
|
||||||
// 1. All Network BBRs (Link-Local scope)
|
// 1. All Network BBRs (Link-Local scope)
|
||||||
// 2. All Domain BBRs (Link-Local scope)
|
// 2. A Backbone Link-Local address
|
||||||
// 3. A Backbone Link-Local address
|
|
||||||
// The source must be a Backbone Link-local address.
|
// The source must be a Backbone Link-local address.
|
||||||
return (Get<BackboneRouter::Local>().IsEnabled() && src.IsLinkLocalUnicast() &&
|
return (Get<BackboneRouter::Local>().IsEnabled() && src.IsLinkLocalUnicast() &&
|
||||||
(dst.IsLinkLocalUnicast() || dst == Get<BackboneRouter::Local>().GetAllNetworkBackboneRoutersAddress() ||
|
(dst.IsLinkLocalUnicast() || dst == Get<BackboneRouter::Local>().GetAllNetworkBackboneRoutersAddress()));
|
||||||
dst == Get<BackboneRouter::Local>().GetAllDomainBackboneRoutersAddress()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void BackboneTmfAgent::SubscribeMulticast(const Ip6::Address &aAddress)
|
void BackboneTmfAgent::SubscribeMulticast(const Ip6::Address &aAddress)
|
||||||
|
|||||||
@@ -90,13 +90,7 @@ Leader::Leader(Instance &aInstance)
|
|||||||
Reset();
|
Reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Leader::Reset(void)
|
void Leader::Reset(void) { mConfig.MarkAsAbsent(); }
|
||||||
{
|
|
||||||
mConfig.MarkAsAbsent();
|
|
||||||
|
|
||||||
// Domain Prefix Length 0 indicates no available Domain Prefix in the Thread network.
|
|
||||||
mDomainPrefix.SetLength(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
Error Leader::ReadConfig(Config &aConfig) const
|
Error Leader::ReadConfig(Config &aConfig) const
|
||||||
{
|
{
|
||||||
@@ -136,18 +130,6 @@ const char *Leader::PrimaryEventToString(PrimaryEvent aEvent)
|
|||||||
return kStrings[aEvent];
|
return kStrings[aEvent];
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *Leader::DomainPrefixEventToString(DomainPrefixEvent aEvent)
|
|
||||||
{
|
|
||||||
#define DomainPrefixEventMapList(_) \
|
|
||||||
_(kDomainPrefixAdded, "Added") \
|
|
||||||
_(kDomainPrefixRemoved, "Removed") \
|
|
||||||
_(kDomainPrefixRefreshed, "Refreshed")
|
|
||||||
|
|
||||||
DefineEnumStringArray(DomainPrefixEventMapList);
|
|
||||||
|
|
||||||
return kStrings[aEvent];
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif // OT_SHOULD_LOG_AT(OT_LOG_LEVEL_INFO)
|
#endif // OT_SHOULD_LOG_AT(OT_LOG_LEVEL_INFO)
|
||||||
|
|
||||||
void Leader::HandleNotifierEvents(Events aEvents)
|
void Leader::HandleNotifierEvents(Events aEvents)
|
||||||
@@ -155,7 +137,6 @@ void Leader::HandleNotifierEvents(Events aEvents)
|
|||||||
if (aEvents.ContainsAny(kEventThreadNetdataChanged | kEventThreadRoleChanged))
|
if (aEvents.ContainsAny(kEventThreadNetdataChanged | kEventThreadRoleChanged))
|
||||||
{
|
{
|
||||||
UpdateBackboneRouterPrimary();
|
UpdateBackboneRouterPrimary();
|
||||||
UpdateDomainPrefixConfig();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -212,52 +193,6 @@ exit:
|
|||||||
OT_UNUSED_VARIABLE(event);
|
OT_UNUSED_VARIABLE(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Leader::UpdateDomainPrefixConfig(void)
|
|
||||||
{
|
|
||||||
NetworkData::Iterator iterator = NetworkData::kIteratorInit;
|
|
||||||
NetworkData::OnMeshPrefixConfig prefixConfig;
|
|
||||||
DomainPrefixEvent event;
|
|
||||||
bool found = false;
|
|
||||||
|
|
||||||
while (Get<NetworkData::Leader>().GetNext(iterator, prefixConfig) == kErrorNone)
|
|
||||||
{
|
|
||||||
if (prefixConfig.mDp)
|
|
||||||
{
|
|
||||||
found = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!found)
|
|
||||||
{
|
|
||||||
VerifyOrExit(HasDomainPrefix());
|
|
||||||
|
|
||||||
mDomainPrefix.Clear();
|
|
||||||
event = kDomainPrefixRemoved;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
VerifyOrExit(prefixConfig.GetPrefix() != mDomainPrefix);
|
|
||||||
|
|
||||||
event = HasDomainPrefix() ? kDomainPrefixRefreshed : kDomainPrefixAdded;
|
|
||||||
mDomainPrefix = prefixConfig.GetPrefix();
|
|
||||||
}
|
|
||||||
|
|
||||||
LogInfo("%s domain Prefix: %s", DomainPrefixEventToString(event), mDomainPrefix.ToString().AsCString());
|
|
||||||
|
|
||||||
#if OPENTHREAD_FTD && OPENTHREAD_CONFIG_BACKBONE_ROUTER_ENABLE
|
|
||||||
Get<Local>().HandleDomainPrefixUpdate(event);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
exit:
|
|
||||||
OT_UNUSED_VARIABLE(event);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Leader::IsDomainUnicast(const Ip6::Address &aAddress) const
|
|
||||||
{
|
|
||||||
return HasDomainPrefix() && aAddress.MatchesPrefix(mDomainPrefix);
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace BackboneRouter
|
} // namespace BackboneRouter
|
||||||
} // namespace ot
|
} // namespace ot
|
||||||
|
|
||||||
|
|||||||
@@ -67,16 +67,6 @@ static_assert(kDefaultMlrTimeout >= kMinMlrTimeout && kDefaultMlrTimeout <= kMax
|
|||||||
static_assert(kMaxMlrTimeout * 1000 > kMaxMlrTimeout, "SecToMsec(kMaxMlrTimeout) will overflow");
|
static_assert(kMaxMlrTimeout * 1000 > kMaxMlrTimeout, "SecToMsec(kMaxMlrTimeout) will overflow");
|
||||||
static_assert(kParentAggregateDelay > 1, "kParentAggregateDelay should be larger than 1 second");
|
static_assert(kParentAggregateDelay > 1, "kParentAggregateDelay should be larger than 1 second");
|
||||||
|
|
||||||
/**
|
|
||||||
* Represents Domain Prefix changes.
|
|
||||||
*/
|
|
||||||
enum DomainPrefixEvent : uint8_t
|
|
||||||
{
|
|
||||||
kDomainPrefixAdded = OT_BACKBONE_ROUTER_DOMAIN_PREFIX_ADDED, ///< Domain Prefix Added.
|
|
||||||
kDomainPrefixRemoved = OT_BACKBONE_ROUTER_DOMAIN_PREFIX_REMOVED, ///< Domain Prefix Removed.
|
|
||||||
kDomainPrefixRefreshed = OT_BACKBONE_ROUTER_DOMAIN_PREFIX_CHANGED, ///< Domain Prefix Changed.
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents Primary Backbone Router events.
|
* Represents Primary Backbone Router events.
|
||||||
*/
|
*/
|
||||||
@@ -220,47 +210,18 @@ public:
|
|||||||
*/
|
*/
|
||||||
bool HasPrimary(void) const { return mConfig.IsPresent(); }
|
bool HasPrimary(void) const { return mConfig.IsPresent(); }
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the Domain Prefix in the Thread Network.
|
|
||||||
*
|
|
||||||
* @retval A pointer to the Domain Prefix or nullptr if there is no Domain Prefix.
|
|
||||||
*/
|
|
||||||
const Ip6::Prefix *GetDomainPrefix(void) const { return HasDomainPrefix() ? &mDomainPrefix : nullptr; }
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Indicates whether or not the Domain Prefix is available in the Thread Network.
|
|
||||||
*
|
|
||||||
* @retval TRUE If there is Domain Prefix.
|
|
||||||
* @retval FALSE If there is no Domain Prefix.
|
|
||||||
*/
|
|
||||||
bool HasDomainPrefix(void) const { return (mDomainPrefix.GetLength() > 0); }
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Indicates whether or not the address is a Domain Unicast Address.
|
|
||||||
*
|
|
||||||
* @param[in] aAddress A reference to the address.
|
|
||||||
*
|
|
||||||
* @retval true @p aAddress is a Domain Unicast Address.
|
|
||||||
* @retval false @p aAddress is not a Domain Unicast Address.
|
|
||||||
*/
|
|
||||||
bool IsDomainUnicast(const Ip6::Address &aAddress) const;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void HandleNotifierEvents(Events aEvents);
|
void HandleNotifierEvents(Events aEvents);
|
||||||
void UpdateBackboneRouterPrimary(void);
|
void UpdateBackboneRouterPrimary(void);
|
||||||
void UpdateDomainPrefixConfig(void);
|
|
||||||
#if OT_SHOULD_LOG_AT(OT_LOG_LEVEL_INFO)
|
#if OT_SHOULD_LOG_AT(OT_LOG_LEVEL_INFO)
|
||||||
static const char *PrimaryEventToString(PrimaryEvent aEvent);
|
static const char *PrimaryEventToString(PrimaryEvent aEvent);
|
||||||
static const char *DomainPrefixEventToString(DomainPrefixEvent aEvent);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
Config mConfig;
|
Config mConfig;
|
||||||
Ip6::Prefix mDomainPrefix;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace BackboneRouter
|
} // namespace BackboneRouter
|
||||||
|
|
||||||
DefineMapEnum(otBackboneRouterDomainPrefixEvent, BackboneRouter::DomainPrefixEvent);
|
|
||||||
DefineCoreType(otBackboneRouterConfig, BackboneRouter::Config);
|
DefineCoreType(otBackboneRouterConfig, BackboneRouter::Config);
|
||||||
|
|
||||||
} // namespace ot
|
} // namespace ot
|
||||||
|
|||||||
@@ -53,8 +53,6 @@ Local::Local(Instance &aInstance)
|
|||||||
, mRegistrationTimeout(0)
|
, mRegistrationTimeout(0)
|
||||||
, mMlrTimeout(kDefaultMlrTimeout)
|
, mMlrTimeout(kDefaultMlrTimeout)
|
||||||
{
|
{
|
||||||
mDomainPrefixConfig.GetPrefix().SetLength(0);
|
|
||||||
|
|
||||||
// Primary Backbone Router Aloc
|
// Primary Backbone Router Aloc
|
||||||
mBbrPrimaryAloc.InitAsThreadOriginMeshLocal();
|
mBbrPrimaryAloc.InitAsThreadOriginMeshLocal();
|
||||||
mBbrPrimaryAloc.GetAddress().GetIid().InitAsLocator(Mle::Aloc16::ForPrimaryBackboneRouter());
|
mBbrPrimaryAloc.GetAddress().GetIid().InitAsLocator(Mle::Aloc16::ForPrimaryBackboneRouter());
|
||||||
@@ -65,13 +63,6 @@ Local::Local(Instance &aInstance)
|
|||||||
mAllNetworkBackboneRouters.mFields.m8[0] = 0xff; // Multicast
|
mAllNetworkBackboneRouters.mFields.m8[0] = 0xff; // Multicast
|
||||||
mAllNetworkBackboneRouters.mFields.m8[1] = 0x32; // Flags = 3, Scope = 2
|
mAllNetworkBackboneRouters.mFields.m8[1] = 0x32; // Flags = 3, Scope = 2
|
||||||
mAllNetworkBackboneRouters.mFields.m8[15] = 3; // Group ID = 3
|
mAllNetworkBackboneRouters.mFields.m8[15] = 3; // Group ID = 3
|
||||||
|
|
||||||
// All Domain Backbone Routers Multicast Address.
|
|
||||||
mAllDomainBackboneRouters.Clear();
|
|
||||||
|
|
||||||
mAllDomainBackboneRouters.mFields.m8[0] = 0xff; // Multicast
|
|
||||||
mAllDomainBackboneRouters.mFields.m8[1] = 0x32; // Flags = 3, Scope = 2
|
|
||||||
mAllDomainBackboneRouters.mFields.m8[15] = 3; // Group ID = 3
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Local::SetEnabled(bool aEnable)
|
void Local::SetEnabled(bool aEnable)
|
||||||
@@ -81,12 +72,10 @@ void Local::SetEnabled(bool aEnable)
|
|||||||
if (aEnable)
|
if (aEnable)
|
||||||
{
|
{
|
||||||
SetState(kStateSecondary);
|
SetState(kStateSecondary);
|
||||||
AddDomainPrefixToNetworkData();
|
|
||||||
IgnoreError(AddService(kDecideBasedOnState));
|
IgnoreError(AddService(kDecideBasedOnState));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
RemoveDomainPrefixFromNetworkData();
|
|
||||||
RemoveService();
|
RemoveService();
|
||||||
SetState(kStateDisabled);
|
SetState(kStateDisabled);
|
||||||
}
|
}
|
||||||
@@ -318,59 +307,6 @@ exit:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Error Local::GetDomainPrefix(NetworkData::OnMeshPrefixConfig &aConfig)
|
|
||||||
{
|
|
||||||
Error error = kErrorNone;
|
|
||||||
|
|
||||||
VerifyOrExit(mDomainPrefixConfig.GetPrefix().GetLength() > 0, error = kErrorNotFound);
|
|
||||||
|
|
||||||
aConfig = mDomainPrefixConfig;
|
|
||||||
|
|
||||||
exit:
|
|
||||||
return error;
|
|
||||||
}
|
|
||||||
|
|
||||||
Error Local::RemoveDomainPrefix(const Ip6::Prefix &aPrefix)
|
|
||||||
{
|
|
||||||
Error error = kErrorNone;
|
|
||||||
|
|
||||||
VerifyOrExit(aPrefix.GetLength() > 0, error = kErrorInvalidArgs);
|
|
||||||
VerifyOrExit(mDomainPrefixConfig.GetPrefix() == aPrefix, error = kErrorNotFound);
|
|
||||||
|
|
||||||
if (IsEnabled())
|
|
||||||
{
|
|
||||||
RemoveDomainPrefixFromNetworkData();
|
|
||||||
}
|
|
||||||
|
|
||||||
mDomainPrefixConfig.GetPrefix().SetLength(0);
|
|
||||||
|
|
||||||
exit:
|
|
||||||
return error;
|
|
||||||
}
|
|
||||||
|
|
||||||
Error Local::SetDomainPrefix(const NetworkData::OnMeshPrefixConfig &aConfig)
|
|
||||||
{
|
|
||||||
Error error = kErrorNone;
|
|
||||||
|
|
||||||
VerifyOrExit(aConfig.IsValid(GetInstance()), error = kErrorInvalidArgs);
|
|
||||||
|
|
||||||
if (IsEnabled())
|
|
||||||
{
|
|
||||||
RemoveDomainPrefixFromNetworkData();
|
|
||||||
}
|
|
||||||
|
|
||||||
mDomainPrefixConfig = aConfig;
|
|
||||||
LogDomainPrefix(kActionSet, kErrorNone);
|
|
||||||
|
|
||||||
if (IsEnabled())
|
|
||||||
{
|
|
||||||
AddDomainPrefixToNetworkData();
|
|
||||||
}
|
|
||||||
|
|
||||||
exit:
|
|
||||||
return error;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Local::ApplyNewMeshLocalPrefix(void)
|
void Local::ApplyNewMeshLocalPrefix(void)
|
||||||
{
|
{
|
||||||
VerifyOrExit(IsEnabled());
|
VerifyOrExit(IsEnabled());
|
||||||
@@ -383,40 +319,6 @@ exit:
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Local::HandleDomainPrefixUpdate(DomainPrefixEvent aEvent)
|
|
||||||
{
|
|
||||||
VerifyOrExit(IsEnabled());
|
|
||||||
|
|
||||||
if (aEvent == kDomainPrefixRemoved || aEvent == kDomainPrefixRefreshed)
|
|
||||||
{
|
|
||||||
Get<BackboneTmfAgent>().UnsubscribeMulticast(mAllDomainBackboneRouters);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (aEvent == kDomainPrefixAdded || aEvent == kDomainPrefixRefreshed)
|
|
||||||
{
|
|
||||||
mAllDomainBackboneRouters.SetMulticastNetworkPrefix(*Get<Leader>().GetDomainPrefix());
|
|
||||||
Get<BackboneTmfAgent>().SubscribeMulticast(mAllDomainBackboneRouters);
|
|
||||||
}
|
|
||||||
|
|
||||||
mDomainPrefixCallback.InvokeIfSet(static_cast<otBackboneRouterDomainPrefixEvent>(aEvent),
|
|
||||||
Get<Leader>().GetDomainPrefix());
|
|
||||||
|
|
||||||
exit:
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Local::RemoveDomainPrefixFromNetworkData(void)
|
|
||||||
{
|
|
||||||
Error error = kErrorNotFound; // only used for logging.
|
|
||||||
|
|
||||||
if (mDomainPrefixConfig.mPrefix.mLength > 0)
|
|
||||||
{
|
|
||||||
error = Get<NetworkData::Local>().RemoveOnMeshPrefix(mDomainPrefixConfig.GetPrefix());
|
|
||||||
}
|
|
||||||
|
|
||||||
LogDomainPrefix(kActionRemove, error);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Local::IncrementSequenceNumber(void)
|
void Local::IncrementSequenceNumber(void)
|
||||||
{
|
{
|
||||||
switch (mSequenceNumber)
|
switch (mSequenceNumber)
|
||||||
@@ -435,18 +337,6 @@ void Local::IncrementSequenceNumber(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Local::AddDomainPrefixToNetworkData(void)
|
|
||||||
{
|
|
||||||
Error error = kErrorNotFound; // only used for logging.
|
|
||||||
|
|
||||||
if (mDomainPrefixConfig.GetPrefix().GetLength() > 0)
|
|
||||||
{
|
|
||||||
error = Get<NetworkData::Local>().AddOnMeshPrefix(mDomainPrefixConfig);
|
|
||||||
}
|
|
||||||
|
|
||||||
LogDomainPrefix(kActionAdd, error);
|
|
||||||
}
|
|
||||||
|
|
||||||
#if OT_SHOULD_LOG_AT(OT_LOG_LEVEL_INFO)
|
#if OT_SHOULD_LOG_AT(OT_LOG_LEVEL_INFO)
|
||||||
|
|
||||||
const char *Local::ActionToString(Action aAction)
|
const char *Local::ActionToString(Action aAction)
|
||||||
@@ -461,12 +351,6 @@ const char *Local::ActionToString(Action aAction)
|
|||||||
return kStrings[aAction];
|
return kStrings[aAction];
|
||||||
}
|
}
|
||||||
|
|
||||||
void Local::LogDomainPrefix(Action aAction, Error aError)
|
|
||||||
{
|
|
||||||
LogInfo("%s Domain Prefix: %s, %s", ActionToString(aAction), mDomainPrefixConfig.GetPrefix().ToString().AsCString(),
|
|
||||||
ErrorToString(aError));
|
|
||||||
}
|
|
||||||
|
|
||||||
void Local::LogService(Action aAction, Error aError)
|
void Local::LogService(Action aAction, Error aError)
|
||||||
{
|
{
|
||||||
LogInfo("%s BBR Service: seqno (%u), delay (%us), timeout (%lus), %s", ActionToString(aAction), mSequenceNumber,
|
LogInfo("%s BBR Service: seqno (%u), delay (%us), timeout (%lus), %s", ActionToString(aAction), mSequenceNumber,
|
||||||
|
|||||||
@@ -77,8 +77,6 @@ class Local : public InstanceLocator, private NonCopyable
|
|||||||
friend class ot::Notifier;
|
friend class ot::Notifier;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
typedef otBackboneRouterDomainPrefixCallback DomainPrefixCallback; ///< Domain Prefix callback.
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents Backbone Router state.
|
* Represents Backbone Router state.
|
||||||
*/
|
*/
|
||||||
@@ -190,37 +188,6 @@ public:
|
|||||||
*/
|
*/
|
||||||
void HandleBackboneRouterPrimaryUpdate(PrimaryEvent aEvent);
|
void HandleBackboneRouterPrimaryUpdate(PrimaryEvent aEvent);
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the Domain Prefix configuration.
|
|
||||||
*
|
|
||||||
* @param[out] aConfig A reference to the Domain Prefix configuration.
|
|
||||||
*
|
|
||||||
* @retval kErrorNone Successfully got the Domain Prefix configuration.
|
|
||||||
* @retval kErrorNotFound No Domain Prefix was configured.
|
|
||||||
*/
|
|
||||||
Error GetDomainPrefix(NetworkData::OnMeshPrefixConfig &aConfig);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Removes the local Domain Prefix configuration.
|
|
||||||
*
|
|
||||||
* @param[in] aPrefix A reference to the IPv6 Domain Prefix.
|
|
||||||
*
|
|
||||||
* @retval kErrorNone Successfully removed the Domain Prefix.
|
|
||||||
* @retval kErrorInvalidArgs @p aPrefix is invalid.
|
|
||||||
* @retval kErrorNotFound No Domain Prefix was configured or @p aPrefix doesn't match.
|
|
||||||
*/
|
|
||||||
Error RemoveDomainPrefix(const Ip6::Prefix &aPrefix);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the local Domain Prefix configuration.
|
|
||||||
*
|
|
||||||
* @param[in] aConfig A reference to the Domain Prefix configuration.
|
|
||||||
*
|
|
||||||
* @returns kErrorNone Successfully set the local Domain Prefix.
|
|
||||||
* @returns kErrorInvalidArgs @p aConfig is invalid.
|
|
||||||
*/
|
|
||||||
Error SetDomainPrefix(const NetworkData::OnMeshPrefixConfig &aConfig);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a reference to the All Network Backbone Routers Multicast Address.
|
* Returns a reference to the All Network Backbone Routers Multicast Address.
|
||||||
*
|
*
|
||||||
@@ -228,36 +195,11 @@ public:
|
|||||||
*/
|
*/
|
||||||
const Ip6::Address &GetAllNetworkBackboneRoutersAddress(void) const { return mAllNetworkBackboneRouters; }
|
const Ip6::Address &GetAllNetworkBackboneRoutersAddress(void) const { return mAllNetworkBackboneRouters; }
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns a reference to the All Domain Backbone Routers Multicast Address.
|
|
||||||
*
|
|
||||||
* @returns A reference to the All Domain Backbone Routers Multicast Address.
|
|
||||||
*/
|
|
||||||
const Ip6::Address &GetAllDomainBackboneRoutersAddress(void) const { return mAllDomainBackboneRouters; }
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Applies the Mesh Local Prefix.
|
* Applies the Mesh Local Prefix.
|
||||||
*/
|
*/
|
||||||
void ApplyNewMeshLocalPrefix(void);
|
void ApplyNewMeshLocalPrefix(void);
|
||||||
|
|
||||||
/**
|
|
||||||
* Updates the subscription of All Domain Backbone Routers Multicast Address.
|
|
||||||
*
|
|
||||||
* @param[in] aEvent The Domain Prefix event.
|
|
||||||
*/
|
|
||||||
void HandleDomainPrefixUpdate(DomainPrefixEvent aEvent);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the Domain Prefix callback.
|
|
||||||
*
|
|
||||||
* @param[in] aCallback The callback function.
|
|
||||||
* @param[in] aContext A user context pointer.
|
|
||||||
*/
|
|
||||||
void SetDomainPrefixCallback(DomainPrefixCallback aCallback, void *aContext)
|
|
||||||
{
|
|
||||||
mDomainPrefixCallback.Set(aCallback, aContext);
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
enum Action : uint8_t
|
enum Action : uint8_t
|
||||||
{
|
{
|
||||||
@@ -271,33 +213,26 @@ private:
|
|||||||
void UpdateState(void);
|
void UpdateState(void);
|
||||||
void RemoveService(void);
|
void RemoveService(void);
|
||||||
void HandleTimeTick(void);
|
void HandleTimeTick(void);
|
||||||
void AddDomainPrefixToNetworkData(void);
|
|
||||||
void RemoveDomainPrefixFromNetworkData(void);
|
|
||||||
void IncrementSequenceNumber(void);
|
void IncrementSequenceNumber(void);
|
||||||
#if OT_SHOULD_LOG_AT(OT_LOG_LEVEL_INFO)
|
#if OT_SHOULD_LOG_AT(OT_LOG_LEVEL_INFO)
|
||||||
static const char *ActionToString(Action aAction);
|
static const char *ActionToString(Action aAction);
|
||||||
void LogService(Action aAction, Error aError);
|
void LogService(Action aAction, Error aError);
|
||||||
void LogDomainPrefix(Action aAction, Error aError);
|
|
||||||
#else
|
#else
|
||||||
void LogService(Action, Error) {}
|
void LogService(Action, Error) {}
|
||||||
void LogDomainPrefix(Action, Error) {}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Indicates whether or not already add Backbone Router Service to local server data.
|
// Indicates whether or not already add Backbone Router Service to local server data.
|
||||||
// Used to check whether or not in restore stage after reset or whether to remove
|
// Used to check whether or not in restore stage after reset or whether to remove
|
||||||
// Backbone Router service for Secondary Backbone Router if it was added by force.
|
// Backbone Router service for Secondary Backbone Router if it was added by force.
|
||||||
bool mIsServiceAdded;
|
bool mIsServiceAdded;
|
||||||
State mState;
|
State mState;
|
||||||
uint8_t mSequenceNumber;
|
uint8_t mSequenceNumber;
|
||||||
uint8_t mRegistrationJitter;
|
uint8_t mRegistrationJitter;
|
||||||
uint16_t mReregistrationDelay;
|
uint16_t mReregistrationDelay;
|
||||||
uint16_t mRegistrationTimeout;
|
uint16_t mRegistrationTimeout;
|
||||||
uint32_t mMlrTimeout;
|
uint32_t mMlrTimeout;
|
||||||
NetworkData::OnMeshPrefixConfig mDomainPrefixConfig;
|
Ip6::Netif::UnicastAddress mBbrPrimaryAloc;
|
||||||
Ip6::Netif::UnicastAddress mBbrPrimaryAloc;
|
Ip6::Address mAllNetworkBackboneRouters;
|
||||||
Ip6::Address mAllNetworkBackboneRouters;
|
|
||||||
Ip6::Address mAllDomainBackboneRouters;
|
|
||||||
Callback<DomainPrefixCallback> mDomainPrefixCallback;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace BackboneRouter
|
} // namespace BackboneRouter
|
||||||
|
|||||||
@@ -284,16 +284,14 @@ bool FavoredOmrPrefix::IsInfrastructureDerived(void) const
|
|||||||
|
|
||||||
void FavoredOmrPrefix::SetFrom(const NetworkData::OnMeshPrefixConfig &aOnMeshPrefixConfig)
|
void FavoredOmrPrefix::SetFrom(const NetworkData::OnMeshPrefixConfig &aOnMeshPrefixConfig)
|
||||||
{
|
{
|
||||||
mPrefix = aOnMeshPrefixConfig.GetPrefix();
|
mPrefix = aOnMeshPrefixConfig.GetPrefix();
|
||||||
mPreference = aOnMeshPrefixConfig.GetPreference();
|
mPreference = aOnMeshPrefixConfig.GetPreference();
|
||||||
mIsDomainPrefix = aOnMeshPrefixConfig.mDp;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void FavoredOmrPrefix::SetFrom(const OmrPrefix &aOmrPrefix)
|
void FavoredOmrPrefix::SetFrom(const OmrPrefix &aOmrPrefix)
|
||||||
{
|
{
|
||||||
mPrefix = aOmrPrefix.GetPrefix();
|
mPrefix = aOmrPrefix.GetPrefix();
|
||||||
mPreference = aOmrPrefix.GetPreference();
|
mPreference = aOmrPrefix.GetPreference();
|
||||||
mIsDomainPrefix = aOmrPrefix.IsDomainPrefix();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FavoredOmrPrefix::IsFavoredOver(const NetworkData::OnMeshPrefixConfig &aOmrPrefixConfig) const
|
bool FavoredOmrPrefix::IsFavoredOver(const NetworkData::OnMeshPrefixConfig &aOmrPrefixConfig) const
|
||||||
|
|||||||
@@ -569,20 +569,6 @@ public:
|
|||||||
*/
|
*/
|
||||||
RoutePreference GetPreference(void) const { return mPreference; }
|
RoutePreference GetPreference(void) const { return mPreference; }
|
||||||
|
|
||||||
/**
|
|
||||||
* Indicates whether the OMR prefix is a domain prefix.
|
|
||||||
*
|
|
||||||
* @retval TRUE If the OMR prefix is a domain prefix.
|
|
||||||
* @retval FALSE If the OMR prefix is not a domain prefix.
|
|
||||||
*/
|
|
||||||
bool IsDomainPrefix(void) const { return mIsDomainPrefix; }
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the OMR prefix and its preference.
|
|
||||||
*
|
|
||||||
* @param[in] aPrefix The IPv6 prefix to set.
|
|
||||||
* @param[in] aPreference The preference to set.
|
|
||||||
*/
|
|
||||||
void SetPrefix(const Ip6::Prefix &aPrefix, RoutePreference aPreference);
|
void SetPrefix(const Ip6::Prefix &aPrefix, RoutePreference aPreference);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -599,7 +585,6 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
Ip6::Prefix mPrefix;
|
Ip6::Prefix mPrefix;
|
||||||
RoutePreference mPreference;
|
RoutePreference mPreference;
|
||||||
bool mIsDomainPrefix;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|||||||
@@ -1169,11 +1169,6 @@ RoutingManager::OmrPrefixManager::InfoString RoutingManager::OmrPrefixManager::F
|
|||||||
string.Append("%s (prf:%s", aFavoredPrefix.GetPrefix().ToString().AsCString(),
|
string.Append("%s (prf:%s", aFavoredPrefix.GetPrefix().ToString().AsCString(),
|
||||||
RoutePreferenceToString(aFavoredPrefix.GetPreference()));
|
RoutePreferenceToString(aFavoredPrefix.GetPreference()));
|
||||||
|
|
||||||
if (aFavoredPrefix.IsDomainPrefix())
|
|
||||||
{
|
|
||||||
string.Append(", domain");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (aFavoredPrefix.GetPrefix() == mLocalPrefix.GetPrefix())
|
if (aFavoredPrefix.GetPrefix() == mLocalPrefix.GetPrefix())
|
||||||
{
|
{
|
||||||
string.Append(", local");
|
string.Append(", local");
|
||||||
@@ -1909,7 +1904,7 @@ Error RoutingManager::RioAdvertiser::AppendRios(RouterAdvert::TxMessage &aRaMess
|
|||||||
|
|
||||||
// (2) Favored OMR prefix.
|
// (2) Favored OMR prefix.
|
||||||
|
|
||||||
if (!omrPrefixManager.GetFavoredPrefix().IsEmpty() && !omrPrefixManager.GetFavoredPrefix().IsDomainPrefix())
|
if (!omrPrefixManager.GetFavoredPrefix().IsEmpty())
|
||||||
{
|
{
|
||||||
mPrefixes.Add(omrPrefixManager.GetFavoredPrefix().GetPrefix());
|
mPrefixes.Add(omrPrefixManager.GetFavoredPrefix().GetPrefix());
|
||||||
}
|
}
|
||||||
@@ -1928,11 +1923,6 @@ Error RoutingManager::RioAdvertiser::AppendRios(RouterAdvert::TxMessage &aRaMess
|
|||||||
// it, while it might still be present in the Network Data due to
|
// it, while it might still be present in the Network Data due to
|
||||||
// delays in registering changes with the leader.
|
// delays in registering changes with the leader.
|
||||||
|
|
||||||
if (prefixConfig.mDp)
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (IsValidOmrPrefix(prefixConfig) &&
|
if (IsValidOmrPrefix(prefixConfig) &&
|
||||||
(prefixConfig.GetPrefix() != omrPrefixManager.GetLocalPrefix().GetPrefix()))
|
(prefixConfig.GetPrefix() != omrPrefixManager.GetLocalPrefix().GetPrefix()))
|
||||||
{
|
{
|
||||||
@@ -1940,13 +1930,13 @@ Error RoutingManager::RioAdvertiser::AppendRios(RouterAdvert::TxMessage &aRaMess
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// (4) All other on-mesh prefixes (excluding Domain Prefix).
|
// (4) All other on-mesh prefixes.
|
||||||
|
|
||||||
iterator = NetworkData::kIteratorInit;
|
iterator = NetworkData::kIteratorInit;
|
||||||
|
|
||||||
while (Get<NetworkData::Leader>().GetNext(iterator, prefixConfig) == kErrorNone)
|
while (Get<NetworkData::Leader>().GetNext(iterator, prefixConfig) == kErrorNone)
|
||||||
{
|
{
|
||||||
if (prefixConfig.mOnMesh && !prefixConfig.mDp && !IsValidOmrPrefix(prefixConfig))
|
if (prefixConfig.mOnMesh && !IsValidOmrPrefix(prefixConfig))
|
||||||
{
|
{
|
||||||
mPrefixes.Add(prefixConfig.GetPrefix());
|
mPrefixes.Add(prefixConfig.GetPrefix());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -66,7 +66,6 @@
|
|||||||
*
|
*
|
||||||
* - It has added at least one external route entry.
|
* - It has added at least one external route entry.
|
||||||
* - It has added at least one prefix entry with default-route and on-mesh flags set.
|
* - It has added at least one prefix entry with default-route and on-mesh flags set.
|
||||||
* - It has added at least one domain prefix (domain and on-mesh flags set).
|
|
||||||
*
|
*
|
||||||
* A Border Router which provides IP connectivity and is acting as a REED is eligible to request a router role upgrade
|
* A Border Router which provides IP connectivity and is acting as a REED is eligible to request a router role upgrade
|
||||||
* by sending an "Address Solicit" request to leader with status reason `BorderRouterRequest`. This reason is used when
|
* by sending an "Address Solicit" request to leader with status reason `BorderRouterRequest`. This reason is used when
|
||||||
|
|||||||
@@ -118,7 +118,7 @@ Error Slaac::FindDomainIdFor(const Address &aAddress, uint8_t &aDomainId) const
|
|||||||
|
|
||||||
bool Slaac::IsSlaac(const NetworkData::OnMeshPrefixConfig &aConfig) const
|
bool Slaac::IsSlaac(const NetworkData::OnMeshPrefixConfig &aConfig) const
|
||||||
{
|
{
|
||||||
return aConfig.mSlaac && !aConfig.mDp && (aConfig.GetPrefix().GetLength() == NetworkPrefix::kLength);
|
return aConfig.mSlaac && (aConfig.GetPrefix().GetLength() == NetworkPrefix::kLength);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Slaac::IsFiltered(const NetworkData::OnMeshPrefixConfig &aConfig) const
|
bool Slaac::IsFiltered(const NetworkData::OnMeshPrefixConfig &aConfig) const
|
||||||
|
|||||||
@@ -514,7 +514,7 @@ void NetworkData::FindRlocs(BorderRouterFilter aBrFilter, RoleFilter aRoleFilter
|
|||||||
case kAnyBrOrServer:
|
case kAnyBrOrServer:
|
||||||
break;
|
break;
|
||||||
case kBrProvidingExternalIpConn:
|
case kBrProvidingExternalIpConn:
|
||||||
matches = prefix.mOnMesh && (prefix.mDefaultRoute || prefix.mDp);
|
matches = prefix.mOnMesh && prefix.mDefaultRoute;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -274,7 +274,6 @@ public:
|
|||||||
*
|
*
|
||||||
* - It has added at least one external route entry.
|
* - It has added at least one external route entry.
|
||||||
* - It has added at least one prefix entry with default-route and on-mesh flags set.
|
* - It has added at least one prefix entry with default-route and on-mesh flags set.
|
||||||
* - It has added at least one domain prefix (domain and on-mesh flags set).
|
|
||||||
*
|
*
|
||||||
* Should be used when the RLOC16s are present in the Network Data (when the Network Data contains the
|
* Should be used when the RLOC16s are present in the Network Data (when the Network Data contains the
|
||||||
* full set and not the stable subset).
|
* full set and not the stable subset).
|
||||||
@@ -292,7 +291,6 @@ public:
|
|||||||
*
|
*
|
||||||
* - It has added at least one external route entry.
|
* - It has added at least one external route entry.
|
||||||
* - It has added at least one prefix entry with default-route and on-mesh flags set.
|
* - It has added at least one prefix entry with default-route and on-mesh flags set.
|
||||||
* - It has added at least one domain prefix (domain and on-mesh flags set).
|
|
||||||
*
|
*
|
||||||
* Should be used when the RLOC16s are present in the Network Data (when the Network Data contains the
|
* Should be used when the RLOC16s are present in the Network Data (when the Network Data contains the
|
||||||
* full set and not the stable subset).
|
* full set and not the stable subset).
|
||||||
@@ -311,7 +309,6 @@ public:
|
|||||||
*
|
*
|
||||||
* - It has added at least one external route entry.
|
* - It has added at least one external route entry.
|
||||||
* - It has added at least one prefix entry with default-route and on-mesh flags set.
|
* - It has added at least one prefix entry with default-route and on-mesh flags set.
|
||||||
* - It has added at least one domain prefix (domain and on-mesh flags set).
|
|
||||||
*
|
*
|
||||||
* Should be used when the RLOC16s are present in the Network Data (when the Network Data contains the
|
* Should be used when the RLOC16s are present in the Network Data (when the Network Data contains the
|
||||||
* full set and not the stable subset).
|
* full set and not the stable subset).
|
||||||
|
|||||||
@@ -105,7 +105,6 @@ public:
|
|||||||
*
|
*
|
||||||
* - It has added at least one external route entry.
|
* - It has added at least one external route entry.
|
||||||
* - It has added at least one prefix entry with default-route and on-mesh flags set.
|
* - It has added at least one prefix entry with default-route and on-mesh flags set.
|
||||||
* - It has added at least one domain prefix (domain and on-mesh flags set).
|
|
||||||
*
|
*
|
||||||
* Does not check the current role of device.
|
* Does not check the current role of device.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -945,14 +945,6 @@ public:
|
|||||||
*/
|
*/
|
||||||
bool IsNdDns(void) const { return (BigEndian::HostSwap16(mFlags) & kNdDnsFlag) != 0; }
|
bool IsNdDns(void) const { return (BigEndian::HostSwap16(mFlags) & kNdDnsFlag) != 0; }
|
||||||
|
|
||||||
/**
|
|
||||||
* Indicates whether or not the Domain Prefix flag is set.
|
|
||||||
*
|
|
||||||
* @retval TRUE If the Domain Prefix flag is set.
|
|
||||||
* @retval FALSE If the Domain Prefix flag is not set.
|
|
||||||
*/
|
|
||||||
bool IsDp(void) const { return (BigEndian::HostSwap16(mFlags) & kDpFlag) != 0; }
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a pointer to the next BorderRouterEntry
|
* Returns a pointer to the next BorderRouterEntry
|
||||||
*
|
*
|
||||||
@@ -999,7 +991,7 @@ private:
|
|||||||
static constexpr uint16_t kDefaultRouteFlag = 1 << 9;
|
static constexpr uint16_t kDefaultRouteFlag = 1 << 9;
|
||||||
static constexpr uint16_t kOnMeshFlag = 1 << 8;
|
static constexpr uint16_t kOnMeshFlag = 1 << 8;
|
||||||
static constexpr uint16_t kNdDnsFlag = 1 << 7;
|
static constexpr uint16_t kNdDnsFlag = 1 << 7;
|
||||||
static constexpr uint16_t kDpFlag = 1 << 6;
|
// Flag bit 6 (1 << 6) was previously kDpFlag (Domain Prefix)
|
||||||
|
|
||||||
uint16_t mRloc;
|
uint16_t mRloc;
|
||||||
uint16_t mFlags;
|
uint16_t mFlags;
|
||||||
|
|||||||
@@ -116,13 +116,6 @@ uint16_t OnMeshPrefixConfig::ConvertToTlvFlags(void) const
|
|||||||
flags |= BorderRouterEntry::kNdDnsFlag;
|
flags |= BorderRouterEntry::kNdDnsFlag;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if OPENTHREAD_FTD && OPENTHREAD_CONFIG_BACKBONE_ROUTER_ENABLE
|
|
||||||
if (mDp)
|
|
||||||
{
|
|
||||||
flags |= BorderRouterEntry::kDpFlag;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
flags |= (static_cast<uint16_t>(RoutePreferenceToValue(mPreference)) << BorderRouterEntry::kPreferenceOffset);
|
flags |= (static_cast<uint16_t>(RoutePreferenceToValue(mPreference)) << BorderRouterEntry::kPreferenceOffset);
|
||||||
|
|
||||||
return flags;
|
return flags;
|
||||||
@@ -151,7 +144,7 @@ void OnMeshPrefixConfig::SetFromTlvFlags(uint16_t aFlags)
|
|||||||
mDefaultRoute = ((aFlags & BorderRouterEntry::kDefaultRouteFlag) != 0);
|
mDefaultRoute = ((aFlags & BorderRouterEntry::kDefaultRouteFlag) != 0);
|
||||||
mOnMesh = ((aFlags & BorderRouterEntry::kOnMeshFlag) != 0);
|
mOnMesh = ((aFlags & BorderRouterEntry::kOnMeshFlag) != 0);
|
||||||
mNdDns = ((aFlags & BorderRouterEntry::kNdDnsFlag) != 0);
|
mNdDns = ((aFlags & BorderRouterEntry::kNdDnsFlag) != 0);
|
||||||
mDp = ((aFlags & BorderRouterEntry::kDpFlag) != 0);
|
mDp = false;
|
||||||
mPreference = RoutePreferenceFromValue(static_cast<uint8_t>(aFlags >> BorderRouterEntry::kPreferenceOffset));
|
mPreference = RoutePreferenceFromValue(static_cast<uint8_t>(aFlags >> BorderRouterEntry::kPreferenceOffset));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -112,7 +112,6 @@ enum RoleFilter : uint8_t
|
|||||||
*
|
*
|
||||||
* - It has added at least one external route entry.
|
* - It has added at least one external route entry.
|
||||||
* - It has added at least one prefix entry with default-route and on-mesh flags set.
|
* - It has added at least one prefix entry with default-route and on-mesh flags set.
|
||||||
* - It has added at least one domain prefix (domain and on-mesh flags set).
|
|
||||||
*/
|
*/
|
||||||
enum BorderRouterFilter : uint8_t
|
enum BorderRouterFilter : uint8_t
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -129,11 +129,6 @@ static uint8_t BorderRouterConfigToFlagByteExtended(const otBorderRouterConfig &
|
|||||||
flags |= SPINEL_NET_FLAG_EXT_DNS;
|
flags |= SPINEL_NET_FLAG_EXT_DNS;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (aConfig.mDp)
|
|
||||||
{
|
|
||||||
flags |= SPINEL_NET_FLAG_EXT_DP;
|
|
||||||
}
|
|
||||||
|
|
||||||
return flags;
|
return flags;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1026,7 +1021,7 @@ template <> otError NcpBase::HandlePropertyInsert<SPINEL_PROP_THREAD_ON_MESH_NET
|
|||||||
(mDecoder.ReadUint8(flagsExtended) == OT_ERROR_NONE))
|
(mDecoder.ReadUint8(flagsExtended) == OT_ERROR_NONE))
|
||||||
{
|
{
|
||||||
borderRouterConfig.mNdDns = ((flagsExtended & SPINEL_NET_FLAG_EXT_DNS) != 0);
|
borderRouterConfig.mNdDns = ((flagsExtended & SPINEL_NET_FLAG_EXT_DNS) != 0);
|
||||||
borderRouterConfig.mDp = ((flagsExtended & SPINEL_NET_FLAG_EXT_DP) != 0);
|
borderRouterConfig.mDp = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
error = otBorderRouterAddOnMeshPrefix(mInstance, &borderRouterConfig);
|
error = otBorderRouterAddOnMeshPrefix(mInstance, &borderRouterConfig);
|
||||||
|
|||||||
@@ -96,10 +96,6 @@ void UpdateIpSets(otInstance *aInstance)
|
|||||||
// 2. Update otbr-deny-src-swap
|
// 2. Update otbr-deny-src-swap
|
||||||
while (otNetDataGetNextOnMeshPrefix(aInstance, &iterator, &config) == OT_ERROR_NONE)
|
while (otNetDataGetNextOnMeshPrefix(aInstance, &iterator, &config) == OT_ERROR_NONE)
|
||||||
{
|
{
|
||||||
if (config.mDp)
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
otIp6PrefixToString(&config.mPrefix, prefixBuf, sizeof(prefixBuf));
|
otIp6PrefixToString(&config.mPrefix, prefixBuf, sizeof(prefixBuf));
|
||||||
SuccessOrExit(error = ipSetManager.AddToIpSet(kIngressDenySrcSwapIpSet, prefixBuf));
|
SuccessOrExit(error = ipSetManager.AddToIpSet(kIngressDenySrcSwapIpSet, prefixBuf));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -100,7 +100,7 @@ class Firewall(thread_cert.TestCase):
|
|||||||
self.assertEqual('router', router1.get_state())
|
self.assertEqual('router', router1.get_state())
|
||||||
self.assertEqual('router', router2.get_state())
|
self.assertEqual('router', router2.get_state())
|
||||||
|
|
||||||
br1.set_domain_prefix(config.DOMAIN_PREFIX, 'prosD')
|
br1.add_prefix(config.DOMAIN_PREFIX, 'pros')
|
||||||
br1.register_netdata()
|
br1.register_netdata()
|
||||||
|
|
||||||
router1.add_ipmaddr(MA1)
|
router1.add_ipmaddr(MA1)
|
||||||
|
|||||||
@@ -557,7 +557,7 @@ def check_compressed_address_registration_tlv(command_msg, cid, iid, cid_present
|
|||||||
|
|
||||||
Args:
|
Args:
|
||||||
command_msg (MleMessage) : The Mle message to check.
|
command_msg (MleMessage) : The Mle message to check.
|
||||||
cid (int): The context id of the domain prefix.
|
cid (int): The context id of the prefix.
|
||||||
iid (string): The Interface Identifier.
|
iid (string): The Interface Identifier.
|
||||||
cid_present_once(boolean): True if cid entry should appear only once in AR Tlv.
|
cid_present_once(boolean): True if cid entry should appear only once in AR Tlv.
|
||||||
False otherwise.
|
False otherwise.
|
||||||
|
|||||||
@@ -60,8 +60,6 @@ LINK_LOCAL_ALL_ROUTERS_ADDRESS = 'ff02::2'
|
|||||||
TMF_PORT = 61631
|
TMF_PORT = 61631
|
||||||
|
|
||||||
DOMAIN_PREFIX = 'fd00:7d03:7d03:7d03::/64'
|
DOMAIN_PREFIX = 'fd00:7d03:7d03:7d03::/64'
|
||||||
DOMAIN_PREFIX_REGEX_PATTERN = '^fd00:7d03:7d03:7d03:'
|
|
||||||
DOMAIN_PREFIX_ALTER = 'fd00:7d04:7d04:7d04::/64'
|
|
||||||
|
|
||||||
PORT_OFFSET = int(os.getenv('PORT_OFFSET', '0'))
|
PORT_OFFSET = int(os.getenv('PORT_OFFSET', '0'))
|
||||||
BACKBONE_IPV6_ADDR_START = f'{0x9100 + PORT_OFFSET:04x}'
|
BACKBONE_IPV6_ADDR_START = f'{0x9100 + PORT_OFFSET:04x}'
|
||||||
@@ -77,9 +75,6 @@ OTBR_DOCKER_NAME_PREFIX = f'otbr_{PORT_OFFSET}_'
|
|||||||
|
|
||||||
ALL_NETWORK_BBRS_ADDRESS = 'ff32:40:fd00:db8:0:0:0:3'
|
ALL_NETWORK_BBRS_ADDRESS = 'ff32:40:fd00:db8:0:0:0:3'
|
||||||
|
|
||||||
ALL_DOMAIN_BBRS_ADDRESS = 'ff32:40:fd00:7d03:7d03:7d03:0:3'
|
|
||||||
ALL_DOMAIN_BBRS_ADDRESS_ALTER = 'ff32:40:fd00:7d04:7d04:7d04:0:3'
|
|
||||||
|
|
||||||
ONLINK_GUA_PREFIX = '2021::/64'
|
ONLINK_GUA_PREFIX = '2021::/64'
|
||||||
|
|
||||||
# Any address starts with 'fd' are considered on-link address.
|
# Any address starts with 'fd' are considered on-link address.
|
||||||
|
|||||||
@@ -1608,14 +1608,6 @@ class NodeImpl:
|
|||||||
self.send_command(cmd)
|
self.send_command(cmd)
|
||||||
self._expect_done()
|
self._expect_done()
|
||||||
|
|
||||||
def set_domain_prefix(self, prefix, flags='prosD'):
|
|
||||||
self.add_prefix(prefix, flags)
|
|
||||||
self.register_netdata()
|
|
||||||
|
|
||||||
def remove_domain_prefix(self, prefix):
|
|
||||||
self.remove_prefix(prefix)
|
|
||||||
self.register_netdata()
|
|
||||||
|
|
||||||
def multicast_listener_list(self) -> Dict[IPv6Address, int]:
|
def multicast_listener_list(self) -> Dict[IPv6Address, int]:
|
||||||
cmd = 'bbr mgmt mlr listener'
|
cmd = 'bbr mgmt mlr listener'
|
||||||
self.send_command(cmd)
|
self.send_command(cmd)
|
||||||
|
|||||||
@@ -448,7 +448,6 @@ class TestCase(NcpSupportMixin, unittest.TestCase):
|
|||||||
'interface': config.BACKBONE_DOCKER_NETWORK_NAME,
|
'interface': config.BACKBONE_DOCKER_NETWORK_NAME,
|
||||||
'prefix': config.BACKBONE_PREFIX,
|
'prefix': config.BACKBONE_PREFIX,
|
||||||
},
|
},
|
||||||
'domain_prefix': config.DOMAIN_PREFIX,
|
|
||||||
'env': {
|
'env': {
|
||||||
'PORT_OFFSET': config.PORT_OFFSET,
|
'PORT_OFFSET': config.PORT_OFFSET,
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -2754,164 +2754,6 @@ void TestLocalOnLinkPrefixDeprecation(void)
|
|||||||
FinalizeTest();
|
FinalizeTest();
|
||||||
}
|
}
|
||||||
|
|
||||||
#if OPENTHREAD_CONFIG_BACKBONE_ROUTER_ENABLE
|
|
||||||
void TestDomainPrefixAsOmr(void)
|
|
||||||
{
|
|
||||||
Ip6::Prefix localOnLink;
|
|
||||||
Ip6::Prefix localOmr;
|
|
||||||
Ip6::Prefix domainPrefix = PrefixFromString("2000:0000:1111:4444::", 64);
|
|
||||||
NetworkData::OnMeshPrefixConfig prefixConfig;
|
|
||||||
uint16_t heapAllocations;
|
|
||||||
|
|
||||||
Log("--------------------------------------------------------------------------------------------");
|
|
||||||
Log("TestDomainPrefixAsOmr");
|
|
||||||
|
|
||||||
InitTest();
|
|
||||||
|
|
||||||
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
||||||
// Start Routing Manager. Check emitted RS and RA messages.
|
|
||||||
|
|
||||||
sRsEmitted = false;
|
|
||||||
sRaValidated = false;
|
|
||||||
sExpectedPio = kPioAdvertisingLocalOnLink;
|
|
||||||
sExpectedRios.Clear();
|
|
||||||
|
|
||||||
heapAllocations = sHeapAllocatedPtrs.GetLength();
|
|
||||||
SuccessOrQuit(sInstance->Get<BorderRouter::RoutingManager>().SetEnabled(true));
|
|
||||||
|
|
||||||
SuccessOrQuit(sInstance->Get<BorderRouter::RoutingManager>().GetOnLinkPrefix(localOnLink));
|
|
||||||
SuccessOrQuit(sInstance->Get<BorderRouter::RoutingManager>().GetOmrPrefix(localOmr));
|
|
||||||
|
|
||||||
Log("Local on-link prefix is %s", localOnLink.ToString().AsCString());
|
|
||||||
Log("Local OMR prefix is %s", localOmr.ToString().AsCString());
|
|
||||||
|
|
||||||
sExpectedRios.Add(localOmr);
|
|
||||||
|
|
||||||
AdvanceTime(30000);
|
|
||||||
|
|
||||||
VerifyOrQuit(sRsEmitted);
|
|
||||||
VerifyOrQuit(sRaValidated);
|
|
||||||
VerifyOrQuit(sExpectedRios.SawAll());
|
|
||||||
Log("Received RA was validated");
|
|
||||||
|
|
||||||
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
||||||
// Check Network Data to include the local OMR and on-link prefix.
|
|
||||||
|
|
||||||
VerifyOmrPrefixInNetData(localOmr, /* aDefaultRoute */ false);
|
|
||||||
VerifyExternalRouteInNetData(kUlaRoute, kWithAdvPioFlagSet);
|
|
||||||
|
|
||||||
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
||||||
// Add a domain prefix directly into net data. The new prefix should
|
|
||||||
// be favored over the local OMR prefix.
|
|
||||||
|
|
||||||
otBackboneRouterSetEnabled(sInstance, true);
|
|
||||||
|
|
||||||
prefixConfig.Clear();
|
|
||||||
prefixConfig.mPrefix = domainPrefix;
|
|
||||||
prefixConfig.mStable = true;
|
|
||||||
prefixConfig.mSlaac = true;
|
|
||||||
prefixConfig.mPreferred = true;
|
|
||||||
prefixConfig.mOnMesh = true;
|
|
||||||
prefixConfig.mDefaultRoute = false;
|
|
||||||
prefixConfig.mDp = true;
|
|
||||||
prefixConfig.mPreference = NetworkData::kRoutePreferenceMedium;
|
|
||||||
|
|
||||||
SuccessOrQuit(otBorderRouterAddOnMeshPrefix(sInstance, &prefixConfig));
|
|
||||||
SuccessOrQuit(otBorderRouterRegister(sInstance));
|
|
||||||
|
|
||||||
AdvanceTime(100);
|
|
||||||
|
|
||||||
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
||||||
// Make sure BR emits RA without domain prefix or previous local OMR.
|
|
||||||
|
|
||||||
sRaValidated = false;
|
|
||||||
sExpectedPio = kPioAdvertisingLocalOnLink;
|
|
||||||
sExpectedRios.Clear();
|
|
||||||
sExpectedRios.Add(domainPrefix);
|
|
||||||
sExpectedRios.Add(localOmr);
|
|
||||||
|
|
||||||
AdvanceTime(20000);
|
|
||||||
|
|
||||||
VerifyOrQuit(sRaValidated);
|
|
||||||
|
|
||||||
// We should see RIO removing the local OMR prefix with lifetime zero
|
|
||||||
// and should not see the domain prefix as RIO.
|
|
||||||
|
|
||||||
VerifyOrQuit(sExpectedRios[0].mPrefix == domainPrefix);
|
|
||||||
VerifyOrQuit(!sExpectedRios[0].mSawInRa);
|
|
||||||
|
|
||||||
VerifyOrQuit(sExpectedRios[1].mPrefix == localOmr);
|
|
||||||
VerifyOrQuit(sExpectedRios[1].mSawInRa);
|
|
||||||
VerifyOrQuit(sExpectedRios[1].mLifetime <= kRioDeprecatingLifetime);
|
|
||||||
VerifyOrQuit(sExpectedRios[1].mPreference == NetworkData::kRoutePreferenceLow);
|
|
||||||
|
|
||||||
// Wait long enough for deprecating RIO prefix to expire
|
|
||||||
AdvanceTime(3200000);
|
|
||||||
|
|
||||||
sRaValidated = false;
|
|
||||||
sExpectedPio = kPioAdvertisingLocalOnLink;
|
|
||||||
sExpectedRios.Clear();
|
|
||||||
sExpectedRios.Add(domainPrefix);
|
|
||||||
sExpectedRios.Add(localOmr);
|
|
||||||
|
|
||||||
// Wait for next RA (650 seconds).
|
|
||||||
|
|
||||||
AdvanceTime(650000);
|
|
||||||
|
|
||||||
VerifyOrQuit(sRaValidated);
|
|
||||||
|
|
||||||
// We should not see either domain prefix or local OMR
|
|
||||||
// as RIO.
|
|
||||||
|
|
||||||
VerifyOrQuit(!sExpectedRios[0].mSawInRa);
|
|
||||||
VerifyOrQuit(!sExpectedRios[1].mSawInRa);
|
|
||||||
|
|
||||||
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
||||||
// Check Network Data. We should now see that the local OMR prefix
|
|
||||||
// is removed.
|
|
||||||
|
|
||||||
VerifyOmrPrefixInNetData(domainPrefix, /* aDefaultRoute */ false);
|
|
||||||
VerifyExternalRouteInNetData(kUlaRoute, kWithAdvPioFlagSet);
|
|
||||||
|
|
||||||
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
||||||
// Remove the domain prefix from net data.
|
|
||||||
|
|
||||||
SuccessOrQuit(otBorderRouterRemoveOnMeshPrefix(sInstance, &domainPrefix));
|
|
||||||
SuccessOrQuit(otBorderRouterRegister(sInstance));
|
|
||||||
|
|
||||||
AdvanceTime(100);
|
|
||||||
|
|
||||||
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
||||||
// Make sure BR emits RA with local OMR prefix again.
|
|
||||||
|
|
||||||
sRaValidated = false;
|
|
||||||
sExpectedRios.Clear();
|
|
||||||
sExpectedRios.Add(localOmr);
|
|
||||||
|
|
||||||
AdvanceTime(20000);
|
|
||||||
|
|
||||||
VerifyOrQuit(sRaValidated);
|
|
||||||
VerifyOrQuit(sExpectedRios.SawAll());
|
|
||||||
|
|
||||||
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
||||||
// Check Network Data. We should see that the local OMR prefix is
|
|
||||||
// added again.
|
|
||||||
|
|
||||||
VerifyOmrPrefixInNetData(localOmr, /* aDefaultRoute */ false);
|
|
||||||
VerifyExternalRouteInNetData(kUlaRoute, kWithAdvPioFlagSet);
|
|
||||||
|
|
||||||
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
||||||
|
|
||||||
SuccessOrQuit(sInstance->Get<BorderRouter::RoutingManager>().SetEnabled(false));
|
|
||||||
AdvanceTime(3000);
|
|
||||||
|
|
||||||
VerifyOrQuit(heapAllocations == sHeapAllocatedPtrs.GetLength());
|
|
||||||
|
|
||||||
Log("End of TestDomainPrefixAsOmr");
|
|
||||||
FinalizeTest();
|
|
||||||
}
|
|
||||||
#endif // OPENTHREAD_CONFIG_BACKBONE_ROUTER_ENABLE
|
|
||||||
|
|
||||||
void TestExtPanIdChange(void)
|
void TestExtPanIdChange(void)
|
||||||
{
|
{
|
||||||
static constexpr uint32_t kMaxRaTxInterval = 196; // In seconds
|
static constexpr uint32_t kMaxRaTxInterval = 196; // In seconds
|
||||||
@@ -5594,9 +5436,6 @@ int main(void)
|
|||||||
ot::TestAdvNonUlaRoute();
|
ot::TestAdvNonUlaRoute();
|
||||||
ot::TestFavoredOnLinkPrefix();
|
ot::TestFavoredOnLinkPrefix();
|
||||||
ot::TestLocalOnLinkPrefixDeprecation();
|
ot::TestLocalOnLinkPrefixDeprecation();
|
||||||
#if OPENTHREAD_CONFIG_BACKBONE_ROUTER_ENABLE
|
|
||||||
ot::TestDomainPrefixAsOmr();
|
|
||||||
#endif
|
|
||||||
ot::TestExtPanIdChange();
|
ot::TestExtPanIdChange();
|
||||||
ot::TestConflictingPrefix();
|
ot::TestConflictingPrefix();
|
||||||
ot::TestPrefixStaleTime();
|
ot::TestPrefixStaleTime();
|
||||||
|
|||||||
@@ -632,9 +632,6 @@ class OpenThreadTHCI(object):
|
|||||||
self.__configBbrDataset(SeqNum=self.bbrSeqNum,
|
self.__configBbrDataset(SeqNum=self.bbrSeqNum,
|
||||||
MlrTimeout=self.bbrMlrTimeout,
|
MlrTimeout=self.bbrMlrTimeout,
|
||||||
ReRegDelay=self.bbrReRegDelay)
|
ReRegDelay=self.bbrReRegDelay)
|
||||||
# Add default domain prefix is not configured otherwise
|
|
||||||
if self.__useDefaultDomainPrefix:
|
|
||||||
self.__addDefaultDomainPrefix()
|
|
||||||
|
|
||||||
self.__executeCommand('ifconfig up')
|
self.__executeCommand('ifconfig up')
|
||||||
self.__executeCommand('thread start')
|
self.__executeCommand('thread start')
|
||||||
@@ -1473,8 +1470,6 @@ class OpenThreadTHCI(object):
|
|||||||
# to default when joining network
|
# to default when joining network
|
||||||
self.hasSetChannel = False
|
self.hasSetChannel = False
|
||||||
self.IsBeingTestedAsCommercialBBR = False
|
self.IsBeingTestedAsCommercialBBR = False
|
||||||
# indicate whether the default domain prefix is used.
|
|
||||||
self.__useDefaultDomainPrefix = True
|
|
||||||
self.__isUdpOpened = False
|
self.__isUdpOpened = False
|
||||||
self.IsHost = False
|
self.IsHost = False
|
||||||
|
|
||||||
@@ -1646,16 +1641,9 @@ class OpenThreadTHCI(object):
|
|||||||
"""
|
"""
|
||||||
assert (ipaddress.IPv6Network(P_Prefix.decode()))
|
assert (ipaddress.IPv6Network(P_Prefix.decode()))
|
||||||
|
|
||||||
# turn off default domain prefix if configBorderRouter is called before joining network
|
|
||||||
if P_dp == 0 and not self.__isOpenThreadRunning():
|
|
||||||
self.__useDefaultDomainPrefix = False
|
|
||||||
|
|
||||||
parameter = ''
|
parameter = ''
|
||||||
prf = ''
|
prf = ''
|
||||||
|
|
||||||
if P_dp:
|
|
||||||
P_slaac_preferred = 1
|
|
||||||
|
|
||||||
if P_slaac_preferred == 1:
|
if P_slaac_preferred == 1:
|
||||||
parameter += 'p'
|
parameter += 'p'
|
||||||
parameter += 'a'
|
parameter += 'a'
|
||||||
@@ -1672,10 +1660,6 @@ class OpenThreadTHCI(object):
|
|||||||
if P_on_mesh == 1:
|
if P_on_mesh == 1:
|
||||||
parameter += 'o'
|
parameter += 'o'
|
||||||
|
|
||||||
if P_dp == 1:
|
|
||||||
assert P_slaac_preferred and P_default and P_on_mesh and P_stable
|
|
||||||
parameter += 'D'
|
|
||||||
|
|
||||||
if P_preference == 1:
|
if P_preference == 1:
|
||||||
prf = 'high'
|
prf = 'high'
|
||||||
elif P_preference == 0:
|
elif P_preference == 0:
|
||||||
|
|||||||
Reference in New Issue
Block a user