From 318b4b077176cf259ae838ac0632c395b4a19357 Mon Sep 17 00:00:00 2001 From: Jonathan Hui Date: Thu, 4 Jun 2026 19:36:33 -0700 Subject: [PATCH] [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. --- include/openthread/backbone_router_ftd.h | 43 ----- include/openthread/border_routing.h | 2 - include/openthread/instance.h | 2 +- include/openthread/netdata.h | 2 +- src/cli/README.md | 5 +- src/cli/README_BR.md | 1 - src/cli/README_HISTORY.md | 1 - src/cli/README_NETDATA.md | 2 - src/cli/cli.cpp | 12 -- src/cli/cli_br.cpp | 1 - src/cli/cli_history.cpp | 1 - src/cli/cli_network_data.cpp | 6 - src/cli/cli_utils.cpp | 5 - src/core/api/backbone_router_ftd_api.cpp | 12 -- src/core/api/border_router_api.cpp | 28 +-- src/core/backbone_router/backbone_tmf.cpp | 6 +- src/core/backbone_router/bbr_leader.cpp | 67 +------- src/core/backbone_router/bbr_leader.hpp | 41 +---- src/core/backbone_router/bbr_local.cpp | 116 ------------- src/core/backbone_router/bbr_local.hpp | 83 +-------- src/core/border_router/br_types.cpp | 10 +- src/core/border_router/br_types.hpp | 15 -- src/core/border_router/routing_manager.cpp | 16 +- src/core/config/border_router.h | 1 - src/core/net/slaac_address.cpp | 2 +- src/core/thread/network_data.cpp | 2 +- src/core/thread/network_data.hpp | 3 - src/core/thread/network_data_notifier.hpp | 1 - src/core/thread/network_data_tlvs.hpp | 10 +- src/core/thread/network_data_types.cpp | 9 +- src/core/thread/network_data_types.hpp | 1 - src/ncp/ncp_base_mtd.cpp | 7 +- src/posix/platform/firewall.cpp | 4 - .../border_router/test_firewall.py | 2 +- tests/scripts/thread-cert/command.py | 2 +- tests/scripts/thread-cert/config.py | 5 - tests/scripts/thread-cert/node.py | 8 - tests/scripts/thread-cert/thread_cert.py | 1 - tests/unit/test_routing_manager.cpp | 161 ------------------ tools/harness-thci/OpenThread.py | 16 -- 40 files changed, 32 insertions(+), 680 deletions(-) diff --git a/include/openthread/backbone_router_ftd.h b/include/openthread/backbone_router_ftd.h index ae727818f..28f81c17d 100644 --- a/include/openthread/backbone_router_ftd.h +++ b/include/openthread/backbone_router_ftd.h @@ -43,7 +43,6 @@ #include #include #include -#include #ifdef __cplusplus extern "C" { @@ -175,17 +174,6 @@ uint8_t otBackboneRouterGetRegistrationJitter(otInstance *aInstance); */ 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. * @@ -300,37 +288,6 @@ otError otBackboneRouterMulticastListenerGetNext(otInstance otBackboneRouterMulticastListenerIterator *aIterator, 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); - /** * @} */ diff --git a/include/openthread/border_routing.h b/include/openthread/border_routing.h index 4b957f5cd..5d365bd44 100644 --- a/include/openthread/border_routing.h +++ b/include/openthread/border_routing.h @@ -603,7 +603,6 @@ otError otBorderRoutingGetNextRouterEntry(otInstance *aI * * - 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 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. * @@ -629,7 +628,6 @@ otError otBorderRoutingGetNextPeerBrEntry(otInstance * * * - 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 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. * diff --git a/include/openthread/instance.h b/include/openthread/instance.h index a13ba8374..ceb9edc82 100644 --- a/include/openthread/instance.h +++ b/include/openthread/instance.h @@ -52,7 +52,7 @@ extern "C" { * * @note This number versions both OpenThread platform and user APIs. */ -#define OPENTHREAD_API_VERSION (602) +#define OPENTHREAD_API_VERSION (603) /** * @addtogroup api-instance diff --git a/include/openthread/netdata.h b/include/openthread/netdata.h index f943ec0d0..e36773a4a 100644 --- a/include/openthread/netdata.h +++ b/include/openthread/netdata.h @@ -73,7 +73,7 @@ typedef struct otBorderRouterConfig bool mOnMesh : 1; ///< Whether this prefix is considered on-mesh. 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 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). } otBorderRouterConfig; diff --git a/src/cli/README.md b/src/cli/README.md index fbc318598..2391f0423 100644 --- a/src/cli/README.md +++ b/src/cli/README.md @@ -3543,7 +3543,7 @@ Done ### 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 > prefix @@ -3556,8 +3556,6 @@ Done Add a valid prefix to the Network Data. -Note: The Domain Prefix flag (`D`) is only available for Thread 1.2. - - p: Preferred flag - a: Stateless IPv6 Address Autoconfiguration 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 - s: Stable flag - n: Nd Dns flag -- D: Domain Prefix flag - prf: Default router preference, which may be 'high', 'med', or 'low'. ```bash diff --git a/src/cli/README_BR.md b/src/cli/README_BR.md index 752d24513..734d026d4 100644 --- a/src/cli/README_BR.md +++ b/src/cli/README_BR.md @@ -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 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. diff --git a/src/cli/README_HISTORY.md b/src/cli/README_HISTORY.md index e1e5c23d4..c0b6829e3 100644 --- a/src/cli/README_HISTORY.md +++ b/src/cli/README_HISTORY.md @@ -466,7 +466,6 @@ The flags are as follows: - `o`: On Mesh flag - `s`: Stable flag - `n`: Nd Dns flag -- `D`: Domain Prefix flag Print the history as a table. diff --git a/src/cli/README_NETDATA.md b/src/cli/README_NETDATA.md index 365392bf2..53a4ce026 100644 --- a/src/cli/README_NETDATA.md +++ b/src/cli/README_NETDATA.md @@ -283,7 +283,6 @@ Publish an on-mesh prefix entry. - o: On Mesh flag - s: Stable flag - n: Nd Dns flag -- D: Domain Prefix flag (only available for Thread 1.2). - prf: Preference, which may be 'high', 'med', or 'low'. ```bash @@ -352,7 +351,6 @@ On-mesh prefixes are listed under `Prefixes` header: - o: On Mesh flag - s: Stable flag - n: Nd Dns flag - - D: Domain Prefix flag (only available for Thread 1.2). - Preference `high`, `med`, or `low` - RLOC16 of device which added the on-mesh prefix diff --git a/src/cli/cli.cpp b/src/cli/cli.cpp index f6c0dc9e4..95a01d183 100644 --- a/src/cli/cli.cpp +++ b/src/cli/cli.cpp @@ -5450,9 +5450,6 @@ template <> otError Interpreter::Process(Arg aArgs[]) * @endcode * @par * 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 * For more information about #otBorderRouterConfig flags, refer to @overview. * @sa otBorderRouterGetNextOnMeshPrefix @@ -5466,15 +5463,6 @@ template <> otError Interpreter::Process(Arg aArgs[]) { 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 diff --git a/src/cli/cli_br.cpp b/src/cli/cli_br.cpp index e46c098f0..722ebbb30 100644 --- a/src/cli/cli_br.cpp +++ b/src/cli/cli_br.cpp @@ -670,7 +670,6 @@ template <> otError Br::Process(Arg aArgs[]) * Data entries: * - 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 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. * Info per BR entry: * - RLOC16 of the BR diff --git a/src/cli/cli_history.cpp b/src/cli/cli_history.cpp index 9642fc506..936a44741 100644 --- a/src/cli/cli_history.cpp +++ b/src/cli/cli_history.cpp @@ -1305,7 +1305,6 @@ void History::OutputRxTxEntryTableFormat(const otHistoryTrackerMessageInfo &aInf * * `o`: On mesh flag. * * `s`: Stable flag. * * `n`: Nd Dns flag. - * * `D`: Domain prefix flag. * * Pref: Preference. Values can be either `high`, `med`, or `low`. * * RLOC16 * @sa otHistoryTrackerIterateOnMeshPrefixHistory diff --git a/src/cli/cli_network_data.cpp b/src/cli/cli_network_data.cpp index f5cb627f3..852c01f2d 100644 --- a/src/cli/cli_network_data.cpp +++ b/src/cli/cli_network_data.cpp @@ -96,11 +96,6 @@ void NetworkData::PrefixFlagsToString(const otBorderRouterConfig &aConfig, Flags *flagsPtr++ = 'n'; } - if (aConfig.mDp) - { - *flagsPtr++ = 'D'; - } - *flagsPtr = '\0'; } @@ -804,7 +799,6 @@ exit: * * o: On Mesh flag * * s: Stable flag * * n: Nd Dns flag - * * D: Domain Prefix flag (only available for Thread 1.2). * * Preference `high`, `med`, or `low` * * RLOC16 of device which added the on-mesh prefix * @par diff --git a/src/cli/cli_utils.cpp b/src/cli/cli_utils.cpp index be7d94767..faeaad57e 100644 --- a/src/cli/cli_utils.cpp +++ b/src/cli/cli_utils.cpp @@ -710,11 +710,6 @@ otError Utils::ParsePrefix(Arg aArgs[], otBorderRouterConfig &aConfig) aConfig.mNdDns = true; break; -#if OPENTHREAD_FTD && OPENTHREAD_CONFIG_BACKBONE_ROUTER_ENABLE - case 'D': - aConfig.mDp = true; - break; -#endif case '-': break; diff --git a/src/core/api/backbone_router_ftd_api.cpp b/src/core/api/backbone_router_ftd_api.cpp index 28343d482..eb04c02df 100644 --- a/src/core/api/backbone_router_ftd_api.cpp +++ b/src/core/api/backbone_router_ftd_api.cpp @@ -82,18 +82,6 @@ void otBackboneRouterSetRegistrationJitter(otInstance *aInstance, uint8_t aJitte return AsCoreType(aInstance).Get().SetRegistrationJitter(aJitter); } -otError otBackboneRouterGetDomainPrefix(otInstance *aInstance, otBorderRouterConfig *aConfig) -{ - return AsCoreType(aInstance).Get().GetDomainPrefix(AsCoreType(aConfig)); -} - -void otBackboneRouterSetDomainPrefixCallback(otInstance *aInstance, - otBackboneRouterDomainPrefixCallback aCallback, - void *aContext) -{ - return AsCoreType(aInstance).Get().SetDomainPrefixCallback(aCallback, aContext); -} - #if OPENTHREAD_CONFIG_BACKBONE_ROUTER_MULTICAST_ROUTING_ENABLE void otBackboneRouterSetMulticastListenerCallback(otInstance *aInstance, otBackboneRouterMulticastListenerCallback aCallback, diff --git a/src/core/api/border_router_api.cpp b/src/core/api/border_router_api.cpp index d000b1c56..b52d43607 100644 --- a/src/core/api/border_router_api.cpp +++ b/src/core/api/border_router_api.cpp @@ -49,36 +49,12 @@ otError otBorderRouterGetNetData(otInstance *aInstance, bool aStable, uint8_t *a otError otBorderRouterAddOnMeshPrefix(otInstance *aInstance, const otBorderRouterConfig *aConfig) { - Error error = kErrorNone; - -#if OPENTHREAD_FTD && OPENTHREAD_CONFIG_BACKBONE_ROUTER_ENABLE - if (aConfig->mDp) - { - error = AsCoreType(aInstance).Get().SetDomainPrefix(AsCoreType(aConfig)); - } - else -#endif - { - error = AsCoreType(aInstance).Get().AddOnMeshPrefix(AsCoreType(aConfig)); - } - - return error; + return AsCoreType(aInstance).Get().AddOnMeshPrefix(AsCoreType(aConfig)); } otError otBorderRouterRemoveOnMeshPrefix(otInstance *aInstance, const otIp6Prefix *aPrefix) { - Error error = kErrorNone; - -#if OPENTHREAD_FTD && OPENTHREAD_CONFIG_BACKBONE_ROUTER_ENABLE - error = AsCoreType(aInstance).Get().RemoveDomainPrefix(AsCoreType(aPrefix)); - - if (error == kErrorNotFound) -#endif - { - error = AsCoreType(aInstance).Get().RemoveOnMeshPrefix(AsCoreType(aPrefix)); - } - - return error; + return AsCoreType(aInstance).Get().RemoveOnMeshPrefix(AsCoreType(aPrefix)); } otError otBorderRouterGetNextOnMeshPrefix(otInstance *aInstance, diff --git a/src/core/backbone_router/backbone_tmf.cpp b/src/core/backbone_router/backbone_tmf.cpp index b67419236..a68f4b0b1 100644 --- a/src/core/backbone_router/backbone_tmf.cpp +++ b/src/core/backbone_router/backbone_tmf.cpp @@ -116,12 +116,10 @@ bool BackboneTmfAgent::IsBackboneTmfMessage(const Ip6::MessageInfo &aMessageInfo // A Backbone TMF message must comply with following rules: // The destination must be one of: // 1. All Network BBRs (Link-Local scope) - // 2. All Domain BBRs (Link-Local scope) - // 3. A Backbone Link-Local address + // 2. A Backbone Link-Local address // The source must be a Backbone Link-local address. return (Get().IsEnabled() && src.IsLinkLocalUnicast() && - (dst.IsLinkLocalUnicast() || dst == Get().GetAllNetworkBackboneRoutersAddress() || - dst == Get().GetAllDomainBackboneRoutersAddress())); + (dst.IsLinkLocalUnicast() || dst == Get().GetAllNetworkBackboneRoutersAddress())); } void BackboneTmfAgent::SubscribeMulticast(const Ip6::Address &aAddress) diff --git a/src/core/backbone_router/bbr_leader.cpp b/src/core/backbone_router/bbr_leader.cpp index ec8396ee7..51d2d3754 100644 --- a/src/core/backbone_router/bbr_leader.cpp +++ b/src/core/backbone_router/bbr_leader.cpp @@ -90,13 +90,7 @@ Leader::Leader(Instance &aInstance) Reset(); } -void Leader::Reset(void) -{ - mConfig.MarkAsAbsent(); - - // Domain Prefix Length 0 indicates no available Domain Prefix in the Thread network. - mDomainPrefix.SetLength(0); -} +void Leader::Reset(void) { mConfig.MarkAsAbsent(); } Error Leader::ReadConfig(Config &aConfig) const { @@ -136,18 +130,6 @@ const char *Leader::PrimaryEventToString(PrimaryEvent 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) void Leader::HandleNotifierEvents(Events aEvents) @@ -155,7 +137,6 @@ void Leader::HandleNotifierEvents(Events aEvents) if (aEvents.ContainsAny(kEventThreadNetdataChanged | kEventThreadRoleChanged)) { UpdateBackboneRouterPrimary(); - UpdateDomainPrefixConfig(); } } @@ -212,52 +193,6 @@ exit: OT_UNUSED_VARIABLE(event); } -void Leader::UpdateDomainPrefixConfig(void) -{ - NetworkData::Iterator iterator = NetworkData::kIteratorInit; - NetworkData::OnMeshPrefixConfig prefixConfig; - DomainPrefixEvent event; - bool found = false; - - while (Get().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().HandleDomainPrefixUpdate(event); -#endif - -exit: - OT_UNUSED_VARIABLE(event); -} - -bool Leader::IsDomainUnicast(const Ip6::Address &aAddress) const -{ - return HasDomainPrefix() && aAddress.MatchesPrefix(mDomainPrefix); -} - } // namespace BackboneRouter } // namespace ot diff --git a/src/core/backbone_router/bbr_leader.hpp b/src/core/backbone_router/bbr_leader.hpp index dd6a22f8b..fc0b59d9f 100644 --- a/src/core/backbone_router/bbr_leader.hpp +++ b/src/core/backbone_router/bbr_leader.hpp @@ -67,16 +67,6 @@ static_assert(kDefaultMlrTimeout >= kMinMlrTimeout && kDefaultMlrTimeout <= kMax static_assert(kMaxMlrTimeout * 1000 > kMaxMlrTimeout, "SecToMsec(kMaxMlrTimeout) will overflow"); 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. */ @@ -220,47 +210,18 @@ public: */ 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: void HandleNotifierEvents(Events aEvents); void UpdateBackboneRouterPrimary(void); - void UpdateDomainPrefixConfig(void); #if OT_SHOULD_LOG_AT(OT_LOG_LEVEL_INFO) static const char *PrimaryEventToString(PrimaryEvent aEvent); - static const char *DomainPrefixEventToString(DomainPrefixEvent aEvent); #endif - Config mConfig; - Ip6::Prefix mDomainPrefix; + Config mConfig; }; } // namespace BackboneRouter -DefineMapEnum(otBackboneRouterDomainPrefixEvent, BackboneRouter::DomainPrefixEvent); DefineCoreType(otBackboneRouterConfig, BackboneRouter::Config); } // namespace ot diff --git a/src/core/backbone_router/bbr_local.cpp b/src/core/backbone_router/bbr_local.cpp index d6948dab3..be6947c35 100644 --- a/src/core/backbone_router/bbr_local.cpp +++ b/src/core/backbone_router/bbr_local.cpp @@ -53,8 +53,6 @@ Local::Local(Instance &aInstance) , mRegistrationTimeout(0) , mMlrTimeout(kDefaultMlrTimeout) { - mDomainPrefixConfig.GetPrefix().SetLength(0); - // Primary Backbone Router Aloc mBbrPrimaryAloc.InitAsThreadOriginMeshLocal(); mBbrPrimaryAloc.GetAddress().GetIid().InitAsLocator(Mle::Aloc16::ForPrimaryBackboneRouter()); @@ -65,13 +63,6 @@ Local::Local(Instance &aInstance) mAllNetworkBackboneRouters.mFields.m8[0] = 0xff; // Multicast mAllNetworkBackboneRouters.mFields.m8[1] = 0x32; // Flags = 3, Scope = 2 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) @@ -81,12 +72,10 @@ void Local::SetEnabled(bool aEnable) if (aEnable) { SetState(kStateSecondary); - AddDomainPrefixToNetworkData(); IgnoreError(AddService(kDecideBasedOnState)); } else { - RemoveDomainPrefixFromNetworkData(); RemoveService(); 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) { VerifyOrExit(IsEnabled()); @@ -383,40 +319,6 @@ exit: return; } -void Local::HandleDomainPrefixUpdate(DomainPrefixEvent aEvent) -{ - VerifyOrExit(IsEnabled()); - - if (aEvent == kDomainPrefixRemoved || aEvent == kDomainPrefixRefreshed) - { - Get().UnsubscribeMulticast(mAllDomainBackboneRouters); - } - - if (aEvent == kDomainPrefixAdded || aEvent == kDomainPrefixRefreshed) - { - mAllDomainBackboneRouters.SetMulticastNetworkPrefix(*Get().GetDomainPrefix()); - Get().SubscribeMulticast(mAllDomainBackboneRouters); - } - - mDomainPrefixCallback.InvokeIfSet(static_cast(aEvent), - Get().GetDomainPrefix()); - -exit: - return; -} - -void Local::RemoveDomainPrefixFromNetworkData(void) -{ - Error error = kErrorNotFound; // only used for logging. - - if (mDomainPrefixConfig.mPrefix.mLength > 0) - { - error = Get().RemoveOnMeshPrefix(mDomainPrefixConfig.GetPrefix()); - } - - LogDomainPrefix(kActionRemove, error); -} - void Local::IncrementSequenceNumber(void) { 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().AddOnMeshPrefix(mDomainPrefixConfig); - } - - LogDomainPrefix(kActionAdd, error); -} - #if OT_SHOULD_LOG_AT(OT_LOG_LEVEL_INFO) const char *Local::ActionToString(Action aAction) @@ -461,12 +351,6 @@ const char *Local::ActionToString(Action 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) { LogInfo("%s BBR Service: seqno (%u), delay (%us), timeout (%lus), %s", ActionToString(aAction), mSequenceNumber, diff --git a/src/core/backbone_router/bbr_local.hpp b/src/core/backbone_router/bbr_local.hpp index f31dc43e3..889d400f9 100644 --- a/src/core/backbone_router/bbr_local.hpp +++ b/src/core/backbone_router/bbr_local.hpp @@ -77,8 +77,6 @@ class Local : public InstanceLocator, private NonCopyable friend class ot::Notifier; public: - typedef otBackboneRouterDomainPrefixCallback DomainPrefixCallback; ///< Domain Prefix callback. - /** * Represents Backbone Router state. */ @@ -190,37 +188,6 @@ public: */ 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. * @@ -228,36 +195,11 @@ public: */ 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. */ 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: enum Action : uint8_t { @@ -271,33 +213,26 @@ private: void UpdateState(void); void RemoveService(void); void HandleTimeTick(void); - void AddDomainPrefixToNetworkData(void); - void RemoveDomainPrefixFromNetworkData(void); void IncrementSequenceNumber(void); #if OT_SHOULD_LOG_AT(OT_LOG_LEVEL_INFO) static const char *ActionToString(Action aAction); void LogService(Action aAction, Error aError); - void LogDomainPrefix(Action aAction, Error aError); #else void LogService(Action, Error) {} - void LogDomainPrefix(Action, Error) {} #endif // 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 // Backbone Router service for Secondary Backbone Router if it was added by force. - bool mIsServiceAdded; - State mState; - uint8_t mSequenceNumber; - uint8_t mRegistrationJitter; - uint16_t mReregistrationDelay; - uint16_t mRegistrationTimeout; - uint32_t mMlrTimeout; - NetworkData::OnMeshPrefixConfig mDomainPrefixConfig; - Ip6::Netif::UnicastAddress mBbrPrimaryAloc; - Ip6::Address mAllNetworkBackboneRouters; - Ip6::Address mAllDomainBackboneRouters; - Callback mDomainPrefixCallback; + bool mIsServiceAdded; + State mState; + uint8_t mSequenceNumber; + uint8_t mRegistrationJitter; + uint16_t mReregistrationDelay; + uint16_t mRegistrationTimeout; + uint32_t mMlrTimeout; + Ip6::Netif::UnicastAddress mBbrPrimaryAloc; + Ip6::Address mAllNetworkBackboneRouters; }; } // namespace BackboneRouter diff --git a/src/core/border_router/br_types.cpp b/src/core/border_router/br_types.cpp index 257f2aa78..b9471e1db 100644 --- a/src/core/border_router/br_types.cpp +++ b/src/core/border_router/br_types.cpp @@ -284,16 +284,14 @@ bool FavoredOmrPrefix::IsInfrastructureDerived(void) const void FavoredOmrPrefix::SetFrom(const NetworkData::OnMeshPrefixConfig &aOnMeshPrefixConfig) { - mPrefix = aOnMeshPrefixConfig.GetPrefix(); - mPreference = aOnMeshPrefixConfig.GetPreference(); - mIsDomainPrefix = aOnMeshPrefixConfig.mDp; + mPrefix = aOnMeshPrefixConfig.GetPrefix(); + mPreference = aOnMeshPrefixConfig.GetPreference(); } void FavoredOmrPrefix::SetFrom(const OmrPrefix &aOmrPrefix) { - mPrefix = aOmrPrefix.GetPrefix(); - mPreference = aOmrPrefix.GetPreference(); - mIsDomainPrefix = aOmrPrefix.IsDomainPrefix(); + mPrefix = aOmrPrefix.GetPrefix(); + mPreference = aOmrPrefix.GetPreference(); } bool FavoredOmrPrefix::IsFavoredOver(const NetworkData::OnMeshPrefixConfig &aOmrPrefixConfig) const diff --git a/src/core/border_router/br_types.hpp b/src/core/border_router/br_types.hpp index 77eaa3082..45a992134 100644 --- a/src/core/border_router/br_types.hpp +++ b/src/core/border_router/br_types.hpp @@ -569,20 +569,6 @@ public: */ 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); /** @@ -599,7 +585,6 @@ public: protected: Ip6::Prefix mPrefix; RoutePreference mPreference; - bool mIsDomainPrefix; }; //- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/core/border_router/routing_manager.cpp b/src/core/border_router/routing_manager.cpp index 72bb501ad..aa45113cf 100644 --- a/src/core/border_router/routing_manager.cpp +++ b/src/core/border_router/routing_manager.cpp @@ -1169,11 +1169,6 @@ RoutingManager::OmrPrefixManager::InfoString RoutingManager::OmrPrefixManager::F string.Append("%s (prf:%s", aFavoredPrefix.GetPrefix().ToString().AsCString(), RoutePreferenceToString(aFavoredPrefix.GetPreference())); - if (aFavoredPrefix.IsDomainPrefix()) - { - string.Append(", domain"); - } - if (aFavoredPrefix.GetPrefix() == mLocalPrefix.GetPrefix()) { string.Append(", local"); @@ -1909,7 +1904,7 @@ Error RoutingManager::RioAdvertiser::AppendRios(RouterAdvert::TxMessage &aRaMess // (2) Favored OMR prefix. - if (!omrPrefixManager.GetFavoredPrefix().IsEmpty() && !omrPrefixManager.GetFavoredPrefix().IsDomainPrefix()) + if (!omrPrefixManager.GetFavoredPrefix().IsEmpty()) { 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 // delays in registering changes with the leader. - if (prefixConfig.mDp) - { - continue; - } - if (IsValidOmrPrefix(prefixConfig) && (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; while (Get().GetNext(iterator, prefixConfig) == kErrorNone) { - if (prefixConfig.mOnMesh && !prefixConfig.mDp && !IsValidOmrPrefix(prefixConfig)) + if (prefixConfig.mOnMesh && !IsValidOmrPrefix(prefixConfig)) { mPrefixes.Add(prefixConfig.GetPrefix()); } diff --git a/src/core/config/border_router.h b/src/core/config/border_router.h index 5235ea8b9..dd6d901d7 100644 --- a/src/core/config/border_router.h +++ b/src/core/config/border_router.h @@ -66,7 +66,6 @@ * * - 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 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 * by sending an "Address Solicit" request to leader with status reason `BorderRouterRequest`. This reason is used when diff --git a/src/core/net/slaac_address.cpp b/src/core/net/slaac_address.cpp index e960eb119..efe6f6113 100644 --- a/src/core/net/slaac_address.cpp +++ b/src/core/net/slaac_address.cpp @@ -118,7 +118,7 @@ Error Slaac::FindDomainIdFor(const Address &aAddress, uint8_t &aDomainId) 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 diff --git a/src/core/thread/network_data.cpp b/src/core/thread/network_data.cpp index e90daf2a3..94696a68b 100644 --- a/src/core/thread/network_data.cpp +++ b/src/core/thread/network_data.cpp @@ -514,7 +514,7 @@ void NetworkData::FindRlocs(BorderRouterFilter aBrFilter, RoleFilter aRoleFilter case kAnyBrOrServer: break; case kBrProvidingExternalIpConn: - matches = prefix.mOnMesh && (prefix.mDefaultRoute || prefix.mDp); + matches = prefix.mOnMesh && prefix.mDefaultRoute; break; } diff --git a/src/core/thread/network_data.hpp b/src/core/thread/network_data.hpp index 05e5bfc6a..7555432b9 100644 --- a/src/core/thread/network_data.hpp +++ b/src/core/thread/network_data.hpp @@ -274,7 +274,6 @@ public: * * - 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 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 * 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 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 * 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 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 * full set and not the stable subset). diff --git a/src/core/thread/network_data_notifier.hpp b/src/core/thread/network_data_notifier.hpp index 79b480387..e8e1da9aa 100644 --- a/src/core/thread/network_data_notifier.hpp +++ b/src/core/thread/network_data_notifier.hpp @@ -105,7 +105,6 @@ public: * * - 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 domain prefix (domain and on-mesh flags set). * * Does not check the current role of device. * diff --git a/src/core/thread/network_data_tlvs.hpp b/src/core/thread/network_data_tlvs.hpp index 108c2c1ea..a9c8fea89 100644 --- a/src/core/thread/network_data_tlvs.hpp +++ b/src/core/thread/network_data_tlvs.hpp @@ -945,14 +945,6 @@ public: */ 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 * @@ -999,7 +991,7 @@ private: static constexpr uint16_t kDefaultRouteFlag = 1 << 9; static constexpr uint16_t kOnMeshFlag = 1 << 8; 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 mFlags; diff --git a/src/core/thread/network_data_types.cpp b/src/core/thread/network_data_types.cpp index b1176b0a0..71985a7b5 100644 --- a/src/core/thread/network_data_types.cpp +++ b/src/core/thread/network_data_types.cpp @@ -116,13 +116,6 @@ uint16_t OnMeshPrefixConfig::ConvertToTlvFlags(void) const flags |= BorderRouterEntry::kNdDnsFlag; } -#if OPENTHREAD_FTD && OPENTHREAD_CONFIG_BACKBONE_ROUTER_ENABLE - if (mDp) - { - flags |= BorderRouterEntry::kDpFlag; - } -#endif - flags |= (static_cast(RoutePreferenceToValue(mPreference)) << BorderRouterEntry::kPreferenceOffset); return flags; @@ -151,7 +144,7 @@ void OnMeshPrefixConfig::SetFromTlvFlags(uint16_t aFlags) mDefaultRoute = ((aFlags & BorderRouterEntry::kDefaultRouteFlag) != 0); mOnMesh = ((aFlags & BorderRouterEntry::kOnMeshFlag) != 0); mNdDns = ((aFlags & BorderRouterEntry::kNdDnsFlag) != 0); - mDp = ((aFlags & BorderRouterEntry::kDpFlag) != 0); + mDp = false; mPreference = RoutePreferenceFromValue(static_cast(aFlags >> BorderRouterEntry::kPreferenceOffset)); } diff --git a/src/core/thread/network_data_types.hpp b/src/core/thread/network_data_types.hpp index 65a184403..e6f54b353 100644 --- a/src/core/thread/network_data_types.hpp +++ b/src/core/thread/network_data_types.hpp @@ -112,7 +112,6 @@ enum RoleFilter : uint8_t * * - 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 domain prefix (domain and on-mesh flags set). */ enum BorderRouterFilter : uint8_t { diff --git a/src/ncp/ncp_base_mtd.cpp b/src/ncp/ncp_base_mtd.cpp index 9095c86dc..cb372b3d3 100644 --- a/src/ncp/ncp_base_mtd.cpp +++ b/src/ncp/ncp_base_mtd.cpp @@ -129,11 +129,6 @@ static uint8_t BorderRouterConfigToFlagByteExtended(const otBorderRouterConfig & flags |= SPINEL_NET_FLAG_EXT_DNS; } - if (aConfig.mDp) - { - flags |= SPINEL_NET_FLAG_EXT_DP; - } - return flags; } @@ -1026,7 +1021,7 @@ template <> otError NcpBase::HandlePropertyInsert Dict[IPv6Address, int]: cmd = 'bbr mgmt mlr listener' self.send_command(cmd) diff --git a/tests/scripts/thread-cert/thread_cert.py b/tests/scripts/thread-cert/thread_cert.py index e8235e5ee..07c0941ff 100644 --- a/tests/scripts/thread-cert/thread_cert.py +++ b/tests/scripts/thread-cert/thread_cert.py @@ -448,7 +448,6 @@ class TestCase(NcpSupportMixin, unittest.TestCase): 'interface': config.BACKBONE_DOCKER_NETWORK_NAME, 'prefix': config.BACKBONE_PREFIX, }, - 'domain_prefix': config.DOMAIN_PREFIX, 'env': { 'PORT_OFFSET': config.PORT_OFFSET, }, diff --git a/tests/unit/test_routing_manager.cpp b/tests/unit/test_routing_manager.cpp index 9242ecb25..5d03a96e2 100644 --- a/tests/unit/test_routing_manager.cpp +++ b/tests/unit/test_routing_manager.cpp @@ -2754,164 +2754,6 @@ void TestLocalOnLinkPrefixDeprecation(void) 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().SetEnabled(true)); - - SuccessOrQuit(sInstance->Get().GetOnLinkPrefix(localOnLink)); - SuccessOrQuit(sInstance->Get().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().SetEnabled(false)); - AdvanceTime(3000); - - VerifyOrQuit(heapAllocations == sHeapAllocatedPtrs.GetLength()); - - Log("End of TestDomainPrefixAsOmr"); - FinalizeTest(); -} -#endif // OPENTHREAD_CONFIG_BACKBONE_ROUTER_ENABLE - void TestExtPanIdChange(void) { static constexpr uint32_t kMaxRaTxInterval = 196; // In seconds @@ -5594,9 +5436,6 @@ int main(void) ot::TestAdvNonUlaRoute(); ot::TestFavoredOnLinkPrefix(); ot::TestLocalOnLinkPrefixDeprecation(); -#if OPENTHREAD_CONFIG_BACKBONE_ROUTER_ENABLE - ot::TestDomainPrefixAsOmr(); -#endif ot::TestExtPanIdChange(); ot::TestConflictingPrefix(); ot::TestPrefixStaleTime(); diff --git a/tools/harness-thci/OpenThread.py b/tools/harness-thci/OpenThread.py index e51d28d89..3dc751e64 100644 --- a/tools/harness-thci/OpenThread.py +++ b/tools/harness-thci/OpenThread.py @@ -632,9 +632,6 @@ class OpenThreadTHCI(object): self.__configBbrDataset(SeqNum=self.bbrSeqNum, MlrTimeout=self.bbrMlrTimeout, ReRegDelay=self.bbrReRegDelay) - # Add default domain prefix is not configured otherwise - if self.__useDefaultDomainPrefix: - self.__addDefaultDomainPrefix() self.__executeCommand('ifconfig up') self.__executeCommand('thread start') @@ -1473,8 +1470,6 @@ class OpenThreadTHCI(object): # to default when joining network self.hasSetChannel = False self.IsBeingTestedAsCommercialBBR = False - # indicate whether the default domain prefix is used. - self.__useDefaultDomainPrefix = True self.__isUdpOpened = False self.IsHost = False @@ -1646,16 +1641,9 @@ class OpenThreadTHCI(object): """ 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 = '' prf = '' - if P_dp: - P_slaac_preferred = 1 - if P_slaac_preferred == 1: parameter += 'p' parameter += 'a' @@ -1672,10 +1660,6 @@ class OpenThreadTHCI(object): if P_on_mesh == 1: 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: prf = 'high' elif P_preference == 0: