mirror of
https://github.com/espressif/openthread.git
synced 2026-06-05 21:14:49 +00:00
[dua] completely remove DUA features and configurations (#13191)
This commit removes the OPENTHREAD_CONFIG_TMF_PROXY_DUA_ENABLE feature and all associated code, tests, CLI commands, and harness references. Changes: - Removed OPENTHREAD_CONFIG_TMF_PROXY_DUA_ENABLE definition and all assert/preprocessor checks. - Completely deleted dua_manager.cpp and dua_manager.hpp. - Removed DUA registration notifying and request URI paths. - Cleaned up all references to Domain Unicast Address (DUA) across child management, notifier, time ticker, and MLE. - Removed DUA commands and logic from the CLI and Python cert tests (including packet verifier). - Verified that the entire codebase compiles clean and all tests successfully pass using the Nexus test suite.
This commit is contained in:
@@ -80,7 +80,7 @@ jobs:
|
|||||||
PYTHONPATH=./tests/scripts/thread-cert pytype tools/otci
|
PYTHONPATH=./tests/scripts/thread-cert pytype tools/otci
|
||||||
- name: Build
|
- name: Build
|
||||||
run: |
|
run: |
|
||||||
./script/cmake-build simulation -DOT_THREAD_VERSION=1.4 -DOT_DUA=ON -DOT_MLR=ON -DOT_BACKBONE_ROUTER=ON \
|
./script/cmake-build simulation -DOT_THREAD_VERSION=1.4 -DOT_MLR=ON -DOT_BACKBONE_ROUTER=ON \
|
||||||
-DOT_CSL_RECEIVER=ON -DOT_SIMULATION_VIRTUAL_TIME=${VIRTUAL_TIME}
|
-DOT_CSL_RECEIVER=ON -DOT_SIMULATION_VIRTUAL_TIME=${VIRTUAL_TIME}
|
||||||
- name: Install OTCI Python Library
|
- name: Install OTCI Python Library
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
@@ -350,7 +350,6 @@ do_build_otbr_docker()
|
|||||||
"-DOT_SRP_CLIENT=ON"
|
"-DOT_SRP_CLIENT=ON"
|
||||||
"-DOT_FULL_LOGS=ON"
|
"-DOT_FULL_LOGS=ON"
|
||||||
"-DOT_UPTIME=ON"
|
"-DOT_UPTIME=ON"
|
||||||
"-DOTBR_DUA_ROUTING=ON"
|
|
||||||
"-DOTBR_DHCP6_PD=ON"
|
"-DOTBR_DHCP6_PD=ON"
|
||||||
)
|
)
|
||||||
local args=(
|
local args=(
|
||||||
|
|||||||
@@ -50,7 +50,6 @@ Done
|
|||||||
- [discover](#discover-channel)
|
- [discover](#discover-channel)
|
||||||
- [dns](#dns-config)
|
- [dns](#dns-config)
|
||||||
- [domainname](#domainname)
|
- [domainname](#domainname)
|
||||||
- [dua](#dua-iid)
|
|
||||||
- [eidcache](#eidcache)
|
- [eidcache](#eidcache)
|
||||||
- [eui64](#eui64)
|
- [eui64](#eui64)
|
||||||
- [extaddr](#extaddr)
|
- [extaddr](#extaddr)
|
||||||
@@ -174,30 +173,6 @@ BBR Primary: None
|
|||||||
Done
|
Done
|
||||||
```
|
```
|
||||||
|
|
||||||
### bbr mgmt dua \<status\|coap-code\> [meshLocalIid]
|
|
||||||
|
|
||||||
Configure the response status for DUA.req with meshLocalIid in payload. Without meshLocalIid, simply respond any coming DUA.req next with the specified status or COAP code.
|
|
||||||
|
|
||||||
Only for testing/reference device.
|
|
||||||
|
|
||||||
known status value:
|
|
||||||
|
|
||||||
- 0: ST_DUA_SUCCESS
|
|
||||||
- 1: ST_DUA_REREGISTER
|
|
||||||
- 2: ST_DUA_INVALID
|
|
||||||
- 3: ST_DUA_DUPLICATE
|
|
||||||
- 4: ST_DUA_NO_RESOURCES
|
|
||||||
- 5: ST_DUA_BBR_NOT_PRIMARY
|
|
||||||
- 6: ST_DUA_GENERAL_FAILURE
|
|
||||||
- 160: COAP code 5.00
|
|
||||||
|
|
||||||
```bash
|
|
||||||
> bbr mgmt dua 1 2f7c235e5025a2fd
|
|
||||||
Done
|
|
||||||
> bbr mgmt dua 160
|
|
||||||
Done
|
|
||||||
```
|
|
||||||
|
|
||||||
### bbr mgmt mlr listener
|
### bbr mgmt mlr listener
|
||||||
|
|
||||||
Show the Multicast Listeners.
|
Show the Multicast Listeners.
|
||||||
@@ -1959,34 +1934,6 @@ Set the Thread Domain Name for Thread 1.2 device.
|
|||||||
Done
|
Done
|
||||||
```
|
```
|
||||||
|
|
||||||
### dua iid
|
|
||||||
|
|
||||||
Get the Interface Identifier manually specified for Thread Domain Unicast Address on Thread 1.2 device.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
> dua iid
|
|
||||||
0004000300020001
|
|
||||||
Done
|
|
||||||
```
|
|
||||||
|
|
||||||
### dua iid \<iid\>
|
|
||||||
|
|
||||||
Set the Interface Identifier manually specified for Thread Domain Unicast Address on Thread 1.2 device.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
> dua iid 0004000300020001
|
|
||||||
Done
|
|
||||||
```
|
|
||||||
|
|
||||||
### dua iid clear
|
|
||||||
|
|
||||||
Clear the Interface Identifier manually specified for Thread Domain Unicast Address on Thread 1.2 device.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
> dua iid clear
|
|
||||||
Done
|
|
||||||
```
|
|
||||||
|
|
||||||
### eidcache
|
### eidcache
|
||||||
|
|
||||||
Print the EID-to-RLOC cache entries.
|
Print the EID-to-RLOC cache entries.
|
||||||
|
|||||||
@@ -690,8 +690,6 @@ openthread_core_files = [
|
|||||||
"thread/csl_tx_scheduler.hpp",
|
"thread/csl_tx_scheduler.hpp",
|
||||||
"thread/discover_scanner.cpp",
|
"thread/discover_scanner.cpp",
|
||||||
"thread/discover_scanner.hpp",
|
"thread/discover_scanner.hpp",
|
||||||
"thread/dua_manager.cpp",
|
|
||||||
"thread/dua_manager.hpp",
|
|
||||||
"thread/energy_scan_server.cpp",
|
"thread/energy_scan_server.cpp",
|
||||||
"thread/energy_scan_server.hpp",
|
"thread/energy_scan_server.hpp",
|
||||||
"thread/indirect_sender.cpp",
|
"thread/indirect_sender.cpp",
|
||||||
|
|||||||
@@ -237,7 +237,6 @@ set(COMMON_SOURCES
|
|||||||
thread/child_table.cpp
|
thread/child_table.cpp
|
||||||
thread/csl_tx_scheduler.cpp
|
thread/csl_tx_scheduler.cpp
|
||||||
thread/discover_scanner.cpp
|
thread/discover_scanner.cpp
|
||||||
thread/dua_manager.cpp
|
|
||||||
thread/energy_scan_server.cpp
|
thread/energy_scan_server.cpp
|
||||||
thread/indirect_sender.cpp
|
thread/indirect_sender.cpp
|
||||||
thread/key_manager.cpp
|
thread/key_manager.cpp
|
||||||
|
|||||||
@@ -208,10 +208,6 @@ void Leader::UpdateBackboneRouterPrimary(void)
|
|||||||
Get<Mlr::Manager>().HandleBackboneRouterPrimaryUpdate(event);
|
Get<Mlr::Manager>().HandleBackboneRouterPrimaryUpdate(event);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if OPENTHREAD_FTD && OPENTHREAD_CONFIG_TMF_PROXY_DUA_ENABLE
|
|
||||||
Get<DuaManager>().HandleBackboneRouterPrimaryUpdate(event);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
OT_UNUSED_VARIABLE(event);
|
OT_UNUSED_VARIABLE(event);
|
||||||
}
|
}
|
||||||
@@ -253,10 +249,6 @@ void Leader::UpdateDomainPrefixConfig(void)
|
|||||||
Get<Local>().HandleDomainPrefixUpdate(event);
|
Get<Local>().HandleDomainPrefixUpdate(event);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if OPENTHREAD_FTD && OPENTHREAD_CONFIG_TMF_PROXY_DUA_ENABLE
|
|
||||||
Get<DuaManager>().HandleDomainPrefixUpdate(event);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
OT_UNUSED_VARIABLE(event);
|
OT_UNUSED_VARIABLE(event);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -47,7 +47,6 @@
|
|||||||
#include "common/locator.hpp"
|
#include "common/locator.hpp"
|
||||||
#include "common/non_copyable.hpp"
|
#include "common/non_copyable.hpp"
|
||||||
#include "net/netif.hpp"
|
#include "net/netif.hpp"
|
||||||
#include "thread/dua_manager.hpp"
|
|
||||||
#include "thread/mlr_types.hpp"
|
#include "thread/mlr_types.hpp"
|
||||||
#include "thread/network_data.hpp"
|
#include "thread/network_data.hpp"
|
||||||
#include "thread/tmf.hpp"
|
#include "thread/tmf.hpp"
|
||||||
|
|||||||
@@ -143,9 +143,6 @@ void Notifier::EmitEvents(void)
|
|||||||
#if OPENTHREAD_CONFIG_MLR_ENABLE || (OPENTHREAD_FTD && OPENTHREAD_CONFIG_TMF_PROXY_MLR_ENABLE)
|
#if OPENTHREAD_CONFIG_MLR_ENABLE || (OPENTHREAD_FTD && OPENTHREAD_CONFIG_TMF_PROXY_MLR_ENABLE)
|
||||||
Get<Mlr::Manager>().HandleNotifierEvents(events);
|
Get<Mlr::Manager>().HandleNotifierEvents(events);
|
||||||
#endif
|
#endif
|
||||||
#if OPENTHREAD_FTD && OPENTHREAD_CONFIG_TMF_PROXY_DUA_ENABLE
|
|
||||||
Get<DuaManager>().HandleNotifierEvents(events);
|
|
||||||
#endif
|
|
||||||
#if OPENTHREAD_CONFIG_RADIO_LINK_TREL_ENABLE
|
#if OPENTHREAD_CONFIG_RADIO_LINK_TREL_ENABLE
|
||||||
Get<Trel::Link>().HandleNotifierEvents(events);
|
Get<Trel::Link>().HandleNotifierEvents(events);
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -104,13 +104,6 @@ void TimeTicker::HandleTimer(void)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if OPENTHREAD_FTD && OPENTHREAD_CONFIG_TMF_PROXY_DUA_ENABLE
|
|
||||||
if (mReceivers & Mask(kDuaManager))
|
|
||||||
{
|
|
||||||
Get<DuaManager>().HandleTimeTick();
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (mReceivers & Mask(kIp6Mpl))
|
if (mReceivers & Mask(kIp6Mpl))
|
||||||
{
|
{
|
||||||
Get<Ip6::Mpl>().HandleTimeTick();
|
Get<Ip6::Mpl>().HandleTimeTick();
|
||||||
|
|||||||
@@ -66,7 +66,6 @@ public:
|
|||||||
kAddressResolver, ///< `AddressResolver`
|
kAddressResolver, ///< `AddressResolver`
|
||||||
kChildSupervisor, ///< `ChildSupervisor`
|
kChildSupervisor, ///< `ChildSupervisor`
|
||||||
kIp6FragmentReassembler, ///< `Ip6::Ip6` (handling of fragmented messages)
|
kIp6FragmentReassembler, ///< `Ip6::Ip6` (handling of fragmented messages)
|
||||||
kDuaManager, ///< `DuaManager`
|
|
||||||
kNetworkDataNotifier, ///< `NetworkData::Notifier`
|
kNetworkDataNotifier, ///< `NetworkData::Notifier`
|
||||||
kIp6Mpl, ///< `Ip6::Mpl`
|
kIp6Mpl, ///< `Ip6::Mpl`
|
||||||
kBbrLocal, ///< `BackboneRouter::Local`
|
kBbrLocal, ///< `BackboneRouter::Local`
|
||||||
|
|||||||
@@ -212,20 +212,6 @@
|
|||||||
#define OPENTHREAD_CONFIG_TMF_ANYCAST_LOCATOR_SEND_RESPONSE 1
|
#define OPENTHREAD_CONFIG_TMF_ANYCAST_LOCATOR_SEND_RESPONSE 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
|
||||||
* @def OPENTHREAD_CONFIG_TMF_PROXY_DUA_ENABLE
|
|
||||||
*
|
|
||||||
* Define to 1 for Thread 1.2 FTD device to register DUA of its MTD children registered
|
|
||||||
* even if it doesn't enable DUA feature itself.
|
|
||||||
*/
|
|
||||||
#ifndef OPENTHREAD_CONFIG_TMF_PROXY_DUA_ENABLE
|
|
||||||
#define OPENTHREAD_CONFIG_TMF_PROXY_DUA_ENABLE (OPENTHREAD_CONFIG_THREAD_VERSION >= OT_THREAD_VERSION_1_2)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if OPENTHREAD_CONFIG_TMF_PROXY_DUA_ENABLE && OPENTHREAD_CONFIG_THREAD_VERSION < OT_THREAD_VERSION_1_2
|
|
||||||
#error "Thread 1.2 or higher version is required for OPENTHREAD_CONFIG_TMF_PROXY_DUA_ENABLE"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @def OPENTHREAD_CONFIG_TMF_PROXY_MLR_ENABLE
|
* @def OPENTHREAD_CONFIG_TMF_PROXY_MLR_ENABLE
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -215,10 +215,6 @@ Instance::Instance(void)
|
|||||||
#if OPENTHREAD_CONFIG_MLR_ENABLE || (OPENTHREAD_FTD && OPENTHREAD_CONFIG_TMF_PROXY_MLR_ENABLE)
|
#if OPENTHREAD_CONFIG_MLR_ENABLE || (OPENTHREAD_FTD && OPENTHREAD_CONFIG_TMF_PROXY_MLR_ENABLE)
|
||||||
, mMlrManager(*this)
|
, mMlrManager(*this)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if OPENTHREAD_FTD && OPENTHREAD_CONFIG_TMF_PROXY_DUA_ENABLE
|
|
||||||
, mDuaManager(*this)
|
|
||||||
#endif
|
|
||||||
#if OPENTHREAD_CONFIG_SRP_SERVER_ENABLE
|
#if OPENTHREAD_CONFIG_SRP_SERVER_ENABLE
|
||||||
, mSrpServer(*this)
|
, mSrpServer(*this)
|
||||||
#if OPENTHREAD_CONFIG_SRP_SERVER_ADVERTISING_PROXY_ENABLE
|
#if OPENTHREAD_CONFIG_SRP_SERVER_ADVERTISING_PROXY_ENABLE
|
||||||
|
|||||||
@@ -128,7 +128,6 @@
|
|||||||
#include "thread/anycast_locator.hpp"
|
#include "thread/anycast_locator.hpp"
|
||||||
#include "thread/child_supervision.hpp"
|
#include "thread/child_supervision.hpp"
|
||||||
#include "thread/discover_scanner.hpp"
|
#include "thread/discover_scanner.hpp"
|
||||||
#include "thread/dua_manager.hpp"
|
|
||||||
#include "thread/energy_scan_server.hpp"
|
#include "thread/energy_scan_server.hpp"
|
||||||
#include "thread/key_manager.hpp"
|
#include "thread/key_manager.hpp"
|
||||||
#include "thread/link_metrics.hpp"
|
#include "thread/link_metrics.hpp"
|
||||||
@@ -769,10 +768,6 @@ private:
|
|||||||
Mlr::Manager mMlrManager;
|
Mlr::Manager mMlrManager;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if OPENTHREAD_FTD && OPENTHREAD_CONFIG_TMF_PROXY_DUA_ENABLE
|
|
||||||
DuaManager mDuaManager;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if OPENTHREAD_CONFIG_SRP_SERVER_ENABLE
|
#if OPENTHREAD_CONFIG_SRP_SERVER_ENABLE
|
||||||
Srp::Server mSrpServer;
|
Srp::Server mSrpServer;
|
||||||
#if OPENTHREAD_CONFIG_SRP_SERVER_ADVERTISING_PROXY_ENABLE
|
#if OPENTHREAD_CONFIG_SRP_SERVER_ADVERTISING_PROXY_ENABLE
|
||||||
@@ -1252,10 +1247,6 @@ template <> inline BackboneRouter::BackboneTmfAgent &Instance::Get(void)
|
|||||||
template <> inline Mlr::Manager &Instance::Get(void) { return mMlrManager; }
|
template <> inline Mlr::Manager &Instance::Get(void) { return mMlrManager; }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if OPENTHREAD_FTD && OPENTHREAD_CONFIG_TMF_PROXY_DUA_ENABLE
|
|
||||||
template <> inline DuaManager &Instance::Get(void) { return mDuaManager; }
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if OPENTHREAD_CONFIG_MLE_LINK_METRICS_INITIATOR_ENABLE
|
#if OPENTHREAD_CONFIG_MLE_LINK_METRICS_INITIATOR_ENABLE
|
||||||
template <> inline LinkMetrics::Initiator &Instance::Get(void) { return mInitiator; }
|
template <> inline LinkMetrics::Initiator &Instance::Get(void) { return mInitiator; }
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
+5
-11
@@ -1102,18 +1102,12 @@ Error Ip6::SendRaw(OwnedPtr<Message> aMessagePtr)
|
|||||||
ExitNow(error = kErrorDrop);
|
ExitNow(error = kErrorDrop);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if OPENTHREAD_CONFIG_BACKBONE_ROUTER_ENABLE
|
// When the packet is forwarded from host to Thread, if its source is on-mesh or its destination is
|
||||||
// The filtering rules don't apply to packets from DUA.
|
// mesh-local, we'll drop the packet unless the packet originates from this device.
|
||||||
if (!Get<BackboneRouter::Leader>().IsDomainUnicast(header.GetSource()))
|
if (Get<NetworkData::Leader>().IsOnMesh(header.GetSource()) ||
|
||||||
#endif
|
Get<Mle::Mle>().IsMeshLocalAddress(header.GetDestination()))
|
||||||
{
|
{
|
||||||
// When the packet is forwarded from host to Thread, if its source is on-mesh or its destination is
|
VerifyOrExit(Get<ThreadNetif>().HasUnicastAddress(header.GetSource()), error = kErrorDrop);
|
||||||
// mesh-local, we'll drop the packet unless the packet originates from this device.
|
|
||||||
if (Get<NetworkData::Leader>().IsOnMesh(header.GetSource()) ||
|
|
||||||
Get<Mle::Mle>().IsMeshLocalAddress(header.GetDestination()))
|
|
||||||
{
|
|
||||||
VerifyOrExit(Get<ThreadNetif>().HasUnicastAddress(header.GetSource()), error = kErrorDrop);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (header.GetDestination().IsMulticast())
|
if (header.GetDestination().IsMulticast())
|
||||||
|
|||||||
@@ -228,26 +228,6 @@ exit:
|
|||||||
return hasAddress;
|
return hasAddress;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if OPENTHREAD_CONFIG_TMF_PROXY_DUA_ENABLE
|
|
||||||
Error Child::GetDomainUnicastAddress(Ip6::Address &aAddress) const
|
|
||||||
{
|
|
||||||
Error error = kErrorNotFound;
|
|
||||||
|
|
||||||
for (const Ip6::Address &ip6Address : mIp6Addresses)
|
|
||||||
{
|
|
||||||
if (Get<BackboneRouter::Leader>().IsDomainUnicast(ip6Address))
|
|
||||||
{
|
|
||||||
aAddress = ip6Address;
|
|
||||||
error = kErrorNone;
|
|
||||||
ExitNow();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
exit:
|
|
||||||
return error;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if OPENTHREAD_CONFIG_TMF_PROXY_MLR_ENABLE
|
#if OPENTHREAD_CONFIG_TMF_PROXY_MLR_ENABLE
|
||||||
|
|
||||||
bool Child::HasMlrRegisteredAddress(const Ip6::Address &aAddress) const
|
bool Child::HasMlrRegisteredAddress(const Ip6::Address &aAddress) const
|
||||||
|
|||||||
@@ -186,18 +186,6 @@ public:
|
|||||||
*/
|
*/
|
||||||
bool HasIp6Address(const Ip6::Address &aAddress) const;
|
bool HasIp6Address(const Ip6::Address &aAddress) const;
|
||||||
|
|
||||||
#if OPENTHREAD_CONFIG_TMF_PROXY_DUA_ENABLE
|
|
||||||
/**
|
|
||||||
* Retrieves the Domain Unicast Address registered by the child.
|
|
||||||
*
|
|
||||||
* @param[out] aAddress A reference to return the DUA address.
|
|
||||||
*
|
|
||||||
* @retval kErrorNone Successfully retrieved the DUA address, @p aAddress is updated.
|
|
||||||
* @retval kErrorNotFound Could not find any DUA address.
|
|
||||||
*/
|
|
||||||
Error GetDomainUnicastAddress(Ip6::Address &aAddress) const;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the child timeout.
|
* Gets the child timeout.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -1,419 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2020, The OpenThread Authors.
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
|
||||||
* modification, are permitted provided that the following conditions are met:
|
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
|
||||||
* documentation and/or other materials provided with the distribution.
|
|
||||||
* 3. Neither the name of the copyright holder nor the
|
|
||||||
* names of its contributors may be used to endorse or promote products
|
|
||||||
* derived from this software without specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
||||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
||||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
|
||||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
||||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
||||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
||||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
||||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
||||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
||||||
* POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @file
|
|
||||||
* This file implements managing DUA.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "dua_manager.hpp"
|
|
||||||
|
|
||||||
#if OPENTHREAD_FTD && OPENTHREAD_CONFIG_TMF_PROXY_DUA_ENABLE
|
|
||||||
|
|
||||||
#include "instance/instance.hpp"
|
|
||||||
|
|
||||||
namespace ot {
|
|
||||||
|
|
||||||
RegisterLogModule("DuaManager");
|
|
||||||
|
|
||||||
DuaManager::DuaManager(Instance &aInstance)
|
|
||||||
: InstanceLocator(aInstance)
|
|
||||||
, mRegistrationTask(aInstance)
|
|
||||||
, mIsDuaPending(false)
|
|
||||||
#if OPENTHREAD_FTD && OPENTHREAD_CONFIG_TMF_PROXY_DUA_ENABLE
|
|
||||||
, mChildIndexDuaRegistering(Mle::kMaxChildren)
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
mDelay.mValue = 0;
|
|
||||||
|
|
||||||
#if OPENTHREAD_FTD && OPENTHREAD_CONFIG_TMF_PROXY_DUA_ENABLE
|
|
||||||
mChildDuaMask.Clear();
|
|
||||||
mChildDuaRegisteredMask.Clear();
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
void DuaManager::HandleDomainPrefixUpdate(BackboneRouter::DomainPrefixEvent aEvent)
|
|
||||||
{
|
|
||||||
if ((aEvent == BackboneRouter::kDomainPrefixRemoved) || (aEvent == BackboneRouter::kDomainPrefixRefreshed))
|
|
||||||
{
|
|
||||||
if (mIsDuaPending)
|
|
||||||
{
|
|
||||||
IgnoreError(Get<Tmf::Agent>().AbortTransaction(HandleDuaResponse, this));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!mChildDuaMask.IsEmpty())
|
|
||||||
{
|
|
||||||
mChildDuaMask.Clear();
|
|
||||||
mChildDuaRegisteredMask.Clear();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void DuaManager::UpdateReregistrationDelay(void)
|
|
||||||
{
|
|
||||||
uint16_t delay;
|
|
||||||
|
|
||||||
VerifyOrExit(Get<BackboneRouter::Leader>().HasPrimary());
|
|
||||||
|
|
||||||
delay = Get<BackboneRouter::Leader>().GetConfig().SelectRandomReregistrationDelay();
|
|
||||||
|
|
||||||
if (mDelay.mFields.mReregistrationDelay == 0 || mDelay.mFields.mReregistrationDelay > delay)
|
|
||||||
{
|
|
||||||
mDelay.mFields.mReregistrationDelay = delay;
|
|
||||||
UpdateTimeTickerRegistration();
|
|
||||||
LogDebg("update reregdelay %d", mDelay.mFields.mReregistrationDelay);
|
|
||||||
}
|
|
||||||
|
|
||||||
exit:
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
void DuaManager::UpdateCheckDelay(uint8_t aDelay)
|
|
||||||
{
|
|
||||||
if (mDelay.mFields.mCheckDelay == 0 || mDelay.mFields.mCheckDelay > aDelay)
|
|
||||||
{
|
|
||||||
mDelay.mFields.mCheckDelay = aDelay;
|
|
||||||
|
|
||||||
LogDebg("update checkdelay %d", mDelay.mFields.mCheckDelay);
|
|
||||||
UpdateTimeTickerRegistration();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void DuaManager::HandleNotifierEvents(Events aEvents)
|
|
||||||
{
|
|
||||||
VerifyOrExit(Get<Mle::Mle>().IsAttached(), mDelay.mValue = 0);
|
|
||||||
|
|
||||||
if (aEvents.Contains(kEventThreadRoleChanged))
|
|
||||||
{
|
|
||||||
if (Get<Mle::Mle>().HasRestored())
|
|
||||||
{
|
|
||||||
UpdateReregistrationDelay();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
exit:
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
void DuaManager::HandleBackboneRouterPrimaryUpdate(BackboneRouter::PrimaryEvent aEvent)
|
|
||||||
{
|
|
||||||
if (aEvent == BackboneRouter::kPrimaryAdded || aEvent == BackboneRouter::kPrimaryUpdatedReregister)
|
|
||||||
{
|
|
||||||
UpdateReregistrationDelay();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void DuaManager::HandleTimeTick(void)
|
|
||||||
{
|
|
||||||
bool attempt = false;
|
|
||||||
|
|
||||||
LogDebg("reregdelay %d, checkdelay %d", mDelay.mFields.mReregistrationDelay, mDelay.mFields.mCheckDelay);
|
|
||||||
|
|
||||||
if ((mDelay.mFields.mCheckDelay > 0) && (--mDelay.mFields.mCheckDelay == 0))
|
|
||||||
{
|
|
||||||
attempt = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((mDelay.mFields.mReregistrationDelay > 0) && (--mDelay.mFields.mReregistrationDelay == 0))
|
|
||||||
{
|
|
||||||
#if OPENTHREAD_FTD && OPENTHREAD_CONFIG_TMF_PROXY_DUA_ENABLE
|
|
||||||
mChildDuaRegisteredMask.Clear();
|
|
||||||
#endif
|
|
||||||
attempt = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (attempt)
|
|
||||||
{
|
|
||||||
mRegistrationTask.Post();
|
|
||||||
}
|
|
||||||
|
|
||||||
UpdateTimeTickerRegistration();
|
|
||||||
}
|
|
||||||
|
|
||||||
void DuaManager::UpdateTimeTickerRegistration(void)
|
|
||||||
{
|
|
||||||
if (mDelay.mValue == 0)
|
|
||||||
{
|
|
||||||
Get<TimeTicker>().UnregisterReceiver(TimeTicker::kDuaManager);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Get<TimeTicker>().RegisterReceiver(TimeTicker::kDuaManager);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void DuaManager::PerformNextRegistration(void)
|
|
||||||
{
|
|
||||||
Error error = kErrorNone;
|
|
||||||
Coap::Message *message = nullptr;
|
|
||||||
Ip6::Address dua;
|
|
||||||
Ip6::Address destAddr;
|
|
||||||
|
|
||||||
VerifyOrExit(Get<Mle::Mle>().IsAttached());
|
|
||||||
VerifyOrExit(Get<BackboneRouter::Leader>().HasPrimary());
|
|
||||||
|
|
||||||
// Only allow one outgoing DUA.req
|
|
||||||
VerifyOrExit(!mIsDuaPending);
|
|
||||||
|
|
||||||
VerifyOrExit(!mChildDuaMask.IsEmpty() && mChildDuaMask != mChildDuaRegisteredMask);
|
|
||||||
|
|
||||||
// Prepare DUA.req
|
|
||||||
message = Get<Tmf::Agent>().AllocateAndInitPriorityConfirmablePostMessage(kUriDuaRegistrationRequest);
|
|
||||||
VerifyOrExit(message != nullptr, error = kErrorNoBufs);
|
|
||||||
|
|
||||||
{
|
|
||||||
uint32_t lastTransactionTime;
|
|
||||||
Child *child = nullptr;
|
|
||||||
|
|
||||||
OT_ASSERT(mChildIndexDuaRegistering == Mle::kMaxChildren);
|
|
||||||
|
|
||||||
for (Child &iter : Get<ChildTable>().Iterate(Child::kInStateValid))
|
|
||||||
{
|
|
||||||
uint16_t childIndex = Get<ChildTable>().GetChildIndex(iter);
|
|
||||||
|
|
||||||
if (mChildDuaMask.Has(childIndex) && !mChildDuaRegisteredMask.Has(childIndex))
|
|
||||||
{
|
|
||||||
mChildIndexDuaRegistering = childIndex;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
child = Get<ChildTable>().GetChildAtIndex(mChildIndexDuaRegistering);
|
|
||||||
SuccessOrAssert(child->GetDomainUnicastAddress(dua));
|
|
||||||
|
|
||||||
SuccessOrExit(error = Tlv::Append<ThreadTargetTlv>(*message, dua));
|
|
||||||
SuccessOrExit(error = Tlv::Append<ThreadMeshLocalEidTlv>(*message, child->GetMeshLocalIid()));
|
|
||||||
|
|
||||||
lastTransactionTime = Time::MsecToSec(TimerMilli::GetNow() - child->GetLastHeard());
|
|
||||||
SuccessOrExit(error = Tlv::Append<ThreadLastTransactionTimeTlv>(*message, lastTransactionTime));
|
|
||||||
}
|
|
||||||
|
|
||||||
destAddr.InitAsRoutingLocator(Get<Mle::Mle>().GetMeshLocalPrefix(), Get<BackboneRouter::Leader>().GetServer16());
|
|
||||||
|
|
||||||
SuccessOrExit(error = Get<Tmf::Agent>().SendMessageTo(*message, destAddr, HandleDuaResponse, this));
|
|
||||||
|
|
||||||
mIsDuaPending = true;
|
|
||||||
mRegisteringDua = dua;
|
|
||||||
mDelay.mValue = 0;
|
|
||||||
|
|
||||||
LogInfo("Sent %s for DUA %s", UriToString<kUriDuaRegistrationRequest>(), dua.ToString().AsCString());
|
|
||||||
|
|
||||||
exit:
|
|
||||||
if (error == kErrorNoBufs)
|
|
||||||
{
|
|
||||||
UpdateCheckDelay(kNoBufDelay);
|
|
||||||
}
|
|
||||||
|
|
||||||
LogWarnOnError(error, "perform next registration");
|
|
||||||
FreeMessageOnError(message, error);
|
|
||||||
}
|
|
||||||
|
|
||||||
void DuaManager::HandleDuaResponse(Coap::Msg *aMsg, Error aResult)
|
|
||||||
{
|
|
||||||
Error error;
|
|
||||||
|
|
||||||
mIsDuaPending = false;
|
|
||||||
#if OPENTHREAD_FTD && OPENTHREAD_CONFIG_TMF_PROXY_DUA_ENABLE
|
|
||||||
mChildIndexDuaRegistering = Mle::kMaxChildren;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (aResult == kErrorResponseTimeout)
|
|
||||||
{
|
|
||||||
UpdateCheckDelay(KResponseTimeoutDelay);
|
|
||||||
ExitNow(error = aResult);
|
|
||||||
}
|
|
||||||
|
|
||||||
VerifyOrExit(aResult == kErrorNone, error = kErrorParse);
|
|
||||||
OT_ASSERT(aMsg != nullptr);
|
|
||||||
|
|
||||||
VerifyOrExit(aMsg->GetCode() == Coap::kCodeChanged || aMsg->GetCode() >= Coap::kCodeBadRequest,
|
|
||||||
error = kErrorParse);
|
|
||||||
|
|
||||||
error = ProcessDuaResponse(aMsg->mMessage);
|
|
||||||
|
|
||||||
exit:
|
|
||||||
if (error != kErrorResponseTimeout)
|
|
||||||
{
|
|
||||||
mRegistrationTask.Post();
|
|
||||||
}
|
|
||||||
|
|
||||||
LogInfo("Received %s response: %s", UriToString<kUriDuaRegistrationRequest>(), ErrorToString(error));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <> void DuaManager::HandleTmf<kUriDuaRegistrationNotify>(Coap::Msg &aMsg)
|
|
||||||
{
|
|
||||||
Error error;
|
|
||||||
|
|
||||||
if (aMsg.IsConfirmable() && Get<Tmf::Agent>().SendAckResponse(aMsg) == kErrorNone)
|
|
||||||
{
|
|
||||||
LogInfo("Sent %s ack", UriToString<kUriDuaRegistrationNotify>());
|
|
||||||
}
|
|
||||||
|
|
||||||
error = ProcessDuaResponse(aMsg.mMessage);
|
|
||||||
|
|
||||||
OT_UNUSED_VARIABLE(error);
|
|
||||||
LogInfo("Received %s: %s", UriToString<kUriDuaRegistrationNotify>(), ErrorToString(error));
|
|
||||||
}
|
|
||||||
|
|
||||||
Error DuaManager::ProcessDuaResponse(Coap::Message &aMessage)
|
|
||||||
{
|
|
||||||
Error error = kErrorNone;
|
|
||||||
Ip6::Address target;
|
|
||||||
uint8_t status;
|
|
||||||
|
|
||||||
if (aMessage.ReadCode() >= Coap::kCodeBadRequest)
|
|
||||||
{
|
|
||||||
status = kDuaGeneralFailure;
|
|
||||||
target = mRegisteringDua;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
SuccessOrExit(error = Tlv::Find<ThreadStatusTlv>(aMessage, status));
|
|
||||||
SuccessOrExit(error = Tlv::Find<ThreadTargetTlv>(aMessage, target));
|
|
||||||
}
|
|
||||||
|
|
||||||
VerifyOrExit(Get<BackboneRouter::Leader>().IsDomainUnicast(target), error = kErrorDrop);
|
|
||||||
|
|
||||||
{
|
|
||||||
Child *child = nullptr;
|
|
||||||
uint16_t childIndex;
|
|
||||||
|
|
||||||
for (Child &iter : Get<ChildTable>().Iterate(Child::kInStateValid))
|
|
||||||
{
|
|
||||||
if (iter.HasIp6Address(target))
|
|
||||||
{
|
|
||||||
child = &iter;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
VerifyOrExit(child != nullptr, error = kErrorNotFound);
|
|
||||||
|
|
||||||
childIndex = Get<ChildTable>().GetChildIndex(*child);
|
|
||||||
|
|
||||||
switch (status)
|
|
||||||
{
|
|
||||||
case kDuaSuccess:
|
|
||||||
// Mark as Registered
|
|
||||||
if (mChildDuaMask.Has(childIndex))
|
|
||||||
{
|
|
||||||
mChildDuaRegisteredMask.Add(childIndex);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case kDuaReRegister:
|
|
||||||
// Parent stops registering for the Child's DUA until next Child Update Request
|
|
||||||
mChildDuaMask.Remove(childIndex);
|
|
||||||
mChildDuaRegisteredMask.Remove(childIndex);
|
|
||||||
break;
|
|
||||||
case kDuaInvalid:
|
|
||||||
case kDuaDuplicate:
|
|
||||||
IgnoreError(child->RemoveIp6Address(target));
|
|
||||||
mChildDuaMask.Remove(childIndex);
|
|
||||||
mChildDuaRegisteredMask.Remove(childIndex);
|
|
||||||
break;
|
|
||||||
case kDuaNoResources:
|
|
||||||
case kDuaNotPrimary:
|
|
||||||
case kDuaGeneralFailure:
|
|
||||||
UpdateReregistrationDelay();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (status != kDuaSuccess)
|
|
||||||
{
|
|
||||||
SendAddressNotification(target, static_cast<DuaStatus>(status), *child);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
exit:
|
|
||||||
UpdateTimeTickerRegistration();
|
|
||||||
return error;
|
|
||||||
}
|
|
||||||
|
|
||||||
#if OPENTHREAD_FTD && OPENTHREAD_CONFIG_TMF_PROXY_DUA_ENABLE
|
|
||||||
void DuaManager::SendAddressNotification(Ip6::Address &aAddress, DuaStatus aStatus, const Child &aChild)
|
|
||||||
{
|
|
||||||
Coap::Message *message = nullptr;
|
|
||||||
Error error;
|
|
||||||
|
|
||||||
message = Get<Tmf::Agent>().AllocateAndInitPriorityConfirmablePostMessage(kUriDuaRegistrationNotify);
|
|
||||||
VerifyOrExit(message != nullptr, error = kErrorNoBufs);
|
|
||||||
|
|
||||||
SuccessOrExit(error = Tlv::Append<ThreadStatusTlv>(*message, aStatus));
|
|
||||||
SuccessOrExit(error = Tlv::Append<ThreadTargetTlv>(*message, aAddress));
|
|
||||||
|
|
||||||
SuccessOrExit(error = Get<Tmf::Agent>().SendMessageToRloc(*message, aChild.GetRloc16()));
|
|
||||||
|
|
||||||
LogInfo("Sent %s for child %04x DUA %s", UriToString<kUriDuaRegistrationNotify>(), aChild.GetRloc16(),
|
|
||||||
aAddress.ToString().AsCString());
|
|
||||||
|
|
||||||
exit:
|
|
||||||
|
|
||||||
if (error != kErrorNone)
|
|
||||||
{
|
|
||||||
FreeMessage(message);
|
|
||||||
|
|
||||||
// TODO: (DUA) (P4) may enhance to guarantee the delivery of DUA.ntf
|
|
||||||
LogWarn("Sent %s for child %04x DUA %s Error %s", UriToString<kUriDuaRegistrationNotify>(), aChild.GetRloc16(),
|
|
||||||
aAddress.ToString().AsCString(), ErrorToString(error));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void DuaManager::HandleChildDuaAddressEvent(const Child &aChild, ChildDuaAddressEvent aEvent)
|
|
||||||
{
|
|
||||||
uint16_t childIndex = Get<ChildTable>().GetChildIndex(aChild);
|
|
||||||
|
|
||||||
if ((aEvent == kAddressRemoved || aEvent == kAddressChanged) && mChildDuaMask.Has(childIndex))
|
|
||||||
{
|
|
||||||
// Abort on going proxy DUA.req for this child
|
|
||||||
if (mChildIndexDuaRegistering == childIndex)
|
|
||||||
{
|
|
||||||
IgnoreError(Get<Tmf::Agent>().AbortTransaction(HandleDuaResponse, this));
|
|
||||||
}
|
|
||||||
|
|
||||||
mChildDuaMask.Remove(childIndex);
|
|
||||||
mChildDuaRegisteredMask.Remove(childIndex);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (aEvent == kAddressAdded || aEvent == kAddressChanged ||
|
|
||||||
(aEvent == kAddressUnchanged && !mChildDuaMask.Has(childIndex)))
|
|
||||||
{
|
|
||||||
if (mChildDuaMask == mChildDuaRegisteredMask)
|
|
||||||
{
|
|
||||||
UpdateCheckDelay(
|
|
||||||
Random::NonCrypto::GenerateInClosedRange<uint8_t>(1, BackboneRouter::kParentAggregateDelay));
|
|
||||||
}
|
|
||||||
|
|
||||||
mChildDuaMask.Add(childIndex);
|
|
||||||
mChildDuaRegisteredMask.Remove(childIndex);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif // OPENTHREAD_FTD && OPENTHREAD_CONFIG_TMF_PROXY_DUA_ENABLE
|
|
||||||
|
|
||||||
} // namespace ot
|
|
||||||
|
|
||||||
#endif // OPENTHREAD_FTD && OPENTHREAD_CONFIG_TMF_PROXY_DUA_ENABLE
|
|
||||||
@@ -1,191 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2020, The OpenThread Authors.
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
|
||||||
* modification, are permitted provided that the following conditions are met:
|
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
|
||||||
* documentation and/or other materials provided with the distribution.
|
|
||||||
* 3. Neither the name of the copyright holder nor the
|
|
||||||
* names of its contributors may be used to endorse or promote products
|
|
||||||
* derived from this software without specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
||||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
||||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
|
||||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
||||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
||||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
||||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
||||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
||||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
||||||
* POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @file
|
|
||||||
* This file includes definitions for managing Domain Unicast Address feature defined in Thread 1.2.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef OT_CORE_THREAD_DUA_MANAGER_HPP_
|
|
||||||
#define OT_CORE_THREAD_DUA_MANAGER_HPP_
|
|
||||||
|
|
||||||
#include "openthread-core-config.h"
|
|
||||||
|
|
||||||
#if OPENTHREAD_FTD && OPENTHREAD_CONFIG_TMF_PROXY_DUA_ENABLE
|
|
||||||
|
|
||||||
#include "backbone_router/bbr_leader.hpp"
|
|
||||||
#include "coap/coap_message.hpp"
|
|
||||||
#include "common/locator.hpp"
|
|
||||||
#include "common/non_copyable.hpp"
|
|
||||||
#include "common/notifier.hpp"
|
|
||||||
#include "common/tasklet.hpp"
|
|
||||||
#include "common/time.hpp"
|
|
||||||
#include "common/time_ticker.hpp"
|
|
||||||
#include "common/timer.hpp"
|
|
||||||
#include "net/netif.hpp"
|
|
||||||
#include "thread/child.hpp"
|
|
||||||
#include "thread/thread_tlvs.hpp"
|
|
||||||
#include "thread/tmf.hpp"
|
|
||||||
|
|
||||||
namespace ot {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @addtogroup core-dua
|
|
||||||
*
|
|
||||||
* @brief
|
|
||||||
* This module includes definitions for generating, managing, registering Domain Unicast Address.
|
|
||||||
*
|
|
||||||
* @{
|
|
||||||
*
|
|
||||||
* @defgroup core-dua Dua
|
|
||||||
*
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Domain Unicast Address (DUA) Registration Status values
|
|
||||||
*/
|
|
||||||
enum DuaStatus : uint8_t
|
|
||||||
{
|
|
||||||
kDuaSuccess = 0, ///< Successful registration.
|
|
||||||
kDuaReRegister = 1, ///< Registration was accepted but immediate reregistration is required to solve.
|
|
||||||
kDuaInvalid = 2, ///< Registration rejected (Fatal): Target EID is not a valid DUA.
|
|
||||||
kDuaDuplicate = 3, ///< Registration rejected (Fatal): DUA is already in use by another device.
|
|
||||||
kDuaNoResources = 4, ///< Registration rejected (Non-fatal): Backbone Router Resource shortage.
|
|
||||||
kDuaNotPrimary = 5, ///< Registration rejected (Non-fatal): Backbone Router is not primary at this moment.
|
|
||||||
kDuaGeneralFailure = 6, ///< Registration failure (Non-fatal): Reason(s) not further specified.
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Implements managing DUA.
|
|
||||||
*/
|
|
||||||
class DuaManager : public InstanceLocator, private NonCopyable
|
|
||||||
{
|
|
||||||
friend class ot::Notifier;
|
|
||||||
friend class ot::TimeTicker;
|
|
||||||
friend class Tmf::Agent;
|
|
||||||
|
|
||||||
public:
|
|
||||||
/**
|
|
||||||
* Initializes the object.
|
|
||||||
*
|
|
||||||
* @param[in] aInstance A reference to the OpenThread instance.
|
|
||||||
*/
|
|
||||||
explicit DuaManager(Instance &aInstance);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Notifies Domain Prefix changes.
|
|
||||||
*
|
|
||||||
* @param[in] aEvent The Domain Prefix event.
|
|
||||||
*/
|
|
||||||
void HandleDomainPrefixUpdate(BackboneRouter::DomainPrefixEvent aEvent);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Notifies the `DuaManager` of a Primary Backbone Router event.
|
|
||||||
*
|
|
||||||
* @param[in] aEvent The Primary Backbone Router event.
|
|
||||||
*/
|
|
||||||
void HandleBackboneRouterPrimaryUpdate(BackboneRouter::PrimaryEvent aEvent);
|
|
||||||
|
|
||||||
#if OPENTHREAD_FTD && OPENTHREAD_CONFIG_TMF_PROXY_DUA_ENABLE
|
|
||||||
/**
|
|
||||||
* Events related to a Child DUA address.
|
|
||||||
*/
|
|
||||||
enum ChildDuaAddressEvent : uint8_t
|
|
||||||
{
|
|
||||||
kAddressAdded, ///< A new DUA registered by the Child via Address Registration.
|
|
||||||
kAddressChanged, ///< A different DUA registered by the Child via Address Registration.
|
|
||||||
kAddressRemoved, ///< DUA registered by the Child is removed and not in Address Registration.
|
|
||||||
kAddressUnchanged, ///< The Child registers the same DUA again.
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Handles Child DUA address event.
|
|
||||||
*
|
|
||||||
* @param[in] aChild A child.
|
|
||||||
* @param[in] aEvent The DUA address event for @p aChild.
|
|
||||||
*/
|
|
||||||
void HandleChildDuaAddressEvent(const Child &aChild, ChildDuaAddressEvent aEvent);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
private:
|
|
||||||
static constexpr uint8_t kNoBufDelay = 5; // In sec.
|
|
||||||
static constexpr uint8_t KResponseTimeoutDelay = 30; // In sec.
|
|
||||||
|
|
||||||
#if OPENTHREAD_FTD && OPENTHREAD_CONFIG_TMF_PROXY_DUA_ENABLE
|
|
||||||
void SendAddressNotification(Ip6::Address &aAddress, DuaStatus aStatus, const Child &aChild);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void HandleNotifierEvents(Events aEvents);
|
|
||||||
|
|
||||||
void HandleTimeTick(void);
|
|
||||||
|
|
||||||
void UpdateTimeTickerRegistration(void);
|
|
||||||
|
|
||||||
DeclareTmfResponseHandlerIn(DuaManager, HandleDuaResponse);
|
|
||||||
|
|
||||||
template <Uri kUri> void HandleTmf(Coap::Msg &aMsg);
|
|
||||||
|
|
||||||
Error ProcessDuaResponse(Coap::Message &aMessage);
|
|
||||||
|
|
||||||
void PerformNextRegistration(void);
|
|
||||||
void UpdateReregistrationDelay(void);
|
|
||||||
void UpdateCheckDelay(uint8_t aDelay);
|
|
||||||
|
|
||||||
using RegistrationTask = TaskletIn<DuaManager, &DuaManager::PerformNextRegistration>;
|
|
||||||
|
|
||||||
RegistrationTask mRegistrationTask;
|
|
||||||
Ip6::Address mRegisteringDua;
|
|
||||||
bool mIsDuaPending : 1;
|
|
||||||
|
|
||||||
union
|
|
||||||
{
|
|
||||||
struct
|
|
||||||
{
|
|
||||||
uint16_t mReregistrationDelay; // Delay (in seconds) for DUA re-registration.
|
|
||||||
uint8_t mCheckDelay; // Delay (in seconds) for checking whether or not registration is required.
|
|
||||||
} mFields;
|
|
||||||
uint32_t mValue; // Non-zero indicates timer should start.
|
|
||||||
} mDelay;
|
|
||||||
|
|
||||||
#if OPENTHREAD_FTD && OPENTHREAD_CONFIG_TMF_PROXY_DUA_ENABLE
|
|
||||||
// TODO: (DUA) may re-evaluate the alternative option of distributing the flags into the child table:
|
|
||||||
// - Child class itself have some padding - may save some RAM
|
|
||||||
// - Avoid cross reference between a bit-vector and the child entry
|
|
||||||
ChildMask mChildDuaMask; // Child Mask for child who registers DUA via Child Update Request.
|
|
||||||
ChildMask mChildDuaRegisteredMask; // Child Mask for child's DUA that was registered by the parent on behalf.
|
|
||||||
uint16_t mChildIndexDuaRegistering; // Child Index of the DUA being registered.
|
|
||||||
#endif
|
|
||||||
};
|
|
||||||
|
|
||||||
DeclareTmfHandler(DuaManager, kUriDuaRegistrationNotify);
|
|
||||||
|
|
||||||
} // namespace ot
|
|
||||||
|
|
||||||
#endif // OPENTHREAD_FTD && OPENTHREAD_CONFIG_TMF_PROXY_DUA_ENABLE
|
|
||||||
#endif // OT_CORE_THREAD_DUA_MANAGER_HPP_
|
|
||||||
@@ -165,28 +165,6 @@ void MeshForwarder::HandleResolved(const Ip6::Address &aEid, Error aError)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if OPENTHREAD_CONFIG_BACKBONE_ROUTER_ENABLE
|
|
||||||
// Pass back to IPv6 layer for DUA destination resolved
|
|
||||||
// by Backbone Query
|
|
||||||
if (Get<BackboneRouter::Local>().IsPrimary() && Get<BackboneRouter::Leader>().IsDomainUnicast(ip6Dst) &&
|
|
||||||
Get<Mle::Mle>().HasRloc16(Get<AddressResolver>().LookUp(ip6Dst)))
|
|
||||||
{
|
|
||||||
uint8_t hopLimit;
|
|
||||||
|
|
||||||
mSendQueue.Dequeue(message);
|
|
||||||
|
|
||||||
// Avoid decreasing Hop Limit twice
|
|
||||||
IgnoreError(message.Read(Ip6::Header::kHopLimitFieldOffset, hopLimit));
|
|
||||||
hopLimit++;
|
|
||||||
message.Write(Ip6::Header::kHopLimitFieldOffset, hopLimit);
|
|
||||||
message.SetLoopbackToHostAllowed(true);
|
|
||||||
message.SetOrigin(Message::kOriginHostTrusted);
|
|
||||||
|
|
||||||
IgnoreError(Get<Ip6::Ip6>().HandleDatagram(OwnedPtr<Message>(&message)));
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
message.SetResolvingAddress(false);
|
message.SetResolvingAddress(false);
|
||||||
didUpdate = true;
|
didUpdate = true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2485,10 +2485,6 @@ private:
|
|||||||
|
|
||||||
DeclareTmfResponseHandlerIn(Mle, HandleAddressSolicitResponse);
|
DeclareTmfResponseHandlerIn(Mle, HandleAddressSolicitResponse);
|
||||||
|
|
||||||
#if OPENTHREAD_CONFIG_TMF_PROXY_DUA_ENABLE
|
|
||||||
void SignalDuaAddressEvent(const Child &aChild, const Ip6::Address &aOldDua) const;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static bool IsMessageMleSubType(const Message &aMessage);
|
static bool IsMessageMleSubType(const Message &aMessage);
|
||||||
static bool IsMessageChildUpdateRequest(const Message &aMessage);
|
static bool IsMessageChildUpdateRequest(const Message &aMessage);
|
||||||
static void HandleAdvertiseTrickleTimer(TrickleTimer &aTimer);
|
static void HandleAdvertiseTrickleTimer(TrickleTimer &aTimer);
|
||||||
|
|||||||
@@ -1826,9 +1826,6 @@ Error Mle::ProcessAddressRegistrationTlv(RxInfo &aRxInfo, Child &aChild)
|
|||||||
OffsetRange offsetRange;
|
OffsetRange offsetRange;
|
||||||
uint8_t count = 0;
|
uint8_t count = 0;
|
||||||
uint8_t storedCount = 0;
|
uint8_t storedCount = 0;
|
||||||
#if OPENTHREAD_CONFIG_TMF_PROXY_DUA_ENABLE
|
|
||||||
Ip6::Address oldDua;
|
|
||||||
#endif
|
|
||||||
#if OPENTHREAD_CONFIG_TMF_PROXY_MLR_ENABLE
|
#if OPENTHREAD_CONFIG_TMF_PROXY_MLR_ENABLE
|
||||||
Child::Ip6AddressArray oldMlrRegisteredAddresses;
|
Child::Ip6AddressArray oldMlrRegisteredAddresses;
|
||||||
#endif
|
#endif
|
||||||
@@ -1837,13 +1834,6 @@ Error Mle::ProcessAddressRegistrationTlv(RxInfo &aRxInfo, Child &aChild)
|
|||||||
|
|
||||||
SuccessOrExit(error = Tlv::FindTlvValueOffsetRange(aRxInfo.mMessage, Tlv::kAddressRegistration, offsetRange));
|
SuccessOrExit(error = Tlv::FindTlvValueOffsetRange(aRxInfo.mMessage, Tlv::kAddressRegistration, offsetRange));
|
||||||
|
|
||||||
#if OPENTHREAD_CONFIG_TMF_PROXY_DUA_ENABLE
|
|
||||||
if (aChild.GetDomainUnicastAddress(oldDua) != kErrorNone)
|
|
||||||
{
|
|
||||||
oldDua.Clear();
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if OPENTHREAD_CONFIG_TMF_PROXY_MLR_ENABLE
|
#if OPENTHREAD_CONFIG_TMF_PROXY_MLR_ENABLE
|
||||||
aChild.GetAllMlrRegisteredAddresses(oldMlrRegisteredAddresses);
|
aChild.GetAllMlrRegisteredAddresses(oldMlrRegisteredAddresses);
|
||||||
#endif
|
#endif
|
||||||
@@ -1932,9 +1922,6 @@ Error Mle::ProcessAddressRegistrationTlv(RxInfo &aRxInfo, Child &aChild)
|
|||||||
// Clear EID-to-RLOC cache for the unicast address registered by the child.
|
// Clear EID-to-RLOC cache for the unicast address registered by the child.
|
||||||
Get<AddressResolver>().RemoveEntryForAddress(address);
|
Get<AddressResolver>().RemoveEntryForAddress(address);
|
||||||
}
|
}
|
||||||
#if OPENTHREAD_CONFIG_TMF_PROXY_DUA_ENABLE
|
|
||||||
SignalDuaAddressEvent(aChild, oldDua);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if OPENTHREAD_CONFIG_TMF_PROXY_MLR_ENABLE
|
#if OPENTHREAD_CONFIG_TMF_PROXY_MLR_ENABLE
|
||||||
Get<Mlr::Manager>().UpdateChildRegistrations(aChild, oldMlrRegisteredAddresses);
|
Get<Mlr::Manager>().UpdateChildRegistrations(aChild, oldMlrRegisteredAddresses);
|
||||||
@@ -1956,40 +1943,6 @@ exit:
|
|||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if OPENTHREAD_CONFIG_TMF_PROXY_DUA_ENABLE
|
|
||||||
void Mle::SignalDuaAddressEvent(const Child &aChild, const Ip6::Address &aOldDua) const
|
|
||||||
{
|
|
||||||
DuaManager::ChildDuaAddressEvent event = DuaManager::kAddressUnchanged;
|
|
||||||
Ip6::Address newDua;
|
|
||||||
|
|
||||||
if (aChild.GetDomainUnicastAddress(newDua) == kErrorNone)
|
|
||||||
{
|
|
||||||
if (aOldDua.IsUnspecified())
|
|
||||||
{
|
|
||||||
event = DuaManager::kAddressAdded;
|
|
||||||
}
|
|
||||||
else if (aOldDua != newDua)
|
|
||||||
{
|
|
||||||
event = DuaManager::kAddressChanged;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Child has no DUA address. If there was no old DUA, no need
|
|
||||||
// to signal.
|
|
||||||
|
|
||||||
VerifyOrExit(!aOldDua.IsUnspecified());
|
|
||||||
|
|
||||||
event = DuaManager::kAddressRemoved;
|
|
||||||
}
|
|
||||||
|
|
||||||
Get<DuaManager>().HandleChildDuaAddressEvent(aChild, event);
|
|
||||||
|
|
||||||
exit:
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
#endif // OPENTHREAD_CONFIG_TMF_PROXY_DUA_ENABLE
|
|
||||||
|
|
||||||
bool Mle::IsMessageMleSubType(const Message &aMessage) { return aMessage.IsSubTypeMle(); }
|
bool Mle::IsMessageMleSubType(const Message &aMessage) { return aMessage.IsSubTypeMle(); }
|
||||||
|
|
||||||
bool Mle::IsMessageChildUpdateRequest(const Message &aMessage)
|
bool Mle::IsMessageChildUpdateRequest(const Message &aMessage)
|
||||||
|
|||||||
@@ -323,10 +323,6 @@ void NeighborTable::Signal(Event aEvent, const Neighbor &aNeighbor)
|
|||||||
|
|
||||||
case kChildRemoved:
|
case kChildRemoved:
|
||||||
Get<Notifier>().Signal(kEventThreadChildRemoved);
|
Get<Notifier>().Signal(kEventThreadChildRemoved);
|
||||||
#if OPENTHREAD_FTD && OPENTHREAD_CONFIG_TMF_PROXY_DUA_ENABLE
|
|
||||||
Get<DuaManager>().HandleChildDuaAddressEvent(static_cast<const Child &>(aNeighbor),
|
|
||||||
DuaManager::kAddressRemoved);
|
|
||||||
#endif
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#if OPENTHREAD_FTD
|
#if OPENTHREAD_FTD
|
||||||
|
|||||||
@@ -123,10 +123,6 @@ bool Agent::HandleResource(const char *aUriPath, Msg &aMsg)
|
|||||||
Case(kUriRelayRx, Agent);
|
Case(kUriRelayRx, Agent);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if OPENTHREAD_FTD && OPENTHREAD_CONFIG_TMF_PROXY_DUA_ENABLE
|
|
||||||
Case(kUriDuaRegistrationNotify, DuaManager);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if OPENTHREAD_CONFIG_TMF_ANYCAST_LOCATOR_ENABLE
|
#if OPENTHREAD_CONFIG_TMF_ANYCAST_LOCATOR_ENABLE
|
||||||
Case(kUriAnycastLocate, AnycastLocator);
|
Case(kUriAnycastLocate, AnycastLocator);
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -95,8 +95,6 @@ struct Entry
|
|||||||
_("d/dr", kUriDiagnosticReset, "DiagReset") \
|
_("d/dr", kUriDiagnosticReset, "DiagReset") \
|
||||||
_("h/an", kUriHistoryAnswer, "HistAnswer") \
|
_("h/an", kUriHistoryAnswer, "HistAnswer") \
|
||||||
_("h/qy", kUriHistoryQuery, "HistQuery") \
|
_("h/qy", kUriHistoryQuery, "HistQuery") \
|
||||||
_("n/dn", kUriDuaRegistrationNotify, "DuaRegNotify") \
|
|
||||||
_("n/dr", kUriDuaRegistrationRequest, "DuaRegRequest") \
|
|
||||||
_("n/mr", kUriMlr, "Mlr")
|
_("n/mr", kUriMlr, "Mlr")
|
||||||
|
|
||||||
// We use the X-Macro pattern here. The `UriEntryMapList` macro defines the
|
// We use the X-Macro pattern here. The `UriEntryMapList` macro defines the
|
||||||
|
|||||||
@@ -45,53 +45,51 @@ namespace ot {
|
|||||||
*/
|
*/
|
||||||
enum Uri : uint8_t
|
enum Uri : uint8_t
|
||||||
{
|
{
|
||||||
kUriAddressError, ///< Address Error ("a/ae")
|
kUriAddressError, ///< Address Error ("a/ae")
|
||||||
kUriAddressNotify, ///< Address Notify ("a/an")
|
kUriAddressNotify, ///< Address Notify ("a/an")
|
||||||
kUriAddressQuery, ///< Address Query ("a/aq")
|
kUriAddressQuery, ///< Address Query ("a/aq")
|
||||||
kUriAddressRelease, ///< Address Release ("a/ar")
|
kUriAddressRelease, ///< Address Release ("a/ar")
|
||||||
kUriAddressSolicit, ///< Address Solicit ("a/as")
|
kUriAddressSolicit, ///< Address Solicit ("a/as")
|
||||||
kUriServerData, ///< Server Data Registration ("a/sd")
|
kUriServerData, ///< Server Data Registration ("a/sd")
|
||||||
kUriAnycastLocate, ///< Anycast Locate ("a/yl")
|
kUriAnycastLocate, ///< Anycast Locate ("a/yl")
|
||||||
kUriBackboneMlr, ///< Backbone Multicast Listener Report ("b/bmr")
|
kUriBackboneMlr, ///< Backbone Multicast Listener Report ("b/bmr")
|
||||||
kUriAnnounceBegin, ///< Announce Begin ("c/ab")
|
kUriAnnounceBegin, ///< Announce Begin ("c/ab")
|
||||||
kUriActiveGet, ///< MGMT_ACTIVE_GET "c/ag"
|
kUriActiveGet, ///< MGMT_ACTIVE_GET "c/ag"
|
||||||
kUriActiveReplace, ///< MGMT_ACTIVE_REPLACE ("c/ar")
|
kUriActiveReplace, ///< MGMT_ACTIVE_REPLACE ("c/ar")
|
||||||
kUriActiveSet, ///< MGMT_ACTIVE_SET ("c/as")
|
kUriActiveSet, ///< MGMT_ACTIVE_SET ("c/as")
|
||||||
kUriCommissionerKeepAlive, ///< Commissioner Keep Alive ("c/ca")
|
kUriCommissionerKeepAlive, ///< Commissioner Keep Alive ("c/ca")
|
||||||
kUriCommissionerGet, ///< MGMT_COMMISSIONER_GET ("c/cg")
|
kUriCommissionerGet, ///< MGMT_COMMISSIONER_GET ("c/cg")
|
||||||
kUriCommissionerPetition, ///< Commissioner Petition ("c/cp")
|
kUriCommissionerPetition, ///< Commissioner Petition ("c/cp")
|
||||||
kUriCommissionerSet, ///< MGMT_COMMISSIONER_SET ("c/cs")
|
kUriCommissionerSet, ///< MGMT_COMMISSIONER_SET ("c/cs")
|
||||||
kUriDatasetChanged, ///< MGMT_DATASET_CHANGED ("c/dc")
|
kUriDatasetChanged, ///< MGMT_DATASET_CHANGED ("c/dc")
|
||||||
kUriEnergyReport, ///< Energy Report ("c/er")
|
kUriEnergyReport, ///< Energy Report ("c/er")
|
||||||
kUriEnergyScan, ///< Energy Scan ("c/es")
|
kUriEnergyScan, ///< Energy Scan ("c/es")
|
||||||
kUriJoinerEntrust, ///< Joiner Entrust ("c/je")
|
kUriJoinerEntrust, ///< Joiner Entrust ("c/je")
|
||||||
kUriJoinerFinalize, ///< Joiner Finalize ("c/jf")
|
kUriJoinerFinalize, ///< Joiner Finalize ("c/jf")
|
||||||
kUriLeaderKeepAlive, ///< Leader Keep Alive ("c/la")
|
kUriLeaderKeepAlive, ///< Leader Keep Alive ("c/la")
|
||||||
kUriLeaderPetition, ///< Leader Petition ("c/lp")
|
kUriLeaderPetition, ///< Leader Petition ("c/lp")
|
||||||
kUriEnrollerJoinerAccept, ///< Enroller Joiner Accept ("c/nj")
|
kUriEnrollerJoinerAccept, ///< Enroller Joiner Accept ("c/nj")
|
||||||
kUriEnrollerKeepAlive, ///< Enroller KeepAlive ("c/nk")
|
kUriEnrollerKeepAlive, ///< Enroller KeepAlive ("c/nk")
|
||||||
kUriEnrollerJoinerRelease, ///< Enroller Joiner Release ("c/nl")
|
kUriEnrollerJoinerRelease, ///< Enroller Joiner Release ("c/nl")
|
||||||
kUriEnrollerRegister, ///< Enroller Register ("c/nr")
|
kUriEnrollerRegister, ///< Enroller Register ("c/nr")
|
||||||
kUriEnrollerReportState, ///< Report Admitter State (to enroller) ("c/ns")
|
kUriEnrollerReportState, ///< Report Admitter State (to enroller) ("c/ns")
|
||||||
kUriPanIdConflict, ///< PAN ID Conflict ("c/pc")
|
kUriPanIdConflict, ///< PAN ID Conflict ("c/pc")
|
||||||
kUriPendingGet, ///< MGMT_PENDING_GET ("c/pg")
|
kUriPendingGet, ///< MGMT_PENDING_GET ("c/pg")
|
||||||
kUriPanIdQuery, ///< PAN ID Query ("c/pq")
|
kUriPanIdQuery, ///< PAN ID Query ("c/pq")
|
||||||
kUriPendingSet, ///< MGMT_PENDING_SET ("c/ps")
|
kUriPendingSet, ///< MGMT_PENDING_SET ("c/ps")
|
||||||
kUriRelayRx, ///< Relay RX ("c/rx")
|
kUriRelayRx, ///< Relay RX ("c/rx")
|
||||||
kUriTcatEnable, ///< TCAT Enable ("c/te")
|
kUriTcatEnable, ///< TCAT Enable ("c/te")
|
||||||
kUriRelayTx, ///< Relay TX ("c/tx")
|
kUriRelayTx, ///< Relay TX ("c/tx")
|
||||||
kUriProxyRx, ///< Proxy RX ("c/ur")
|
kUriProxyRx, ///< Proxy RX ("c/ur")
|
||||||
kUriProxyTx, ///< Proxy TX ("c/ut")
|
kUriProxyTx, ///< Proxy TX ("c/ut")
|
||||||
kUriDiagnosticGetAnswer, ///< Network Diagnostic Get Answer ("d/da")
|
kUriDiagnosticGetAnswer, ///< Network Diagnostic Get Answer ("d/da")
|
||||||
kUriDiagnosticGetRequest, ///< Network Diagnostic Get Request ("d/dg")
|
kUriDiagnosticGetRequest, ///< Network Diagnostic Get Request ("d/dg")
|
||||||
kUriDiagnosticGetQuery, ///< Network Diagnostic Get Query ("d/dq")
|
kUriDiagnosticGetQuery, ///< Network Diagnostic Get Query ("d/dq")
|
||||||
kUriDiagnosticReset, ///< Network Diagnostic Reset ("d/dr")
|
kUriDiagnosticReset, ///< Network Diagnostic Reset ("d/dr")
|
||||||
kUriHistoryAnswer, ///< History Answer ("h/an")
|
kUriHistoryAnswer, ///< History Answer ("h/an")
|
||||||
kUriHistoryQuery, ///< History Query ("h/qy")
|
kUriHistoryQuery, ///< History Query ("h/qy")
|
||||||
kUriDuaRegistrationNotify, ///< DUA Registration Notification ("n/dn")
|
kUriMlr, ///< Multicast Listener Registration ("n/mr")
|
||||||
kUriDuaRegistrationRequest, ///< DUA Registration Request ("n/dr")
|
kUriUnknown, ///< Unknown URI
|
||||||
kUriMlr, ///< Multicast Listener Registration ("n/mr")
|
|
||||||
kUriUnknown, ///< Unknown URI
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -163,8 +161,6 @@ template <> const char *UriToString<kUriDiagnosticGetAnswer>(void);
|
|||||||
template <> const char *UriToString<kUriDiagnosticGetRequest>(void);
|
template <> const char *UriToString<kUriDiagnosticGetRequest>(void);
|
||||||
template <> const char *UriToString<kUriDiagnosticGetQuery>(void);
|
template <> const char *UriToString<kUriDiagnosticGetQuery>(void);
|
||||||
template <> const char *UriToString<kUriDiagnosticReset>(void);
|
template <> const char *UriToString<kUriDiagnosticReset>(void);
|
||||||
template <> const char *UriToString<kUriDuaRegistrationNotify>(void);
|
|
||||||
template <> const char *UriToString<kUriDuaRegistrationRequest>(void);
|
|
||||||
template <> const char *UriToString<kUriMlr>(void);
|
template <> const char *UriToString<kUriMlr>(void);
|
||||||
|
|
||||||
} // namespace ot
|
} // namespace ot
|
||||||
|
|||||||
@@ -94,7 +94,6 @@ class ADDRESS_TYPE(Enum):
|
|||||||
RLOC = 'RLOC'
|
RLOC = 'RLOC'
|
||||||
ALOC = 'ALOC'
|
ALOC = 'ALOC'
|
||||||
ML_EID = 'ML_EID'
|
ML_EID = 'ML_EID'
|
||||||
DUA = 'DUA'
|
|
||||||
BACKBONE_GUA = 'BACKBONE_GUA'
|
BACKBONE_GUA = 'BACKBONE_GUA'
|
||||||
BACKBONE_LINK_LOCAL = 'BACKBONE_LINK_LOCAL'
|
BACKBONE_LINK_LOCAL = 'BACKBONE_LINK_LOCAL'
|
||||||
OMR = 'OMR'
|
OMR = 'OMR'
|
||||||
@@ -139,7 +138,6 @@ ADDRESS_QUERY_INITIAL_RETRY_DELAY = 15
|
|||||||
DEFAULT_CHILD_TIMEOUT = 6
|
DEFAULT_CHILD_TIMEOUT = 6
|
||||||
VIRTUAL_TIME = int(os.getenv('VIRTUAL_TIME', 0))
|
VIRTUAL_TIME = int(os.getenv('VIRTUAL_TIME', 0))
|
||||||
PARENT_AGGREGATIOIN_DELAY = 5
|
PARENT_AGGREGATIOIN_DELAY = 5
|
||||||
DUA_DAD_DELAY = 5
|
|
||||||
DEFAULT_BBR_REGISTRATION_JITTER = 2
|
DEFAULT_BBR_REGISTRATION_JITTER = 2
|
||||||
DEFAULT_ROUTER_SELECTION_JITTER = 1
|
DEFAULT_ROUTER_SELECTION_JITTER = 1
|
||||||
|
|
||||||
|
|||||||
@@ -1616,32 +1616,6 @@ class NodeImpl:
|
|||||||
self.remove_prefix(prefix)
|
self.remove_prefix(prefix)
|
||||||
self.register_netdata()
|
self.register_netdata()
|
||||||
|
|
||||||
def set_next_dua_response(self, status: Union[str, int], iid=None):
|
|
||||||
# Convert 5.00 to COAP CODE 160
|
|
||||||
if isinstance(status, str):
|
|
||||||
assert '.' in status
|
|
||||||
status = status.split('.')
|
|
||||||
status = (int(status[0]) << 5) + int(status[1])
|
|
||||||
|
|
||||||
cmd = 'bbr mgmt dua {}'.format(status)
|
|
||||||
if iid is not None:
|
|
||||||
cmd += ' ' + str(iid)
|
|
||||||
self.send_command(cmd)
|
|
||||||
self._expect_done()
|
|
||||||
|
|
||||||
def set_dua_iid(self, iid: str):
|
|
||||||
assert len(iid) == 16
|
|
||||||
int(iid, 16)
|
|
||||||
|
|
||||||
cmd = 'dua iid {}'.format(iid)
|
|
||||||
self.send_command(cmd)
|
|
||||||
self._expect_done()
|
|
||||||
|
|
||||||
def clear_dua_iid(self):
|
|
||||||
cmd = 'dua iid clear'
|
|
||||||
self.send_command(cmd)
|
|
||||||
self._expect_done()
|
|
||||||
|
|
||||||
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)
|
||||||
@@ -2153,7 +2127,7 @@ class NodeImpl:
|
|||||||
omr_addrs = []
|
omr_addrs = []
|
||||||
for addr in self.get_addrs():
|
for addr in self.get_addrs():
|
||||||
for prefix in prefixes:
|
for prefix in prefixes:
|
||||||
if (addr.startswith(prefix)) and (addr != self.__getDua()):
|
if addr.startswith(prefix):
|
||||||
omr_addrs.append(addr)
|
omr_addrs.append(addr)
|
||||||
break
|
break
|
||||||
|
|
||||||
@@ -2202,13 +2176,6 @@ class NodeImpl:
|
|||||||
|
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def __getDua(self) -> Optional[str]:
|
|
||||||
for ip6Addr in self.get_addrs():
|
|
||||||
if re.match(config.DOMAIN_PREFIX_REGEX_PATTERN, ip6Addr, re.I):
|
|
||||||
return ip6Addr
|
|
||||||
|
|
||||||
return None
|
|
||||||
|
|
||||||
def get_ip6_address_by_prefix(self, prefix: Union[str, IPv6Network]) -> List[IPv6Address]:
|
def get_ip6_address_by_prefix(self, prefix: Union[str, IPv6Network]) -> List[IPv6Address]:
|
||||||
"""Get addresses matched with given prefix.
|
"""Get addresses matched with given prefix.
|
||||||
|
|
||||||
@@ -2244,8 +2211,6 @@ class NodeImpl:
|
|||||||
return self.__getAloc()
|
return self.__getAloc()
|
||||||
elif address_type == config.ADDRESS_TYPE.ML_EID:
|
elif address_type == config.ADDRESS_TYPE.ML_EID:
|
||||||
return self.__getMleid()
|
return self.__getMleid()
|
||||||
elif address_type == config.ADDRESS_TYPE.DUA:
|
|
||||||
return self.__getDua()
|
|
||||||
elif address_type == config.ADDRESS_TYPE.BACKBONE_GUA:
|
elif address_type == config.ADDRESS_TYPE.BACKBONE_GUA:
|
||||||
return self._getBackboneGua()
|
return self._getBackboneGua()
|
||||||
elif address_type == config.ADDRESS_TYPE.OMR:
|
elif address_type == config.ADDRESS_TYPE.OMR:
|
||||||
|
|||||||
@@ -109,14 +109,6 @@ class Ipv6Addr(Bytes):
|
|||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
@property
|
|
||||||
def is_dua(self) -> bool:
|
|
||||||
"""
|
|
||||||
Returns if the Ip6 address is Domain Unicast Address.
|
|
||||||
"""
|
|
||||||
from pktverify import consts
|
|
||||||
return self.startswith(consts.DOMAIN_PREFIX)
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def is_backbone_gua(self) -> bool:
|
def is_backbone_gua(self) -> bool:
|
||||||
"""
|
"""
|
||||||
|
|||||||
@@ -30,7 +30,6 @@
|
|||||||
from pktverify.addrs import Ipv6Addr
|
from pktverify.addrs import Ipv6Addr
|
||||||
from pktverify.bytes import Bytes
|
from pktverify.bytes import Bytes
|
||||||
|
|
||||||
DOMAIN_PREFIX = Bytes('fd00:7d03:7d03:7d03')
|
|
||||||
BACKBONE_IPV6_PREFIX = Bytes('91')
|
BACKBONE_IPV6_PREFIX = Bytes('91')
|
||||||
|
|
||||||
LINK_LOCAL_ALL_THREAD_NODES_MULTICAST_ADDRESS = Ipv6Addr('ff32:40:fd00:db8::1')
|
LINK_LOCAL_ALL_THREAD_NODES_MULTICAST_ADDRESS = Ipv6Addr('ff32:40:fd00:db8::1')
|
||||||
@@ -279,8 +278,6 @@ NWD_SERVER_TLV = 6
|
|||||||
LM_FORWARD_PROBING_REGISTRATION_SUB_TLV = 3
|
LM_FORWARD_PROBING_REGISTRATION_SUB_TLV = 3
|
||||||
LM_ENHANCED_ACK_CONFIGURATION_SUB_TLV = 7
|
LM_ENHANCED_ACK_CONFIGURATION_SUB_TLV = 7
|
||||||
|
|
||||||
# DUA related constants
|
|
||||||
|
|
||||||
ADDRESS_QUERY_INITIAL_RETRY_DELAY = 15
|
ADDRESS_QUERY_INITIAL_RETRY_DELAY = 15
|
||||||
ADDRESS_QUERY_MAX_RETRY_DELAY = 8
|
ADDRESS_QUERY_MAX_RETRY_DELAY = 8
|
||||||
ADDRESS_QUERY_TIMEOUT = 3
|
ADDRESS_QUERY_TIMEOUT = 3
|
||||||
@@ -291,10 +288,6 @@ CONTEXT_ID_REUSE_DELAY = 48
|
|||||||
|
|
||||||
DATA_RESUBMIT_DELAY = 300
|
DATA_RESUBMIT_DELAY = 300
|
||||||
|
|
||||||
DUA_DAD_PERIOD = 100
|
|
||||||
DUA_DAD_QUERY_TIMEOUT = 1.0
|
|
||||||
DUA_DAD_REPEATS = 2
|
|
||||||
DUA_RECENT_TIME = 20
|
|
||||||
FAILED_ROUTER_TRANSMISSIONS = 4
|
FAILED_ROUTER_TRANSMISSIONS = 4
|
||||||
ID_REUSE_DELAY = 100
|
ID_REUSE_DELAY = 100
|
||||||
ID_SEQUENCE_PERIOD = 10
|
ID_SEQUENCE_PERIOD = 10
|
||||||
@@ -377,8 +370,6 @@ WIRESHARK_DECODE_AS_ENTRIES = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TIMEOUT_JOIN_NETWORK = 10
|
TIMEOUT_JOIN_NETWORK = 10
|
||||||
TIMEOUT_DUA_REGISTRATION = 10
|
|
||||||
TIMEOUT_DUA_DAD = 15
|
|
||||||
TIMEOUT_HOST_READY = 10
|
TIMEOUT_HOST_READY = 10
|
||||||
TIMEOUT_CHILD_DETACH = 120
|
TIMEOUT_CHILD_DETACH = 120
|
||||||
TIMEOUT_REGISTER_MA = 5
|
TIMEOUT_REGISTER_MA = 5
|
||||||
|
|||||||
@@ -125,9 +125,7 @@ class PacketVerifier(object):
|
|||||||
name = self.test_info.get_node_name(i)
|
name = self.test_info.get_node_name(i)
|
||||||
self._vars[name + '_IPADDRS'] = addrs
|
self._vars[name + '_IPADDRS'] = addrs
|
||||||
for addr in addrs:
|
for addr in addrs:
|
||||||
if addr.is_dua:
|
if addr.is_backbone_gua:
|
||||||
key = name + '_DUA'
|
|
||||||
elif addr.is_backbone_gua:
|
|
||||||
key = name + '_BGUA'
|
key = name + '_BGUA'
|
||||||
elif addr.is_link_local and (name + '_BGUA') in self._vars:
|
elif addr.is_link_local and (name + '_BGUA') in self._vars:
|
||||||
# FIXME: assume the link-local address after Backbone GUA is the Backbone Link Local address
|
# FIXME: assume the link-local address after Backbone GUA is the Backbone Link Local address
|
||||||
@@ -161,10 +159,6 @@ class PacketVerifier(object):
|
|||||||
key = self.test_info.get_node_name(i) + '_OMR'
|
key = self.test_info.get_node_name(i) + '_OMR'
|
||||||
self._vars[key] = omr
|
self._vars[key] = omr
|
||||||
|
|
||||||
for i, dua in self.test_info.duas.items():
|
|
||||||
key = self.test_info.get_node_name(i) + '_DUA'
|
|
||||||
self._vars[key] = dua
|
|
||||||
|
|
||||||
if self.test_info.leader_aloc:
|
if self.test_info.leader_aloc:
|
||||||
self._vars['LEADER_ALOC'] = self.test_info.leader_aloc
|
self._vars['LEADER_ALOC'] = self.test_info.leader_aloc
|
||||||
|
|
||||||
@@ -216,72 +210,6 @@ class PacketVerifier(object):
|
|||||||
|
|
||||||
return result
|
return result
|
||||||
|
|
||||||
def verify_ping(self, src: str, dst: str, bbr: str = None, pkts: 'PacketVerifier' = None) -> VerifyResult:
|
|
||||||
"""
|
|
||||||
Verify the ping process.
|
|
||||||
|
|
||||||
:param src: The source device name.
|
|
||||||
:param dst: The destination device name.
|
|
||||||
:param bbr: The Backbone Router name.
|
|
||||||
If specified, this method also verifies that the ping request and reply be forwarded by the Backbone Router.
|
|
||||||
:param pkts: The PacketFilter to search.
|
|
||||||
|
|
||||||
:return: The verification result.
|
|
||||||
"""
|
|
||||||
if bbr:
|
|
||||||
assert not (self.is_thread_device(src) and self.is_thread_device(dst)), \
|
|
||||||
f"both {src} and {dst} are WPAN devices"
|
|
||||||
assert not (self.is_backbone_device(src) and self.is_backbone_device(dst)), \
|
|
||||||
f"both {src} and {dst} are ETH devices"
|
|
||||||
|
|
||||||
if pkts is None:
|
|
||||||
pkts = self.pkts
|
|
||||||
|
|
||||||
src_dua = self.vars[src + '_DUA']
|
|
||||||
dst_dua = self.vars[dst + '_DUA']
|
|
||||||
if bbr:
|
|
||||||
bbr_ext = self.vars[bbr]
|
|
||||||
bbr_eth = self.vars[bbr + '_ETH']
|
|
||||||
|
|
||||||
result = VerifyResult()
|
|
||||||
ping_req = pkts.filter_ping_request().filter_ipv6_dst(dst_dua)
|
|
||||||
if self.is_backbone_device(src):
|
|
||||||
p = ping_req.filter_eth_src(self.vars[src + '_ETH']).must_next()
|
|
||||||
else:
|
|
||||||
p = ping_req.filter_wpan_src64(self.vars[src]).must_next()
|
|
||||||
|
|
||||||
# pkts.last().show()
|
|
||||||
ping_id = p.icmpv6.echo.identifier
|
|
||||||
logging.info("verify_ping: ping_id=%x", ping_id)
|
|
||||||
result.record_last('ping_request', pkts)
|
|
||||||
ping_req = ping_req.filter(lambda p: p.icmpv6.echo.identifier == ping_id)
|
|
||||||
|
|
||||||
# BBR unicasts the ping packet to TD.
|
|
||||||
if bbr:
|
|
||||||
if self.is_backbone_device(src):
|
|
||||||
ping_req.filter_wpan_src64(bbr_ext).must_next()
|
|
||||||
else:
|
|
||||||
ping_req.filter_eth_src(bbr_eth).must_next()
|
|
||||||
|
|
||||||
ping_reply = pkts.filter_ping_reply().filter_ipv6_dst(src_dua).filter(
|
|
||||||
lambda p: p.icmpv6.echo.identifier == ping_id)
|
|
||||||
# TD receives ping packet and responds back to Host via SBBR.
|
|
||||||
if self.is_thread_device(dst):
|
|
||||||
ping_reply.filter_wpan_src64(self.vars[dst]).must_next()
|
|
||||||
else:
|
|
||||||
ping_reply.filter_eth_src(self.vars[dst + '_ETH']).must_next()
|
|
||||||
|
|
||||||
result.record_last('ping_reply', pkts)
|
|
||||||
|
|
||||||
if bbr:
|
|
||||||
# SBBR forwards the ping response packet to Host.
|
|
||||||
if self.is_thread_device(dst):
|
|
||||||
ping_reply.filter_eth_src(bbr_eth).must_next()
|
|
||||||
else:
|
|
||||||
ping_reply.filter_wpan_src64(bbr_ext).must_next()
|
|
||||||
|
|
||||||
return result
|
|
||||||
|
|
||||||
def is_thread_device(self, name: str) -> bool:
|
def is_thread_device(self, name: str) -> bool:
|
||||||
"""
|
"""
|
||||||
Returns if the device is an WPAN device.
|
Returns if the device is an WPAN device.
|
||||||
@@ -314,45 +242,3 @@ class PacketVerifier(object):
|
|||||||
eth_idx = max(eth_idx, ei)
|
eth_idx = max(eth_idx, ei)
|
||||||
|
|
||||||
return wpan_idx, eth_idx
|
return wpan_idx, eth_idx
|
||||||
|
|
||||||
def verify_dua_registration(self, src64, dua, *, pbbr_eth, sbbr_eth=None, pbbr_src64=None):
|
|
||||||
pv, pkts = self, self.pkts
|
|
||||||
MM = pv.vars['MM_PORT']
|
|
||||||
BB = pv.vars['BB_PORT']
|
|
||||||
|
|
||||||
# Router1 should send /n/dr for DUA registration
|
|
||||||
dr = pkts.filter_wpan_src64(src64).filter_coap_request('/n/dr', port=MM).filter(
|
|
||||||
'thread_nm.tlv.target_eid == {ROUTER1_DUA}', ROUTER1_DUA=dua).must_next()
|
|
||||||
|
|
||||||
# SBBR should not send /b/bq for Router1's DUA
|
|
||||||
if sbbr_eth is not None:
|
|
||||||
pkts.filter_backbone_query(dua, eth_src=sbbr_eth, port=BB).must_not_next()
|
|
||||||
|
|
||||||
# PBBR should respond to /n/dr
|
|
||||||
if pbbr_src64 is not None:
|
|
||||||
pkts.filter_wpan_src64(pbbr_src64).filter_coap_ack(
|
|
||||||
'/n/dr', port=MM).must_next().must_verify('thread_nm.tlv.status == 0')
|
|
||||||
|
|
||||||
# PBBR should send /b/bq for Router1's DUA (1st time)
|
|
||||||
bq1 = pkts.filter_backbone_query(dua, eth_src=pbbr_eth, port=BB).must_next()
|
|
||||||
bq1_index = pkts.index
|
|
||||||
|
|
||||||
assert bq1.sniff_timestamp - dr.sniff_timestamp <= 1.01, bq1.sniff_timestamp - dr.sniff_timestamp
|
|
||||||
|
|
||||||
# PBBR should send /b/bq for Router1's DUA (2nd time)
|
|
||||||
bq2 = pkts.filter_backbone_query(dua, eth_src=pbbr_eth, port=BB).must_next()
|
|
||||||
|
|
||||||
assert 0.9 < bq2.sniff_timestamp - bq1.sniff_timestamp < 1.1, bq2.sniff_timestamp - bq1.sniff_timestamp
|
|
||||||
|
|
||||||
# PBBR should send /b/bq for Router1's DUA (3rd time)
|
|
||||||
bq3 = pkts.filter_backbone_query(dua, eth_src=pbbr_eth, port=BB).must_next()
|
|
||||||
|
|
||||||
assert 0.9 < bq3.sniff_timestamp - bq2.sniff_timestamp < 1.1, bq3.sniff_timestamp - bq2.sniff_timestamp
|
|
||||||
|
|
||||||
# PBBR should send PRO_BB.ntf for Router's DUA when DAD completed
|
|
||||||
pkts.filter_eth_src(pbbr_eth).filter_backbone_answer(dua, port=BB, confirmable=False).must_next().show()
|
|
||||||
|
|
||||||
# PBBR should not recv /b/ba response from other BBRs during this period
|
|
||||||
pkts.range(bq1_index, pkts.index,
|
|
||||||
cascade=False).filter('eth.src != {PBBR_ETH}',
|
|
||||||
PBBR_ETH=pbbr_eth).filter_backbone_answer(dua, port=BB).must_not_next()
|
|
||||||
|
|||||||
@@ -54,7 +54,6 @@ class TestInfo(object):
|
|||||||
self.rlocs = {int(k): Ipv6Addr(v) for k, v in test_info.get('rlocs', {}).items()}
|
self.rlocs = {int(k): Ipv6Addr(v) for k, v in test_info.get('rlocs', {}).items()}
|
||||||
self.rloc16s = self._convert_hex_values(self._convert_keys_to_ints(test_info.get('rloc16s', {})))
|
self.rloc16s = self._convert_hex_values(self._convert_keys_to_ints(test_info.get('rloc16s', {})))
|
||||||
self.omrs = {int(k): [Ipv6Addr(x) for x in l] for k, l in test_info.get('omrs', {}).items()}
|
self.omrs = {int(k): [Ipv6Addr(x) for x in l] for k, l in test_info.get('omrs', {}).items()}
|
||||||
self.duas = {int(k): Ipv6Addr(v) for k, v in test_info.get('duas', {}).items()}
|
|
||||||
self.extra_vars = test_info.get('extra_vars', {})
|
self.extra_vars = test_info.get('extra_vars', {})
|
||||||
self.leader_aloc = Ipv6Addr(test_info.get('leader_aloc')) if 'leader_aloc' in test_info else ''
|
self.leader_aloc = Ipv6Addr(test_info.get('leader_aloc')) if 'leader_aloc' in test_info else ''
|
||||||
|
|
||||||
|
|||||||
@@ -410,19 +410,6 @@ class TestCase(NcpSupportMixin, unittest.TestCase):
|
|||||||
|
|
||||||
test_info['omrs'][i] = node.get_ip6_address(config.ADDRESS_TYPE.OMR)
|
test_info['omrs'][i] = node.get_ip6_address(config.ADDRESS_TYPE.OMR)
|
||||||
|
|
||||||
def collect_duas(self):
|
|
||||||
if not self._do_packet_verification:
|
|
||||||
return
|
|
||||||
|
|
||||||
test_info = self._test_info
|
|
||||||
test_info['duas'] = {}
|
|
||||||
|
|
||||||
for i, node in self.nodes.items():
|
|
||||||
if node.is_host:
|
|
||||||
continue
|
|
||||||
|
|
||||||
test_info['duas'][i] = node.get_ip6_address(config.ADDRESS_TYPE.DUA)
|
|
||||||
|
|
||||||
def collect_leader_aloc(self, node):
|
def collect_leader_aloc(self, node):
|
||||||
if not self._do_packet_verification:
|
if not self._do_packet_verification:
|
||||||
return
|
return
|
||||||
|
|||||||
@@ -54,7 +54,6 @@ ot_build:
|
|||||||
- REST_API=0
|
- REST_API=0
|
||||||
- OT_COMMISSIONER=1
|
- OT_COMMISSIONER=1
|
||||||
options:
|
options:
|
||||||
- "-DOTBR_DUA_ROUTING=ON"
|
|
||||||
- "-DOT_MLR=ON"
|
- "-DOT_MLR=ON"
|
||||||
rcp_subpath: build/ot12/simulation
|
rcp_subpath: build/ot12/simulation
|
||||||
rcp_options:
|
rcp_options:
|
||||||
@@ -72,7 +71,6 @@ ot_build:
|
|||||||
- REST_API=0
|
- REST_API=0
|
||||||
- EXTERNAL_COMMISSIONER=1
|
- EXTERNAL_COMMISSIONER=1
|
||||||
options:
|
options:
|
||||||
- "-DOTBR_DUA_ROUTING=ON"
|
|
||||||
- "-DOT_MLR=ON"
|
- "-DOT_MLR=ON"
|
||||||
rcp_subpath: build/ot13/simulation
|
rcp_subpath: build/ot13/simulation
|
||||||
rcp_options:
|
rcp_options:
|
||||||
|
|||||||
@@ -3086,37 +3086,6 @@ class OpenThreadTHCI(object):
|
|||||||
cmd = 'childip max %d' % int(num)
|
cmd = 'childip max %d' % int(num)
|
||||||
self.__executeCommand(cmd)
|
self.__executeCommand(cmd)
|
||||||
|
|
||||||
@API
|
|
||||||
def config_next_dua_status_rsp(self, mliid, status_code):
|
|
||||||
if status_code >= 400:
|
|
||||||
# map status_code to correct COAP response code
|
|
||||||
a, b = divmod(status_code, 100)
|
|
||||||
status_code = ((a & 0x7) << 5) + (b & 0x1f)
|
|
||||||
|
|
||||||
cmd = 'bbr mgmt dua %d' % status_code
|
|
||||||
|
|
||||||
if mliid is not None:
|
|
||||||
mliid = mliid.replace(':', '')
|
|
||||||
cmd += ' %s' % mliid
|
|
||||||
|
|
||||||
self.__executeCommand(cmd)
|
|
||||||
|
|
||||||
@API
|
|
||||||
def getDUA(self):
|
|
||||||
dua = self.getGUA('fd00:7d03')
|
|
||||||
return dua
|
|
||||||
|
|
||||||
def __addDefaultDomainPrefix(self):
|
|
||||||
self.configBorderRouter(P_dp=1, P_stable=1, P_on_mesh=1, P_default=1)
|
|
||||||
|
|
||||||
def __setDUA(self, sDua):
|
|
||||||
"""specify the DUA before Thread Starts."""
|
|
||||||
if isinstance(sDua, str):
|
|
||||||
sDua = sDua.decode('utf8')
|
|
||||||
iid = ipaddress.IPv6Address(sDua).packed[-8:]
|
|
||||||
cmd = 'dua iid %s' % ''.join('%02x' % ord(b) for b in iid)
|
|
||||||
return self.__executeCommand(cmd)[-1] == 'Done'
|
|
||||||
|
|
||||||
def __getMlIid(self):
|
def __getMlIid(self):
|
||||||
"""get the Mesh Local IID."""
|
"""get the Mesh Local IID."""
|
||||||
# getULA64() would return the full string representation
|
# getULA64() would return the full string representation
|
||||||
@@ -3130,10 +3099,6 @@ class OpenThreadTHCI(object):
|
|||||||
cmd = 'mliid %s' % sMlIid
|
cmd = 'mliid %s' % sMlIid
|
||||||
self.__executeCommand(cmd)
|
self.__executeCommand(cmd)
|
||||||
|
|
||||||
@API
|
|
||||||
def registerDUA(self, sAddr=''):
|
|
||||||
self.__setDUA(sAddr)
|
|
||||||
|
|
||||||
@API
|
@API
|
||||||
def config_next_mlr_status_rsp(self, status_code):
|
def config_next_mlr_status_rsp(self, status_code):
|
||||||
cmd = 'bbr mgmt mlr response %d' % status_code
|
cmd = 'bbr mgmt mlr response %d' % status_code
|
||||||
@@ -3185,8 +3150,7 @@ class OpenThreadTHCI(object):
|
|||||||
@API
|
@API
|
||||||
def migrateNetwork(self, channel=None, net_name=None):
|
def migrateNetwork(self, channel=None, net_name=None):
|
||||||
"""migrate to another Thread Partition 'net_name' (could be None)
|
"""migrate to another Thread Partition 'net_name' (could be None)
|
||||||
on specified 'channel'. Make sure same Mesh Local IID and DUA
|
on specified 'channel'.
|
||||||
after migration for DUA-TC-06/06b (DEV-1923)
|
|
||||||
"""
|
"""
|
||||||
if channel is None:
|
if channel is None:
|
||||||
raise Exception('channel None')
|
raise Exception('channel None')
|
||||||
@@ -3197,7 +3161,6 @@ class OpenThreadTHCI(object):
|
|||||||
print('new partition %s on channel %d' % (net_name, channel))
|
print('new partition %s on channel %d' % (net_name, channel))
|
||||||
|
|
||||||
mliid = self.__getMlIid()
|
mliid = self.__getMlIid()
|
||||||
dua = self.getDUA()
|
|
||||||
self.reset()
|
self.reset()
|
||||||
deviceRole = self.deviceRole
|
deviceRole = self.deviceRole
|
||||||
self.setDefaultValues()
|
self.setDefaultValues()
|
||||||
@@ -3205,7 +3168,6 @@ class OpenThreadTHCI(object):
|
|||||||
if net_name is not None:
|
if net_name is not None:
|
||||||
self.setNetworkName(net_name)
|
self.setNetworkName(net_name)
|
||||||
self.__setMlIid(mliid)
|
self.__setMlIid(mliid)
|
||||||
self.__setDUA(dua)
|
|
||||||
return self.joinNetwork(deviceRole)
|
return self.joinNetwork(deviceRole)
|
||||||
|
|
||||||
@API
|
@API
|
||||||
|
|||||||
@@ -357,14 +357,11 @@ class OpenThread_BR(OpenThreadTHCI, IThci):
|
|||||||
self.bash(cmd)
|
self.bash(cmd)
|
||||||
|
|
||||||
@API
|
@API
|
||||||
def setupHost(self, setDp=False, setDua=False):
|
def setupHost(self, setDp=False):
|
||||||
self.IsHost = True
|
self.IsHost = True
|
||||||
|
|
||||||
self.bash('ip -6 addr add 910b::1 dev %s' % self.backboneNetif)
|
self.bash('ip -6 addr add 910b::1 dev %s' % self.backboneNetif)
|
||||||
|
|
||||||
if setDua:
|
|
||||||
self.bash('ip -6 addr add fd00:7d03:7d03:7d03::1 dev %s' % self.backboneNetif)
|
|
||||||
|
|
||||||
self.__startRadvdService(setDp)
|
self.__startRadvdService(setDp)
|
||||||
|
|
||||||
def _deviceEscapeEscapable(self, string):
|
def _deviceEscapeEscapable(self, string):
|
||||||
|
|||||||
@@ -2436,14 +2436,6 @@ class OTCI(object):
|
|||||||
#
|
#
|
||||||
|
|
||||||
# TODO: bbr mgmt ...
|
# TODO: bbr mgmt ...
|
||||||
def set_bbr_dua_response_status(self, status: int, mliid: Optional[str] = None):
|
|
||||||
"""Set Backbone Router Data Unicast Address Response status/coap-code.
|
|
||||||
|
|
||||||
Only for testing/reference devices
|
|
||||||
"""
|
|
||||||
_mliid = mliid if mliid is not None else ""
|
|
||||||
self.execute_command(f'bbr mgmt dua {status} {_mliid}')
|
|
||||||
|
|
||||||
def set_bbr_mlr_response_status(self, status: int):
|
def set_bbr_mlr_response_status(self, status: int):
|
||||||
"""Set Backbone Router Multicast Listener Response status."""
|
"""Set Backbone Router Multicast Listener Response status."""
|
||||||
self.execute_command(f'bbr mgmt mlr response {status}')
|
self.execute_command(f'bbr mgmt mlr response {status}')
|
||||||
@@ -2583,7 +2575,7 @@ class OTCI(object):
|
|||||||
return listeners
|
return listeners
|
||||||
|
|
||||||
#
|
#
|
||||||
# Thread 1.2 and DUA/MLR utilities
|
# Thread 1.2 and MLR utilities
|
||||||
#
|
#
|
||||||
|
|
||||||
def get_domain_name(self) -> str:
|
def get_domain_name(self) -> str:
|
||||||
|
|||||||
Reference in New Issue
Block a user