This commit refactors the TLV parsing logic within the Network
Diagnostics `Client`.
The monolithic `GetNextDiagTlv` method has been refactored. The large
switch statement that parsed individual TLV payloads was extracted
into a dedicated `ParseDiagTlv` helper method. This separation of
concerns cleans up the `while` loop that iterates over TLVs,
improving readability and making future TLV parsing updates easier.
The new `ParseDiagTlv()` method can also be used in the future by
other modules such as `MeshDiag`.
Additionally, `ParseEnhancedRoute()` was refactored and simplified
to be a member method instead of a static standalone function,
utilizing the newly introduced `EnhRoute` typedef.
This commit introduces the `NetDiag::AnswerSender` class to manage the
transmission of multipart CoAP answer messages for Network Diagnostics
and History Tracker queries.
Previously, both `NetDiag::Server` and `HistoryTracker::Server`
contained duplicated logic to queue allocated answer messages, track
responses, and send subsequent messages one by one using an internal
CoAP message queue.
By extracting this into the new `AnswerSender` class, it eliminates the
redundancy in message queue management, freeing of related answers, and
CoAP response handling across both modules. The `AnswerSender` takes
ownership of the messages generated by an `AnswerBuilder` and manages
the asynchronous transmission lifecycle.
This commit removes `mRouterUpgradeThreshold` and
`mRouterDowngradeThreshold` from the `Mle` class. These variables
were previously moved into the `RoleTransitioner` class, but their
declarations in `Mle` were left behind. Removing them cleans up the
class definition and eliminates unused state.
This commit extends the `NetDiag::AnswerBuilder` class to support
generating and managing answer messages for the `HistoryTracker` module.
This refactor eliminates redundant implementation in
`HistoryTracker::Server`, removing its internal `AnswerInfo` struct
and related message allocation and length checking methods, replacing
them with the unified `NetDiag::AnswerBuilder` workflow.
This commit adds `SendResponseWithStateTlv()` to `Tmf::Agent` to
streamline sending TMF responses that consist solely of a `StateTlv`.
By encapsulating message allocation, TLV appending, and message
transmission into a single method, this reduces duplicate boilerplate
code across `DatasetManager`, `Leader`, and `NetworkData::Leader`.
This commit provides a complete POSIX implementation of the new
`otPlatTcp` platform abstraction APIs. It leverages the existing
OpenThread `Mainloop` polling mechanism to build a fully event-driven,
non-blocking TCP socket implementation without requiring extra threads.
Key features and implementation details:
- Uses `Mainloop` read/write/error sets to monitor socket states.
- Implements `otPlatTcpEnableListener` and `otPlatTcpAccept` to handle
incoming connection requests over IPv6.
- Implements `otPlatTcpConnect` for asynchronous non-blocking outgoing
TCP connections, monitoring `SO_ERROR` to detect handshake completion.
- Handles data transmission utilizing `otPlatTcpIsTxPending` to
monitor the write descriptor and correctly signal `HandleTxReady`.
- Implements `otPlatTcpSend` and `otPlatTcpReceive` ensuring proper
buffering, suppressing `SIGPIPE` safely using `SO_NOSIGPIPE` and
`MSG_NOSIGNAL`.
- Encodes socket file descriptors directly within the platform data
`mData.mDescriptor` union, avoiding dynamic memory allocation.
This commit replaces the implicit sizing of `escaped_frame_buffer`
with an explicit macro `HDLC_MAX_FRAME_SIZE` in the standalone
`spi-hdlc-adapter` tool.
Previously, `escaped_frame_buffer` was sized statically to
`MAX_FRAME_SIZE * 2` (4096 bytes). While this size is mathematically
sufficient to hold a worst-case escaped payload (4091 bytes for a
2043-byte max payload, 4 escaped CRC bytes, and 1 flag byte), it was
not self-documenting and relied on implicit math.
This commit defines `HDLC_MAX_FRAME_SIZE` explicitly as:
`((MAX_FRAME_SIZE - HEADER_LEN) * 2 + 5)`
making the worst-case framing overhead bounds clear and robust to
any future changes to the constants.
This commit corrects the SPI frame sanity checks in the POSIX platform
driver (`spi_interface.cpp`).
Previously, the sanity checks compared `mSpiSlaveDataLen` and
`slaveAcceptLen` against `kMaxFrameSize` (8192). However,
`mSpiSlaveDataLen` is the payload size, which excludes the 5-byte SPI
frame header. If the slave advertised a data length of exactly
`kMaxFrameSize` (8192), it would pass the sanity check, but the
subsequent `DoSpiTransfer` would request a transfer length of
`kMaxFrameSize + kSpiFrameHeaderSize + alignment` (e.g. 8213 bytes).
This would cause an out-of-bounds read on `mSpiTxFrameBuffer` which is
sized `kMaxFrameSize + kSpiAlignAllowanceMax` (8208 bytes).
This commit updates the sanity checks to use
`kMaxFrameSize - kSpiFrameHeaderSize` as the maximum allowed payload
length, ensuring that worst-case transfers always fit within the
tx buffer allocation.
The slave (RCP) controls the `data_len` and `accept_len` fields of the SPI
header. Both carry a payload length that excludes the 5-byte header, as
shown by `sMTU = MAX_FRAME_SIZE - HEADER_LEN`, so the largest valid value
is the MTU, `MAX_FRAME_SIZE - HEADER_LEN`.
The two sanity checks in `push_pull_spi()` only rejected values greater
than `MAX_FRAME_SIZE`, allowing an RCP to advertise a length in the range
(MAX_FRAME_SIZE - HEADER_LEN, MAX_FRAME_SIZE]. That value flows into
`spi_xfer_bytes`, and `do_spi_xfer()` then transfers
`spi_xfer_bytes + HEADER_LEN + sSpiRxAlignAllowance` bytes into
`sSpiRxFrameBuffer` / `sSpiTxFrameBuffer`. Those buffers are sized
`MAX_FRAME_SIZE + SPI_RX_ALIGN_ALLOWANCE_MAX`, so the extra HEADER_LEN
added by the transfer can write up to 5 bytes past the end of both.
Clamp both checks to `MAX_FRAME_SIZE - HEADER_LEN` so the advertised
payload plus the header always fits within the existing buffers.
This commit refactors the `AesCcm` class to simplify its public interface,
decoupling the high-level API from the underlying cryptographic execution.
Key improvements:
- Redesigned the API from a series of procedural method calls
(`Init()`, `Header()`, `Payload()`, `Finalize()`) into a unified,
stateful model. Callers now pre-configure the operation parameters using
dedicated setters (`SetKey()`, `SetNonce()`, `SetAuthData()`,
`SetTagLength()`) and execute the entire cryptographic operation in a
single step via unified `Process()` methods.
- Introduced a nested `Engine` class to encapsulate the low-level AES-CCM
mathematical and cryptographic state. The `Engine` provides clean internal
interfaces for both optimized one-shot (single-part) and multi-part
operations.
- This architectural separation allows the outer `AesCcm` class to focus on
parameter validation, high-level buffer management, and complex `Message`
chunk iterations, while the `Engine` remains focused purely on the
cryptographic core. This also provides a clean extension point to easily
route one-shot operations to platform-specific hardware acceleration APIs
in the future.
- Updated `Mac` and `Mle` modules to use the simplified APIs, reducing
boilerplate code.
- Retained a static `Perform()` wrapper to support the legacy public
`otCrypto` API.
- Updated unit tests to validate the new stateful interfaces, including
robust in-place message chunk processing and separate-buffer
validations.
This commit introduces a new platform abstraction layer for TCP
connections and listeners, enabling OpenThread to leverage platform-
provided TCP stacks. The API is designed for asynchronous, event-driven
environments and can easily support POSIX as well as various embedded
network stacks.
In the core, `Ip6::PlatTcp` and its nested `Connection` and `Listener`
classes are introduced to manage these platform interactions, providing
a clean C++ interface for the OpenThread core. The `PlatTcp` manager
is integrated into the `Instance` class and utilizes `Tasklet` for
asynchronous resource cleanup.
Additionally, this commit adds a comprehensive unit test to verify the
TCP platform abstraction and `Ip6::PlatTcp` implementation. The tests
cover listener and connection lifecycles, data flow, flow control,
incoming connection acceptance, and active object iteration.
This commit refactors `Mle::ProcessMessageSecurity()` to use a new packed
structure, `AesCcmAuthData`, to represent the authenticated data used during
AES-CCM security processing.
The `AesCcmAuthData` structure encapsulates the sender and receiver IPv6
addresses along with the Auxiliary Security Header. By packing these fields
together, we can pass them as a single contiguous buffer to `AesCcm::Header()`.
This eliminates the need for multiple separate calls to `AesCcm::Header()`
and allows the removal of the generic template-based `Header<ObjectType>()`
method in the `AesCcm` class.
Callers to `ProcessMessageSecurity()` have been updated to populate the
`AesCcmAuthData` structure before passing it for processing.
This commit introduces a new `ComposeMeshLocalAddress()` helper method
in the `Mle` class. This method constructs a full IPv6 Address by
combining the Mesh-Local Prefix with a provided Interface Identifier (IID).
By using this helper, we eliminate the repetitive two-step process of
calling `SetPrefix()` followed by `SetIid()` previously scattered across
`Commissioner`, `AddressResolver`, `Child`, and unit tests. This
improves code readability and correctly encapsulates address composition
logic within the `Mle` module.
This commit replaces `Ip6::Address::InitAsRoutingLocator()` and
the now unused `Ip6::Address::InitAsAnycastLocator()` with the
single unified method `Ip6::Address::InitAsLocator()`.
Callers in `Mle` have been updated to use the unified method.
This commit refactors the `FrameBuilder` and `FrameData` modules,
replacing multiple distinct endian-specific methods with a unified,
type-safe templated API.
Key changes:
- Introduced `enum Encoding` (`kBigEndian`, `kLittleEndian`) and a
templated `HostSwap<Encoding, UintType>` helper in `encoding.hpp` to
centralize byte-swapping logic.
- Replaced `AppendBigEndianUint16()`, `AppendLittleEndianUint32()`,
and other variations in `FrameBuilder` with a single templated
method: `AppendUint<Encoding, UintType>()`.
- Replaced `ReadBigEndianUint16()`, `ReadLittleEndianUint32()`,
and other variations in `FrameData` with a single templated
method: `ReadUint<Encoding, UintType>()`.
- Updated all callers in `Lowpan` and `Mac` modules to use the new
templated encoding APIs.
- Updated `test_frame_builder.cpp` to validate the new syntax.
This commit replaces the raw array `mChildren` in `ChildTable` with
the `Array` class from the common utilities.
By switching to `Array`, we can leverage its built-in array management,
bounds checking, and iterator support. This removes boilerplate code
associated with keeping track of `mMaxChildrenAllowed` and simplifies
methods like `GetChildAtIndex`, `FindChild`, `HasChildren`, and
`GetNumChildren` by using `Array` methods.
Additionally, the commit renames `Neighbor::MatchesFilter()` to simply
`Neighbor::Matches()`, which aligns with the expected indicator matching
API used by `Array` and `LinkedList`.
This commit introduces two robustness improvements to Header Information
Element (IE) parsing in Frame:
1. Aligned HasCslIe() with GetCslIe():
Previously, HasCslIe() returned true if a Header IE matching the CSL ID
was present, regardless of whether its declared content length was valid
(>= 4 bytes). Updating HasCslIe() to check GetCslIe() != nullptr ensures
that presence checks enforce the same length validation as retrieval,
preventing callers from assuming a malformed CSL IE is valid.
2. Robust Multi-Vendor IE Iteration in GetTimeIe():
GetTimeIe() previously retrieved the Vendor IE by matching ID 0x00
using GetHeaderIe(), which returns only the first matching element. If
a frame contained multiple Vendor IEs (e.g., a standard Thread Vendor IE
followed by a Nest Time Vendor IE), GetTimeIe() inspected only the
first element, failed the OUI check, and returned nullptr. GetTimeIe()
is refactored to iterate through all Header IEs until a matching Nest
OUI and Time SubType are found, ensuring correct discovery across
multi-vendor frames.
Both otPlatBleGapAdvSetData() and otPlatBleGapAdvUpdateData() now have the same set of retvals.
The aInterval parameter is explained better: it's a request/hint to the BLE platform for the
advertising interval, but not a requirement.
This adds sIsEnabled for more realistic BLE simulation platform behavior. Also
improves internal disconnection state management, per review comments.
Adds asynchronous calling of otPlatBleGapOnDisconnected() to avoid doing the
'disconnected' callback twice, per review comments. A unit test is extended to
verify that the callback happens once.
For test_platform.cpp 2 instances of '#ifdef' are fixed to '#if'.
To get an update of TCAT advertisement data when the active dataset changes, notifier events are
introduced. This also refactors the existing adv update on MLE role change to use a notifier event.
This update now covers all cases where an application/CLI/user changes the active dataset, which should
be then reflected in TCAT advertisement flag values.
The 'requested advertising state' is refactored from a BleState to a bool, to make the code more
readable and avoid subtle errors.
This fixes the issue observed in tests, that the BLE advertisement contents (flags) were not updated
after a TCAT Commissioner disconnects. A unit test is added for BLE advertisement contents to
validate the advertisement data changes.
It also adds an explicit 'disconnect' CLI command to the TCAT expect tests, which wasn't tested
before.
This fixes some ble.h issues and makes explicit that BLE advertising will stop once a client connects.
The TCAT agent is updated to re-enable advertising after a client disconnects (in the default case).
This fixes an issue observed in cert tests. For easier testing in the future, debug log messages are
added for the simulation BLE platform.
The simulation platform (ble.c) is improved to act more like a real BLE platform, by now supporting
client connection state and calling of otPlatBleGapOnConnected() and otPlatBleGapOnDisconnected().
This is required to manually test the TCAT Commissioner/Device flow in Posix simulation.
GetThreadIe(), GetCslIe(), and GetTimeIe() read a fixed content struct
(VendorIeHeader / CslIe / TimeIe) at `ie + sizeof(HeaderIe)` after
matching the IE id, without first checking that the IE's Length field
covers that struct. FindPayloadIndex() only guarantees the IE header
plus its declared Length fit within the frame, so a matching IE whose
Length is shorter than the content struct (e.g. a zero-length vendor IE
placed at the end of the header-IE region) causes a read past the IE
content, and past the PSDU buffer when the IE ends at the frame
boundary.
Gate each content read on the IE Length being at least the
corresponding kIeContentSize before dereferencing the struct.
This commit introduces the `AesCcm::Nonce` class to represent the IEEE
802.15.4 nonce byte sequence, replacing the previous `GenerateNonce()`
method which operated on a raw byte array.
Replacing `uint8_t *` buffers and `kNonceSize` with a dedicated, packed
`Nonce` class makes the code cleaner and prevents potential buffer size
mismatches at call sites. The new class provides an `InitFrom()` method
to safely initialize the nonce from an extended address, frame counter,
and security level.
All callers in `Mac` (frame transmission and reception) and `Mle`
(message security) have been updated to use the new `Nonce` class.
Enhance `MeshForwarder::EvictMessage` to prioritize evicting messages
from `mReassemblyList` that were received without link security when
reclaiming message buffers (reason `kEvictReasonNoMessageBuffer`).
This helps protect secure messages in the send queue from being
evicted due to buffer exhaustion, by prioritizing the dropping of
insecure, potentially incomplete, reassembled fragments.
Both FTD and MTD implementations of `EvictMessage` are updated.
This commit updates the commit hash pin for codecov/codecov-action
from 671740a (v5.5.2) to fb8b358 (v7.0.0) across all CI workflows.
Workflows updated:
- otbr.yml
- posix.yml
- simulation.yml
- toranj.yml
- unit.yml
This commit introduces `ComposeRloc()` and `ComposeAloc()` in the `Mle`
module and updates the codebase to use them.
These methods streamline the construction of Routing Locators and
Anycast Locators by automatically combining the Mesh-Local Prefix with
the provided RLOC16 or ALOC16. This centralizes address composition
logic within `Mle` instead of relying on manually formatting
`Ip6::Address` instances across various modules.
This commit removes all Domain Prefix configuration and management logic
from the OpenThread stack, CLI commands, unit tests, and GRL harness
THCI wrapper.
- Removed public Backbone Router Domain Prefix APIs.
- Removed Domain Prefix flag ('mDp') and 'D' flag parser/formatter
from core network data types, Spinel, and CLI.
- Cleaned up local Backbone Router and Leader logic to exclude Domain
Prefix configuration, tracking, and events.
- Updated RoutingManager prefix advertisement (RIO) to exclude
special handling for Domain Prefix.
- Updated CLI documentation to remove Domain Prefix references.
- Removed domain prefix helper methods from python test certification
scripts.
- Removed auto-addition of default domain prefix and D flag support
from GRL harness OpenThread.py.
This commit ensures that the peer's extended address matches the stored
extended address when receiving a Link Accept for an already valid link,
preventing unintended frame counter resets and neighbor table updates.
To achieve this:
- We validate that the peer's extended address (extracted from the
IPv6 peer address IID) matches the router's stored extended address
when processing Link Accepts for a neighbor that is already in the
kStateValid state. If there is a mismatch, the packet is rejected
with kErrorSecurity.
- We gate InitNeighbor() and the resetting of MLE frame counters
so they only execute if the neighbor is not already kStateValid.
For valid neighbors, we only update link statistics (RSS, last
heard, link quality, key sequence) and clear the Link Accept
timeout without modifying the frame counters or average RSS history.
This commit renames the static helper `Utils::ParseToIp6Address()` to
`Utils::ParseOrSynthesizeIp6Address()` to better reflect its behavior
of parsing an IPv6 address or synthesizing one from an IPv4 address
via NAT64.
Additionally, the method is refactored into a non-static member of the
`Utils` class. This eliminates the need to manually pass the `otInstance`
pointer, as the `Utils` class already maintains it. The internal
implementation is also simplified to reduce nesting by exiting early
upon successful IPv6 address parsing.
All callers in the CLI module (TCP, UDP, Ping, DNS) have been updated
to use the new member method.
This commit updates `Name::LabelIterator::ReadLabel()` to explicitly
check that the read label from the message does not contain any embedded
`kNullChar` (`\0`) characters. It uses `StringLength()` to verify that
the length of the string matches the expected label length. If a null
character is found before the end of the label, `kErrorParse` is
returned to prevent potential string truncation issues or
misinterpretation of the label name.
This broader check replaces a recent fix in `PtrRecord::ReadPtrName()`
from #13183 which only verified that the first label was not empty
or malformed by checking for a single-character label with a null
byte. By enforcing this validation centrally at the `ReadLabel()`
level, we now ensure that labels of any length are properly
protected against embedded null characters across all DNS record
types.
This commit refactors several Nexus diagnostic test cases to use the
existing `Mle::GetMeshLocalRloc()` method instead of manually assembling
the RLOC by combining the mesh-local prefix and the node's RLOC16. This
improves code readability and adheres to the standard pattern for
retrieving a node's Routing Locator.
This commit renames several methods in the `Mle` class that construct
an IPv6 address from the mesh-local prefix and an RLOC16/ALOC16 from
`Get...()` to `Compose...()` to better reflect their behavior.
The affected methods are:
- `GetLeaderRloc()` -> `ComposeLeaderRloc()`
- `GetLeaderAloc()` -> `ComposeLeaderAloc()`
- `GetCommissionerAloc()` -> `ComposeCommissionerAloc()`
- `GetServiceAloc()` -> `ComposeServiceAloc()`
This commit updates the codebase to use the `Icmp6Header` type
directly, replacing the nested `Ip6::Icmp::Header` definition.
This change aligns the ICMPv6 header type definition with the
conventions used for other network protocol headers and simplifies
type references across the network, border router, and utility
modules.
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 updates the SRP registration and verification logic to pass
the 1_3_SRP_TC_1 test case in the Nexus simulator:
1. In test_1_3_SRP_TC_1.cpp, temporarily disable/enable the eth1 DNS-SD
agent during SRV, AAAA, and browser resolver queries to force a
clear of the local cache. This ensures the queries are sent over the
wire to the Border Router (DUT) instead of being answered from the
resolver's cache.
2. In verify_1_3_SRP_TC_1.py, add checks for mDNS query and response
packets for Steps 9b, 9c, 15b, and 15c. Relax the Step 15c check to
not require the ML-EID in the mDNS response, as advertising
Mesh-Local addresses on the infrastructure link is optional and not
done by the OpenThread SRP advertising proxy.
This commit wraps the contents of `tcp6.hpp` and `tcp6_ext.hpp` with
`#if OPENTHREAD_CONFIG_TCP_ENABLE` feature guards to ensure that TCP
definitions and types are cleanly excluded when TCP support is disabled
in the build configuration. Additionally, it explicitly disables the
`OPENTHREAD_CONFIG_TCP_ENABLE` feature flag in the Toranj test
configuration to validate building without TCP support.
This commit removes the deprecated `test_trel_connectivity.py`
integration test. The TREL connectivity test functionality is
already fully covered by the Nexus simulation test suite, which
provides faster and more reliable testing.
This commit migrates the legacy Thread certification test
'test_publish_meshcop_service.py' to the C++ simulation test suite
in the Nexus platform.
To avoid redundancy and keep the test suite clean, the coverage
is consolidated directly within 'tests/nexus/test_border_agent.cpp'
instead of introducing a new redundant test file.
Consolidated coverage and changes:
- Extended the state bitmap parser and 'ValidateMeshCoPTxtData' in
'test_border_agent.cpp' to verify Backbone Router (BBR) active
and primary flags (kFlagBbrIsActive, kFlagBbrIsPrimary) when
OPENTHREAD_CONFIG_BACKBONE_ROUTER_ENABLE is enabled.
- Added a new test block in 'TestBorderAgentServiceRegistration' to
enable Backbone Router on node0, verify that BBR active and primary
flags are dynamically advertised in the MeshCoP TXT record over
mDNS, and verify that disabling BBR correctly updates the TXT
record state bitmap.
- Fully deleted the legacy Python certification script
'test_publish_meshcop_service.py' from 'thread-cert'.
This commit updates the codebase to use the `Icmp4Header` type directly,
replacing the nested `Ip4::Icmp::Header` type. The empty `Ip4::Icmp`
wrapper class is removed to simplify the header definition. This change
aligns the ICMPv4 header structure with the flat naming conventions used
for other IP headers (e.g., `Ip6::Icmp6Header`, `Ip6::UpdHeader`).
This commit completely removes the local Domain Unicast Address (DUA)
registration feature flag (OPENTHREAD_CONFIG_DUA_ENABLE) and all of
its associated implementation, public APIs, CLI commands, Spinel
property handlers, and certification tests.
Thread 1.2 FTD Border Router/Router DUA proxying features for MTD
children (OPENTHREAD_CONFIG_TMF_PROXY_DUA_ENABLE) are preserved and
updated to only compile/instantiate components when proxy DUA
features are active.
Detailed Changes:
- Remove default definition of OPENTHREAD_CONFIG_DUA_ENABLE from
misc.h.
- Remove OT_DUA and openthread_config_dua_enable from CMake/GN
configs.
- Remove otThreadSetFixedDuaInterfaceIdentifier and
otThreadGetFixedDuaInterfaceIdentifier from
include/openthread/thread.h
and implementation src/core/api/thread_api.cpp.
- Remove CLI DUA interpreter from src/cli/cli.cpp.
- Remove SPINEL_CAP_DUA capability and SPINEL_PROP_THREAD_DUA_ID
Spinel property handlers and dispatchers from NCP.
- Strip local DUA management features (conflict checking, SLAAC DUA
interface identifiers, and dad info settings) from DuaManager, MLE,
Address Resolver, and settings.
- Clean up Notifier, TimeTicker, and TMF dispatcher guards.
- Clean up -DOT_DUA=ON compilation flags across build/test scripts.
- Delete obsolete DUA certification tests:
- v1_2_test_domain_unicast_address
- v1_2_test_domain_unicast_address_registration
- v1_2_test_dua_handle_address_error
`PtrRecord::ReadPtrName()` reads a PTR target's first label with
`Name::ReadLabel()`, which performs no emptiness check. A response whose
first label is a single NUL byte (wire `01 00`) is stored as an empty
C-string and cached by the browse cache as a service instance. When the
cache later builds a known-answer question, it calls
`Name::AppendLabel("")`, which returns `kErrorInvalidArgs`; the
surrounding `SuccessOrAssert()` turns that into an abort. A single
unauthenticated link-local mDNS response thus crashes any node with an
active browser.
Reject an empty first label in `ReadPtrName()` so the record is dropped
on receive and never cached. This matches the `Name::ValidateLabel`
checks already applied on the registration and resolver paths, and makes
the "ReadPtrName() validates that PTR record is well-formed" comment at
the call site accurate.
Add a regression test that delivers a PTR response with a single
NUL-byte instance label and verifies no result is reported and the
browser keeps querying without the malformed entry.
This commit adds the missing Doxygen groups for TCP (`core-tcp`),
TCP Extensions (`core-tcp-ext`), and UDP (`core-udp`). These groups
are used in the code but were not previously defined.
This commit updates the codebase to use `TcpHeader` and `UdpHeader` types
directly, instead of the nested `Tcp::Header` and `Udp::Header` types.
The `TcpHeader` and `UdpHeader` classes are already defined in
`ip6_headers.hpp`. This change reduces dependencies on the `Tcp` and
`Udp` class definitions, which is particularly useful when TCP
is disabled in the build configuration, avoiding the need to include
their respective class headers just for the header definitions.
This commit fixes instances of "the the" typos found in various
files across the codebase, including documentation, headers, source
files, and test scripts.
This commit updates the `markdown-lint-check` job to explicitly set
the `PUPPETEER_EXECUTABLE_PATH` environment variable to use the
system-installed Google Chrome (`/usr/bin/google-chrome`) for the
`linkspector` action. This resolves issues where the action fails
to find a browser environment to execute properly.
This commit implements additional vendor application or ecosystem
policy settings for TCAT including:
1) Automatic deactivation of the TCAT agent / TCAT advertisement after
the thread network has been started over TCAT
2) Automatic activation of the TCAT agent / TCAT advertisement after
the thread network has been stopped over TCAT
3) Automatic activation of the TCAT agent / TCAT advertisement after
decommissioning over TCAT
4) Blocking support of certain TCAT TLVs by the application /
ecosystem
The commit also fixes an issue with certificate storage after
decommissioning.
This commit renames several methods in `Ip6::Address`,
`Ip6::InterfaceIdentifier`, `Ip6::Prefix`, and `Ip4::Address` that
fully initialize the object from `Set...()` to `Init...()`.
This creates a clear semantic distinction in the API:
- `Init...()`: Fully (re-)initializing the object.
- `Set...()`: Modifies a specific property or a sub-component of
the object (e.g., `SetPrefix()`, `SetLocator()`,
`SetSubnetId()`).
Some examples of renames include:
- `SetFromExtAddress()` -> `InitFromExtAddress()`
- `SetToLocator()` -> `InitAsLocator()`
- `SetToLinkLocalAddress()` -> `InitAsLinkLocalAddress()`
- `SetToRoutingLocator()` -> `InitAsRoutingLocator()`
- `SetToAnycastLocator()` -> `InitAsAnycastLocator()`
- `SetToIp4Mapped()` -> `InitAsIp4Mapped()`
All calls to these methods across the codebase have been updated
to reflect the new names.
This commit sets the SO_RCVBUF socket option to 2MB on the
multicast receiving sockets in the simulation platform.
Under heavy simulation load (such as expect tests with 15 nodes
all sending MLE advertisements and discovery packets), the default
OS UDP receive socket buffer can overflow, leading to silent
packet drops. This occasionally caused expect tests like
cli-big-table.exp to fail with "Join failed [NotFound]" because
Node 4's discovery requests or response beacons were dropped.
Increasing the receive buffer size to 2MB prevents packet loss
during dense simulation runs, resolving intermittent CI test
failures.
This commit fixes a frequent unit test flake in ot-test-trickle_timer
under the TestTrickleTimerMinMaxIntervalChange test case.
The test case starts the trickle timer with Imin = 2000 and
Imax = 2000. The random time t (mTimeInInterval) is chosen in
[1000, 2000), so t can range up to 1999.
When t randomly evaluates to 1999, t + 1 becomes 2000. Calling
timer.SetIntervalMax(2000) triggers an early-exit optimization
in TrickleTimer::SetIntervalMax because mIntervalMax is already 2000,
leaving the scheduled timer's fire time unchanged. The test then
crashes on the assertion expecting the fire time to have changed.
This is resolved by setting the new interval max to
Min(t + 1, interval - 1). This ensures that the requested value is
strictly less than 2000 even when t = 1999, successfully triggering
the interval shortening and rescheduling logic tested by this case.
This commit adds a brief 0.1-second sleep delay immediately after
spawning node processes (rcp, cli, and mtd types) in the expect test
harness.
Under high CPU load on GitHub Actions runner VMs, the PTY file
descriptors can take a fraction of a second to fully initialize. If
commands are sent immediately after spawn without delay, the initial
expect match can fail with an instant timeout. This triggers duplicate
retransmissions in wait_for, leaving extra "Done" strings in expect's
PTY read buffer. The leftover "Done" strings desynchronize subsequent
assertions, causing tests to match cached output instead of waiting
for actual command execution (e.g., sending "diag stats" during an
active "diag send" command, which fails).
Adding a 100ms delay gives the PTY and child process enough time to
fully initialize and stabilize, avoiding instant timeouts and
subsequent test harness desynchronization.
This commit adds GCC 15 (version 15.2.rel1) to the `arm-gcc` job
matrix in the OpenThread build (`build.yml`) workflow.
Including GCC 15 in the builds helps ensure that OpenThread compiles
successfully and is free from warnings or errors with the latest GCC
15.2.rel1 release.
Increase wait delay after starting the OTBR service in the
test_publish_meshcop_service.py script.
Starting otbr-agent requires the node to re-attach to the simulated
Thread network and transition to the leader role. In virtualized CI
environments, this role transition can take up to 14.5 seconds. Using
a hardcoded 10-second delay results in a race condition where the
service is published very late, causing the subsequent browse query to
miss the service and fail with AssertionError.
Substituting the delay with BORDER_ROUTER_STARTUP_DELAY (20s) ensures
the node has sufficient time to attach, become leader, start the border
agent, and fully register the mDNS service before browsing.
This commit simplifies MLR state tracking for child devices. Previously,
`Child::Ip6AddrEntry` inherited from `Ip6::Address` to encapsulate the
MLR registration check using the `Child` reference. This introduced
tight coupling between `Child` and `Ip6AddrEntry`.
The logic is refactored by removing `Ip6AddrEntry`. Instead, `Child`
now directly manages a `Child::Ip6AddressArray` and encapsulates the
MLR state querying/updating through new methods:
- `SetAddressMlrRegistrationState()`
- `GetAllMlrRegisteredAddresses()`
- `ClearAllAddressesMlrRegistrationState()`
In `Mlr::Manager`, the redundant `ChildAddressArray` typedef and
`kMaxChildAddresses` constant are removed, reusing the
`Child::Ip6AddressArray`. The method `UpdateProxiedSubscriptions()`
is renamed to the more intuitive `UpdateChildRegistrations()`, and
overloaded to allow calling it without an old address list during
initial child registration.
The test `test_1_3_DBR_TC_7A` was failing occasionally due to
uninitialized stack memory in `NetworkData::OnMeshPrefixConfig config`.
Because `OnMeshPrefixConfig` inherits from `otBorderRouterConfig`
and does not automatically initialize its fields in its default
constructor, declaring `NetworkData::OnMeshPrefixConfig config;`
on the stack left its members (including `mDp` and `mNdDns` flags)
with arbitrary stack garbage. If `mDp` (Domain Prefix flag)
evaluated to true, it caused the registered `PRE_1` prefix to be
erroneously processed as a Domain Prefix. Consequently, the border
router did not include `PRE_1` as a Route Information Option (RIO)
in its emitted Router Advertisements, causing packet verification
to fail in Step 4.
This commit fixes the issue by explicitly initializing the
`config` struct using `config.Clear()` right after declaration.
Fixes an intermittent failure in the
`nexus_announce_no_flap_on_unmergeable_partitions` test.
Previously, only LEADER_NEW was isolated (by enabling allowlist
mode with an empty address list) in Step 2. Because LEADER_OLD
still had allowlist mode disabled, it could receive advertisements
from LEADER_NEW. If LEADER_NEW's randomly allocated partition ID
happened to be larger than LEADER_OLD's, LEADER_OLD would see it
as a "better partition" and initiate a transition to child to
attach to LEADER_NEW.
Although this attempt would initially fail in Step 2 (since
LEADER_NEW dropped all RX), it kept retrying. In Step 3, when the
allowlist was opened on both sides, the queued/retried attach
attempt from LEADER_OLD succeeded, making it a child and causing
the Leader assertion to fail.
Isolating both nodes during Step 2 ensures that LEADER_OLD never
hears LEADER_NEW's initial good-link advertisements. When Step 3
begins, it only hears LEADER_NEW through the weak link and
correctly rejects the advertisements, keeping both nodes stable
leaders of separate partitions.
Explicitly cast the result of the bitwise NOT operator ~ to uint8_t in
BitSetUtils::FlipBits to resolve a build error under AppleClang.
In C++, using the bitwise NOT operator on a uint8_t value promotes it to
an int. Assigning the promoted int back to uint8_t triggers an implicit
conversion warning/error (-Wimplicit-int-conversion) under newer
compiler versions, which fails the build when compiled with -Werror.
This commit introduces helper methods to `MeshCoP::Dataset` to determine
if a given Dataset affects network connectivity or the Network Key.
It also adds a corresponding public API `otDatasetAffectsConnectivity()`.
A Dataset is considered to affect connectivity if it contains a
different Channel, PAN ID, Mesh Local Prefix, or Network Key than
the current values in use.
`Mle::AnnounceHandler::HandleAnnounce` previously executed the
`kAnnounceAttachAfterDelay` action on an attached node even when
the announced channel and PAN ID already equaled the current MAC
parameters. The `!channelAndPanIdMatch` guard was only consulted
in the `IsDetached()` branch. For an attached node this scheduled
`StartAnnounceAttach`, which calls `Stop()` then `Start()` with
the same channel/PAN ID -- accomplishing nothing while disrupting
attached children.
This causes an endless role flap in a topology where two FTDs
share channel, PAN ID, and network credentials but hold different
Active Dataset Timestamps, and where their RF link is too weak to
merge partitions (Advertisements rejected with LinkMarginLow at
`mle_router.cpp`). Each side restarts on every Announce received
from the higher-timestamp peer; the reactive `kSendAnnouceBack`
path further amplifies this because the lower-timestamp side's
own outgoing Announces draw Announce responses from the peer.
Apply the channel/PAN ID match guard unconditionally in
`kAnnounceAttachAfterDelay`. Mirror it on the FTD
`kSendAnnouceBack` path (matching the existing `isFromOrphan`
behavior) so peers sharing MAC parameters are not prompted to
migrate to the channel/PAN ID they already use.
Add `addon_test_announce_no_flap_on_unmergeable_partitions.py`
which builds the topology above and asserts that both nodes
retain their original partition IDs across a 20-minute simulated
window. Without this change the lower-timestamp node is
repeatedly demoted from leader during that window.
This commit moves the state and logic for managing the maximum number
of IP addresses per child from `Mle` to `ChildTable`. The logic for
checking the limit is also moved to the `Child` class itself.
This change better encapsulates the child table properties.
This commit updates the DHCPv6 Prefix Delegation (PD) client to
comply with RFC 9915, which obsoletes the Server Unicast option
(Option 12) and the UseMulticast status code.
Changes:
- Removed `mServerAddress` and `ProcessServerUnicastOption()` from
`Dhcp6PdClient`.
- Modified `Dhcp6PdClient::SendMessage` to always transmit via
multicast to `ff02::1:2`.
- Removed `UseMulticast` status code handling in `HandleReply()`.
- Added `otMessageFree` weak stub in simulation platform's
`infra_if.c` to resolve linking errors on simulation radio-only
targets when DHCPv6 PD client is enabled.
- Updated `test_dhcp6_pd_client.cpp` to expect multicast and
removed the obsolete UseMulticast test case.
This commit updates `MacCountersTlv` and `MleCountersTlv` to use the
`SimpleTlvInfo` template. The original classes are replaced with
`MacCountersTlvValue` and `MleCountersTlvValue` which only represent
the TLV values. This helps simplify the TLV parsing and appending
logic and more importantly allows the TLV value formats to be
reused.
This commit extends the `BitSet` class with several new
methods:
- `CountElements()`
- `IsSubsetOf()` and `IsSupersetOf()`
- `Complement()`
- `UnionWith()`, `IntersectWith()`, and `SubtractWith()`
- `SetMask()`, `AppendTo()`, and `ReadFrom()` message.
This commit also introduces a new `BitSetUtils` non-template base class
for the `BitSet<kNumBits>` template class. This change helps optimize
code by moving the common implementation logic for various bit
manipulation operations out of the template, reducing template
instantiation overhead.
This commit refactors the Nexus tests configuration in CMakeLists.txt
by properly classifying and sorting test cases:
- Moved `inform_previous_parent_on_reattach` from the "Cert tests"
section to the "Misc tests" section, and changed its label from
"cert;nexus" to "core;nexus".
- Moved `retransmission_security` from the "Cert tests" section
to the "Misc tests" section where it belongs (retaining its
"core;nexus" label) and sorted it alphabetically.
These changes ensure the CMake file remains clean and the tests are
properly categorized.
This commit removes the thread-cert/backbone tests and cleans
up all related configurations and references.
Specifically, the following changes are made:
- Deleted tests in tests/scripts/thread-cert/backbone/
- Removed the backbone-router job from .github/workflows/otbr.yml
- Removed backbone-router dependency from upload-coverage job
- Removed setup, cleanup, and checks for backbone tests in
tests/scripts/thread-cert/run_cert_suite.py
This commit removes the `avahi` mDNS configurations from the
`thread-border-router` job matrix in the OpenThread Border Router
(`otbr.yml`) workflow.
With this change, the `thread-border-router` integration tests will
exclusively run using the `mDNSResponder` configuration.
This commit renames the `NetworkDiagnostic` namespace in `src/core/thread/`
and its related types to `NetDiag` for brevity. It updates the
corresponding filenames and header guards as well.
When a sleepy end device (where `Mle::IsRxOnWhenIdle()` returns
false) sends an MLR request, it initiates fast data polls via
`DataPollSender::SendFastPolls()` to quickly receive the response.
This commit updates `Manager::HandleResponse()` to call
`DataPollSender::StopFastPolls()` when the MLR response is processed
by a sleepy end device. This ensures that the device does not
unnecessarily continue fast polling.
Retransmissions of frames containing time-dependent header Information
Elements (IEs), such as CSL or Time Sync, require updates to these
IEs to reflect the exact time of sending. If the frame counter is not
incremented for these retransmissions, it leads to nonce reuse in
AES-CCM encryption, which is a security vulnerability.
This commit addresses this issue by ensuring that every transmission
attempt (initial or retry) uses a fresh frame counter:
- Deferred security processing from `SubMac::Send()` to
`SubMac::BeginTransmit()`.
- Upon retransmission in `SubMac::HandleTransmitDone()`, the frame is
restored to plaintext via `TxFrame::DecryptTransmitAesCcm()` and
security flags are cleared.
- This allows time-dependent IEs to be updated and a new frame counter
to be assigned for every attempt.
Added a Nexus test case `retransmission_security` to verify that both
CSL and standard MAC retransmissions use incrementing frame counters
and updated CSL phases.
This commit introduces a structured state machine to `Mlr::Manager` to
coordinate Multicast Listener Registration (MLR) activities more
efficiently. The previous implementation relied on independent delay
variables and the global `TimeTicker`, which could lead to redundant
or premature registrations, especially when a Primary Backbone Router
(PBBR) was newly discovered or updated.
The new state machine (`kStateStopped`, `kStateIdle`,
`kStateToRegisterAll`, `kStateRegistering`, `kStateRegistered`,
`kStateNewAddrToRegister`) provides explicit transitions for the
entire MLR lifecycle. This ensures that registrations are properly
aggregated and that periodic renewals are correctly rescheduled after
successful out-of-band registrations.
Additionally, the manager now uses a dedicated `TimerMilli` instead of
`TimeTicker`, reducing system-wide overhead and providing more
precise timing control.
Per RFC 9664, the UL option is always included in a success response (RCODE=0).
Comment in test_srp_server is updated also to avoid suggesting the opposite.
This commit introduces a new set of template-based APIs for
non-cryptographic random number generation in the `Random::NonCrypto`
namespace. These new methods provide a cleaner, type-safe, and more
robust interface compared to the previous methods.
Key additions:
- `Generate<UintType>()`: Returns a random value of the given
unsigned integer type (`uint8_t`, `uint16_t`, or `uint32_t`).
- `GenerateUpToExcluding<UintType>(aMax)`: Returns a random value in
the range `[0, aMax)`.
- `GenerateFromMinUpToExcluding<UintType>(aMin, aMax)`: Returns a
random value in the range `[aMin, aMax)`.
- `GenerateInClosedRange<UintType>(aMin, aMax)`: Returns a random
value in the closed range `[aMin, aMax]`.
The introduction of `GenerateInClosedRange` is an improvement as it
safely handles ranges up to the maximum value of the integer type
(e.g., `0xffff`) without the risk of overflow.
All call sites across the OpenThread core stack and tests have been
updated to adopt these new APIs. The public `otRandomNonCrypto`
functions are also updated to leverage the new internal methods.
Doxygen documentation is added for all new template methods,
detailing their behavior, including edge cases where the upper bound
is smaller than or equal to the lower bound.
This commit refactors various unit tests to use `constexpr` for
defining constants instead of anonymous `enum` types.
Using `constexpr` is the modern and preferred approach in C++, as it
provides explicit types for constants and improves code clarity and
type safety.
This commit fixes minor coding style issues in
`RoutingManager::RoutePublisher::StateToString()`. It adds a missing
semicolon after the `DefineEnumStringArray()` macro and corrects the
indentation of the return statement.
This commit makes `Tlv::AppendTlvHeader()` public and updates call
sites to use it. This method automatically handles the formatting
of the TLV header as either a standard TLV header or an extended one
based on the provided length.
This commit removes all code, configurations, APIs, and tests related
to the OPENTHREAD_CONFIG_BACKBONE_ROUTER_DUA_NDPROXYING_ENABLE feature.
Specifically, the following changes were made:
- Removed DUA ND Proxying Backbone Router configuration option and the
related OPENTHREAD_CONFIG_NDPROXY_TABLE_ENTRY_NUM definition.
- Removed CLI commands: `bbr mgmt dua` and the proactive backbone
notification fake command `/b/ba`.
- Removed NdProxyTable and bbr_manager DUA ND Proxying implementation.
- Removed public/internal APIs for ND Proxying and proactive backbone
notifications.
- Deleted ndproxy_table source files and unit tests.
- Simplified CMake and GN build files to remove deleted targets.
This commit improves the `tests/nexus/build.sh` script by adding a
`display_usage()` function and implementing stricter command-line
argument validation.
This commit removes the obsolete Backbone Router (BBR) certification
tests:
- tests/scripts/thread-cert/backbone/bbr_5_11_01.py
- tests/scripts/thread-cert/backbone/
test_mlr_multicast_routing_across_thread_pans.py
These tests are removed because DUA (Domain Unicast Address) routing
features (specifically DUA ND Proxying) have been deprecated and
removed from the codebase. Since these features are no longer
supported, the corresponding certification and validation tests are
no longer valid or runnable.
Remove obsolete backbone test cases for Domain Unicast Address
(DUA) Duplicate Address Detection (DAD), DUA routing, DUA routing
for Minimal End Devices (MED), and Neighbor Discovery (ND) Proxy.
These features and their corresponding tests are no longer needed.
This commit removes all DUA (Domain Unicast Address) validation
and verification steps from test_firewall.py. Since DUA routing
features are being phased out or removed, this keeps the firewall
test in sync and prevents potential failures during test runs.
Specifically:
- Removed DUA ping validation from host to router.
- Removed DUA collection call (collect_duas).
- Removed the packet verifier checks checking for DUA ping traffic.
When cloning the ot-br-posix repository to run the Docker-in-Docker
integration tests, the clone was shallow and did not recursively
check out nested submodules (such as cJSON and cpp-httplib). This led
to build failures inside the Docker build container since libcjson
is not pre-installed on the base build image.
This commit resolves the issue by:
1. Appending the `--recurse-submodules` flag to the git-tool clone
calls in `otbr-posix-dind.yml` and `script/test`.
2. Updating `script/git-tool`'s destination directory parsing to
robustly handle multi-line output from recursive submodule
checkouts. The new pattern extracts the path exclusively from
the first line using `sed` to prevent SIGPIPE or parsing errors.
This commit introduces a new GitHub Actions workflow to automate the
monthly release process using Calendar Versioning (CalVer).
The workflow:
- Runs automatically at 00:00 UTC on the 1st day of every month.
- Supports manual execution via `workflow_dispatch`.
- Automatically generates a CalVer tag (e.g., vYYYY.MM.0).
- Employs the GitHub CLI to create a release and auto-generate
release notes based on merged pull requests.
This commit fixes a potential `uint16_t` overflow in
`Config::SelectRandomReregistrationDelay()` which could occur if
`mReregistrationDelay` was set to the maximum `uint16_t` value.
The `Random::NonCrypto::GetUint16InRange(lower, upper)` function
includes the lower bound but excludes the upper bound. Previously,
the code called `GetUint16InRange(1, mReregistrationDelay + 1)`,
which would overflow the upper bound if `mReregistrationDelay` was
`0xffff`. The logic is updated to `1 + GetUint16InRange(0,
mReregistrationDelay)`, which safely produces a random value in the
range `[1, mReregistrationDelay]` without overflow.
This commit introduces a new helper method that allows appending a
TLV by copying its value directly from a specified `OffsetRange` of
another `Message`.
This helper automatically handles formatting the TLV as an Extended
TLV if the length exceeds 254 bytes, eliminating the need for manual
length checks and TLV header construction at the call sites.
Key changes:
- Added `Tlv::AppendTlvWithValueFromMessage()`.
- Refactored TLV header construction into a private helper
`Tlv::AppendTlvHeader()` to share logic between `AppendTlv` variants
and `StartTlv()`.
- Updated `Commissioner::SendRelayTransmit()` and
`JoinerRouter::HandleUdpReceive()` to use the new helper for
`JoinerDtlsEncapsulation` TLVs.
- Updated `TcatAgent::HandlePing()` to use the new helper, significantly
simplifying the payload response generation.
When logging while `Instance` has not been initialized yet, use 0 as
return value of `GetUptime` and use `OPENTHREAD_CONFIG_LOG_LEVEL_INIT`
as default log level instead of accessing raw memory.
This commit updates `BackboneRouter::Local` to receive role change
events directly from the `Notifier`. Previously, `Bbr::Local` was
indirectly relying on `BackboneRouter::Leader` to emit events even
when the PBBR configuration had not changed (e.g., during role
transitions).
The previous design was fragile and created an unnecessary dependency.
`Bbr::Local` now independently tracks role changes to ensure it
correctly evaluates its own status (e.g., deciding whether to
register as the Primary BBR).
This commit introduces `PrimaryEvent` to represent changes in the
Primary Backbone Router (PBBR) configuration, replacing the previous
`State` enum. Calling it `State` was misleading as the values
describe transitions or updates to the PBBR rather than a persistent
state.
The new `PrimaryEvent` enum provides a more descriptive way to notify
dependent modules (`Mlr::Manager`, `DuaManager`, and `Bbr::Local`)
about specific changes in the PBBR, such as when it is added,
removed, or when its configuration parameters (e.g., RLOC16, Sequence
Number, or MLR Timeout) are updated.
This commit simplifies and enhances the TLV parsing logic in
`TcatAgent` so to use the `Tlv::Info` helper class. This safely and
automatically handles both standard and extended TLVs, removing the
need for manual type checking and length/offset calculations.
Key changes:
- Updated `TcatAgent::HandleSingleTlv()` to use `Tlv::Info::ParseFrom()`.
- Replaced individual `aOffset` and `aLength` parameters with
`const OffsetRange &` across various TLV handler methods (e.g.,
`HandlePing`, `HandleSetActiveOperationalDataset`, `VerifyHash`).
This improves code readability, safety, and consistency with common
OpenThread TLV parsing patterns.
This commit simplifies the logic in `BleSecure::HandleTlsReceive`
by reducing the nesting level through the use of early `ExitNow()`
calls and replacing a complex `if-else` block with a `switch`
statement for handling `errorTcatAgent`.
Key improvements:
- Removed a large `else` block by adding `ExitNow()` after the
initial transparent mode check.
- Used a `switch` statement to handle `errorTcatAgent` returned
by `MeshCoP::TcatAgent::HandleSingleTlv()`, clearly separating
`kErrorNone`, `kErrorAbort` (disconnect), and default fatal
error handling.
- Improved code formatting and comment readability.
This commit refactors `BleSecure::HandleTransport()` to use the
`OffsetRange` and `Message::ReadAndAdvance()` helper methods. This
replaces manual length and offset tracking, resulting in cleaner
and safer message parsing logic.
Additionally:
- Simplified the payload length calculation by using nested `Min()`
calls instead of multiple `if/else` blocks.
- Added a `RadioPacket` typedef in `BleSecure` to alias the public
`otBleRadioPacket` structure, aligning with OpenThread's core
namespace conventions.
This commit introduces a new CMake option `OT_NEXUS_BUILD_TESTS`
(defaulting to `ON`) to control whether the individual Nexus test
executables are built.
When developing or debugging the OpenThread core stack within the
Nexus framework, building the large number of certification tests can
be time-consuming. This option allows developers to skip building the
tests and only compile the `ot-nexus-platform` library and OT core.
The check is implemented inside the `ot_nexus_test` macro to ensure
all test definitions automatically respect the flag without requiring
large conditional blocks in the `CMakeLists.txt` file.
Additionally, a `no_tests` argument is added to `tests/nexus/build.sh`
to easily invoke this configuration from the command line.
This commit refactors and improves the Backbone Router callback and
`Config` introducing new methods and encapsulating configuration-related
logic.
Key changes:
- Added `Leader::GetConfig()` to provide direct access to the internal
cached `Config` object.
- Renamed `Leader::GetConfig(Config &)` to `Leader::ReadConfig(Config &)`
to better reflect its purpose.
- Added `Config::SelectRandomReregistrationDelay()` to encapsulate the
logic for selecting a random re-registration delay.
- Simplified variosu `HandleBackboneRouterPrimaryUpdate()` callbacks
to remove the parameter `aConfig`, allowing these modules to use
`Leader::GetConfig()` instead.
This adds details to the Posix platform UDP bind error message, showing address and
port just like for the otPlatUdpConnect case. Also the severity is changed from Crit
to Warn, since it's not a critical failure given that otPlatUdpBind() is used in a
loop to find an available ephemeral port - i.e. probe the ports in range until one
succeeds.
It also fixes an issue where `errno` might be modified by the logging code itself.
Ideally the platform code would discern 'port in use' vs 'unrecoverable failure to
bind the port', but the currently defined OT APIs don't allow for any other errors
apart from ok/failed. If the specific port number is really needed, the caller
is responsible to log a critical failure.
If the PD client sendto() fails, e.g. because of an unroutable IPv6
destination, currently the message remains in the queue. Then the
subsequent retries cause a 100% CPU use (without end). This fixes the
issue by dropping the message in case of an unresolvable sendto()
failure.
This commit refactors and improves the `Sntp::Client` class by
adopting common OpenThread patterns and simplifying the logic.
Key changes:
- Introduced `Sntp::Client::QueryInfo` core class to wrap the
public `otSntpQuery` structure.
- Added `Timestamp` class to handle SNTP timestamps, simplifying
the `Header` structure.
- Renamed methods and variables to be more concise and consistent
(e.g., `FinalizeSntpTransaction` to `Finalize`,
`mRetransmissionTimer` to `mTimer`).
- Simplified the `HandleUdpReceive` logic by splitting response
processing into `ProcessResponse`.
This change improves code readability and maintainability of the
SNTP client module.
This commit adds support for interacting with nodes via the CLI in the
Nexus simulation framework. This enables writing higher-level
integration tests that verify stack behavior and state through
standard CLI commands.
Key changes:
- Integrated `Cli::Interpreter` into the `Nexus::Node` class.
- Added `Node::InputCli()` to allow sending commands to a node with
`printf`-style formatting.
- Implemented output capturing logic in `Node::HandleCliOutput()` to
buffer and parse CLI responses into individual lines, stored in a
`CliOutputArray`.
- Added helper methods to `CliOutputLine` for matching and validating
the captured output.
- Added a new `cli_basic` Nexus test to demonstrate and validate the
CLI interaction functionality.
This commit introduces a new core class `BackboneRouter::Config` that
inherits from the public `otBackboneRouterConfig` struct. This aligns
with the OpenThread architectural pattern of using core-internal
classes to wrap public API structures, providing a cleaner interface
and encapsulating logic.
Importantly, this commit ensures that the `MlrTimeout` is adjusted
and clamped to valid ranges before comparing the new configuration
with the existing one. This ensures that the state transition
(e.g., `kStateRefreshed`) correctly reflects the actual values
that will be used.
Other improvements:
- Added helper methods `IsPresent()`, `MarkAsAbsent()`, and getters
for configuration fields.
- Moved `MlrTimeout` adjustment logic into `Config::AdjustMlrTimeout()`.
- Added `Config::Log()` to log configuration details, and updated
`Leader` to log both old and new configurations when a Primary
Backbone Router event occurs.
Update `otbr-posix-dind.yml` workflow to run the DinD integration test
using a matrix strategy that covers both the default mDNS implementation
and `mDNSResponder`.
This mirrors the testing matrix used in `ot-br-posix` repository's
`docker-test.yml` workflow.
In Host + RCP mode, running `diag start` from the host CLI may trigger
RadioSpinel warnings: InvalidState, “Error processing result” / “Error
waiting response”.
**Root cause**
Diags::ProcessStart sent channel / power commands before enabling diag
mode. On Spinel, these are forwarded to the RCP (via
`SPINEL_PROP_NEST_STREAM_MFG`), but the RCP only accepts other diag
commands after start.
```
if (!IsEnabled() && !StringMatch(aArgs[0], "start"))
{
Output("diagnostics mode is disabled\r\n");
ExitNow(error = kErrorInvalidState);
}
```
As a result, early channel / power commands are rejected with
InvalidState.
This commit removes the `kDomainPrefixUnchanged` event from the
`DomainPrefixEvent` enum and refactors the related logic in
`BackboneRouter::Leader`. This value was redundant, as the manager
should only report events when an actual change (addition, removal,
or refresh) occurs in the Domain Prefix configuration.
This commit introduces `Message::ReadAndAdvance()` and its template
flavor to the `Message` class. This helper method reads data from a
`Message` at a given `OffsetRange` and advances the `OffsetRange` by
the number of bytes read upon success.
Sequential parsing of structured data (such as TLVs or protocol
headers) is a common pattern across the OpenThread codebase.
Previously, this required two separate calls: one to `Read()` and
another to `AdvanceOffset()`. The new `ReadAndAdvance()` method
consolidates these into a single, safer operation that ensures the
offset is only advanced if the read operation succeeds.
This commit updates numerous call sites across the core stack
(MLE, BBR, DatasetManager, NetworkDiagnostic, DHCPv6, etc.) to use
the new helper, improving code clarity and reducing boilerplate.
This commit removes the legacy `Tlv::FindTlv()` method variations
that read a TLV into a local buffer. These methods are no longer
used across the codebase, having been replaced by safer and more
efficient alternatives such as `Tlv::Find<TlvType>()`,
`Tlv::FindTlvValueOffsetRange()`, or `Tlv::Info::FindIn()`.
The removed methods were prone to misuse, as they did not always
handle Extended TLVs correctly if the caller provided a fixed-size
buffer. Removing these variations forces new code to use the modern
helper functions, which provide better validation and correctly
handle the decoupling of the TLV header from its value.
This commit introduces a new model for handling `RouteTlv` by
adding the `RouteTlv::Data` and `RouteTlv::Data::Entry` classes.
Previously, `RouteTlv` directly represented the packed on-wire
format, which made it difficult to work with, especially when
supporting different configurations such as
`OPENTHREAD_CONFIG_MLE_LONG_ROUTES_ENABLE`.
The new `RouteTlv::Data` class decouples the on-wire serialization
from the in-memory representation, providing a cleaner API for
parsing the TLV from a `Message` and accessing its entries and
their properties (Router ID, Route Cost, and Link Qualities).
This change improves code clarity and maintainability by providing
a structured way to handle route information.
This commit introduces a GitHub Actions workflow (OTBR DinD) to
verify that changes in the OpenThread repository do not break the
integration tests in ot-br-posix.
The workflow runs on every pull request and merge to main. It performs
the following steps:
1. Clones openthread/ot-br-posix using script/git-tool, which
automatically applies any dependent PRs specified in the PR body.
2. Replaces the openthread submodule in ot-br-posix with the local
OpenThread checkout containing the changes under test.
3. Builds the Docker-in-Docker (DinD) test runner image from
etc/docker/test/Dockerfile.dind_runner in ot-br-posix.
4. Runs test_dind_dns_sd.sh inside the DinD container to ensure that
DNS-SD advertising proxy and TREL integration tests pass
successfully.
Ideally, the mesh-local address (ML-EID) is only used when
communicating with devices in the Thread mesh. The mesh-local
address must not be used when communicating with other devices on
the infrastructure link or outside the Thread mesh.
This commit addresses this by implementing address labeling:
1. Modifying `UpdateUnicastLinux` in `src/posix/platform/netif.cpp`
to stop marking mesh-local addresses as deprecated. They are now
added as preferred addresses.
2. Implementing `AddAddressLabel` and `DeleteAddressLabel` to manage
address labels via netlink (RTM_NEWADDRLABEL/RTM_DELADDRLABEL).
3. Calling `AddAddressLabel` when a mesh-local address is added to
assign a specific label (99) to the Mesh-Local Prefix.
This ensures that the kernel prefers the ML-EID for destinations
sharing the same label (i.e., within the Thread mesh), while
avoiding its use for external traffic where other addresses with
standard labels would be a better match.
Issue: 8443
It seems that frames which are received through TREL do not have a
priority field. This creates quite some log noise when having notice log
level enabled. Lower this log entry to debug level.
This commit combines simulation-1.1.yml and simulation-1.4.yml into
a single simulation.yml workflow.
The combined workflow includes:
- ot-commissioner (from 1.1)
- simulation-local-host (from 1.1)
- channel-manager-csl (from 1.4)
- expects (renamed from 1.4's expects)
The expects job from 1.1 is removed as requested. The jobs now rely
on the project's default THREAD_VERSION instead of explicitly
setting it in the environment. Artifact naming is updated to ensure
unique coverage files are generated and correctly merged by the
unified upload-coverage job.
This commit removes the thread-cert job from the POSIX GitHub Actions
workflow. These tests have been migrated to the Nexus test framework.
The removal of the thread-cert job simplifies the POSIX workflow and
relies on the Nexus-based tests for validating Thread stack behavior.
This commit adds a new Nexus test (`test_mlr_redundant.cpp`) to verify
that the MLR manager correctly handles registrations when multiple
entities (e.g., a parent router and its children) subscribe to the
same multicast address, without sending redundant requests.
The test sets up a topology with a Primary Backbone Router, an FTD
Router, and three SEDs. The Router and SEDs all subscribe to the same
multicast address. The Router then subscribes to 14 additional unique
multicast addresses to exceed the single CoAP message payload limit
(`kMaxIp6Addresses`).
A CoAP interceptor is registered on the Backbone Router to parse
incoming `MLR.req` messages and count the number of times the shared
multicast address is included in the payload. The test verifies that
the shared address is requested exactly once, ensuring that fragmented
state tracking does not lead to duplicate registrations.
In CliUartOutput, if otPlatUartFlush() fails when trying to send
buffered output to make room for new output, it logs a warning using
otLogWarnPlat. However, this warning is added to the same full
buffer, which does not help and can cause further issues.
This commit removes the offending log line as suggested in issue #7478.
This commit simplifies the tracking of Multicast Listener Registration
(MLR) state for IPv6 addresses by removing intermediate states and
relying on the original CoAP request payload.
Previously, `Mlr::Manager` used a 3-state system (`kStateToRegister`,
`kStateRegistering`, `kStateRegistered`) which required core structures
like `Child` and `Netif` to track transient registration states.
This commit reduces the state to a single boolean (`IsMlrRegistered`)
tracked in `ChildTable` and `ThreadNetif`. When a CoAP response is
received, `Mlr::Manager` now uses `GetDispatchingRequest()` to
retrieve the original TMR MLE request message, parses the
`Ip6AddressesTlv` to determine exactly which addresses were included
in the request, and updates the registration states based purely on
this info (minus any explicitly failed addresses).
This change improves robustness, reduces RAM usage by eliminating
state-tracking arrays, and significantly cleans up the logical flow
within the MLR manager.
There exists a NULL-byte OOB in the spinel logging. The initial stack
buffer is initialized with an extra byte for the NULL-byte. However,
the full size is passed into `spinel_datatype_unpack_in_place()` which
interprets it as the valid writable size (`require_action(NULL !=
block_len_ptr && *block_len_ptr >= block_len, bail, (ret = -1, errno =
EINVAL));`).
When `block_len` is the length of the buffer, the NULL-byte write
after the function call will be OOB.
This commit moves the `AddressArray` class out of the `Mlr::Manager`
and into a dedicated `mlr_types.hpp` file as `Mlr::AddressArray`. This
decouples the type from the manager, making it available for broader
use across the module.
Additionally, the logic for parsing the `Ip6AddressesTlv` is extracted
from `Mlr::Manager::ParseResponse()` into a new `FindIn()` method on
the TLV class itself. This centralizes the TLV parsing logic within
the TLV class, which is more idiomatic. The `FindIn()` method also
provides a safety guarantee by clearing the output `AddressArray` if
parsing fails.
The build system configurations (`BUILD.gn` and `CMakeLists.txt`) are
updated to include the newly added `mlr_types.cpp` file. Doxygen
documentation is also provided for the new types and methods.
This commit updates `CoapBase::PendingRequests` to track the request
currently being processed during callback invocation via the new
`mDispatchingRequest` pointer.
It also introduces `GetDispatchingRequest()` which returns a copy of
the original request `Message`. This enables response handler
callbacks to inspect the original request (for example to read
specific TLVs). The method is restricted to confirmable requests and
must only be called from within the context of a response handler.
The method `InvokeResponseHandler` is renamed to `DispatchResponse`
to align with the new nomenclature.
This commit enhances the radio URL parsing logic to detect and fail
when unused parameters are provided in the URL. This prevents typos
or unsupported parameters from being silently ignored.
The following changes were made:
- Updated ot::Url::Url to track parameter usage by appending a
trailing '&' delimiter in Init() and replacing it with '\0'
in GetValue() when a parameter is matched. This marks the
parameter as used and removes any limit on the number of
trackable parameters.
- Added a Validate() method to ot::Url::Url to verify that all
parameters in the query string were accessed.
- Refactored ot::Posix::Radio to share a single RadioUrl instance
with SpinelManager, ensuring all components track usage on the
same URL object.
- Integrated Validate() calls in otSysInit() and platformTrelInit()
to perform validation after all platform components have been
initialized.
- Updated Radio::ProcessMaxPowerTable to use a local copy of the
parameter string to avoid premature modification of the URL buffer.
- Adjusted RadioUrl and unit tests to provide sufficient buffer
space for the additional tracking delimiter.
- Added new unit tests in tests/unit/test_url.cpp to verify the
usage tracking and validation logic.
This commit removes the `CheckInvariants()` method and all its calls
from `Mlr::Manager`.
The `CheckInvariants()` method verified internal state consistency
by checking the `kStateRegistering` status of multicast addresses
against variables like `mPending` and `mSendDelay`. As the MLR module
is being prepared for upcoming structural updates, including changes
to how address states and delays are tracked, these specific invariant
checks are no longer applicable. Removing them clears the way for
the planned redesign of the MLR state machine.
This commit introduces a cap on the number of concurrently scheduled
discovery responses in `Mle::DelayedSender`.
By adding the `CountMatchingSchedules()` method, we can now track how
many discovery responses are currently queued. The newly defined
constant `kMaxScheduledDiscoveryResponse` sets this limit to 16. If
the limit is reached, further `ScheduleDiscoveryResponse()` requests
are ignored.
This change protects the device from resource exhaustion (RAM, CPU,
and network) if it is flooded with discovery requests, preventing
potential Denial of Service (DoS) conditions.
This commit introduces the `Deprecate()` method in the `OnLinkPrefix`
class. This method properly deprecates an on-link prefix by setting
its preferred lifetime to zero and bounding the remaining valid
lifetime to a maximum of two hours from the current time.
Previously, `RxRaTracker` only called `ClearPreferredLifetime()`,
which left the valid lifetime unchanged. By replacing
`ClearPreferredLifetime()` with the new `Deprecate()` method, we
ensure that the valid lifetime of deprecated prefixes is also
bounded.
This change ensures that if a router is deemed unreachable, its
on-link prefixes will live for a maximum of 2 more hours. This
allows the state associated with an unreachable router to age out
more quickly, even if the router had previously advertised the on-link
prefix with long valid lifetime.
This commit simplifies the logic for limiting the number of messages
tracked in `MultiPacketRxMessages`.
It introduces a new cap, `kMaxRxMsgEntries` (set to 64), to restrict
the total number of unique `RxMsgEntry` items being tracked,
preventing unbounded memory growth. Additionally, the existing
message limit per entry is renamed from `kMaxNumMessages` to
`kMaxNumMessagesPerEntry` and moved within the `RxMsgEntry` scope.
The manual `for` loop used to count existing messages in
`RxMsgEntry::Add` is replaced with a clean check using
`CountAllEntries()`.
This commit simplifies the `Mlr::Manager::ParseResponse()` method and
improves its robustness.
Specific improvements include:
- Initializing the local `error` with the CoAP response result and
using `SuccessOrExit()` to cleanly handle transport-layer failures.
- Simplify parsing of of `Ip6AddressesTlv`, ensuring duplicate entries
are added only once in the `aFailedAddresses` array.
- Remove redundant `Ip6AddressesTlv` TLV length checks. Same checks are
now performed as IPv6 addresses are read from the TLV value.
- Updating `AddressArray::AddUnique()` to return an `Error`,
- Consolidating the logging logic directly into `ParseResponse()`,
removing the separate `LogResponse()` helper method.
- Explicitly clearing the `aFailedAddresses` array at the beginning of
the parsing process.
This commit refactors the logic for scheduling Multicast Listener
Registration (MLR) delays by replacing `UpdateReregistrationDelay(bool)`
with a new, more expressive method: `ScheduleNextRegistration()`.
The new method takes a `RegistrationRequest` enum (`kReregister` or
`kRenew`), clearly distinguishing between the two different scheduling
scenarios:
- `kReregister`: Triggered after re-attaching or when a Primary BBR
is added/updated. This schedules a rapid registration attempt
using a random delay between 1 and the configured BBR
reregistration delay.
- `kRenew`: Triggered periodically. This schedules a standard
registration renewal using a delay randomized between half the MLR
timeout and the timeout minus a 9-second guard time
(`kRenewGuardTime`), as mandated by Thread Spec.
This change also introduces constants for `kLongRenewTimeout` and
`kRenewGuardTime` to replace magic numbers, improving overall code
readability and maintainability.
This commit introduces an opaque `otCliInterpreter` type and a set of
new public C CLI APIs (e.g., `otCliInterpreterInit()`,
`otCliInterpreterInputLine()`) to support multiple, dynamically
allocated CLI interpreters per OpenThread instance.
This architecture allows applications to instantiate and manage
multiple concurrent CLI sessions. Backward compatibility is preserved
by retaining the original `otCli*` APIs, which now interact with a
single built-in static interpreter.
The `OPENTHREAD_CONFIG_CLI_STATIC_INTERPRETER_ENABLE` configuration
is also added. It enables support for the static interpreter and is
enabled by default. It can be disabled to save RAM in deployments
that solely use the multi-interpreter APIs.
There exists a stack OOB read in `tryProcessIcmp6RaMessage()`. The bug
originates from the posix packet processing in
`processTransmit()`. When an ICMPv6 RA packet is sent, this triggers
`tryProcessIcmp6RaMessage()`, which calculates: `raLength = length +
(ra - data)`
However, the length passed is the packet size, which can go up to the
`char packet[kMaxIp6Size];` stack buffer size. The correct calculation
is `raLength = length - (ra - data)`.
This small mistake can make `raLength` larger than the total stack
buffer size, causing a read OOB during RA processing in
`otPlatBorderRoutingProcessIcmp6Ra()`.
This commit introduces a recursion depth limit of 4 in
Ip6::HandleDatagram to prevent unbounded stack recursion from deeply
nested IPv6-in-IPv6 tunnel packets (NextHeader = 41).
This mirrors the safety limit fix implemented in the 6LoWPAN layer
decompress path (issue #12669).
A new Nexus test case `ipv6_recursion` has been added to construct
and verify that packets exceeding the depth limit are correctly
dropped with kErrorDrop, while valid nesting depth succeeds.
Key changes:
* Added `mle_router_role_allowed` nexus test, which includes a test of
the correct type of advertisement used by each type of node.
* Updated the `router_downgrade_on_sec_policy_change` nexus test
to also test changes of the Router role allowed/disallowed when
multiple factors are changed
* Updated checks in `verify_1_1_5_3_6.py` to verify that only Router
advertisments are sent during the test, to verify that REED
advertisements are not sent unless the unit is no longer
attempting to upgrade
Every DTLS ClientHello from an unseen port previously allocated a
dynamic CoapDtlsSession on the heap before DTLS cookie verification.
This allowed multiple connection attempts to leave allocated sessions
active indefinitely, leading to high memory utilization.
To resolve this:
- Enforce a 15-second handshake timeout on newly allocated sessions.
Connecting sessions that do not successfully finish the handshake
within 15 seconds are cleanly disconnected and freed.
- Enforce a session limit cap of 16 concurrent secure sessions on the
Border Agent. Reaching this limit immediately rejects new session
connection requests before triggering heap allocation.
- Implement Nexus test case TestBorderAgentSessionsLimit to robustly
verify both session limit rejection and handshake timeout behavior.
This commit adds support for IPv6 loopback address (::1) in the
simulation platform. When the local interface is set to the IPv6
loopback address, it uses the interface-local multicast group
(ff01::116) instead of the link-local group (ff02::116) for
node-to-node communication.
It also ensures that the `sin6_scope_id` is correctly set for the
loopback address in the transmission socket.
This commit fixes a deterministic null-pointer dereference in
CoapBase::ProcessBlock2Request when receiving a Block2 request
with block number greater than 0 without a preceding active
blockwise transfer.
Previously, when mLastResponse was null, the option copying logic
would unconditionally attempt to initialize the iterator with a
dereferenced mLastResponse pointer (iterator.Init(*mLastResponse)),
causing a segmentation fault crash.
This fix inserts a VerifyOrExit check on mLastResponse inside
ProcessBlock2Request. If mLastResponse is null, it returns the
kErrorNoFrameReceived error code. In ProcessBlockwiseRequest, this
is mapped to a 4.08 Request Entity Incomplete response, matching the
spec-compliant error handling behavior of Block1.
An automated reproduction and verification test case has also been
added to tests/nexus/test_coap_block.cpp.
This commit fixes the occasional/flaky failure of the Nexus test
1_1_5_8_4 by addressing a joiner expiration issue and strictly
verifying MLE Discovery Responses.
In test_1_1_5_8_4.cpp, the joiner was added with a timeout of 100s in
Step 1. However, the total simulated elapsed time before Step 11
(when the joiner is checked) is exactly 104s. This causes the
joiner to expire occasionally/consistently, resulting in the Leader
skipping the MLE Discovery Response in Step 12.
We increase the joiner timeout to 1000s so that it stays active
throughout the test. In addition, we update verify_1_1_5_8_4.py to
strictly verify the Step 12 Discovery Response and perform packet
matching chronologically rather than relying on seeking backward to
idx10.
This commit introduces a new static helper method,
`Manager::DidRegisterSuccessfully()`, to evaluate whether a specific
multicast address was successfully registered based on the MLR response
status and the list of failed addresses.
Previously, this evaluation logic was duplicated and inline within
`Manager::Finish()` using the expression:
`success = aSuccess || !aFailedAddresses.IsEmptyOrContains(addr)`.
This logic was not immediately intuitive and required reasoning through
the boolean conditions to understand the intended behavior.
Extracting this into a dedicated helper method improves code
readability and maintainability. It simplifies `Finish()` by
clearly separating the outcome evaluation from the actual state
transition logic (`kStateRegistering` to `kStateRegistered` or
`kStateToRegister`).
Additionally, the unused `AddressArray::IsEmptyOrContains()` method
has been removed.
This commit introduces a new helper method, `RxFrame::IsSecuredWith()`,
which allows callers to cleanly verify if a received MAC frame has
security enabled and uses a specific set of allowed Key ID Modes.
This eliminates redundant logic in `ThreadLinkInfo::SetFrom()`, where
the code previously had to manually check `GetSecurityEnabled()`,
extract the Key ID Mode, and validate it against `kKeyIdMode0` or
`kKeyIdMode1`. Mac::ProcessCsl()` is updated to use this new method
to cleanly enforce that CSL IE processing only occurs on frames
secured with Key ID Mode 1
Crucially, this commit also updates `DataPollHandler::HandleDataPoll()`
to use this new helper. Previously, it only checked if the frame
was secured (`GetSecurityEnabled()`), which would accept frames
using any Key ID Mode (including mode 2 with fixed/known keys). By
restricting the data poll handling to only accept Key ID Mode 1, we
ensure that data polls are only processed if they are secured with
a valid Thread network key.
This commit updates `Ip6::Filter::Apply()` to remove the exception
that allowed all unsecure link-local IPv6 datagrams to pass through
when the Thread role was disabled (e.g., when the interface is up
but Thread has not yet started).
By removing this check, the device now consistently enforces strict
port filtering at all times. Only explicitly allowed traffic, such
as MLE messages, commissioner traffic, or user-configured unsecure
ports, will be permitted, improving the overall security posture
regardless of the current Thread role state.
For testing and backward compatibility on reference devices, the
`mAllowUnsecureWhenDisabled` flag is introduced (available when
`OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE` is enabled). This allows
the legacy behavior to be restored via the new public APIs
`otIp6SetAllowUnsecureWhenDisabled()`. The new APIs are also provided
in CLI under `unsecureport allwhendisabled` command.
This commit introduces a new private helper method, `ShouldRegister()`,
to the `Manager` class. This method consolidates the checks required
to determine if the device should perform MLR.
This commit introduces the `KeyManager::ClearKek()` method, which clears
the `Kek` and resets the `mIsKekSet` flag.
The KEK is a temporary key used during the commissioning and entrust
phases. To improve security and key hygiene, this commit updates the
`Joiner` and `JoinerRouter` to explicitly clear the KEK once these
operations have concluded.
Specifically:
- `Joiner::Finish()` clears the KEK when finishing in `kStateEntrust`
or `kStateJoined`.
- `JoinerRouter::HandleJoinerEntrustResponse()` clears the KEK
immediately upon handling the entrust response, before scheduling
any delayed entrusts (which set their own KEK from metadata).
This commit removes a redundant `static_cast<const uint8_t *>` when
calling `Tlv::Append<Ip6AddressesTlv>()` in `SendMlrRequest()` in
`test_1_2_MATN_TC_21.cpp`. Since the method accepts `const void *`
as its value argument, the explicit cast is unnecessary and can be
safely removed to simplify the code.
This commit updates the `ContextTlv::IsValid()` method to reject
Context TLVs that specify a Context ID of zero.
According to the Thread specification, Context ID 0 is reserved for
the Mesh-Local Prefix and should not be distributed in the Network Data.
Adding this check ensures that such invalid TLVs are correctly
identified as malformed and dropped during Network Data processing.
This commit updates `AdvertisingProxy::CopyNameAndRemoveDomain()` to
properly handle potential errors returned by `Dns::Name::ExtractLabels()`.
Previously, any error returned by `ExtractLabels()` was ignored, which
could leave the output name buffer in an indeterminate state. With this
change, if extracting the labels fails, the name buffer is explicitly
cleared by setting its first character to `kNullChar`.
This prevents subsequent code from using uninitialized or partially
written data in the event of a parsing or buffer size error.
This commit resolves the flaky test failures occasionally observed
in the history_tracker Nexus test during ping verification.
The flakiness was caused by two primary issues:
1. Concurrent background Thread control traffic (e.g. multicast
Hop-by-Hop Options packets) sometimes interleaving with the Echo
Request pings, polluting the HistoryTracker queues and causing
the strict chronological checks to fail.
2. The FTD child node upgrading to a Router due to the
TooFewRouters network threshold rule, which dynamically changed
its RLOC16 and caused NeighborRloc16 history checks to fail.
To fix these, we:
1. Set the child node's router eligibility to false after joining
to prevent any unwanted topology changes or Rloc16 updates.
2. Refactored the strict Leader TX and Child RX chronological checks
with robust iterative loops filtering specifically for the
OT_ICMP6_TYPE_ECHO_REQUEST packets.
Verified 100% stable after executing a loop of 50 successful runs.
This commit enforces strictly in-order IPv6 fragment reassembly
in the core stack to improve reassembly robustness and correctness.
Previously, the reassembly engine did not track contiguous bytes
received. An out-of-order or gapped fragment containing the M=0
flag could incorrectly trigger reassembly completion, potentially
leading to the forwarding or processing of incomplete packets.
To resolve this, we now:
1. Enforce that reassembly must start with a fragment offset
of 0.
2. Verify that any subsequent fragment aligns perfectly with the
offset where the contiguous payload data currently ends
(`offset == message->GetOffset()`).
3. Safely advance `message->GetOffset()` as each fragment is
successfully appended to keep track of the contiguous
reassembled byte range.
4. Added a robust Nexus test case verifying that gapped
reassembly is properly dropped and blocked.
This strictly in-order validation approach is consistent with the
preexisting 6LoWPAN fragment reassembly in MeshForwarder.
This commit adds aRecursionDepth tracking and limit check in
Lowpan::Compress methods to prevent excessive recursive stack usage
from recursive compression of highly nested IP-in-IP headers.
Specifically:
- Threads aRecursionDepth parameter through 3-arg and 4-arg (now
5-arg) Compress wrappers.
- Enforces aRecursionDepth <= kMaxRecursionDepth (4) in Compress.
- Increments recursion depth on nested IP-in-IP calls (Ip6::kProtoIp6).
- Adds a Nexus integration test to verify that highly nested packets
are compressed up to the threshold limit, and successfully fall back
to uncompressed inline transmission without excessive stack usage.
This commit adds validation to ensure that Key ID Mode 0 (implied KEK)
secured frames are only accepted if a KEK is configured. If KEK is not
configured, the frame is rejected.
Specifically:
- Added `mIsKekSet` boolean member variable to `KeyManager` to track
KEK status.
- Implemented `KeyManager::IsKekSet()` to check if a KEK is
configured.
- Enforced a guard in `Mac::ProcessReceiveSecurity()` under
`kKeyIdMode0` to immediately reject incoming frames with
`kErrorSecurity` when the KEK is not configured.
- Added unit test `TestKeyManagerKek()` in `test_pskc.cpp` to
verify that `IsKekSet()` transitions from `false` to `true` as
expected.
This commit resolves an issue in HandleAddressSolicitResponse where
a malformed or invalid leader-supplied Router ID Mask omitting the
leader ID could trigger an assertion.
When a node receives an Address Solicit Response, it installs the new
router ID mask. If the leader's router ID is missing from the mask,
the Router entry for the leader is removed from the local router table.
Subsequently, when the node tries to ensure it has a valid next hop
and cost towards the leader, `mRouterTable.GetLeader()` returns `nullptr`,
leading to an `OT_ASSERT(leader != nullptr)` failure or a null-pointer
write when assertions are disabled.
This is resolved by safely verifying that the leader's router ID is
indeed present in the received router ID mask before applying the
routing update, ensuring `GetLeader()` is guaranteed to find it.
This commit updates `Mac::ProcessCsl` to explicitly verify that CSL IE
data frames are secured using `KeyIdMode1` (utilizing the network key
and per-neighbor frame counter freshness checks).
Fix a double-free of `mSavedResponse` in `Dns::Client` when processing
duplicate DNS responses matching an active query.
When an SRV/TXT query needs to resolve a host address (AAAA), the DNS
client allocates a chained `newQuery` to handle it. If duplicate
responses are processed before the query chain is finalized, they
trigger multiple AAAA resolution allocations for the same parent query.
Because the new query inherits `mSavedResponse` from the parent query's
`QueryInfo`, multiple chained queries end up aliasing/sharing the same
cloned `mSavedResponse` message. During finalization, `FreeQuery`
walks the chain and frees `mSavedResponse` for each query, leading to
a double-free of the shared `Message` and free-list/heap corruption.
This commit resolves the issue by:
1. Rejecting duplicate responses early in `ParseResponse` if a response
has already been received and saved for the query
(`info.mSavedResponse != nullptr`), returning `kErrorDrop`.
2. Initializing the `mSavedResponse` field of the `QueryInfo` struct
to `nullptr` before allocating the host resolution query (`newQuery`)
to prevent it from inheriting a potentially non-null saved response
from its parent.
This commit add a `OutputResult()` wrapper method in the `Utils` base
class.
Previously, several CLI sub-modules (`Dns`, `History`, `LinkMetrics`,
`MeshDiag`, and `PingSender`) implemented their own `OutputResult()`
wrappers that simply delegated to the `Interpreter`. Since all these
sub-modules inherit from `Utils`, this functionality is now provided
directly by the base class, removing redundant code and simplifying
the sub-module implementations.
This commit introduces the `Mlr` namespace to encapsulate all
Multicast Listener Registration related types and logic, improving
overall code organization and readability.
The following primary renames were performed:
- `MlrManager` to `Mlr::Manager`
- `MlrState` to `Mlr::State`
- `MlrStatus` to `Mlr::Status`
- Constants like `kMlrSuccess` to `Mlr::kStatusSuccess`
Additionally, methods within the newly scoped `Mlr::Manager` class
have been simplified by removing redundant `Mlr` prefixes (e.g.,
`SendMlr()` is now `Send()`, `FinishMlr()` is now `Finish()`).
External modules and tests have been updated to reference the new
scoped names.
This commit extracts the logic for appending an `Ip6AddressesTlv` into
a new `static` helper method, `Ip6AddressesTlv::AppendTo()`.
Previously, multiple locations in the codebase manually managed the
TLV construction and appending. This change centralizes this logic,
simplifying the call sites in `BackboneRouter::Manager` and
`MlrManager`.
RFC 7731 Section 4 specifies that the MPL Option MUST only reside
within a Hop-by-Hop Options extension header. However, previously,
Ip6::HandleOptions processed MplOption::kType regardless of whether the
enclosing header was Hop-by-Hop or Destination Options.
This commit fixes the issue by adding a boolean parameter to
Ip6::HandleOptions indicating if the enclosing header is Hop-by-Hop.
MplOption::kType is now only processed if this parameter is true.
If the MPL Option is encountered in a Destination Options header,
it is treated as unrecognized, and because its type action mandates
discarding the packet, the datagram is dropped safely.
Gate `MeshForwarder::UpdateEidRlocCacheAndStaleChild` on link
security, ensuring that the received frame has security enabled.
Adding the link security check ensures that only fully authenticated
data frames (successfully decrypted and verified at the MAC layer)
can influence the EID-to-RLOC cache and the child table states.
Host-untrusted IP-in-IP packets could reach the local TMF socket
without the intended port checks on the receive path if destined to
the Border Router's own OMR address with an inner destination set to
the Thread-side link-local address. When the outer message is
decapsulated, it recurses through the IPv6 stack receive path while
retaining its HOST_UNTRUSTED origin, but local UDP socket dispatching
lacks equivalent origin checks.
This commit introduces a validation check in Ip6::HandleDatagram to
immediately drop any message from a host-untrusted origin with a
next header of kProtoIp6 (IP-in-IP encapsulation). This securely
prevents this receive-path processing and the corresponding
forwarding behavior.
Added the tmf_origin Nexus integration test to verify that
host-untrusted IP-in-IP packets are successfully dropped by
returning kErrorDrop.
This commit reorganizes the `Node` class declaration in
`nexus_node.hpp` to improve readability and maintainability.
The methods and members are now logically grouped into marked
sections.
This commit removes an overly strict `OT_ASSERT` on child state
validity inside `ProcessAddressRegistrationTlv`.
When a valid child transitions to a link-reestablishment state
(e.g., `kStateChildUpdateRequest` or `kStateChildIdRequest`) with
registered MLR addresses, its MLR registered set is preserved. The
subsequent processing of the Child Update Response or Child ID Request
causes `ProcessAddressRegistrationTlv` to be invoked while the child
is not yet back in `kStateValid`, which triggers the assertion on the
parent router/leader.
Since the parsing logic and `MlrManager` handle non-valid child states
gracefully, this assertion is deleted.
This commit updates Tmf::Agent::Filter to require link-layer security
for all incoming TMF requests.
Thread Management Framework (TMF) messages are used for network
management and configuration. The Thread specification requires that
all TMF messages be secured. While individual handlers often have
specific checks, enforcing this at the TMF Agent level provides a
consistent security layer for all TMF traffic.
For most TMF messages, security is provided by the Network Key. For
commissioning-related messages (like Joiner Entrust), security is
provided by the Key Encryption Key (KEK). In all cases, a valid TMF
message must have link-layer security enabled.
This change prevents unauthenticated attackers from sending unsecured
TMF messages to manipulate network state or configuration.
This commit fixes an issue where a tasklet could not be successfully
unposted if it was already scheduled for execution in the current
event loop iteration.
Previously, `Scheduler::ProcessQueuedTasklets()` copied and cleared the
queued tasklets before running them. If a running tasklet called
`Unpost()` on another tasklet that was also in the copied list, the
unpost operation would fail to remove it because it only checked the
main queue.
To address this, the `Scheduler` now explicitly maintains two separate
queues: `mPostedQueue` and `mRuningQueue`. The `Tasklet::Unpost()`
method is updated to remove the target tasklet from both queues,
ensuring it is correctly dequeued even if it is pending in the running
list.
The queue logic is encapsulated into a nested `Queue` class to manage
the circular singly linked-list operations cleanly. Additionally, unit
tests are expanded to cover scenarios where tasklets post or unpost
other tasklets during execution.
This commit adds an explicit check in Joiner::HandleTmf<kUriJoinerEntrust>
to verify that the received message has link-layer security enabled.
According to the Thread specification, the Joiner Entrust message MUST
be protected by link-layer security using the Key Encryption Key (KEK).
Previously, this check was missing, allowing an unauthenticated
attacker to send unsecured Joiner Entrust messages. Such messages
could inject invalid network configuration, causing the device to
fail to attach to the correct network after a reboot.
By verifying IsLinkSecurityEnabled(), we ensure that the message
was successfully decrypted using the KEK (since the network key is
not yet known by the Joiner), thus authenticating the sender as the
valid Commissioner or Joiner Router.
This commit updates the `Interpreter::SetUserCommands()` method to
detect if a set of CLI commands is already registered. If a duplicate
registration is detected, the method now returns `OT_ERROR_NONE` and
exits early without consuming an additional slot in the user commands
table. It also ensures that `OT_ERROR_FAILED` is only returned when
there are no available slots for a new registration.
This commit simplifies the `MlrManager::SendMlrMessage()` method by
removing the `void *aContext` parameter.
Previously, all callers (`SendMlr()` and `RegisterMulticastListeners()`)
were passing `this` as the context for the CoAP response handler. The
context is now passed directly as `this` when invoking
`Tmf::Agent::SendMessageTo()`, removing the need to thread it through
the method arguments.
This commit updates the way Route TLV is constructed and appended to
messages. Previously, a `RouteTlv` object with a large fixed-size
`mRouteData` array was allocated on the stack, filled by
`RouterTable`, and then appended to the message.
To simplify the code and improve efficiently a new helper method
`RouterTable::AppendRouteTlv()` is introduced which appends the TLV
content directly in the `Message`. It uses `Tlv::StartTlv()` and
`Tlv::EndTlv()` to encapsulate the `RouterIdMask` and the iteratively
appended route data entries.
A helper method `RouteTlv::AppendRouteDataEntry()` is added which
handles encoding and adding a Route Data Entry, including the the
bit-packing logic(the staggered 1.5-byte packing under
`OPENTHREAD_CONFIG_MLE_LONG_ROUTES_ENABLE`).
This commit removes several simulation test jobs from the GitHub Actions
workflows, specifically 'simulation-1.1.yml' and 'simulation-1.4.yml'.
The following jobs were removed:
- packet-verification
- cli-ftd
- cli-mtd
- cli-time-sync
- thread-1-4
These tests have been migrated to the Nexus test framework, which
allows for more efficient and scalable network simulations by
running multiple OpenThread nodes within a single process.
This commit simplifies the `MulticastListenersTable` by replacing the
custom heap-based sorting logic with a standard `Array` and integrating
an internal `TimerMilli` (`mTimer`) to handle entry expirations.
Previously, the table maintained a min-heap based on expiration times
(`FixHeap`, `SiftHeapElemDown`, `SiftHeapElemUp`) and required
external calls to `Expire()` every second. The new implementation
uses `mListeners.FindMatching()` and `mListeners.RemoveAllMatching()`,
significantly reducing code complexity and maintenance overhead.
The unit tests in `test_multicast_listeners_table.cpp` are also updated
to reflect the simplified model
This commit updates the CLI sub-modules to use a new, non-static
`GetInterpreter()` method provided by the `Utils` base class, rather
than relying on the static `Interpreter::GetInterpreter()` which
returns a global singleton.
The `Utils::GetInterpreter()` method downcasts its associated
`OutputImplementer` reference to the specific `Interpreter` instance
it belongs to. `OutputImplementer` is a base class of `Interpreter`.
This change is a step towards adding support for multiple CLI
interpreters (per OpenThread instance).
Additionally, the `OutputImplementer` constructor is made `protected`
as it is intended to serve as a base class.
This commit refactors the instance allocation logic in `Instance` to
use `constexpr size_t` constants replacing the preprocessor macros
(`OT_DEFINE_ALIGNED_VAR` and `OT_ALIGNED_VAR_SIZE`).
The new constants `kInstanceSizeInUint64s` and
`kMultiInstanceSizeInUint64s` provide better type safety and are more
idiomatic C++. The raw storage arrays (`gInstanceRaw` and
`gMultiInstanceRaw`) are now explicitly defined as `uint64_t` arrays
using these calculated sizes.
Additionally, this commit introduces `kNumStaticInstances` to represent
the configured number of multiple static instances.
This commit introduces the `RoleTransitioner` class (renamed from
`RouterRoleTransition`) to centralize the management of router role
eligibility, thresholds, and transitions.
The following state and logic are moved from the `Mle` class into
the `RoleTransitioner`:
- Router role eligibility and allowance state (`mRouterEligible`,
`mRouterRoleAllowed`).
- Upgrade and downgrade thresholds.
- Downgrade blocking state (`mDowngradeBlocked`).
- Transition decision logic (`DecideWhetherToUpgrade()`,
`DecideWhetherToDowngrade()`).
- The transition jitter timer and its management.
By consolidating these responsibilities, the complexity of the main
`Mle` class is reduced, and the role transition process is more
explicitly managed within its own sub-component.
This commit updates `Trel::Link::ProcessReceivedPacket()` to move
channel mismatch validation until after the acknowledgment logic.
TREL ACKs serve as a mechanism to monitor link status between peers.
By deferring the channel check, we ensure that TREL packets requiring
an acknowledgment are correctly acknowledged at the TREL layer even
if they are not further processed.
A primary use case is the MLE Announce message, which is sent on a
different channel as a broadcast. At the TREL layer, this broadcast
is converted to unicast TREL packet transmissions to each peer on the
same PAN, with packets marked to request a TREL ACK. This change
ensures the receiving TREL peer sends an ACK for such packets,
maintaining link monitoring, while still dropping the packet at the
TREL link layer due to the channel mismatch.
When uart-exclusive is specified as a radio URL parameter, the UART
device is locked using flock(LOCK_EX) to prevent concurrent access,
and TIOCEXCL is set where supported.
This commit implements rate limitation for the TCAT commands Present
PSKd Hash TLV (0x10), Present PSKc Hash TLV (0x11) and Present
Install-code Hash TLV (0x12) to prevent password guessing attacks.
It also removes the TCAT command Request PSKd Hash TLV (0x14), to
prevent offline password guessing attacks with a single Hash value
retrieved from the device.
Note: The commit does not remove the Request PSKd Hash TLV
implementation in the Python commissioner such that the non-existence
of the command TLV can still be tested.
This commit enhances MLE where a full Route TLV could be appended to
a Link Accept message sent to a child neighbor, potentially leading
to a message requiring lowpan fragmentation.
Previously, `Mle::SendLinkAccept()` relied on a `Router` pointer to
determine whether to use a full or compact Route TLV. When the Link
Request originated from a child, this pointer was null, causing a
full Route TLV to be used.
The changes in this commit include:
- Updating the `LinkAcceptInfo` struct to track the RLOC16 of the Link
Request sender.
- Updating `Mle::TxMessage::AppendRouteTlv()` and adding
`AppendCompactRouteTlv()` to replace the previous single method that
took a `Neighbor` pointer. This makes the intent clearer and
supports both router and child neighbors.
- Updating `RouterTable::FillRouteTlv()` to take an RLOC16 instead of
a `Neighbor` pointer. It uses `Mle::RouterIdFromRloc16()` to ensure
that if the destination is a child, its parent's Router ID is
included in the compact Route TLV.
- Includes new Nexus test `test_compact_route_tlv` to validate the
use of compact Route TLV in Link Accept.
This commit removes the test_ping.py test file from the
thread-cert test suite.
The ping functionality tested by this file is already
well covered by existing Nexus tests (e.g.,
test_ipv6_source_selection.cpp, test_radio_filter.cpp),
so this file is no longer needed.
This commit migrates the test_history_tracker.py test
from the thread-cert test suite to the Nexus test
framework as a new C++ test.
The new C++ test, test_history_tracker.cpp, covers:
- Role changes (detached -> leader -> disabled)
- NetInfo age up to 49 days
- Child mode Rn changes
- Ping between leader and child, verifying message
types, checksums, priority, and success flags
It directly uses HistoryTracker::Local methods instead
of the C APIs.
This commit introduces `NeighborTable::Iterator` and
`NeighborTable::kIteratorInit` as core type aliases for
the public `otNeighborInfoIterator` and its initializer
`OT_NEIGHBOR_INFO_ITERATOR_INIT`.
This commit adds a new Nexus test `TestFedRxOnlyLinkEstablishment` to
verify that a Full End Device (FED) successfully establishes rx-only
links with all its neighboring routers in the network.
The test forms a topology with a leader and 15 routers, then adds an
FED child. It uses the `NeighborTable` callback to track the addition
of routers to the FED's neighbor table and ensures that it
eventually establishes links with all available neighboring routers.
This commit renames the local variable `aKeyType` to `keyType` in
`Radio::SetMacKey()` to align with the project's naming conventions.
The `a` prefix is reserved for function arguments, while local
variables use `lowerCamelCase` without a prefix.
This commit migrates the functionality covered by
`tests/scripts/thread-cert/test_radio_filter.py` to a new Nexus test
`tests/nexus/test_radio_filter.cpp`.
The new test covers:
- Initial state of radio filter (disabled).
- Enabling radio filter on Router blocks pings.
- Disabling radio filter on Router restores pings.
- Enabling radio filter on SED causes it to detach.
- Disabling radio filter on SED allows it to reattach.
To make the test pass in Nexus, the following fixes were applied:
- Set external poll period to 40ms for SED to receive ping replies.
- Forced parent search on SED using `BecomeChild()` to avoid long
backoff interval.
The energy scan portion of the original test is skipped because
`otPlatRadioEnergyScan` is not implemented in the Nexus platform.
The original Python test file is removed.
This commit migrates the functionality covered by
`tests/scripts/thread-cert/test_coaps.py` to a new Nexus test
`tests/nexus/test_coaps.cpp`.
The new test covers:
- CoAP Secure with PSK.
- CoAP Secure with X.509 certificates.
The X509 test is conditionally compiled based on
`MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED`.
The original Python test file is removed.
This commit renames the `RouterTable::FindNextHopOf()` method to
`RouterTable::FindNextHopTowards()` to more accurately reflect its
purpose: finding the next hop on the path towards a given destination
router.
This commit migrates the functionality covered by test_coap_observe.py
to the Nexus test framework.
- Enabled OPENTHREAD_CONFIG_COAP_OBSERVE_API_ENABLE in Nexus config.
- Created test_coap_observe.cpp to test CoAP observations and
notifications in a simulated network.
- Handled edge cases in the test to avoid segfaults during cancel
response processing.
- Removed the old Python test test_coap_observe.py.
This commit addresses an occasional failure in test 1_2_MATN_TC_10
where the Router's ping reply was not found in Step 8.
- Increased the time advanced in Step 8 from 10 seconds
(kStabilizationTime) to 20 seconds (2 * kStabilizationTime).
- This allows more time for address resolution (NS/NA) and packet
transmission in the simulated environment.
- Verified that the test passes consistently with 100 consecutive
successful runs after applying this fix.
This commit migrates the functionality covered by test_coap_block.py
to the Nexus test framework.
- Enabled OPENTHREAD_CONFIG_COAP_BLOCKWISE_TRANSFER_ENABLE in Nexus
config.
- Created test_coap_block.cpp to test CoAP GET and PUT block
transfers in a simulated network.
- Removed the old Python test test_coap_block.py.
This commit introduces support for configuring and retrieving a vendor
OUI-24 (Organizationally Unique Identifier). It defines the new
`OPENTHREAD_CONFIG_NET_DIAG_VENDOR_OUI` configuration option and adds
the `otThreadGetVendorOui()` and `otThreadSetVendorOui()` APIs.
When specified, the vendor OUI is included in the `BorderAgent`
mDNS/DNS-SD TXT data under the `vo` key.
The `VendorInfo` class is updated to manage the OUI value. This
commit also adds the `vendor oui` CLI command to get or set this
property. Finally, it updates the tests to validate the presence and
correctness of the new `vo` key in the TXT data.
This commit removes the `OPENTHREAD_CONFIG_MLE_IP_ADDRS_TO_REGISTER`
configuration option and the logic in `Mle` that limited the number of
IPv6 addresses registered by an MTD with its parent.
By removing this limit, MTDs will now attempt to register all their
valid unicast and multicast addresses. The parent router still
enforces its own limit on the number of addresses it accepts and
stores per child via `OPENTHREAD_CONFIG_MLE_IP_ADDRS_PER_CHILD`.
An error check is added to `openthread-core-config-check.h` to inform
users of the removal of this configuration macro.
This commit moves the constants for the minimum and maximum number of
IPv6 addresses allowed in a Multicast Listener Registration (MLR)
request from the `Ip6AddressesTlv` class to `mlr_types.hpp`.
The new constants are named `kMlrMinIp6Addresses` and
`kMlrMaxIp6Addresses`. This change decouples the protocol-specific
limits from the TLV definition, which is more appropriate as these
limits are specific to the MLR process rather than the TLV itself.
The `Ip6AddressesTlv` class is simplified to a `typedef` of `TlvInfo`.
Call sites in `MlrManager`, `BackboneRouter::Manager`, and `NcpBase`
are updated accordingly.
This commit combines the two separate definitions of the `RouteTlv`
class, which were previously conditionally compiled based on the
`OPENTHREAD_CONFIG_MLE_LONG_ROUTES_ENABLE` configuration, into a
single unified class definition.
The `#if`/`#else` preprocessor directives are now localized within the
specific getter and setter methods (e.g., `GetRouteDataEntryCount()`,
`GetRouteCost()`, `SetRouteData()`) to handle the different routing
data formats. This removes significant code duplication for shared
methods such as `Init()`, `IsValid()`, `GetRouterIdSequence()`, and
`IsSingleton()`.
This commit migrates the test_ping_lla_src.py script from thread-cert
to the Nexus test framework.
The new test_ping_lla_src.cpp implements the same test logic:
- Forms a network with a Leader and two Routers.
- Verifies that pings using a Link-Local Address (LLA) as the source
succeed when sent to a neighbor's Mesh-Local EID (ML-EID).
- Verifies that pings using an LLA source fail when sent to a
non-neighbor's ML-EID, as LLAs are only valid for single-hop
communication.
- Verifies that external routes are not used for LLA-sourced packets.
To support this migration, the Nexus Core class was enhanced with:
- Overloads for SendAndVerifyEchoRequest that allow specifying a
source address.
- New SendAndVerifyNoEchoResponse methods to verify that no echo
response is received (useful for negative test scenarios).
Changes:
- Added tests/nexus/test_ping_lla_src.cpp
- Updated tests/nexus/CMakeLists.txt to include the new test.
- Enhanced tests/nexus/platform/nexus_core.hpp/cpp with new helpers.
- Removed tests/scripts/thread-cert/test_ping_lla_src.py.
Add the jlumbroso/free-disk-space action to all jobs in the Nexus
workflow. This ensures that the runner has sufficient disk space to
complete the build and test tasks, preventing failures due to exhausted
disk resources on GitHub-hosted runners.
Added OPENTHREAD_CONFIG_PARENT_SEARCH_BACKOFF_INTERVAL with a value of
10 minutes (10 * 60 seconds) to the Nexus core configuration. This
helps in controlling the backoff behavior during parent search in the
simulator, making it more interactive.
This commit migrates the 'test_pbbr_aloc.py' script from the
thread-cert framework to the Nexus simulation framework.
The new 'test_pbbr_aloc.cpp' replicates the original test:
- Forms a network with PBBR, Leader, and Router nodes.
- Enables Backbone Router (BBR) on the PBBR node and waits for it
to become the Primary BBR.
- Verifies connectivity to the Leader ALOC (0xfc00) and the PBBR
ALOC (0xfc38) from the Router node using ICMPv6 Echo Requests.
- Confirms that the stack correctly uses Network Data for ALOC
resolution.
Nexus tests provide faster and more scalable network simulations
within a single process, improving CI efficiency and reliability.
Original Python script 'tests/scripts/thread-cert/test_pbbr_aloc.py'
is removed as its functionality is now fully covered by Nexus.
This commit migrates the test for DNSSD names with special characters
from the thread-cert functional tests to the Nexus simulation
framework.
The new Nexus test 'test_dnssd_name_with_special_chars.cpp' replicates
the logic from 'test_dnssd_name_with_special_chars.py' and covers:
- SRP service registration with an instance name containing special
and Unicode characters ("O\T 网关").
- DNS-SD browse to discover the service instance.
- DNS-SD resolution of the service instance name, including
verification of case-insensitive resolution.
* [posix] truncate settings file to last valid offset on parse error
When Init() encounters a corrupt entry, it currently truncates the
entire file to 0 bytes, destroying all settings. Since the parse loop
already knows the exact offset where corruption starts, truncate to
that offset instead, preserving all entries that were successfully
parsed.
This prevents loss of the active operational dataset (and other
settings) when only trailing bytes are corrupt — a common failure
mode when power is lost during a write.
If corruption starts at offset 0 (no valid entries), behavior is
identical to the original code.
* [posix] fsync parent directory after settings file rename
SwapPersist() calls fsync() on the data file descriptor but does not
sync the parent directory after rename(). On journaling filesystems
(ext4, overlayfs), the rename metadata may not reach stable storage
before a power loss. This can leave the old swap file in place,
which triggers a parse error on the next Init().
Add a best-effort fsync() on the parent directory after the rename.
This is non-fatal since the file data is already persisted; only the
directory entry could lag behind.
This commit exposes radio model parameters (path loss constant,
exponent, and sensitivity) and the minimum link request margin from
the Nexus simulator backend to the frontend.
Changes in backend:
- Expose constants in `RadioModel` and `Radio`.
- Add `GetRadioParameters` RPC to `simulation.proto` and implement it
in gRPC and WASM bindings.
- Expose `OPENTHREAD_CONFIG_MLE_LINK_REQUEST_MARGIN_MIN` and
`OPENTHREAD_CONFIG_MLE_PARTITION_MERGE_MARGIN_MIN` via the new RPC.
Changes in config:
- Set `OPENTHREAD_CONFIG_MLE_LINK_REQUEST_MARGIN_MIN` and
`OPENTHREAD_CONFIG_MLE_PARTITION_MERGE_MARGIN_MIN` to 5 dB in
`openthread-core-nexus-config.h`.
This allows the frontend to calculate and render circles dynamically.
This commit introduces the `DoesArrayContain()` template function to
check if a given item is present in a fixed-size C array. The template
arguments are deduced by the compiler, allowing callers to simply use
`DoesArrayContain(aArray, aItem)`.
It also updates `Manager::CoapDtlsSession::ReadSteeringDataTlv()` and
`Ip6::HandleDatagram()` to use this new helper function instead of
using manual `for` loops to iterate over `kEnrollerValidSteeringDataLengths`
and `kForwardIcmpTypes` arrays respectively.
This commit updates the `RouteTlv` implementation to use `ReadBits` and
`WriteBits` from `bit-utils` for reading and writing route data entries
(Link Quality In/Out and Route Cost). This simplifies the bitwise
operations and improves readability.
This commit migrates the DNS-SD test from the thread-cert Python
framework to the Nexus C++ framework.
The new Nexus test 'test_dnssd.cpp' replicates the original test
scenario and functionality:
- Formation of a Thread network with multiple SRP clients and a
server.
- Service registration with subtypes via SRP.
- DNS browsing for full service types and specific subtypes.
- DNS address (AAAA) and service (SRV/TXT/AAAA) resolution.
- Specific DNS record queries for SRV and KEY record types.
- Verification of DNS behavior for non-existent records.
The original Python script 'tests/scripts/thread-cert/test_dnssd.py'
is removed as its functionality is now fully covered by Nexus.
Nexus tests provide faster and more scalable network simulations
within a single process, improving CI efficiency and reliability.
This commit migrates the test_service.py script from thread-cert to the
Nexus test framework.
The new test_service.cpp implements the same test logic:
- Forms a network with a Leader and two Routers.
- Adds and removes services on different nodes.
- Verifies that Service Anycast Locators (ALOCs) are correctly
added to and removed from the nodes' unicast addresses.
- Confirms reachability of the ALOCs using ICMPv6 Echo Requests
from all nodes in the network.
- Ensures ALOCs become unreachable after the service is removed
from the network data.
Changes:
- Added tests/nexus/test_service.cpp
- Updated tests/nexus/CMakeLists.txt to include the new test.
- Removed tests/scripts/thread-cert/test_service.py.
This commit restricts the API to set a preferred router ID under
`OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE`. This feature is intended
for testing and therefore be excluded from standard builds to ensure
compliance with the Thread Specification.
In `Nexus::Core::HandleStateChanged`, the `lastParentId` was not
cleared when a device transitioned to the Router or Leader role. This
could cause stale parent associations to persist, leading to incorrect
link state reporting in the visualizer during subsequent role
transitions (e.g., when a former Leader merges into a partition and
becomes a Child/REED).
This fix clears `lastParentId` (sets it to `0xffff`) when the device
becomes a Router or Leader, ensuring a fresh state for parent
tracking.
This commit migrates 'test_on_mesh_prefix.py' from the thread-cert
functional tests to the Nexus simulation framework.
The new Nexus test 'test_on_mesh_prefix.cpp' covers:
- Propagation of stable and non-stable on-mesh prefixes.
- Different Network Data request behavior for MEDs and SEDs.
- MEDs receiving both stable and non-stable prefixes.
- SEDs receiving only stable prefixes.
- IPv6 address configuration (SLAAC) for all prefixes.
- Reachability verification via ICMPv6 Echo Request/Response.
Migrating to Nexus provides faster execution and improves the
reliability of the functional test suite.
This commit migrates the router multicast link request test from the
thread-cert functional tests to the Nexus simulation framework.
The new Nexus test 'test_router_multicast_link_request.cpp' covers:
- Verification of a REED node becoming a router.
- Multicast Link Request transmission to neighboring routers.
- Quick link establishment with multiple neighbors after role upgrade.
The original Python test 'test_router_multicast_link_request.py' is
removed as its functionality is now fully covered by the Nexus test.
This commit migrates the SRP server anycast mode test from the
thread-cert Python script to the Nexus test framework.
The new Nexus test `test_srp_server_anycast_mode.cpp` covers:
- SRP Server configuration in both Anycast and Unicast modes.
- Proper publication of SRP Server information in Network Data.
- SRP Client auto-start and server selection logic.
- Service registration and verification in both address modes.
- DNS browsing for registered SRP services.
Nexus tests allow for faster and more scalable network simulations
within a single process, improving CI efficiency.
Removed:
- tests/scripts/thread-cert/test_srp_server_anycast_mode.py
Migrate legacy Python test `test_reset.py` to Nexus C++ test
`test_reset.cpp`.
The test verifies that OpenThread correctly recovers network state,
specifically frame counters and datasets, after sequential resets of
nodes in a multi-hop topology (Leader <-> Router <-> ED).
The test sequence:
- Establish multi-hop topology: Leader <-> Router <-> ED.
- Send 1010 pings from ED to Leader to advance the frame counter
beyond the default storage threshold (1000).
- Reset Leader, Router, and ED sequentially.
- Verify end-to-end connectivity after resets, confirming that frame
counters were correctly recovered from non-volatile storage.
Legacy `tests/scripts/thread-cert/test_reset.py` is removed as its
functionality is now fully covered by the Nexus test.
This commit migrates the following tests from thread-cert to Nexus:
- test_router_reboot_multiple_link_request.py
- test_leader_reboot_multiple_link_request.py
New Nexus tests cover:
- Router rebooting and sending multiple Link Requests when isolated.
- Leader rebooting and sending multiple Link Requests when isolated.
The original Python cert tests are removed as they are now fully
covered by the Nexus framework.
This commit adds a new Nexus test to verify the functionality of the
MLE long routes experimental feature, which allows path costs to
exceed the standard limit of 15.
The new test `TestLongRoutes` in `test_long_routes.cpp` forms a
topology consisting of a leader and a chain of 25 routers. It then
validates that the path cost from the last router in the chain to the
leader is correctly reported as 25 using `GetPathCostToLeader()`.
Supporting changes include:
- Updating `build.sh` to support a `long_routes` build target that
enables `OT_MLE_LONG_ROUTES`.
- Adding the `long_routes` test to `CMakeLists.txt` with the
appropriate labels.
- Introducing a new GitHub workflow job `nexus-long-routes-tests` in
`nexus.yml` to automate the execution of this test.
This commit migrates the router reattach test from the thread-cert
Python framework to the Nexus C++ framework.
The new Nexus test 'test_router_reattach.cpp' replicates the
original test scenario:
- A full 32-node router network is formed.
- Router upgrade/downgrade thresholds are set to 32.
- A router is reset and verified to re-attach and reclaim its
router role.
- The test ensures the router does not downgrade after the router
selection jitter interval.
The original Python script 'tests/scripts/thread-cert/
test_router_reattach.py' is removed as its functionality is now
fully covered by Nexus.
Nexus tests provide faster and more scalable network simulations
within a single process, improving CI efficiency.
This commit migrates the anycast routing test from the thread-cert
functional tests to the Nexus simulation framework.
The new Nexus test 'test_anycast.cpp' replicates the linear topology
(R1-R2-R3-R4-R5) and verifies:
- Anycast routing for DHCPv6 Agent (ds/cs) ALOCs.
- Dynamic routing updates when multiple anycast servers are present.
- Traffic routing to the nearest anycast destination.
The original Python test 'test_anycast.py' is removed as its
functionality is now fully covered by the Nexus test.
This commit migrates the anycast locator test from the thread-cert
functional tests to the Nexus simulation framework.
The new Nexus test 'test_anycast_locator.cpp' covers:
- Anycast Locator (ALOC) resolution for the Leader from all nodes.
- Custom service ALOC resolution when only one node provides it.
- Closest-node ALOC resolution when multiple nodes provide the same
service in a line topology (LEADER-R1-R2-R3-R4).
- Verification that nodes resolve to the nearest service instance.
The original Python test 'test_anycast_locator.py' is removed as its
functionality is now fully covered by the Nexus test.
This commit simplifies the `Ip6AddressesTlv` by removing the dedicated
class definition and instead defining it as a `TlvInfo` for the
`ThreadTlv::kIp6Addresses` type.
The usage of `Ip6AddressesTlv` is updated in `BbrManager`,
`MlrManager`, and related tests to use `Tlv::StartTlv()` and
`Tlv::EndTlv()` when appending the TLV to messages.
This commit renames `GetRouteDataLength()` and `SetRouteDataLength()`
to `GetRouteDataEntryCount()` and `SetRouteDataEntryCount()` in the
`RouteTlv` class.
When `OPENTHREAD_CONFIG_MLE_LONG_ROUTES_ENABLE` is enabled, the
route data entries use a packed format (12 bits or 1.5 bytes per
entry). Consequently, the byte length of the route data field in
the TLV is no longer equal to the number of route entries.
This change ensures that `GetRouteDataEntryCount()` correctly
calculates the number of entries from the TLV length and
`SetRouteDataEntryCount()` sets the TLV length correctly based on
the entry count.
This commit migrates the SRP TTL test from the thread-cert Python
framework to the Nexus C++ framework.
The new Nexus test `test_srp_ttl.cpp` covers all four TTL clamping
cases originally implemented in `test_srp_ttl.py`:
1. CLIENT_TTL < TTL_MIN < LEASE_MAX => Clamped to TTL_MIN.
2. TTL_MIN < CLIENT_TTL < TTL_MAX < LEASE_MAX => Used CLIENT_TTL.
3. TTL_MAX < LEASE_MAX < CLIENT_TTL => Clamped to TTL_MAX.
4. LEASE_MAX < TTL_MAX < CLIENT_TTL => Clamped to LEASE_MAX.
Nexus tests provide faster and more scalable network simulations
within a single process, improving CI efficiency.
The original Python script `tests/scripts/thread-cert/test_srp_ttl.py`
is removed as its functionality is now fully covered by Nexus.
The test was failing occasionally due to the unpredictable timing of
tick-aligned timers and dataset propagation in simulations.
Specifically:
1) The router's jittered timeout (minimum 1 second) could expire
in as little as 1ms if an MLE TimeTick occurred immediately
after the security policy update.
2) Dataset propagation via MLE Advertisements could take up to
32 seconds, making immediate checks on the router's role
unreliable.
This commit fixes the flakiness by:
- Replacing flaky router role checks with `IsRouterRoleAllowed()`
assertions. This verifies that the security policy has been
successfully propagated and applied, regardless of whether the
actual role transition has completed.
- Increasing the propagation wait time to 5 seconds. This provides
a safe margin for simulated radio propagation while remaining
well within the leader's 10-second downgrade delay.
- Ensuring both the leader and router are verified for policy
application in both phases of the test.
- Maintaining the final checks to ensure both nodes eventually
become detached after the full downgrade delay (150 seconds).
The fix was verified with 1000 consecutive successful iterations.
This commit migrates the SRP server reboot port test from the
thread-cert functional tests to the Nexus simulation framework.
The new Nexus test 'test_srp_server_reboot_port.cpp' covers:
- SRP server address mode configuration (Unicast).
- SRP client auto-start discovery of the server.
- SRP server reboot (disable/enable) without node reboot.
- Verification that the server selects a new port after each reboot.
- Robustness of service re-registration over 25 reboot iterations.
The original Python test 'test_srp_server_reboot_port.py' is removed
as its functionality is now fully covered by the Nexus test.
This commit migrates the SRP register services with different
lease test from the thread-cert Python framework to the Nexus
test framework.
The new Nexus test (test_srp_register_services_diff_lease.cpp)
reproduces the functionality of the original Python test:
- Registration of multiple services with different lease/key-lease
intervals.
- Verification of per-service lease values on the SRP server.
- Ensuring key-lease is always at least as long as the lease.
- Validating lease renewal and expiry behaviors.
- Testing dynamic changes to default client lease and TTL.
Migrating to Nexus allows for faster and more scalable network
simulations within a single process.
This commit migrates the srp_client_save_server_info test from the
thread-cert Python-based test framework to the Nexus C++ simulation
framework.
The new Nexus test (test_srp_client_save_server_info.cpp) verifies:
- SRP client selects an SRP server when auto-start is enabled.
- SRP client sticks to the current server even if other SRP servers
become available.
- SRP client saves and reuses the selected server info across SRP
client stops and restarts.
- SRP client selects a new server if the current one becomes
unavailable.
- SRP client sticks to the new server even if the old one returns.
The original Python test script is removed as its functionality is
now fully covered by the new Nexus test.
This commit migrates the test_srp_register_500_services.py test from
the thread-cert test suite to the Nexus platform.
The new C++ test (tests/nexus/test_srp_scale.cpp) implements the same
functionality: it verifies that 25 SRP clients (13 routers and 12
FEDs) can successfully register a total of 500 services (20 services
per client) with a single SRP server (the leader).
The commit includes:
- Removal of the original Python test file.
- Addition of the new Nexus C++ test file.
- Integration of the new test into CMakeLists.txt and
run_nexus_tests.sh.
This commit migrates the SRP client host removal test from the
thread-cert Python-based framework to the Nexus framework.
The new C++ implementation in tests/nexus/test_srp_client_remove_host.cpp
covers the same scenarios as the original Python script:
- Successful registration of SRP host and services.
- Verification that ClearHostAndServices() does not immediately remove
server-side state.
- Verification that RemoveHostAndServices(removeKey=False,
sendUnregToServer=True) marks the host and services as deleted on the
SRP server.
- Verification that RemoveHostAndServices(removeKey=True,
sendUnregToServer=True) fully removes the host and service entries
from the SRP server.
The original Python script test_srp_client_remove_host.py is removed
as its functionality is now fully covered by the Nexus test.
This commit migrates the test_srp_many_services_mtu_check.py from
tests/scripts/thread-cert to the Nexus test framework.
The new test, tests/nexus/test_srp_many_services_mtu_check.cpp,
verifies that the SRP client correctly handles and splits SRP Update
messages when registering a large number of services that exceed
the IPv6 MTU size (1280 bytes).
Changes:
- Added tests/nexus/test_srp_many_services_mtu_check.cpp.
- Updated tests/nexus/CMakeLists.txt to include the new test.
- Removed tests/scripts/thread-cert/test_srp_many_services_mtu_check.py.
This commit stabilizes the Nexus reed_address_solicit_rejected test by
increasing the wait time for network data synchronization from 5 seconds
to 15 seconds.
The test was occasionally failing because the 5-second wait was
sometimes insufficient for the REED's service registration to reach the
leader and for the updated network data to be broadcast back to the
REED. Increasing the delay to 15 seconds provides more robust buffer for
these network events.
Verified by running the test 50 times in a loop without failures.
This commit migrates the `test_mle_msg_key_seq_jump.py` cert test to the
Nexus simulation framework.
The new Nexus test `test_mle_msg_key_seq_jump.cpp` verifies that nodes
can correctly handle jumps in the MLE key sequence and stay attached to
the network. It covers scenarios like child triggering key sequence
updates via Child Update Request and routers propagating key sequence
updates.
The original Python test script is removed as its functionality is now
fully covered by the new Nexus test.
This commit migrates the 'test_srp_client_change_lease.py' cert test
to the Nexus simulation framework.
The new Nexus test ('test_srp_client_change_lease.cpp') verifies:
- SRP registration with default lease and TTL.
- Updating the lease interval and ensuring it is reflected in SRP
Update messages.
- Updating the TTL and ensuring it is reflected in SRP Update
messages.
- Setting the TTL to 0 and ensuring the lease interval is used as
the TTL in SRP Update messages.
The original Python test script is removed as its functionality is
now fully covered by the new Nexus test.
This commit stabilizes the Nexus SRP auto-start test by increasing
the synchronization wait time from 20 seconds to 30 seconds.
The test was occasionally failing in the Nexus environment because
the 20-second wait was sometimes insufficient for the SRP server
registration to fully propagate through the network data and for
the SRP client to process the update and complete its server
selection. Increasing the wait time to 30 seconds provides a more
robust buffer for these network synchronization events.
Verified by running the test 100 times in a loop without failures.
This commit migrates the `test_ipv6_fragmentation.py` cert test to the
Nexus simulation framework.
To support this migration, the Nexus core configuration was updated to
enable IPv6 fragmentation (`OPENTHREAD_CONFIG_IP6_FRAGMENTATION_ENABLE`).
The new Nexus test `test_ipv6_fragmentation.cpp` covers the validation
of IPv6 fragmentation and reassembly. It sends large ICMPv6 Echo
Requests exceeding the 1280-byte MTU between a Leader and a Router:
- 1952 bytes payload from Leader to Router
- 1831 bytes payload from Router to Leader
The original Python test script is removed as its functionality is now
fully covered by the new Nexus test.
This commit updates the `RouterIdSet` class, renaming it to
`RouterIdMask` and expanding it to encapsulate both the router ID
sequence number and the bitmask. This allows simplifying the
definition of `ThreadRouterMaskTlv` and `RouteTlv`.
This commit simplifies the `TimeParameterTlv` implementation by
defining a `TimeParameterTlvValue` and using the `SimpleTlvInfo`
template to define `TimeParameterTlv`.
This commit migrates the SRP auto-start test from the Python-based
thread-cert test suite to the Nexus C++ test framework.
The new Nexus test replicates the logic of the original Python test:
- Forms a network with four router nodes.
- Verifies SRP client auto-start upon server discovery in netdata.
- Tests selection priority between multiple unicast and anycast
SRP servers.
- Verifies selection based on anycast sequence numbers.
- Tests selection of specific unicast addresses published in
Service Data.
- Confirms automatic failover and client stop/restart.
The original Python test file is removed as it is now covered by
the Nexus test suite.
This commit migrates the functionality of
tests/scripts/thread-cert/test_netdata_publisher.py to a new Nexus
test tests/nexus/test_netdata_publisher.cpp.
The new Nexus test covers:
- DNS/SRP Anycast entries (equal and different version numbers).
- DNS/SRP Unicast entries (service data and server data).
- Displacement of server data unicast by anycast entries.
- Publisher preference logic for DNS/SRP services.
- On-mesh prefix publisher preference and replacement.
- External route publisher preference and replacement.
Other changes:
- Add netdata_publisher to tests/nexus/CMakeLists.txt.
- Add netdata_publisher to default tests in tests/nexus/run_nexus_tests.sh.
- Remove the old tests/scripts/thread-cert/test_netdata_publisher.py.
This commit migrates the cert test script to the Nexus simulation
framework.
The new Nexus test covers:
- Initial key sequence counter and default key switch guard time.
- Dynamic updates of the key rotation time via Operational Dataset
and verification of the 93% guard time calculation rule.
- Automatic key rotation after the rotation time interval expires.
- Verification that the key switch guard time correctly prevents
nodes from updating their key sequence counter prematurely when
receiving MLE messages with a higher sequence.
- Continued communication (ICMP Echo) between nodes even when key
sequences are temporarily mismatched due to the guard timer.
The original Python test script is removed as its functionality is
now fully covered by the new Nexus test.
This commit fixes an intermittent failure in the Nexus test
'dns_client_config_auto_start'. The test was occasionally failing
because the REED node was not upgrading to the Router role within
the previous 15-second stabilization period.
The Router role transition can take up to 120 seconds due to the
default 'ROUTER_SELECTION_JITTER' parameter. This commit increases
'kStabilizationTime' to 200 seconds to ensure the node has ample
time to become a router before the test proceeds to verify its
DNS configuration.
Make `otPlatLogOutput()` `OT_TOOL_WEAK` in `cli_logging.cpp` so that
applications can provide their own strong definition to customize
instance-aware log output behaviour.
This commit migrates the 'test_mac_scan.py' cert test to the Nexus
simulation framework.
The new Nexus test 'test_mac_scan.cpp' verifies the IEEE 802.15.4
Active Scan (MAC scan) functionality. It forms a simple network
consisting of a Leader and a Router and performs an active scan
from the Leader to ensure it correctly discovers the Router's
beacon.
The original Python test script is removed as its functionality is
now fully covered by the new Nexus test.
This commit migrates the dns_client_config_auto_start test from the
thread-cert Python-based test framework to the Nexus C++ simulation
framework.
The new Nexus test (test_dns_client_config_auto_start.cpp) verifies:
- DNS client uses the SRP server address automatically when no
explicit config is set.
- Explicitly set DNS config takes precedence over auto-discovered
SRP server address.
- Clearing an explicit DNS config allows the client to fall back to
the auto-discovered SRP server address.
- DNS client updates its default config when the SRP server changes.
Changes:
- Added tests/nexus/test_dns_client_config_auto_start.cpp
- Updated tests/nexus/CMakeLists.txt to build the new test
- Updated tests/nexus/run_nexus_tests.sh to include it in default
- Removed tests/scripts/thread-cert/test_dns_client_config_auto_start.py
This commit migrates the functional test for child supervision from
the thread-cert Python-based framework to the Nexus framework.
The original test in 'tests/scripts/thread-cert/test_child_supervision.py'
has been removed and replaced with a C++ implementation in
'tests/nexus/test_child_supervision.cpp'.
The new Nexus test covers:
- Verification of initial child supervision interval on parent and child.
- Dynamically updating the supervision interval and check timeout.
- Behavior when supervision messages are blocked (child detaching).
- Verification of connectivity when child supervision is disabled.
- Handling of zero supervision interval.
'tests/nexus/CMakeLists.txt' is updated to include the new test.
This commit migrates the 'test_reed_address_solicit_rejected.py' test
from the thread-cert suite to the Nexus test framework.
The new Nexus test 'test_reed_address_solicit_rejected.cpp' covers:
- Verification that a REED node can successfully register a service and
receive the corresponding Service ALOC (0xfc10).
- Verification that when a REED node's attempt to upgrade to a router
is rejected by the Leader, it correctly remains a child while
maintaining its Service ALOC.
The original Python script is removed as its functionality is now
fully covered by the Nexus implementation.
This commit migrates the functionality of the Python-based certification
test 'test_br_upgrade_router_role.py' to a new Nexus-based C++ test
'test_br_upgrade_router_role.cpp'.
The test verifies that Border Routers (BRs) providing IP connectivity
are eligible to request a router role upgrade even when the active
router count already meets the 'router_upgrade_threshold'.
Key test steps:
- Set router upgrade threshold to 2.
- Ensure three BRs remain in child role when 2 routers already exist.
- Verify BRs upgrade to router role when they provide external routes
or prefixes, up to the limit of 2 BR routers.
- Verify that a third BR providing external routes remains a child.
- Verify that removing a route from one BR router triggers the child BR
to upgrade to a router.
The Python test is removed as it is now covered by the Nexus test.
Set the RSSI field in simulated MAC ACK frames in nexus_core.cpp.
Previously, the simulator did not populate the mRssi field in the
mInfo.mRxInfo structure of simulated ACK frames passed to
otPlatRadioTxDone. This caused OpenThread to ignore the RSSI of ACKs,
preventing the parentRss average from updating on successful data polls
from Sleepy End Devices (SEDs).
Now, the RSSI from the parent to the child is calculated using the radio
model and clamped to int8_t before being assigned to the ACK frame.
This commit migrates the test for zero-length external routes from a
Python script to the Nexus test framework. The original test was
test_zero_len_external_route.py in tests/scripts/thread-cert.
The new Nexus test test_zero_len_external_route.cpp replicates the
original test scenario:
- Forms a network with a Leader and two Routers.
- Verifies that adding a zero-length external route "::/0" on a Router
allows routing to a manually added IPv6 address on that Router.
- Verifies that explicit external routes are preferred over on-mesh
prefixes that have the default route flag set.
- Verifies that removing the external route causes traffic to be
re-routed (and in this case, fail as intended when the destination
is moved).
- Verifies that moving the address to another Router with a default
route flag allows successful routing.
This commit also fixes a bug in Core::SendAndVerifyEchoRequest in
nexus_core.cpp where the ICMP handler was not always unregistered,
especially when failures occurred. This fix ensures that subsequent
handler registrations in the same process do not fail with
kErrorAlready.
Migrating to Nexus provides faster execution and better integration with
the core OpenThread codebase.
This commit migrates the `test_ipv6_source_selection.py` cert test to
the Nexus simulation framework.
To support this migration, the Nexus framework was extended to allow
verifying the local (source) address on which an ICMP Echo Reply is
received. This is achieved by adding an overload to
`SendAndVerifyEchoRequest` that accepts an expected source address.
The new Nexus test `test_ipv6_source_selection.cpp` covers the
following scenarios:
- RLOC source for RLOC destination
- ML-EID source for ALOC destination
- ML-EID source for ML-EID destination
- Link-local source for Link-local destination
- ML-EID source for Realm-local multicast destination (ff03::1)
- GUA source for GUA destination
- GUA source for external address (via default route)
The original Python test script is removed as its functionality is now
fully covered by the new Nexus test.
Refine the event suppression logic in nexus_core.cpp when handling
NeighborTable::kChildRemoved events.
Previously, any valid neighbor found would suppress the event. Now, it
only suppresses the event if the node is found in the Router table.
This ensures that removal events for Sleepy End Devices (SEDs) are not
suppressed, allowing the link to disappear in the visualizer as
expected.
This commit fixes a compiler warning in nexus_radio.cpp where the
aFrame parameter in otPlatRadioTransmit was considered unused in
non-debug builds. The variable is only used within an OT_ASSERT.
Using OT_UNUSED_VARIABLE is the standard OpenThread pattern to
address unused parameters and ensure clean builds across different
compilers and build configurations.
This commit migrates the certification test for router downgrade on
security policy change from a Python script to the Nexus test framework.
The original test was test_router_downgrade_on_sec_policy_change.py in
tests/scripts/thread-cert.
The new Nexus test test_router_downgrade_on_sec_policy_change.cpp
replicates the original test scenario:
- Forms a network with a Leader and a Router.
- Verifies that both nodes are in the expected router/leader roles.
- Changes the security policy to disable 'R' bit (routers) and sets the
version threshold to 7.
- Verifies that the Leader and Router do not immediately downgrade,
respecting the mandatory 10-second delay.
- Verifies that restoring the original security policy before the
timeout cancels the pending downgrade.
- Verifies that re-applying the security policy change leads to both
nodes eventually downgrading to the detached state once the version
threshold and router disable flags are propagated and the timer
expires.
Migrating to Nexus provides faster execution using virtual time and a
more integrated environment for debugging core Thread logic.
This commit addresses intermittent failures in Nexus tests 1_4_DNS_TC_1,
1_4_DNS_TC_5, 1_4_PIC_TC_1, 1_4_PIC_TC_3, and 1_4_PIC_TC_4.
The issue was caused by the 'ed1' node occasionally upgrading its role
from an End Device to a Router. When 'ed1' became a router, it would
sometimes use its Routing Locator (RLOC) as the source address for DNS
queries, whereas the verification scripts expected its Mesh Local
Endpoint Identifier (MLEID), leading to packet verification failures.
To resolve this, 'ed1' is now explicitly joined as a Full End Device
(FED) using 'Node::kAsFed' instead of the default Full Thread Device
(FTD) mode. This prevents 'ed1' from becoming a router and ensures it
maintains its End Device role throughout the test, providing stable
addressing for verification.
This commit migrates the dataset_updater functional test from the
Python-based thread-cert framework to the Nexus simulation framework.
Nexus provides faster and more scalable network simulations within a
single process using virtual time.
The new test_dataset_updater.cpp covers:
- Network formation and child joining (MED and SED).
- Channel updates initiated by Leader and Router using DatasetUpdater.
- Dataset update overrides between nodes.
The legacy tests/scripts/thread-cert/test_dataset_updater.py is removed
as it is now redundant.
This commit adds a new Nexus test to verify that a Sleepy End Device
(SED) correctly informs its previous parent after reattaching to a new
parent. This replicates the functionality of the now-deleted
test_inform_previous_parent_on_reattach.py script.
The test scenario involves:
- Forming a network with a Leader and a Router.
- Attaching a SED to the Leader.
- Simulating a link failure between the SED and Leader while allowing
communication between the SED and Router.
- Verifying that the SED reattaches to the Router.
- Confirming that the SED sends an empty IPv6 message (Next Header 59)
to the Leader's RLOC to inform it of the change.
- Ensuring the SED is successfully removed from the Leader's child
table.
Migrating this test to Nexus allows for faster execution using virtual
time and single-process simulation.
The following SRP test scripts in tests/scripts/thread-cert are
redundant as their functionality is now covered by the Nexus test
framework certification suite (test_1_3_SRP_TC_*):
- test_srp_register_single_service.py: Covered by Nexus
test_1_3_SRP_TC_1.
- test_srp_lease.py: Covered by Nexus test_1_3_SRP_TC_3 (service
lease) and test_1_3_SRP_TC_4 (key lease).
- test_srp_name_conflicts.py: Covered by Nexus test_1_3_SRP_TC_2.
- test_srp_auto_host_address.py: Covered by Nexus test_1_3_SRP_TC_13.
- test_srp_sub_type.py: Covered by Nexus test_1_3_SRP_TC_15.
Nexus tests are preferred as they run in a single process using
virtual time, making them faster and more reliable than the
multi-process simulation scripts.
This commit adds support for building the Nexus simulator for
WebAssembly (WASM) using the Emscripten toolchain. This enables the
simulator to run in a web browser environment with a JavaScript-based
control interface and visualization.
Key implementation details:
- Introduced `nexus_wasm.cpp` which defines Emscripten bindings (using
Embind) for core simulation controls, including stepping time,
node creation, topology orchestration, and state manipulation.
- Implemented a `WasmObserver` and a global event queue to capture
simulation events (node state changes, link updates, packet events)
and expose them to JavaScript via a polling mechanism (`pollEvent`).
- Updated the CMake build system to support the `EMSCRIPTEN` platform,
configuring specific linker options for ES6 module export,
modularization, and memory growth.
- Enhanced `build.sh` to allow targeting WASM via `emcmake`.
- Guarded file-system-dependent operations in `nexus_pcap.cpp` and
adjusted `nexus_core.cpp` to handle WASM-specific constraints where
standard I/O or multiple observers might not be applicable.
- Added `test_wasm_bindings.mjs`, a Node.js-based smoke test that
verifies the integrity of the WASM bindings and event pipeline.
- Integrated `nexus-wasm-tests` into the GitHub Actions workflow to
ensure continuous verification of the WASM build and functionality.
This commit introduces a mechanism to temporarily override the log
level. The `Instance` class now provides `OverrideLogLevel()` and
`RestoreLogLevel()` methods. When an override is active, the
effective log level is the maximum of the original user-set level and
the override level. If `SetLogLevel()` is called while an override is
active, it updates the original level and the effective level is
recomputed.
This ensures that log messages are generated only when needed,
without permanently losing the user's original log level
configuration.
The feature is controlled by the new configuration macro
`OPENTHREAD_CONFIG_LOG_LEVEL_OVERRIDE_ENABLE`.
A new Nexus unit test `test_log_override.cpp` is added to validate
the behavior of these new feature.
The following test scripts in tests/scripts/thread-cert are now
redundant as their functionality is sufficiently covered by the Nexus
test framework:
- test_detach.py: Covered by Nexus MLE synchronization and parent
selection tests.
- test_router_upgrade.py: Covered by 5.1.x Nexus router attachment
tests.
Nexus tests are preferred for these scenarios as they execute in a
single process using virtual time, providing faster and more reliable
verification than the traditional multi-process simulation scripts.
Added `Core::AllowLinkBetween()` and `Core::UnallowLinkBetween()`
helper methods to the Nexus test platform. These methods simplify
establishing bidirectional links between nodes in simulation tests by
handling the reciprocal `AllowList()` calls in a single step.
Updated various Nexus test cases to utilize these new helpers,
replacing manual bidirectional `AllowList()` calls. This change
reduces verbosity and ensures consistency in how links are established
in the test topology.
This commit introduces `AnswerBuilder` class to track and manage
Network Diagnostic answer messages. This class is used when the
response to a query requires multiple CoAP answer messages. It
automatically manages the inclusion of the Query ID and the Answer
TLVs(providing message indexing and "more-to-follow" flags) in each
allocated answer message, while maintaining all answer messages in a
queue. The `NetworkDiagnostic::Server` is updated to use the
`AnswerBuilder`, simplifying the logic for preparing and sending
answers.
The `AnswerBuilder` class is added in a new header file
`network_diagnostic_types.hpp` to allow for its reuse by other
modules in the future.
This commit introduces gRPC support to the Nexus simulator, enabling
remote control and monitoring of simulations. This infrastructure allows
external tools and visualizers to interact with the simulated network
in real-time.
Key changes:
- Defined `simulation.proto` providing the `NexusService` definition for
simulation control and event streaming.
- Implemented `GrpcServer` in `nexus_grpc.cpp` which functions as a
Nexus simulation observer, pushing events to connected clients.
- Added RPCs for dynamic node creation, position updates, node state
control, and network orchestration (forming and joining).
- Implemented a real-time event stream that includes node state changes,
link updates, and packet captures (with basic protocol decoding).
- Introduced `nexus_native.cpp` as an entry point for a persistent
simulation server that can be controlled via gRPC.
- Updated `Core` and `Observer` interfaces to support a list of
concurrent observers instead of a single instance.
- Enhanced the CMake build system to optionally find and link against
gRPC and Protobuf, including automatic source generation.
- Updated CI (GitHub Actions) to include build and test steps for the
new gRPC functionality.
- Added comprehensive unit tests in `test_grpc.cpp` to verify all
exposed gRPC service methods.
This commit updates `CslClockAccuracyTlv` to use the `SimpleTlvInfo`
and a separate `CslClockAccuracyTlvValue` class. This change
simplifies how the TLV is appended to and read from messages
by leveraging the `Tlv::Append<TlvType>` and `Tlv::Find<TlvType>`
helper methods (avoiding the use of `FindTlv()`).
This commit removes the redundant `multiple-instance` job from the
`simulation-1.1.yml` workflow. This job was used to run Thread 1.1
certification tests with `OT_MULTIPLE_INSTANCE=ON`.
The job is being removed to streamline the CI process and reduce
redundant test coverage, as multiple-instance configurations are
sufficiently covered in other workflow files. The dependency list
for the coverage collection job is also updated to reflect this
removal.
The previous logic for suppressing CHILD_REMOVED events was flawed. It
checked if the neighbor was not in the child table. However, since the
callback is triggered after the child is removed, it was always false,
leading to false suppression for all removed children.
This caused the parent node to never emit "link removed" events to the
UI when children detached, leading to inconsistent link states (dashed
lines) when only one direction was active.
This fix updates the logic to check if a neighbor entry exists in the
neighbor table with an established link (kStateValid). This ensures we
only suppress the event when the child has successfully transitioned to
a router role and established a valid link.
This commit updates `Mle::SendMulticastAdvertisement()` to verify
that the router role is allowed by calling `IsRouterRoleAllowed()`
before proceeding to send the multicast MLE advertisement.
This commit introduces the `SimulationObserver` interface and integrates
it into the Nexus core simulation logic. This allows external systems to
observe node state changes, link updates, and packet events in real-time.
Key changes:
- Defined `SimulationObserver` interface to handle node state changes,
link updates, packet events, and event clearing.
- Added `SetObserver` and `GetObserver` methods to the `Core` class.
- Implemented `Core::HandleNeighborTableChanged` to notify the observer
of neighbor additions and removals.
- Implemented `Core::HandleStateChanged` to track node role transitions
and parent changes, updating links accordingly.
- Integrated packet event notification in `Core::ProcessRadio`,
including basic destination node ID resolution for unicast frames.
- Added `Core::SetNodeEnabled` to allow enabling or disabling Thread and
MLE on specific nodes at runtime.
- Updated `Core::Reset` to clear events via the observer.
- Increased `OPENTHREAD_CONFIG_MAX_STATECHANGE_HANDLERS` to accommodate
the new nexus state change handler.
- Added `mLastParentId` to `Node` class to correctly manage link updates
during parent switches or detachment.
RFC 8200 states that the Hop-by-Hop Options header MUST be the first
extension header and can only occur once in a packet. This commit
updates HandleExtensionHeaders to enforce this rule.
This fix prevents a potential infinite loop or exponential growth of
messages when multiple Hop-by-Hop headers (each containing an MPL
option) are processed. Previously, each MPL option could trigger its
own retransmission, and if these options were evicted from the MPL
SeedSet, they would be re-processed as new messages upon loopback,
leading to exponential growth and eventually a timeout.
This commit adds a new RadioModel class to simulate wireless propagation
characteristics between Nexus nodes. It implements a simple path-loss
model based on node distance to calculate RSSI.
Key changes include:
- Added RadioModel with CalculateRssi and ShouldDropPacket methods.
- Integrated RSSI calculation into the Core radio processing logic.
- Implemented packet dropping for signals below -100 dBm sensitivity.
- Added nexus_radio_model.cpp to the build system.
This commit introduces a new member variable `mRouterRoleAllowed` in
the `Mle` class to cache the evaluation of whether the device is
currently permitted to operate as a router.
Previously, the `IsRouterEligible()` method evaluated several
conditions (e.g., `IsFullThreadDevice()`, `mRouterEligible` config,
and various fields in `SecurityPolicy`) every time it was called.
Since this method is invoked frequently across different `Mle`
operations, re-evaluating these conditions repeatedly was
inefficient.
The new `mRouterRoleAllowed` variable caches the final computed
result. It is updated via the `UpdateRouterRoleAllowed()` method
whenever any underlying input changes, such as:
- `Mle` starting.
- Configuration parameter updates (e.g., `SetRouterEligible()`).
- Security policy changes from the `KeyManager`.
This change centralizes the logic for handling role permission updates
into a single location (`UpdateRouterRoleAllowed()`). By
consolidating the actions taken when the allowed state changes, the
codebase is cleaner and easier to maintain and update.
It also provides a clearer conceptual distinction between the user's
router configuration (`mRouterEligible`) and the effective state
used by the device.
This commit moves the TREL configuration from the build script to the
nexus-config header file. This ensures that TREL is consistently enabled
for all nexus builds and simplifies the build script.
Specifically:
- Added OPENTHREAD_CONFIG_RADIO_LINK_TREL_ENABLE to
tests/nexus/openthread-core-nexus-config.h.
- Removed OT_TREL from tests/nexus/build.sh and simplified the build
options.
This commit moves the `OPENTHREAD_CONFIG_MULTIPLE_INSTANCE_ENABLE`
configuration from the build scripts to the nexus-specific core
configuration header file.
Specifically:
- Added `#define OPENTHREAD_CONFIG_MULTIPLE_INSTANCE_ENABLE 1` to
`tests/nexus/openthread-core-nexus-config.h`.
- Removed `-DOT_MULTIPLE_INSTANCE=ON` from `tests/nexus/build.sh`.
- Removed `-DOT_MULTIPLE_INSTANCE=ON` from `tests/fuzz/oss-fuzz-build`.
This change centralizes nexus-specific configurations in the header
file, making the build scripts cleaner and ensuring consistent
configuration across different build environments that use the
nexus core config."
Due to a state retention issue in the unit test platform, TCAT tests were passing in ways they should not.
Now with the new settings/flash clearing per #12875 applied, these tests were failing.
This fixes TCAT unit tests to pass again and better express the expected behavior also.
Issue: state was retained between OT instances in the unit test platform, across tests.
This commit adds settings and flash clearing as part of testInitInstance().
This commit simplifies the Simulation 1.4 workflow by removing the
compiler and architecture matrix. Run-time issues due to compiler
differences or architecture have not been an issue, so testing a single
configuration is sufficient to reduce CI resource usage.
The workflow now uses the default environment instead of explicitly
testing both gcc/clang and m32/m64 architectures.
This commit adds a compile-time check in `time_sync_service.hpp` to
ensure that `OPENTHREAD_CONFIG_RADIO_LINK_TREL_ENABLE` is not
enabled alongside `OPENTHREAD_CONFIG_TIME_SYNC_ENABLE`. The time
synchronization feature is experimental and currently only supports
IEEE 802.15.4 radio links. Attempting to use it over TREL is
unsupported and will now result in a build failure.
This commit introduces the `Context` and `ContextWith<kContextSize>`
helper classes in the `Crypto` namespace to wrap `otCryptoContext`
and manage its storage allocation. `ContextWith<kContextSize>`
handles the buffer allocation based on the configuration
`OPENTHREAD_CONFIG_CRYPTO_PLATFORM_ALLOCS_CONTEXT`, automatically
clearing and setting the buffer.
The `AesEcb`, `HkdfSha256`, `HmacSha256`, and `Sha256` classes are
updated to use the new `ContextWith` template for their `mContext`
members. This simplifies their initialization sequences and
constructors.
This commit introduces the ability to configure whether the CLI
interpreter outputs the prompt string (`> `) at runtime.
- Adds `mPromptEnabled` boolean flag (enabled by default) under the
`OPENTHREAD_CONFIG_CLI_PROMPT_ENABLE` configuration.
- Adds the `Interpreter::SetPromptConfig()` method to toggle this
behavior.
- Updates `Interpreter::OutputPrompt()` to check `mPromptEnabled`
before emitting the prompt string.
This commit removes the following legacy 1.2 certification test scripts:
- tests/scripts/thread-cert/v1_2_router_5_1_1.py
- tests/scripts/thread-cert/v1_2_test_parent_selection.py
It also removes the 'packet-verification-1-1-on-1-4' job from the
Simulation 1.4 workflow as it is no longer required.
Now signed by the correct 'Thread Certification DeviceCA'. A 'test'
target is added in the Makefile to test chaining. The Thread
certification CA certificate is also added in the 'CA' directory,
which was missing. Documentation is updated to clarify that the
'TcatCertCa' private key is not included in this repo; and other
clarifications.
This commit introduces `testResetInstance()` in the unit test platform
layer to finalize an existing `ot::Instance` and re-initialize it
using the same underlying memory buffer, simulating a device reset.
This commit also updates `test_routing_manager.cpp` to use this new
function to streamline the test implementation.
This commit introduces static helper methods `SteeringDataTlv::FindIn()`
and `SteeringDataTlv::AppendTo()` to simplify the handling of steering
data in `Message` objects.
`SteeringDataTlv::FindIn()` encapsulates the pattern of searching for a
`SteeringDataTlv` in a `Message` and reading its value into a
`SteeringData` object. `SteeringDataTlv::AppendTo()` provides a unified
way to append steering data to a `Message`, including a validity check.
These helpers are adopted across core modules (MeshCoP, MLE, Discovery)
and various Nexus tests, replacing manual TLV manipulation with a
cleaner and safer helper methods.
This commit fixes the CLI implementation of `sntp` and `diagnostic`
commands by ensuring they use the public `otMessageInfo` type instead
of the internal `ot::Ip6::MessageInfo` class.
This commit implements the Nexus test specification 1_4_PIC_TC_4
to verify the Border Router (BR) built-in NAT64 translator.
The test verifies that the BR DUT:
- Automatically configures an IPv4 address and NAT64 prefix.
- Offers IPv4 internet connectivity to Thread devices using NAT64.
- Offers IPv4 local network connectivity to Thread devices.
- Operates a DNS recursive resolver to look up IPv4 server addresses.
New files added:
- tests/nexus/test_1_4_PIC_TC_4.cpp: C++ test execution script
- tests/nexus/verify_1_4_PIC_TC_4.py: Python pcap verification script
Integration:
- Updated tests/nexus/CMakeLists.txt to compile the test.
- Added test to default array in tests/nexus/run_nexus_tests.sh.
This commit updates the default value of the
`OPENTHREAD_CONFIG_PLATFORM_KEY_REFERENCES_ENABLE` configuration
to be enabled automatically when `OPENTHREAD_CONFIG_CRYPTO_LIB` is
set to `OPENTHREAD_CONFIG_CRYPTO_LIB_PSA`. Additionally, it adds a
compile-time check in `crypto_platform_psa.cpp` to enforce this
requirement. This ensures that the platform key references support is
always enabled when the PSA crypto library is selected.
This commit introduces `ActiveInstanceTracker` as the first member
variable of the `Instance` class to manage the global `gActiveInstance`
pointer (when `OPENTHREAD_CONFIG_LOG_INSTANCE_AWARE_API_ENABLE` is
enabled).
By placing it as the very first member, we ensure its constructor
is called before any other member and its destructor is called after
all others. The `Instance` destructor body also explicitly sets
`gActiveInstance = this` at its start to "claim" the context during its
own destruction. This guarantees that logs emitted during both the
initialization and destruction of an `Instance` are always correctly
associated with that instance. Finally, the `ActiveInstanceTracker`
destructor sets `gActiveInstance` to `nullptr` at the very end to
prevent any potential use of a dangling pointer.
This commit introduces an overloaded version of `AppendModeTlv()`
that automatically uses the device's own `GetDeviceMode()`.
The new parameter-less version simplifies the common case where a
node reports its own mode. The parameterized version is
preserved for cases where a specific mode must be provided (e.g.,
parent reporting one of its children's mode).
This commit introduces `TxMessage::AppendSourceAddressAndLeaderDataTlvs()`
to consolidate the appending of `Source Address` and `Leader Data` TLVs.
This combination is frequently used together across various MLE messages
to provide the sender's identity and leader data. Centralizing this
into a single helper method improves code consistency.
Additionally, the `TxMessage` methods in `mle.hpp` and `mle.cpp` are
organized into "Appending single TLV" and "Appending multiple TLVs"
sections for better clarity and maintainability. Existing multi-TLV
methods like `AppendLinkAndMleFrameCounterTlvs()` and
`AppendActiveAndPendingTimestampTlvs()` are moved to the new section.
This commit updates the Nexus platform to use the internal core C++
API `Ip6::SetReceiveCallback()` instead of the public C API
`otIp6SetReceiveCallback()`.
This commit introduces `Mle::ShouldRegisterUnicastAddrWithParent()` to
centralize the logic for determining which unicast addresses should be
registered with the parent.
Previously, the filtering logic for unicast addresses was duplicated
in `HasUnregisteredAddress()` and `AppendAddressRegistrationTlv()`. By
unifying this in a single helper method, the code ensures consistent
behavior between checking for unregistered addresses and actually
appending them to the MLE messages.
Additionally, this change:
- Marks `Mle::HasUnregisteredAddress()` as `const`.
- Updates `Mle::ShouldRegisterMulticastAddrsWithParent()` to improve
readability and follow common coding patterns in the codebase.
This commit improves the address registration behavior in
`Mle::SendChildUpdateResponse()` for non-FTD devices.
Previously, the device would always append only the mesh-local address
and then unconditionally attempt to send a follow-up Child Update
Request. The updated logic now checks if the parent's request
included a Challenge TLV. If not, all addresses are appended directly
to the response, eliminating the extra message exchange. If a
Challenge is present (indicating the parent is restoring its link),
only the mesh-local address is included to prevent message
fragmentation. In this case, if the device is attached and has
unregistered addresses, a follow-up Child Update Request is scheduled
via `mDelayedSender`.
The previous implementation indirectly assumed the parent would only
request the `Address Registration` TLV when restoring its link (the
current behavior of OpenThread parents). However, such behavior on the
parent is not strictly required and could change. This update on the
child side ensures robust address registration regardless of the
parent's specific behavior.
When the Nexus test finishes, it automatically destructs all its allocated
Nodes sequentially. During this destruction phase, the OpenThread instance
attempts to destruct objects like `Nat64::Translator`, which might in turn
call logging mechanisms like `Mapping::Free()` that rely on the static
`Instance::GetActiveInstance()` pointer.
Because `Core::~Core()` did not maintain or update `gActiveInstance` while
iterating through node destructors, this pointer was left dangling, causing
segmentation faults when dereferenced by `ot::Instance::GetLogLevel()`.
This commit fixes `Core::~Core()` to manually loop through and destruct the
`mNodes` list, calling `UpdateActiveInstance(&node->GetInstance())` right
before destroying each node. This ensures that `gActiveInstance` points to
the correct context while node destruction logic runs.
This commit adds a Nexus test case 1_4_PIC_TC_3 to verify the IPv6
default route advertisement behavior of a Border Router (BR) in a
Thread 1.4 network.
The test verifies that:
- The BR correctly advertises a default route (::/0) in Thread Network
Data when it discovers a default route on the infrastructure link.
- The BR maintains the default route advertisement even if the
infrastructure default route is withdrawn, provided a non-ULA prefix
remains active on the infrastructure link.
- The default route advertisement is correctly restored or updated when
the infrastructure default route is re-enabled.
The test implementation includes:
- test_1_4_PIC_TC_3.cpp: C++ test logic using the Nexus simulation
framework, simulating BR, Router, End Device, and Infrastructure
nodes (Eth_1, Eth_2). It uses a custom ICMPv6 receive callback to
simulate "no route to host" conditions.
- verify_1_4_PIC_TC_3.py: Python verification script that analyzes
the captured packets to ensure MLE Data Responses and ICMPv6 traffic
match the expected behavior for each test step.
Integration:
- Updated tests/nexus/CMakeLists.txt and tests/nexus/run_nexus_tests.sh
to include the new test in the automated test suite.
This commit adds a new Nexus test that implements the test
specification in test-1-4-PIC-TC-1.md. The test verifies Border
Router functionality including:
- DHCPv6-PD client to obtain OMR prefix
- Advertising route to OMR prefix on AIL (Stub Router)
- DNS recursive resolver for public internet addresses
- Connectivity (ICMPv6, UDP, TCP/HTTP) to internet and local servers
New files:
- tests/nexus/test_1_4_PIC_TC_1.cpp: C++ test execution
- tests/nexus/verify_1_4_PIC_TC_1.py: Python pcap verification
Nexus platform enhancements:
- Enabled DHCPv6-PD client in openthread-core-nexus-config.h
- Implemented DHCPv6-PD platform APIs in nexus_infra_if.cpp
- Added RDNSS option to RA in nexus_infra_if.cpp
- Improved packet delivery on infrastructure interface in nexus_core.cpp
- Fixed upstream DNS query matching in nexus_dns.cpp
Previously, version checks used `<= 0x03060500` to guard mbedtls v3.x
APIs, incorrectly treating any version above 3.6.5 (e.g. 3.6.6+) as
v4.0. Replace these checks with `< 0x04000000` to properly cover all
v3.x releases.
This commit adds support for the Vendor OUI (`vo`) key in the Border
Agent MeshCoP service TXT data parser.
The `otBorderAgentTxtDataInfo` structure and its internal counterpart
`TxtData::Info` are updated to include a boolean flag `mHasVendorOui`
and a 3-byte array `mVendorOui` to store the 24-bit vendor OUI.
The parsing logic in `TxtData::Info::ProcessTxtEntry()` is updated to
recognize the `vo` key and extract its value. Additionally, the CLI
`Interpreter` is updated to output the vendor OUI in hexadecimal
format when it is present in the parsed information.
This commit updates the Nexus platform `InfraIf` class to inherit from
`InstanceLocator`, aligning it with the standard OpenThread architectural
patterns.
The `mNode` and `mNodeId` member variables are removed as they are now
redundant. Access to the associated `Instance` and other platform-level
components is now managed through `GetInstance()` and the newly added
`Instance::Get<T>` template specializations for `Node`, `InfraIf`,
`Udp`, `Trel`, and `Mdns`.
The `InfraIf::Init()` method is renamed to `AfterInit()` to better
reflect its role in the node initialization lifecycle. All call sites in
`nexus_infra_if.cpp` are updated to use the locator-based accessors.
This commit implements the Nexus test specification 1_4_DNS_TC_5 for
DNS record types and special cases in OpenThread 1.4.
The test verifies that the Border Router:
- Can resolve A and AAAA records from upstream DNS servers.
- Does not perform IPv6 AAAA synthesis from A records when not
specifically requested or configured.
- Can resolve mDNS records on the Adjacent Infrastructure Link (AIL).
- Supports non-typical record types (RRTypes) and "Private Use"
ranges (0xFF00-0xFFFE).
- Correctly blocks and responds with NXDomain for "ipv4only.arpa"
queries, ensuring they are not forwarded upstream.
Test Implementation:
- Created test_1_4_DNS_TC_5.cpp to simulate the network topology and
DNS query/response sequences.
- Created verify_1_4_DNS_TC_5.py to perform packet-level verification
of the DNS interactions and BR behavior.
- Integrated the new test into the Nexus build and test execution
scripts.
This commit implements the Nexus test specification 1_4_DNS_TC_3 for
upstream DNS resolver selection in OpenThread.
Nexus Platform Enhancements:
- Added OPENTHREAD_CONFIG_DNS_UPSTREAM_QUERY_ENABLE and
OPENTHREAD_CONFIG_PLATFORM_DNS_ENABLE to nexus config.
- Implemented platform DNS APIs in nexus_dns.cpp, supporting
upstream server selection based on prefix lifetimes and reachability.
- Added UdpHook to Core to allow tests to intercept and simulate
responses for backbone UDP traffic on port 53.
- Updated InfraIf::Receive to call Core::HandleUdp for generic UDP
interception.
- Added raw buffer delivery overloads for InfraIf::SendUdp.
Test Implementation:
- Created test_1_4_DNS_TC_3.cpp which performs network formation,
RA signaling (PIO/RIO/RDNSS), and DNS resolution triggers.
- Created verify_1_4_DNS_TC_3.py to validate network behavior,
RA contents, and correct upstream query routing using pktverify.
- Integrated the new test into CMakeLists.txt and the default
run_nexus_tests.sh suite.
This commit updates `Mle::HandleTimeTick()` to separate the processing
of role transitions and the checking of the leader's age into two
distinct `switch` statements.
Previously, these two checks were combined in a single `switch`
statement with complex fall-through logic. This structure contained
two issues:
1. For a device in the `kRoleChild` state, if the role transition
timeout expired, the code would execute `ExitNow()`. This
unintentionally skipped the leader age check and the rest of the
operations in `Mle::HandleTimeTick()`, such as updating the
`ChildTable` and `RouterTable`.
2. A non-router-eligible child would incorrectly fall through and
perform the leader age check. The new logic adds an explicit check
using `IsRouterEligible()` to ensure only router-eligible children
monitor the leader's age.
By separating the logic into two blocks, the code is simplified and
we avoid the brittle fall-through behavior and ensure that all time
tick operations are consistently executed regardless of the device's
role or role transition state.
This commit removes redundant calls to `mInfraIf.Init()` and
`mInfraIf.AddAddress()` from various Nexus test cases.
The infrastructure interface (`mInfraIf`) is automatically initialized
and assigned a link-local address by the core framework when a new
`Node` is added. The `InfraIf::Init()` method derives the link-local
address from the MAC address and adds it to the interface. Therefore,
these explicit manual calls in individual test scripts are unnecessary
and can be removed to simplify the test setup.
Removed redundant channel, panid, and extpanid commands. Their
information is now more comprehensively provided by the dataset active
-ns output.
Removed partitionid from the debug command list as it was redundant
with leaderdata.
Nexus test 1_4_TREL_TC_4 occasionally fails during topology formation
because the router promotion timeout (kAttachToRouterTime) was set to
120 seconds.
The MLE router selection jitter (OPENTHREAD_CONFIG_MLE_ROUTER_SELECTION
_JITTER) defaults to 120 seconds. Since the jitter timer starts after
successful attachment as a child, 120 seconds is insufficient when the
maximum jitter is selected, leading to a race condition.
This commit increases kAttachToRouterTime to 200 seconds, matching the
value used in most other Nexus tests and providing sufficient time for
router promotion to complete reliably.
This commit removes the `mSrpHostAddresses` array from the `Node`
class in the Nexus platform. The array was specific to SRP client
testing and was occupying unnecessary memory for every simulated
node instance.
Instead of keeping this state inside the `Node` abstraction, a local
`hostAddrs` array is now declared within the `Test_1_3_SRP_TC_1()` test
function. This local array safely persists for the duration of the
test, allowing `Srp::Client::SetHostAddresses()` to use the
provided pointer without relying on a global or node-level member.
This commit improves robustness and forward compatibility of Secure
Transport with newer MbedTLS/PSA configurations. There are places
where mbedtls structures are accessed directly , which can be fragile
when internal struct layouts change across Mbed TLS configurations or
versions.
To address this, this commit makes the following changes:
1. Replace direct TLS struct member access in secure transport with
mbedtls_ssl_get_peer_cert(), and tighten state/null checks to improve
robustness and forward compatibility with newer MbedTLS/PSA
configurations.
This commit updates the address-based node lookup methods in `Core`
to use the `FindMatching()` and `ContainsMatching()` methods provided
by the `LinkedList` class. This replaces manual `for` loops with
cleaner, built-in list operations.
To facilitate this, a new `AddressNetif` enum and a `Matches()` method
are added to the `Node` class. The `Matches()` method accepts an
`Ip6::Address` and an `AddressNetif` indicator, allowing it to check
if the node has the specified address on its Thread interface, its
Infrastructure interface, or any.
Additionally, a `const` overload for the `Get()` template method is
added to the `Node` class to ensure proper const-correctness.
This commit updates the IPv6 receive path in the Nexus platform to
utilize `OwnedPtr<Message>` for message lifecycle management. It
also removes the need for a large local buffer and redundant
message allocations.
Previously, `Node::HandleReceive()` copied the entire `otMessage`
payload into a local array, and `InfraIf::SendIp6()` allocated a new
`Message` to enqueue for transmission.
With this change:
- `Node::HandleIp6Receive()` wraps the received `otMessage` in an
`OwnedPtr<Message>`, ensuring proper cleanup upon exit without
explicitly calling `otMessageFree()`.
- The `Ip6::Header::ParseFrom` is used which reads and validates
the IPv6 header and the message.
- The hop limit is updated in-place within the `Message` using
`Write()` to overwrite previous header.
- `InfraIf::SendIp6()` accepts the `OwnedPtr<Message>` directly,
taking ownership and enqueuing it without requiring reallocation
or memory copying.
- Condition checks in `Node::HandleIp6Receive()` are reordered
to match the comment.
This commit simplifies the `SecureTransport` API by consolidating the
previous `Open()` and `Bind()` methods into two specialized `Open()`
flavors.
The first flavor, `Open(uint16_t aPort, ...)`, creates and binds a UDP
socket to a specific port and network interface. If the port is zero,
an ephemeral port is automatically selected.
The second flavor, `Open(TransportCallback aCallback, ...)`, enables
callback-based transmission, where outgoing messages are sent via the
provided callback and received messages are passed in through
`HandleReceive()`.
This consolidation ensures that the transport is fully initialized and
ready for traffic in a single method call. It also prevents the
creation of unused UDP sockets when a `TransportCallback` is
employed, avoiding unnecessary overhead in the `Udp` class.
All core components (`BorderAgent`, `Commissioner`, `Joiner`, and
`BleSecure`) and related tests are updated to utilize the new
patterns.
This commit adds support for handling mDNS service name conflicts by
automatically renaming the service when a collision is detected during
registration.
The new naming scheme appends a suffix based on the last two bytes of
the device's Extended Address (e.g., " #AB1E"). If this name also
conflicts, an additional index is appended (e.g., " #AB1E (1)").
Changes:
- Added `mServiceRenameIndex` to `Manager` and `EphemeralKeyManager`
to track re-naming attempts.
- Updated `otBorderAgentSetMeshCoPServiceBaseName()` and CLI documentation
to reflect the new naming and conflict resolution logic.
- Updated `OT_BORDER_AGENT_MESHCOP_SERVICE_BASE_NAME_MAX_LENGTH` to
ensure the full name fits within the 63-character DNS label limit.
- Added Nexus tests to verify the renaming logic under conflict.
This commit updates the logging in `Mle::DelayedSender` to provide
clearer information about delayed message transmissions.
The `MessageAction` enum values `kMessageDelay` and
`kMessageRemoveDelayed` are renamed to `kMessageScheduleDelayedSend`
and `kMessageRemoveDelayedSend` to better reflect their purpose. The
corresponding string mappings are also updated to "Schedule tx of"
and "Remove scheduled tx of".
Additionally, a new log entry is added to `AddSchedule()` to explicitly
record the delay duration in milliseconds, making it easier to track
when the scheduled message is expected to be sent.
This commit updates `Node::Reset()` in the Nexus platform to correctly
set the IPv6 receive callback after the OpenThread `Instance` has been
re-initialized via placement `new`.
Previously, `otIp6SetReceiveCallback()` was called before the new
`Instance` was constructed, meaning the callback registration would
be lost when the instance memory was overwritten. Additionally, the
callback registration now passes the associated `Node` object as the
context.
This change updates `Ip6::Udp::GetUdpSockets()` to return a reference
to the `LinkedList<SocketHandle>` instead of a pointer to the head of
the list. This allows for cleaner iteration using range-based for
loops and provides a more idiomatic C++ interface.
Call sites are updated accordingly. Specifically, the Nexus UDP
platform code now uses a range-based for loop to iterate through the
sockets.
In nexus tests, DNS browser and resolver objects must be initialized
using ClearAllBytes before use to ensure predictable behavior.
This commit adds missing ClearAllBytes calls for:
- Dns::Multicast::Core::Browser
- Dns::Multicast::Core::TxtResolver
- Dns::Multicast::Core::SrvResolver
- Dns::Multicast::Core::AddressResolver
In test_1_3_SRP_TC_4.cpp, ClearAllBytes is now called before browser
reuse in Step 19.
Redundant includes of common/clearable.hpp were removed as it is
available transitively.
A blank line was added after Browser declarations for consistency.
This commit enhances the `UptimeToString()` function by introducing
`UptimeStringFlags` to allow customization of the output string.
Specifically, it adds the following flags:
- `kUptimeStringIncludeMsec`: Includes milliseconds in the string.
- `kUptimeStringSkipHoursIfZero`: Omits the `<hh>:` part when hours
and days are zero.
The commit also adds a new `UptimeToString()` overload that returns
an `UptimeString` (a `String` object), simplifying usage in logging
and other areas. All existing call sites are updated to use the new
flags and the new overload where appropriate.
This commit fixes a nullptr-with-nonzero-offset runtime error in
Mac::ProcessEnhAckProbing. The error occurred because pointer
arithmetic was performed on the enhAckProbingIe pointer before
verifying if it was null.
The fix moves the pointer calculation after the null check to
ensure that it is only performed when a valid IE is present.
This was discovered by ASAN/UBSAN when processing frames without
the Enhancement ACK Probing IE.
This commit implements the Thread 1.4 Credential Sharing (CS) TC-3
Nexus test, focusing on Thread Administration Sharing using ePSKc.
The test case covers mDNS discovery, ePSKc generation/validation,
and DTLS secure transport for TMF message exchange.
Detailed changes:
- Implement full 26-step Nexus test in tests/nexus/test_1_4_CS_TC_3.cpp
covering the following procedures:
- mDNS discovery of meshcop and meshcop-e service instances.
- Validation of State Bitmap (sb) and other TXT record fields.
- Generation and Verhoeff-based validation of One-Time Passcodes.
- DTLS handshakes using correct and incorrect ePSKc values.
- MGMT_ACTIVE_GET and MGMT_PENDING_GET request/response exchanges
over the secure DTLS session.
- Testing of ephemeral key expiration and max connection attempts.
- Add Python-based packet verification script in
tests/nexus/verify_1_4_CS_TC_3.py using pktverify to ensure
protocol compliance.
- Register the 1_4_CS_TC_3 test in tests/nexus/CMakeLists.txt.
- Add 1_4_CS_TC_3 to the default test list in run_nexus_tests.sh.
This commit implements the otPlatUdp API for the Nexus simulation
environment and updates core UDP logic to facilitate it.
Changes in src/core:
- Initialize mHandle in Udp::Open with the current Instance pointer
when Nexus platform UDP is enabled. This allows the platform UDP
implementation to retrieve the instance context directly from the
otUdpSocket handle.
Changes in Nexus platform:
- Implement otPlatUdp API in nexus_udp.cpp/hpp. The implementation
routes UDP traffic through the simulated infrastructure interface
(InfraIf).
- Integrate Udp class into Nexus::Node and Nexus::Platform.
- Update InfraIf::Receive to dispatch incoming UDP packets to the
new platform UDP implementation.
- Enable OPENTHREAD_CONFIG_PLATFORM_UDP_ENABLE and related configs
in Nexus.
Changes in Nexus tests:
- Update test_border_admitter, test_border_agent, test_dtls, and
test_1_4_DNS_TC_1 to align with the new platform UDP and address/
netif usage.
- Add nexus_udp.cpp to CMakeLists.txt.
This commit updates `Manager::CoapDtlsSession::SendEnrollerResponse()`
to always include the Admitter info TLVs in responses sent to
enrollers. Previously, these TLVs were only included in responses to
registration and keep-alive requests.
This change ensures that enrollers receive consistent state updates
from the `Admitter` during all interactions, such as joiner
acceptance or release.
The test case `TestBorderAdmitterJoinerEnrollerInteraction` is
updated to validate the new behavior.
This commit enhances the `Admitter` logic for forwarding `RelayRx`
messages to connected enrollers.
If an enroller has explicitly accepted a specific joiner IID, the
`Admitter` will now always forward that joiner's relay traffic to the
owning enroller, regardless of its current `kForwardJoinerRelayRx`
flag in its registered enroller mode. The flag now strictly controls
whether the enroller receives general "multicast" forwarding for
joiners that have not yet been accepted by any enroller.
This enhancement adds a new capability to the interactions between the
`Admitter` and enrollers. Previously, if an enroller accepted a joiner
but also cleared its `kForwardJoinerRelayRx` flag, it could be
considered a misbehavior by the enroller, as it would effectively
block that joiner's traffic from reaching any other enrollers without
receiving the traffic itself. This scenario is no longer possible, and
this configuration now supports a new behavior: allowing an enroller
to accept certain joiners and receive relay traffic only from those it
has explicitly accepted.
The `test_border_admitter` is updated to validate this behavior in
detail.
This commit updates `RouterNeighborTlv` to follow the `SimpleTlvInfo`
pattern, separating the TLV value structure from its type/length
header.
Specifically, it defines `RouterNeighborTlvValue` to hold the data
fields for a router neighbor's diagnostic information, while
`RouterNeighborTlv` is redefined as a `SimpleTlvInfo` using the value
structure and the `kRouterNeighbor` type.
This allows the use of generic `Tlv::Append<RouterNeighborTlv>()` and
`tlvInfo.Read<RouterNeighborTlv>()` methods, which are generally
safer and allow value type reuse.
The `NetworkDiagnostic` and `MeshDiag` module are updated to
utilize these new methods.
This commit introduces the `LinkLayerAddress` class as a nested type
within `InfraIf`. The new class inherits from the
`otPlatInfraIfLinkLayerAddress` and provides utility methods to
simplify address manipulation and logging.
Specifically, the following capabilities are added:
- `ConvertToIid()` converts the link-layer address into an IPv6
`InterfaceIdentifier`.
- `ToString()` formats the address into a human-readable string.
- Getters like `GetLength()` and `GetBytes()` for accessing the
underlying address data.
The `nexus` platform tests are updated to leverage the newly added
`LinkLayerAddress` methods, simplifying the handling of MAC addresses
and the derivation of IPv6 interface identifiers.
This commit moves the `@addtogroup plat-infra-if` Doxygen block to the
top of the `infra_if.h` header file. Previously, it was defined
after `otPlatInfraIfLinkLayerAddress`, causing that structure and
the `OT_PLAT_INFRA_IF_MAX_LINK_LAYER_ADDR_LENGTH` macro to be excluded
from the `plat-infra-if` module in the generated documentation.
This commit updates `ChildTlv` to follow the `SimpleTlvInfo` pattern,
separating the TLV value structure from its type/length header.
Specifically, it defines `ChildTlvValue` to hold the data fields for
a child's diagnostic information, while `ChildTlv` is redefined as
a `SimpleTlvInfo` using the value structure and the `kChild` type.
This allows the use of generic `Tlv::Append<ChildTlv>()` and
`tlvInfo.Read<ChildTlv>()` methods, which are generally safer and
allow value type reuse.
The `NetworkDiagnostics` and `MeshDiag` are updated to utilize
these new definitions.
Heap::Data::UpdateBuffer() freed the existing buffer before
attempting to allocate a new one. If the allocation failed,
mData retained a dangling pointer to the already-freed buffer.
A subsequent Free() call (from the destructor or an error path)
would then free the same pointer again, causing a double-free.
This changes UpdateBuffer() to use the allocate-first pattern
(consistent with Heap::String::Set): the new buffer is allocated
first, and the old buffer is freed only after a successful
allocation. On allocation failure, the old buffer is preserved
and no dangling pointer is created.
Signed-off-by: Oblivionsage <cookieandcream560@gmail.com>
This commit updates `test-008-multicast-traffic.py` to use a strict
equality check for the number of multicast `ping` responses when the
ping originates from an SED.
The test now also verifies the `RxSuccess` IP counter on the SED to
ensure it increases by exactly the number of expected replies. This
confirms that the parent correctly avoids forwarding the original
multicast echo request back to the originating SED, even if the SED
is subscribed to the multicast address. This validates the behavior
introduced in PR #12329.
This commit adds Nexus test case 1_3_GEN_TC_2, which verifies mDNS TXT
record regeneration across factory resets in the Nexus simulation
environment.
The test ensures that key fields such as 'id' (Border Agent ID) and
'omr' (OMR prefix) are correctly updated in mDNS advertisements after
a settings wipe and network reset.
Key features of this implementation include:
- tests/nexus/test_1_3_GEN_TC_2.cpp: Sets up a Border Router, forms a
network, and validates initial mDNS state. It then performs an
otPlatSettingsWipe followed by a reset to trigger new configuration.
- tests/nexus/verify_1_3_GEN_TC_2.py: Implements robust packet
verification using hex-based marker matching for OMR prefixes to
accurately identify iteration-specific TXT records despite any
interleaved or stale mDNS packets in the capture.
- Integrated the new test into tests/nexus/CMakeLists.txt and
tests/nexus/run_nexus_tests.sh for automated build and execution.
This test validates that the Thread stack correctly manages persistent
state and re-generates unique identifiers upon a factory reset.
OpenThread's NAT64 translator assumed a fixed IPv4 header length of 20
bytes, which caused incorrect parsing and translation of IPv4 packets
containing options (IHL > 5).
Specifically, if an IPv4 packet with options was received:
1. The transport header was read from a fixed 20-byte offset, leading
to corruption of transport layer fields (e.g., UDP ports).
2. Only 20 bytes were removed from the message, leaving the IPv4
options at the beginning of the translated IPv6 payload.
3. Mandatory security checks for source route options were bypassed.
This commit fixes these issues by:
- Updating Ip4::Header to validate IHL and provide the actual header
length.
- Using the actual header length for transport header parsing and
IPv4 header removal in the NAT64 translator.
- Implementing a check to discard packets with LSRR or SSRR options
as required by RFC 7915.
A new Nexus regression test is added to verify the fix.
This commit adds Nexus test case 1_4_DNS_TC_1, which verifies that the
Thread Border Router DUT can successfully handle DNS queries with
multiple questions (QDCOUNT > 1), per the Thread 1.4 specification.
The implementation includes:
- tests/nexus/test_1_4_dns_tc_1.cpp: C++ test logic that sets up a
topology with Eth_1, BR_1 (DUT), Router_1, and ED_1. It registers
services via mDNS on Eth_1 and SRP on Router_1, and then performs
various DNS queries from ED_1, including multi-question queries.
- tests/nexus/verify_1_4_dns_tc_1.py: Python script that verifies
the DNS packet exchange in the pcap, ensuring that multi-question
queries are correctly received by the DUT and that valid responses
are returned.
- Integration into tests/nexus/CMakeLists.txt and
tests/nexus/run_nexus_tests.sh for automated building and execution.
This commit adds Nexus test case 1_4_TREL_TC_6, which verifies mDNS
discovery of the TREL service on a Border Router (DUT), per the Thread
1.4 specification.
The implementation includes:
- tests/nexus/test_1_4_TREL_TC_6.cpp: C++ test logic that sets up a
Border Router and a reference Ethernet device. It performs mDNS
browsing to capture the TREL service instance name and then
resolves that service.
- tests/nexus/verify_1_4_TREL_TC_6.py: Python script that verifies
the mDNS packet exchange in the pcap, including PTR, SRV, TXT, and
AAAA records, ensuring all DNS-SD parameters and fields are
correctly advertised.
- Integration into tests/nexus/CMakeLists.txt and
tests/nexus/run_nexus_tests.sh for automated building and execution.
This commit adds Nexus test case 1_4_TREL_TC_5, which verifies
MLE discovery scan behavior when nodes support different radio
links, per the Thread 1.4 specification.
The implementation includes:
- tests/nexus/test_1_4_TREL_TC_5.cpp: Sets up a topology with
three nodes: Node_1 (DUT) and Node_2 support both 15.4 and
TREL, while Node_3 supports 15.4 only. Each node forms its
own network. The test performs Discovery Scans from Node_2
and Node_3 and verifies that all expected peers are seen.
- tests/nexus/verify_1_4_TREL_TC_5.py: Verifies the exchange
of MLE Discovery Request and Response packets in the pcap
output, ensuring that nodes with different radio capabilities
can discover each other correctly.
- Updated tests/nexus/CMakeLists.txt and
tests/nexus/run_nexus_tests.sh to include the new test in the
build and default test list.
This commit simplifies node naming in various Nexus test cases by
using the indexed `SetName(prefix, index)` flavor.
This replaces manual string formatting using `snprintf` or
`ot::String` buffers with the built-in indexed naming support.
This commit adds a new `AddTestVar` overload that accepts a
`uint32_t` value, simplifying the addition of numeric test
variables in Nexus tests.
Previously, adding a numeric test variable required manual string
formatting using a local `String` object. The new flavor handles
the uint to string conversion internally.
The change also introduces a `NewTestVar` private helper method in
the `Core` class to consolidate the logic for creating and
initializing a new `TestVar` entry.
Various Nexus test cases are updated to use the new `AddTestVar`
flavor, removing redundant string formatting code.
This commit updates `test_1_2_BBR_TC_3.cpp` to use the `Get<>()` method
when accessing the network name and extended PAN ID from the
`MeshCoP::Dataset::Info` instance.
This commit implements Thread 1.4 Test Case 8.4 (TREL-8.4), "Radio Link
(Re)discovery through Receive", using the Nexus simulation framework.
The test validates the multi-radio behavior of a Border Router (DUT)
and a Router neighbor, specifically focusing on TREL link state
transitions and rediscovery mechanisms.
Key test scenarios include:
- Initial topology formation with a multi-radio BR (DUT), a multi-radio
Router, and a 15.4-only End Device (ED).
- Preference detection for TREL vs. 802.15.4 radio links.
- Detection of TREL link failure and fallback to 802.15.4.
- TREL radio link rediscovery triggered by receiving messages from a
neighbor over the TREL interface.
- Continued reachability via TREL when the 802.15.4 radio link is
explicitly disabled.
The implementation consists of:
- tests/nexus/test_1_4_TREL_TC_4.cpp: C++ test logic for node
configuration, state transitions, and message exchange.
- tests/nexus/verify_1_4_TREL_TC_4.py: Python script for automated
packet-level verification of radio link selection.
- Integration into the Nexus build system and test runner.
This commit adds Nexus test case 1_3_GEN_TC_1, which verifies that the
Thread Version TLV uses the value '4' or higher, as required by the
Thread 1.3.x and 1.4.x specifications.
The implementation includes:
- tests/nexus/test_1_3_GEN_TC_1.cpp: C++ test logic that sets up a
topology with a Border Router, a Router, and an End Device. It
triggers MLE attachment procedures and discovery scans to generate
MLE packets containing the Version TLV. For 1.4 devices, it also
sends TMF Get Diagnostic Requests to verify the Version TLV in
DIAG_GET.rsp.
- tests/nexus/verify_1_3_GEN_TC_1.py: Python script that verifies
the MLE Version TLV in Parent Request/Response, Child ID Request,
and Discovery Response packets. It also verifies the Version TLV
in Network Diagnostic responses for 1.4 devices.
- Integration into tests/nexus/CMakeLists.txt and
tests/nexus/run_nexus_tests.sh for automated building and execution.
This commit adds Nexus test case 1_4_TREL_TC_3, which verifies the
multi-radio probe mechanism and TREL radio link rediscovery after a
temporary disconnect, according to the Thread 1.4 specification.
The implementation includes:
- tests/nexus/test_1_4_TREL_TC_3.cpp: Sets up a topology with a
multi-radio Border Router (DUT), a multi-radio Router, and a
15.4-only End Device. It simulates a TREL disconnect by disabling
the TREL interface on the Router, verifies that the DUT falls back
to 15.4, and then re-enables TREL to trigger and verify the probe
mechanism for link rediscovery.
- tests/nexus/verify_1_4_TREL_TC_3.py: Verifies the packet flow from
the pcap output, ensuring that TREL is used when available, 15.4
is used during the TREL disconnect, and TREL usage resumes after
rediscovery.
- Updated tests/nexus/CMakeLists.txt and tests/nexus/run_nexus_tests.sh
to include the new test in the build and default test list.
The test ensures that the Thread stack correctly manages link
preferences and successfully rediscovers more efficient radio links
using the multi-radio probe mechanism.
This commit adds Nexus test case 1_4_TREL_TC_2, which verifies 6LoWPAN
mesh header forwarding and fragmentation over multi-hop paths involving
both 15.4 and TREL radio links, according to the Thread 1.4 spec.
The implementation includes:
- tests/nexus/test_1_4_TREL_TC_2.cpp: Sets up a complex topology with
a multi-radio Border Router (DUT), a multi-radio Leader, and several
Routers and End Devices with varying radio capabilities (15.4-only
or multi-radio). It triggers pings with large payloads (500B) to
verify fragmentation and multi-hop routing through the DUT.
- tests/nexus/verify_1_4_TREL_TC_2.py: Verifies that packets follow the
expected multi-hop path, checking that TREL is used for infrastructure
segments (UDP) and 15.4 is used for Thread-only segments. It also
ensures that 6LoWPAN fragmentation and mesh headers are correctly
handled by the DUT when forwarding between different radio types.
- Updated tests/nexus/CMakeLists.txt and tests/nexus/run_nexus_tests.sh
to include the new test.
This test ensures that the Thread stack correctly handles multi-hop
routing and MTU differences across heterogeneous radio links.
This commit adds the Nexus test case 1_4_TREL_TC_1 which verifies
connectivity between multi-radio (15.4 and TREL) and single-radio
(15.4 only) devices, as per the Thread 1.4 test specification.
The implementation includes:
- tests/nexus/test_1_4_TREL_TC_1.cpp: Implements the test sequence.
It sets up a topology with a Border Router (DUT) and two Routers.
BR and Router_1 support both 15.4 and TREL, while Router_2 supports
only 15.4. The test verifies that nodes can correctly detect
neighbor radio capabilities and establishes connectivity using
both radio types.
- tests/nexus/verify_1_4_TREL_TC_1.py: Performs automated packet
verification. It ensures that traffic between multi-radio nodes
preferentially uses TREL (simulated over the infrastructure link
via UDP), while traffic involving the single-radio node uses 15.4.
It also validates successful ping exchange across the mixed-radio
topology.
- Integrated the new test into tests/nexus/CMakeLists.txt and
tests/nexus/run_nexus_tests.sh.
The test validates that the Thread stack correctly manages multiple
radio links and ensures seamless connectivity across different
physical layers.
This commit enables TREL by default for all Nexus tests to avoid
requiring multiple builds.
Key changes:
- Modified tests/nexus/build.sh to enable TREL (OT_TREL=ON) by default.
- Updated tests/nexus/test_border_admitter.cpp and
tests/nexus/test_border_agent.cpp to handle multiple mDNS services
in the platform layer, as TREL adds its own mDNS service.
- Refined tests/nexus/verify_1_2_BBR_TC_3.py to specifically filter
for MeshCoP mDNS services and made OMR prefix verification more
lenient to handle transitions in multi-radio environments.
- Updated .github/workflows/nexus.yml to use the default build for all
Nexus jobs and merged TREL tests into the cert tests job.
All 133 cert tests, core tests, and TREL tests passed successfully with
these changes.
This commit updates the TREL traffic simulation in the Nexus platform
to flow through the simulated infrastructure link. This ensures that
TREL packets are captured in the pcap file generated by the
infrastructure link, matching the behavior of mDNS traffic.
Key changes:
- Updated Trel::Send to use InfraIf::SendUdp instead of direct
delivery.
- Modified InfraIf::Receive to recognize TREL UDP packets and pass
them to the TREL platform layer.
- Removed the manual mPendingTxList from the Trel struct as
packets are now managed by the infrastructure interface's queue.
- Added initialization for the TREL platform layer in Core::CreateNode.
- Removed Core::ProcessTrel as TREL packets are now processed within
Core::ProcessInfraIf.
This change improves the realism of the TREL simulation and simplifies
packet capture for TREL-related tests.
This commit adds the Nexus test case 1_3_DPR_TC_2 which verifies
Service discovery of services on Thread and Infrastructure with
multiple Border Routers and multiple Thread networks, as per the
Thread 1.3 test specification.
The implementation includes:
- tests/nexus/test_1_3_DPR_TC_2.cpp: Implements the test sequence.
It sets up two isolated Thread networks, each with its own Border
Router (BR_1/DUT and BR_2) and End Device (ED_1 and ED_2),
attached via a shared infrastructure link. It simulates SRP
registration on both networks and verifies that services can be
discovered across networks using the Discovery Proxy function.
- tests/nexus/verify_1_3_DPR_TC_2.py: Performs automated packet
verification. It ensures both BRs correctly add SRP Server info
to their respective Network Data, SRP updates are successful,
and DNS queries (PTR and SRV) from one network successfully
discover services in the other network through the Discovery
Proxy and mDNS on the infrastructure link.
- Integrated the new test into tests/nexus/CMakeLists.txt and
tests/nexus/run_nexus_tests.sh.
The test validates that the Border Router's Discovery Proxy can
successfully discover and report services advertised by another
Border Router's Advertising Proxy function across an adjacent
infrastructure link.
This commit adds the Nexus test case 1_3_DPR_TC_1 which verifies
Discovery Proxy functionality on a Border Router, as per the
Thread 1.3 test specification.
The implementation includes:
- tests/nexus/test_1_3_DPR_TC_1.cpp: Implements the test sequence.
It sets up a topology with a Border Router (BR_1), a Thread End
Device (ED_1), and an infrastructure node (Eth_1). It simulates
Eth_1 advertising services via mDNS and ED_1 querying for those
services through the BR's Discovery Proxy.
- tests/nexus/verify_1_3_DPR_TC_1.py: Performs automated packet
verification. It ensures the BR correctly adds SRP Server info
to Network Data, Eth_1 advertises services, and ED_1 receives
a valid DNS response from the BR containing the discovered
infrastructure services.
- tests/nexus/openthread-core-nexus-config.h: Enables the
OPENTHREAD_CONFIG_DNSSD_DISCOVERY_PROXY_ENABLE configuration to
support Discovery Proxy testing in the Nexus environment.
- Integrated the new test into tests/nexus/CMakeLists.txt and
tests/nexus/run_nexus_tests.sh.
The test validates that the Border Router's Discovery Proxy can
successfully discover and report services from the infrastructure
link to Thread devices.
This commit adds the Nexus test case 1_3_DIAG_TC_2 which verifies
that an End Device correctly reports its diagnostic information and
MLE counters via Network Diagnostic queries, as per the Thread 1.4
test specification.
The implementation includes:
- tests/nexus/test_1_3_DIAG_TC_2.cpp: Sets up a topology with a Leader,
a Router, and a TD_1 (DUT) configured as a MED. It triggers Network
Diagnostic Get queries from the Leader to the DUT for various TLVs
including Max Child Timeout, EUI-64, Version, Vendor info, and MLE
Counters.
- tests/nexus/verify_1_3_DIAG_TC_2.py: Performs automated verification
of the captured traffic. It validates the presence and values of
requested TLVs (Type 19, 23-28) and ensures that MLE Counters (Type
34) reflect the expected role changes and tracking time.
- Integrated the new test into tests/nexus/CMakeLists.txt and
tests/nexus/run_nexus_tests.sh.
The test ensures the correctness of Thread 1.4 End Device Diagnostic
and MLE Counter reporting, facilitating network health monitoring
and troubleshooting in a Thread network.
This commit hardens OpenThread against Mbed TLS/PSA ABI variation
across customer configurations. Because Mbed TLS/PSA does not
guarantee a stable ABI across build-time option sets,
application-level config changes can alter crypto context struct
size/layout, causing precompiled stack libraries to assume
incompatible memory layouts and potentially fail at runtime.
To address this, this PR makes the following changes:
1. Add OPENTHREAD_CONFIG_PLATFORM_ALLOCS_CRYPTO_CONTEXTS to let
platforms allocate/manage crypto contexts when required, while
preserving existing static context storage as the default path.
2. Update AES/HKDF/HMAC/SHA256 context initialization to support both
platform-managed and internally managed context memory models.
This commit adds the Nexus test case 1_3_DIAG_TC_1 which verifies
that a Thread Router correctly reports its child and neighbor
information via Network Diagnostic and MeshDiag queries, as per
the Thread 1.4 test specification.
The implementation includes:
- tests/nexus/test_1_3_DIAG_TC_1.cpp: Sets up a star topology with
a Leader, Router_1 (DUT), and various child nodes (FED, MED, SED,
REED). It triggers Network Diagnostic Get and MeshDiag queries
(QueryChildTable, QueryChildrenIp6Addrs, QueryRouterNeighborTable)
from the Leader to the DUT.
- tests/nexus/verify_1_3_DIAG_TC_1.py: Performs automated verification
of the captured traffic. It implements a custom TLV parser for
CoAP payloads to verify Max Child Timeout (19), Vendor/Stack info
(23-28), MLE Counters (34), Child Table (29), Child IPv6 (30),
and Router Neighbor (31) TLVs.
- Integrated the new test into tests/nexus/CMakeLists.txt and
tests/nexus/run_nexus_tests.sh.
The test ensures the correctness of Thread 1.4 Router Diagnostic
and Child Information reporting, facilitating remote monitoring
and management of the Thread network.
This commit defines `AnswerTlvValue` to represent the value of an
Answer TLV, allowing it to be reused across different modules,
specifically `NetworkDiagnostic` and `HistoryTracker`.
The `AnswerTlv` implementation is also updated to use the
template-based `SimpleTlvInfo` pattern. This enables the use of
generic `Tlv::Append<AnswerTlv>()` and `Tlv::Find<AnswerTlv>()`
methods, which improves type safety and reduces manual TLV handling.
This commit adds the Nexus test case 1_3_SRPC_TC_7 which verifies
that a Thread device re-registers its service with the same KEY
record after a reboot, as per the Thread 1.3 test specification.
The implementation includes:
- tests/nexus/test_1_3_SRPC_TC_7.cpp: Executes the test sequence
by forming a Thread network with a Border Router (BR_1), a Router,
and a DUT (TD_1). It registers a service on the DUT, simulates a
reboot using Node::Reset(), and re-registers the same service.
- tests/nexus/verify_1_3_SRPC_TC_7.py: Performs automated verification
of the captured traffic. It ensures that the SRP Update sent after
reboot contains a KEY record identical to the one sent before
reboot. It includes a monkey-patch to access the
dns.key.public_key field in the packet verifier.
- Integrated the new test into tests/nexus/CMakeLists.txt and
tests/nexus/run_nexus_tests.sh.
The test validates that the SRP client correctly persists its key
material across reboots, which is essential for maintaining service
registration continuity.
This commit adds the Nexus test case 1_3_SRPC_TC_5 which verifies
that a DNS-SD client can correctly discover multiple services
registered via SRP, as per the Thread 1.3 test specification.
The implementation includes:
- tests/nexus/test_1_3_SRPC_TC_5.cpp: Executes the test sequence
by configuring a Border Router (BR_1), an End Device (ED_2)
registering 5 services with various TXT records, and a DUT
(TD_1). It instructs the DUT to browse for services, resolve
them, and send UDP packets to each resolved service. It verifies
the TXT record values and successful UDP transmissions.
- tests/nexus/verify_1_3_SRPC_TC_5.py: Performs automated
verification of the captured traffic (PCAP). It validates the
DNS query, the DNS response containing all 5 services, and the
subsequent UDP packets sent to the resolved addresses and ports.
- Integrated the new test into tests/nexus/CMakeLists.txt and
tests/nexus/run_nexus_tests.sh.
The test ensures the correctness of DNS-SD client discovery logic
and its ability to handle multiple service responses in a Thread
network.
This commit adds the Nexus test case 1_3_SRPC_TC_4 which verifies
that an SRP client can correctly remove one service while leaving
other services registered, as per the Thread 1.3 test specification.
The implementation includes:
- tests/nexus/test_1_3_SRPC_TC_4.cpp: Executes the test sequence
by configuring a Border Router (BR_1) and an End Device (TD_1
as DUT). It instructs the DUT to register two services and then
remove the first service. It verifies that the SRP server handles
the removal correctly and only provides the remaining service in
subsequent DNS PTR queries.
- tests/nexus/verify_1_3_SRPC_TC_4.py: Performs automated
verification of the captured traffic (PCAP). It validates the
SRP Update messages for service registration and removal, and
checks that the DNS response from BR_1 only contains the
expected service.
- Integrated the new test into tests/nexus/CMakeLists.txt and
tests/nexus/run_nexus_tests.sh.
The test ensures the correctness of SRP client service removal
logic and SRP server state management.
This commit adds the Nexus test case 1_3_SRPC_TC_1 which verifies
that the SRP client correctly handles re-registration with active
SRP servers, especially when multiple Border Routers are present,
as per the Thread 1.3 test specification.
The implementation includes:
- tests/nexus/test_1_3_SRPC_TC_1.cpp: Executes the test sequence
by configuring two Border Routers (BR_1 and BR_2), a Router,
and an End Device (ED_1 as DUT). It simulates BR_1 (the initial
SRP server) becoming unresponsive and verifies that the DUT
correctly switches to BR_2. It also verifies that the DUT
stays with its current server (BR_2) even when a numerically
lower server (BR_1) is re-enabled.
- tests/nexus/verify_1_3_SRPC_TC_1.py: Performs automated
verification of the captured traffic (PCAP). It checks for
correct SRP Update packets to the expected SRP servers and
validates that the DUT behavior matches the specification
criteria.
- Integrated the new test into tests/nexus/CMakeLists.txt and
tests/nexus/run_nexus_tests.sh.
The test ensures robust SRP client behavior in dynamic networks
with multiple SRP servers.
This commit fixes an intermittent failure in the Nexus test
1_2_BBR_TC_2 by ensuring that the Backbone Router (BBR) service
is registered immediately when a node assumes the Leader role and
no primary BBR is active.
Previously, BbrLeader only tracked network data changes, and
BbrLocal applied a mandatory jitter delay before registration.
This created a race condition where another node could register
its BBR service before the new Leader, causing the Leader to
incorrectly skip its own registration.
Changes:
- Update BbrLeader to monitor role changes (kEventThreadRoleChanged).
- Modify BbrLocal to bypass registration jitter if the node is
the Leader and there is no existing primary BBR.
This commit adds the Nexus test case 1_3_SRP_TC_15 which verifies
that the SRP server and Border Router correctly handle services
that include additional subtypes, as per the Thread 1.3 test
specification.
The implementation includes:
- tests/nexus/test_1_3_SRP_TC_15.cpp: Executes the test sequence
by configuring a Border Router (BR_1 as DUT/Leader), an End
Device (ED_1), and an Infrastructure node (Eth_1). It simulates
adding, updating, and removing subtypes for a registered service
and verifies that the BR responds correctly to DNS and mDNS
queries for both basic types and subtypes.
- tests/nexus/verify_1_3_SRP_TC_15.py: Performs automated
verification of the captured traffic (PCAP). It checks SRP
updates, DNS resolutions, and mDNS responses to ensure that
subtypes are properly registered and advertised.
- Integrated the new test into tests/nexus/CMakeLists.txt and
tests/nexus/run_nexus_tests.sh.
The test ensures robust support for SRP service subtypes and
their discovery across both Thread and Infrastructure links.
This commit adds the Nexus test case 1_3_SRP_TC_13 which verifies that
the SRP server and BR correctly handle SRP updates when a Thread
Device's IPv6 addresses change, as per the Thread 1.3 test
specification.
The implementation includes:
- tests/nexus/test_1_3_SRP_TC_13.cpp: Executes the test sequence by
configuring a Border Router (BR_1 as DUT/Leader), an End Device
(ED_1), and an Infrastructure node (Eth_1). It simulates address
updates on ED_1 and verifies that the BR updates its records and
correctly responds to DNS/mDNS queries.
- tests/nexus/verify_1_3_SRP_TC_13.py: Performs automated verification
of the captured traffic (PCAP). It checks SRP updates, DNS
resolutions, and mDNS responses to ensure they only contain the
updated addresses and not stale ones.
- Integrated the new test into tests/nexus/CMakeLists.txt and
tests/nexus/run_nexus_tests.sh.
The test ensures that SRP and DNS discovery remain accurate when
device addresses are updated dynamically.
This commit updates recently added Nexus tests to use the new
SetGlobalLogLevel() method instead of the deprecated instance-specific
SetLogLevel(). This aligns with the recent changes in the logging
API which introduced per-instance log levels and repurposed the
global log level management.
The following test files were updated:
- tests/nexus/test_1_3_SRP_TC_11.cpp
- tests/nexus/test_1_3_SRP_TC_12.cpp
The change also wraps the call in SuccessOrQuit() to ensure that any
errors during log level configuration are caught, matching the
pattern used in other Nexus tests.
This commit simplifies the definition of `ThreadNetworkDataTlv`.
Previously, `ThreadNetworkDataTlv` included a 255-byte array to store
the Network Data TLVs. The code now relies on standard TLV parsing
methods like `Tlv::FindTlvValueOffsetRange()` and `Message::ReadBytes()`
to access the Network Data directly from the message payload.
This commit introduces the ability to set and manage log levels on a
per-instance basis when dynamic logging is enabled, while maintaining
backward compatibility with existing logging behaviors.
The existing `otLoggingGetLevel()` and `otLoggingSetLevel()` APIs are
repurposed to manage the "global" log level. They continue to behave
exactly as before in both single-instance and multi-instance
configurations, ensuring that existing users of these APIs do not need
to change their implementations. To provide more granular control, new
APIs `otGetLogLevel()` and `otSetLogLevel()` are added to handle
per-instance log levels.
Specifically, this commit makes the following changes:
- Adds `mLogLevel` to `Instance` to track the instance-specific log
level.
- Renames the global log level static variable to `sGlobalLogLevel` and
introduces `GetGlobalLogLevel()` and `SetGlobalLogLevel()` to manage
it in a multi-instance configuration.
- Updates `otGetLogLevel()` and `otSetLogLevel()` APIs to handle
per-instance log level retrieval and configuration. If a specific
level is not set for an instance, it falls back to the global
log level.
- Adds `mIsLogLevelSet` to distinguish between an explicitly set
instance log level and the global fallback in multi-instance builds.
- Introduces `otPlatLogHandleLogLevelChanged()` platform callback to
notify the platform when an instance-specific log level is updated.
- Updates Nexus tests to use `SetGlobalLogLevel()` instead of the
deprecated instance `SetLogLevel()` method.
This commit fixes an intermittent failure in the Nexus test
1_2_MATN_TC_9 by ensuring that the packet verification for Step 4b
does not advance the packet cursor prematurely.
In Step 4b, the test verifies that BR_2 (DUT) becomes the leader and
distributes its BBR dataset. It checks for both an MLE Advertisement
and an MLE Data Response from BR_2. However, these packets may arrive
in either order.
Previously, the check for the MLE Advertisement used must_next(),
which advanced the packet cursor. If the MLE Data Response arrived
before the Advertisement, the subsequent check for the Data Response
would fail because it started searching from after the Advertisement.
By using copy() for the MLE Advertisement check, we ensure that both
checks search from the same point in the packet log, making the test
robust against packet reordering.
This commit adds the Nexus test case 1_3_SRP_TC_12 which verifies
DNS/SRP service advertisement by all BRs in the Thread Network and
correct integration by the Leader, as per the Thread 1.3 test
specification.
The implementation includes:
- tests/nexus/test_1_3_SRP_TC_12.cpp: Executes the test sequence with
three Border Routers (BR_1 as DUT/Leader, BR_2, and BR_3). It
simulates adding faked high and low numerical addresses for Unicast
Datasets and adding an additional Anycast Dataset from BR_2. It
verifies the integration and withdrawal logic for SRP services.
- tests/nexus/verify_1_3_SRP_TC_12.py: Performs automated verification
of the captured traffic (PCAP). It checks the Thread Network Data
contained in MLE Data Responses for the presence of expected
Anycast and Unicast Datasets and the withdrawal of the DUT's
service when appropriate.
- Integrated the new test into tests/nexus/CMakeLists.txt and
tests/nexus/run_nexus_tests.sh.
The test ensures that the DUT correctly manages multiple SRP server
entries in the network data based on their priority and numerical
address values.
This commit updates the `ThreadRouterMaskTlv` class definition to
include the `OT_TOOL_PACKED_BEGIN` and `OT_TOOL_PACKED_END` macros.
This class defines the structure of a TLV used in Thread messages
and directly maps to a memory buffer. Therefore, it must be properly
packed to ensure its memory footprint accurately reflects the wire
format and to prevent potential memory alignment padding.
Thankfully, this omission did not impact the format of this specific
TLV, as the alignment of its members natively matched the packed
layout.
This commit adds the Nexus test case 1_3_SRP_TC_11 which verifies that
SRP registration and mDNS discovery are correctly recovered after
various device reboots, as per the Thread 1.3 test specification.
The implementation includes:
- tests/nexus/test_1_3_SRP_TC_11.cpp: Executes the test sequence by
simulating reboots of a Thread End Device (ED_1), a Border Router
(BR_1), and an Infrastructure node (Eth_1). It ensures consistent
network datasets across reboots and uses direct method calls for
configuration.
- tests/nexus/verify_1_3_SRP_TC_11.py: Performs automated verification
of the captured traffic (PCAP). It uses specific MAC address filters
to reliably identify mDNS queries and responses across multiple
reboot scenarios where protocol exchanges may otherwise appear
identical.
- Integrated the new test into tests/nexus/CMakeLists.txt and
tests/nexus/run_nexus_tests.sh.
The test ensures that SRP clients automatically re-register after
device or server reboots and that the BR correctly continues to
respond to mDNS queries on the infrastructure interface.
This commit adds the Nexus test case 1_3_SRP_TC_8 which verifies that
the SRP server correctly removes only selected service instances while
keeping others registered, as per the Thread 1.3 test specification.
The implementation includes:
- tests/nexus/test_1_3_SRP_TC_8.cpp: Executes the test sequence by
configuring a Thread Border Router (DUT), an End Device (ED), and
an Infrastructure node (Eth). It registers multiple services and
then removes one while verifying the remaining service.
- tests/nexus/verify_1_3_SRP_TC_8.py: Performs automated verification
of the captured traffic (PCAP), ensuring that SRP Updates, DNS
queries, and mDNS responses correctly reflect the removal of the
selected service and the persistence of the other.
- Integrated the new test into tests/nexus/CMakeLists.txt and
tests/nexus/run_nexus_tests.sh.
The test ensures that the SRP server properly handles service
deregistration according to the SRP draft and that DNS/mDNS discovery
responses are updated correctly.
This commit adds the Nexus test case 1_3_SRP_TC_6 which verifies that
the SRP server correctly handles SRP Updates both with and without
DNS name compression, according to the Thread 1.3 test specification.
The implementation includes:
- tests/nexus/test_1_3_SRP_TC_6.cpp: Executes the test sequence by
configuring a Thread Border Router (DUT), an End Device (ED), and
an Infrastructure node (Eth). It uses SetDnsNameCompressionEnabled()
to toggle name compression for SRP Updates.
- tests/nexus/verify_1_3_SRP_TC_6.py: Performs automated verification
of the captured traffic (PCAP), ensuring that SRP Updates, DNS
queries, and mDNS responses are correctly formatted and contain the
expected resource records.
- Updating tests/nexus/CMakeLists.txt and tests/nexus/run_nexus_tests.sh
to integrate the new test into the build and default test suite.
The test ensures that the SRP server can successfully parse uncompressed
names in SRP Updates and that subsequent DNS/mDNS discovery remains
functional for both compressed and uncompressed registration formats.
This commit refactors the `OmrPrefixManager` to decouple it from the main
`RoutingManager` policy evaluation cycle. This allows the OMR prefix to
be managed independently and published faster into the Network Data.
Previously, `OmrPrefixManager` relied on its `Evaluate()` method being
called during the main `RoutingManager::EvaluateRoutingPolicy()` cycle.
This meant it had to wait for other components to be ready — such as
sending Router Solicitations to discover other routers on the Adjacent
Infrastructure Link (AIL)—before taking action.
With this change, `OmrPrefixManager` operates independently. It can
evaluate its state as soon as the Border Router function is enabled and
`Start()` is called.
Additional improvements supporting this independent operation include:
- Replaces the `mIsLocalAddedInNetData` boolean with a `LocalPrefixState`
enum (`kNotAdded`, `kToAdd`, `kAdded`) to manage addition state and
support delayed updates.
- Introduces a random delay (`kMinDelayToAdd` to `kMaxDelayToAdd`)
before adding a self-generated OMR prefix to Network Data. This gives
the network time to settle, allowing other BRs or the `PdPrefixManager`
time to establish a prefix.
- Implements a retry mechanism with jitter for Network Data addition
failures, rather than silently ignoring them.
- Refactors `PdPrefixManager` to batch state changes via an `mEvents`
bitmask and process them through `mEventTask`. Changes are now handled
explicitly by `OmrPrefixManager::HandlePdPrefixManagerEvent()`, further
reducing unnecessary main routing policy evaluations.
This commit adds an API otDatasetIsValid to check whether the given
Operational Dataset contains all the required TLVs (Active Timestamp,
Channel, Channel Mask, Extended PAN ID, Mesh-Local Prefix, Network
Key, Network Name, PAN ID, PSKc, and Security Policy). This API also
checks whether there are duplicated TLVs or the TLVs are not
well-formed.
This commit removes three Python-based thread-cert scripts for v1.2
backbone router and multicast registration testing:
- v1_2_test_backbone_router_service.py
- v1_2_test_multicast_listener_registration.py
- v1_2_test_multicast_registration.py
These tests have been fully migrated to the Nexus simulation
framework, providing equivalent verification in a more robust and
scalable environment.
The equivalent Nexus test cases are already part of the repository:
- 1_2_BBR_TC_1, 1_2_BBR_TC_2, 1_2_BBR_TC_3
- 1_2_MATN_TC_1, 1_2_MATN_TC_2, ..., 1_2_MATN_TC_26
C++ promotes narrow integer types to int before applying ~ or unary -,
so the result is always int even when the variable being assigned to is
narrower. Clang accepted this silently for years due to a bug in its
range tracking (LLVM #126846, fixed March 2025); Clang 21, now included
in the latest Mac OS for example, correctly flags these as errors.
Add <static_cast> to the destination type at each affected spot.
This commit adds the Nexus test case 1_3_SRP_TC_5 which verifies SRP
KEY record inclusion and omission behavior according to the Thread 1.3
test specification (SRP TC-5).
The implementation includes:
- Adding mHostKeyRecordEnabled flag to Srp::Client to control host
KEY record inclusion in SRP Updates. This is enabled only when
OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE is defined.
- Implementing SetHostKeyRecordEnabled() and IsHostKeyRecordEnabled()
methods in Srp::Client.
- Modifying AppendHostDescriptionInstruction() in srp_client.cpp
to conditionally include the KEY record.
- Creating tests/nexus/test_1_3_SRP_TC_5.cpp to execute the test
sequence across multiple simulated nodes (BR_1, ED_1, Eth_1).
- Creating tests/nexus/verify_1_3_SRP_TC_5.py to perform automated
verification of the captured traffic.
- Updating tests/nexus/CMakeLists.txt and
tests/nexus/run_nexus_tests.sh to include the new test.
The test ensures that the SRP server correctly handles updates with
and without service KEY records, omits KEY records in DNS/mDNS
responses, and rejects updates that omit all KEY records.
This commit adds a new Nexus test case 1_3_SRP_TC_4 which implements
the test specification for SRP key lease handling.
The test verifies that:
- A service instance name cannot be claimed even after the service
instance lease has expired, as long as its key lease remains active.
- The SRP server correctly manages key leases and rejects registration
updates for hosts or services that are still claimed by a previous
registration during the key lease period.
- DNS and mDNS responses correctly reflect the state of registrations
and their expirations.
Changes:
- Add tests/nexus/test_1_3_SRP_TC_4.cpp for test execution.
- Add tests/nexus/verify_1_3_SRP_TC_4.py for pcap verification.
- Update tests/nexus/CMakeLists.txt to include the new test.
- Update tests/nexus/run_nexus_tests.sh to add it to DEFAULT_TESTS.
This commit removes the `Tlv::ReadTlvValue()` method which is no
longer needed or used. The same functionality is provided through
the `Tlv::Info` class, specifically using its `ParseFrom()` and
`ReadValue()` methods. This approach is safer and provides more
comprehensive information about the parsed TLV.
The unit tests are also updated to replace the usage of the removed
method with the new `Tlv::Info` based approach.
This commit introduces node-specific log files for Nexus tests. Each
created node can save its OpenThread logs into a separate file
`ot-logs<id>.log`.
The generation of log files is controlled by the environment variable
`OT_NEXUS_SAVE_LOGS`. By default, it is disabled, but it can be
activated by setting the environment variable to "1", "yes", "true",
"on", or "t".
This commit also refactors the Nexus platform logging logic into a new
`nexus_logging.cpp` file and improves the log message format in `stdout`
to include a standard timestamp using `UptimeToString()`.
This commit updates the `BBR_TC_3` Nexus test to use two separate host
nodes, `HOST_1` and `HOST_2`, for sending mDNS queries.
By using distinct host nodes, the packet verification script can now
unambiguously identify and track queries from different test steps
based on their source Ethernet MAC address. This improves the
robustness of the test by reducing reliance on packet sequence
numbers for isolation which can be fragile due to possible multiple
transmission of mDNS query message.
Specifically, `HOST_1` is used for queries in steps 1, 5, and 12,
while `HOST_2` is dedicated to the query in step 9. Both the C++ test
logic in `test_1_2_BBR_TC_3.cpp` and the Python verification script in
`verify_1_2_BBR_TC_3.py` are updated to reflect this change.
This commit updates `Mle::HandleUdpReceive()` to avoid logging an error
when an MLE message is received while MLE is disabled.
When `IsDisabled()` is true, the `VerifyOrExit` macro now exits the
method without setting `error` to `kErrorInvalidState`. This ensures
that the `LogProcessError()` call at the `exit` label does not emit an
error log. This reduces log spam during testing/debugging.
This commit provides the platform-level implementation for the
instance-aware logging API `otPlatLogOutput()`. This API is used when
`OPENTHREAD_CONFIG_LOG_INSTANCE_AWARE_API_ENABLE` is enabled, allowing
the platform to receive the `otInstance` pointer with each log line.
The new API is implemented across:
- The simulation platform logging.
- The POSIX platform using `syslog()`.
- The NCP base to route logs to the NCP host.
- The CLI logging module.
- Unit tests and mock platforms.
The `OPENTHREAD_CONFIG_LOG_INSTANCE_AWARE_API_ENABLE` configuration is
also enabled for Toranj simulations to support multi-instance log
testing.
This commit adds support for `OPENTHREAD_CONFIG_LOG_PREPEND_UPTIME` in
multi-instance builds.
When `OPENTHREAD_CONFIG_MULTIPLE_INSTANCE_ENABLE` is enabled, the uptime
is retrieved from the currently active `Instance` using
`Instance::GetActiveInstance()`. This requires
`OPENTHREAD_CONFIG_LOG_INSTANCE_AWARE_API_ENABLE` to be enabled so that
the `Logger` can identify the instance and access its `UptimeTracker`.
A compile-time check is added to ensure that
`OPENTHREAD_CONFIG_LOG_INSTANCE_AWARE_API_ENABLE` is set when
`OPENTHREAD_CONFIG_LOG_PREPEND_UPTIME` is used in a multi-instance
build.
This commit adds a new Nexus test case 1_3_SRP_TC_3 which implements
the test specification for service instance lease renewal and
automatic service/host removal.
The test covers:
- SRP service registration and discovery via DNS and mDNS.
- SRP lease renewal before expiration.
- Automatic removal of SRP services and hosts after lease expiration.
- Verification of DNS and mDNS responses after lease expiration,
ensuring that expired records are no longer returned.
Changes:
- Add tests/nexus/test_1_3_SRP_TC_3.cpp for test execution.
- Add tests/nexus/verify_1_3_SRP_TC_3.py for pcap verification.
- Update tests/nexus/CMakeLists.txt to include the new test.
- Update tests/nexus/run_nexus_tests.sh to add it to DEFAULT_TESTS.
This commit adds a new Nexus test case 1_3_SRP_TC_2 which implements
the test specification for handling name conflicts in SRP host and
service registrations.
The test covers:
- Handling name conflicts in Host Description records.
- Handling name conflicts in Service Description records.
- Verifying that original services are discoverable on the AIL
while conflicting services are correctly rejected and not seen.
- Validating mDNS discovery on the adjacent infrastructure link
using direct method calls for SRP and DNS-SD operations.
Changes:
- Add tests/nexus/test_1_3_SRP_TC_2.cpp for test execution.
- Add tests/nexus/verify_1_3_SRP_TC_2.py for pcap verification.
- Update tests/nexus/CMakeLists.txt to include the new test.
- Update tests/nexus/run_nexus_tests.sh to add it to DEFAULT_TESTS.
In testing I have observed some failures to attach due to a `Child ID
Request` or `Child ID Response` getting lost in the air causing the
attaching device to start it's own new partition (assuming FTD).
When attaching, after selecting a parent candidate from the responses
to a multicast `Parent Request` message, devices only have one shot to
send and receive a response to a `Child ID Request`. There is a higher
rate of failure in this sequence during high traffic periods such as
formation and reset, which will cause more devices than desired to
fail the attachment process (and become their own leader if an FTD).
This commit aims to help address this by adding 2 additional retries
to `Child ID Request` messages, which gives devices a much better
chance of attaching the first time.
This commit adds a new Nexus test case 1_3_SRP_TC_1 which verifies
SRP registration and discovery in a topology with a Border Router.
The test covers:
- SRP server registration in Thread Network Data.
- SRP service registration by a Thread End Device.
- Unicast DNS queries over the Thread interface.
- mDNS discovery over the Infrastructure interface.
Changes:
- Add tests/nexus/test_1_3_SRP_TC_1.cpp for test execution.
- Add tests/nexus/verify_1_3_SRP_TC_1.py for pcap verification.
- Update tests/nexus/CMakeLists.txt and run_nexus_tests.sh.
- Extend pktverify library (consts.py, layer_fields.py) to support
DNS/mDNS and SRP-specific fields.
This commit updates the `Mle` router role downgrade logic. When a
REED transitions to a router in response to a Child ID Request, it
indicates that the attaching child has no other viable parent options.
To ensure this child remains connected to the mesh, this commit
prevents the newly promoted router from downgrading back to a REED.
A new flag `mBlockDowngrade` is added to `Mle`, and a matching
property `mBlockParentDowngrade` is added to `Child` to track if it is
blocking its parent's downgrade. The downgrade restriction is lifted
under specific conditions: when the device detaches, when a new router
is added to the network (providing a potential alternative parent for
the child), or when all children blocking the downgrade are removed.
A new nexus test `test_mle_blocking_downgrade` is added to validate
the new behavior.
This commit removes the active node tracking logic from the Nexus
simulation framework.
Previously, `Core` maintained a pointer to the `mActiveNode` and updated
it dynamically during processing and network events. This was necessary
so that log messages could be attributed to the correct node/instance.
With the recent introduction of "instance-aware logging" in the OpenThread
core, the logging mechanism natively knows which `otInstance` generated a
log. Therefore, manually tracking and context-switching the active node
in the Nexus framework is no longer required.
This change simplifies `nexus::Core`, removes context-switching overhead
from heavily utilized inline methods like `Node::Get<Type>()`, and allows
us to simplify the signature of `InfraIf::Receive()`.
This commit adds a new Nexus test case 1_3_DBR_TC_10 which implements
the test specification for reachability, OMR address configuration,
and default route processing in a Thread network with a Border Router.
The test ensures that:
- End Devices correctly configure OMR addresses from OMR prefixes.
- Routers correctly process and route packets based on external
(default) routes advertised by Border Routers.
- Border Routers can manage default routes using both external route
TLVs (::/0) and the P_default flag in OMR prefixes.
Changes:
- Add tests/nexus/test_1_3_DBR_TC_10.cpp for test execution.
- Add tests/nexus/verify_1_3_DBR_TC_10.py for pcap verification.
- Update tests/nexus/CMakeLists.txt and tests/nexus/run_nexus_tests.sh
to include the new test.
This commit adds several new helper methods to tests/nexus/verify_utils.py
to simplify common verification tasks in Nexus tests:
- check_ra_has_rio: verify presence and preference of RIO in RA.
- check_ra_has_pio: verify presence of PIO in RA.
- check_nwd_has_route: verify presence and preference of external
route in Network Data.
Existing tests (1_3_DBR_TC_7A/B/C and 1_3_DBR_TC_8) are updated to use
these new helper methods, which improves code readability and
consistency across the Nexus test suite.
This commit introduces the 1_3_DBR_TC_8 Nexus test case, which
verifies bi-directional reachability in a topology with multiple
Border Routers (BRs) and the presence of OMR prefixes with different
lifetimes.
Key features of this test:
- Simulates a network with two BRs and a Thread Router.
- Configures an infrastructure link with a GUA prefix.
- Configures an OMR prefix (OMR_4, P_preferred=false) in Network
Data and ensures the DUT BR correctly generates its own OMR
prefix when existing ones are not usable.
- Verifies that the DUT BR correctly multicasts Router
Advertisements (RAs) on the infrastructure link containing OMR
routes but excluding deprecated OMR_4 routes.
- Confirms bi-directional ICMPv6 connectivity between an
infrastructure device and a Thread Router.
- Ensures the DUT BR continues to advertise OMR routes even after
the originating BR (BR_2) is disabled.
The implementation includes:
- tests/nexus/test_1_3_DBR_TC_8.cpp: Test execution logic using
direct method calls and Note-level logging.
- tests/nexus/verify_1_3_DBR_TC_8.py: PCAP-based verification script
with robust Network Data and RA checking.
- Updates to tests/nexus/CMakeLists.txt and
tests/nexus/run_nexus_tests.sh to register the new test case.
This commit introduces the 1_3_DBR_TC_7C Nexus test case, which
verifies bi-directional reachability in a topology with multiple
Border Routers (BRs) and the presence of non-OMR prefixes.
Key features of this test:
- Simulates a network with two BRs and a Thread Router.
- Configures an infrastructure link with a GUA prefix.
- Configures a non-OMR prefix (PRE_1, P_on_mesh=false) in Network
Data and ensures the DUT BR correctly generates its own OMR
prefix when existing ones are not usable.
- Verifies that the DUT BR correctly multicasts Router
Advertisements (RAs) on the infrastructure link containing OMR
routes but excluding PRE_1 routes.
- Confirms bi-directional ICMPv6 connectivity between an
infrastructure device and a Thread Router.
- Ensures the DUT BR continues to advertise OMR routes even after
the originating BR (BR_2) is disabled.
The implementation includes:
- tests/nexus/test_1_3_DBR_TC_7C.cpp: Test execution logic using
direct method calls and Note-level logging.
- tests/nexus/verify_1_3_DBR_TC_7C.py: PCAP-based verification script
with robust Network Data and RA checking.
- Updates to tests/nexus/CMakeLists.txt and
tests/nexus/run_nexus_tests.sh to register the new test case.
This commit adds `otPlatLogOutput()`, a new platform logging API that
provides the `otInstance` pointer along with a pre-formatted log
string. This addresses the limitation of the existing `otPlatLog()` in
multi-instance builds, where the function cannot reliably determine
which OpenThread instance generated the log.
`OPENTHREAD_CONFIG_LOG_INSTANCE_AWARE_API_ENABLE`, is introduced to
enable this behavior. When enabled, `Logger::Log()` resolves the
active instance (via a tracked global pointer `gActiveInstance`)
and passes it to `otPlatLogOutput()`.
To support tracking the active instance context,
`UpdateActiveInstance()` is added and called during standard
instance retrieval paths, such as `Locator::GetInstance()` and
`Message::GetInstance()`. The TCP endpoints and listeners are also
updated to track the active instance when their `GetInstance()` methods
are invoked.
The Nexus testing platform is updated to enable this configuration
and implement `otPlatLogOutput()` to print the instance ID alongside
the log line, simplifying log tracing in multi-node simulations.
This commit simplifies the logic for updating the local OMR prefix
within `RoutingManager::OmrPrefixManager`.
The process of updating the prefix in `UpdateLocalPrefix()` is
consolidated into a single flow. Instead of multiple paths clearing
the old prefix from `NetworkData` and logging changes, the method now
determines the appropriate `prefix`, `preference`, and `origin`
(`kSelfGenerated`, `kCustom`, `kDhcp6Pd`), and delegates the change
to a shared sequence at the end of the method.
It also adds a `Matches()` method to `OmrPrefix` to efficiently check
if a given `Ip6::Prefix` and `RoutePreference` match the current OMR
prefix, avoiding unnecessary copies during updates.
Additionally, this change standardizes the log output format for local
OMR prefix updates by utilizing `LocalToString()` and ensures
the prefix's route preference is consistently included.
This commit introduces the 1_3_DBR_TC_7B Nexus test case, which
verifies bi-directional reachability in a topology with multiple
Border Routers (BRs) and the presence of deprecated prefixes.
Key features of this test:
- Simulates a network with two BRs and a Thread Router.
- Configures an infrastructure link with a GUA prefix.
- Configures a deprecated prefix (PRE_1, P_preferred=false) in
Network Data and ensures the DUT BR correctly generates its own
OMR prefix when existing ones are not usable.
- Verifies that the DUT BR correctly multicasts Router Advertisements
(RAs) on the infrastructure link containing both OMR and PRE_1
routes.
- Confirms bi-directional ICMPv6 connectivity between an
infrastructure device and a Thread Router.
- Ensures the DUT BR continues to advertise PRE_1 routes even after
the originating BR (BR_2) is disabled, as long as the prefix
remains in Network Data.
The implementation includes:
- tests/nexus/test_1_3_DBR_TC_7B.cpp: Test execution logic using
direct method calls and Note-level logging.
- tests/nexus/verify_1_3_DBR_TC_7B.py: PCAP-based verification script
with robust Network Data flag checking.
- Updates to tests/nexus/CMakeLists.txt and
tests/nexus/run_nexus_tests.sh to register the new test case.
This commit introduces the 1_3_DBR_TC_7A Nexus test case, which verifies
bi-directional reachability in a topology with multiple Border Routers
(BRs) and the presence of non-OMR prefixes.
Key features of this test:
- Simulates a network with two BRs and a Thread Router.
- Configures an infrastructure link with a GUA prefix.
- Configures a non-OMR prefix (PRE_1) in Network Data and ensures the
DUT BR correctly generates its own OMR prefix when existing ones are
not usable (e.g., SLAAC disabled).
- Verifies that the DUT BR correctly multicasts Router Advertisements
(RAs) on the infrastructure link containing both OMR and PRE_1 routes.
- Confirms bi-directional ICMPv6 connectivity between an infrastructure
device and a Thread Router.
- Ensures the DUT BR continues to advertise PRE_1 routes even after the
originating BR (BR_2) is disabled, as long as the prefix remains in
Network Data.
The implementation includes:
- tests/nexus/test_1_3_DBR_TC_7A.cpp: Test execution logic using direct
method calls and Note-level logging.
- tests/nexus/verify_1_3_DBR_TC_7A.py: PCAP-based verification script
with robust Network Data flag checking.
- Updates to tests/nexus/CMakeLists.txt and tests/nexus/run_nexus_tests.sh
to register the new test case.
In order to facilitate a well-staged post reset process for a larger
size link, it is important to consider the timing of devices returning
to the link.
With the changes in this PR, that timing will be as follows:
1. The leader and routers will begin sending link request messages in
an attempt to reattach to the previous partition.
2. Both the leader and routers will have 4 attempts to reconnect,
afterwords falling back to attach any.
3. The leader here is given a 2s retry window (jittered 10% either
way), for a worst-case (tightest timing vs routers) of 4x2.2s =
8.8s before starting attachment.
4. The routers here are given the normal 5s multicast retx delay with
the same 10% jitter, resulting in a tightest timing (shortest) of
4x4.5s = 18s
5. For this analysis, the jitter during the attach process is ignored
because it will not be particularly significant, so we assume both
flow through a nominal failed attachment of 2x0.75s (routers) +
4x1.25s (reeds) = 6.5s
6. This means that the previous leader will start the new partition
around 15.3s after starting.
7. The former routers would fall back to starting a new partition on
their own at 24.5s after reset.
This timing leaves 9.2s of leeway (greater than the length of the full
attachment process) for the routers to get parent responses from the
old leader which has started the new partition and attach instead of
starting their own partitions.
This also leaves sufficient time between the router attachment and
children timing out of their role restoration process to attach to
their former parents.
Additionally, 4 attempts should be more than sufficient with this
timing to successfully reattach to a partition that did not also
reset. If a link request sent in this period is not accepted, then the
old partition can be safely assumed to be gone, or removed links to
the reset device.
Routers with children and the leader will also benefit in
single-device reset cases here because they are able to rejoin more
quickly. Only routers with very few/no children are slowed down in
re-attachment by 5s.
This adds a new --settings-file launch option that allows specifying
a fixed base name for the settings file, overriding the default
EUI64-based naming scheme.
When an RCP device is replaced, the new device has a different EUI64,
which causes the host to lose access to its previously stored dataset.
By using --settings-file, the settings file name remains stable across
RCP replacements, preserving the Thread network configuration.
Ref: https://github.com/orgs/openthread/discussions/12428
This commit introduces the 1_3_DBR_TC_6 Nexus test case to verify
bi-directional reachability in a multi-BR topology with existing
IPv6 infrastructure.
Key changes:
- Implement tests/nexus/test_1_3_DBR_TC_6.cpp and its corresponding
pcap-based verification script tests/nexus/verify_1_3_DBR_TC_6.py.
- Enhance the Nexus platform InfraIf class to support constructing
and sending ICMPv6 Router Advertisements (RA) with PIO and RIO.
- Add RouterAdvertisementStart() and RouterAdvertisementStop() to
InfraIf for managed periodic unsolicited RA transmissions.
- Update Core::Process() to drive the periodic RA logic in InfraIf.
- Implement response logic for ICMPv6 Router Solicitations in
InfraIf when RA advertising is enabled.
- The 1_3_DBR_TC_6 test validates that the DUT BR correctly adopts
existing OMR prefixes, advertises an external default route (::/0),
and sends appropriate RAs on the infrastructure link.
- Register the new test case in tests/nexus/CMakeLists.txt and
tests/nexus/run_nexus_tests.sh.
This commit updates the conditional compilation for the multiple
static instances array in `Instance`. It adds a check for
`OPENTHREAD_CONFIG_MULTIPLE_INSTANCE_ENABLE` alongside
`OPENTHREAD_CONFIG_MULTIPLE_STATIC_INSTANCE_ENABLE`.
This commit adds `CloneMessage()`, `CloneMessageWithoutFooter()`,
and `CloneMessageWithout<Footer>()` methods to the `MessageAllocator`
class. These methods simplify creating copies of messages by
automatically applying the correct `kReservedHeader` size. It also
updates existing code in `CoapBase`, `Dns::Client`, `Sntp::Client`,
and `Mle` to utilize these new methods.
Additionally, this commit updates the `Clone()` method in `Message`
to be a template method, accepting a `CloneMode` to specify whether
the cloned message should retain the reserved header or have no
reserved header. The documentation for the clone methods has also
been updated to clarify which message fields are copied during the
cloning process.
This commit introduces the 1_3_DBR_TC_3 nexus test case to verify
bi-directional reachability between multiple Thread networks connected
via a common infrastructure link.
The test verifies that independent Thread networks, each with its own
Border Router (BR) connected to the same infrastructure link, can
successfully route traffic to each other. This confirms reachability
in multi-Thread network environments where no existing IPv6
infrastructure is present.
Key changes:
- Implement test_1_3_DBR_TC_3.cpp to simulate a topology with two
Thread networks (BR_1/ED_1 and BR_2/ED_2) and verify end-to-end
ping success between End Devices.
- Implement verify_1_3_DBR_TC_3.py for pcap-based validation of:
- Network Data registration of OMR and infrastructure prefixes.
- RA multicasts on the infrastructure link with correct RIO/PIO.
- Proper mapping of Extended PAN ID into the infrastructure ULA.
- Bi-directional ICMPv6 connectivity between End Devices.
- Register the new test case in CMakeLists.txt and run_nexus_tests.sh.
Thread spec doesn't define the order of TLVs in the dataset, so that
we can't call `memcmp` to compare two dataset. If we convert the
dataset to otOperationalDataset and then compare each value of
otOperationalDataset, we will met an issue if the new Thread spec
defines new TLVs in the dataset in the future.
This commit add a new dataset API `otDatasetTlvsCompare` to check
whether two dataset contain the exact same set of TLVs (same types and
values).
This commit introduces a new `Event` enumeration in `RouterTable`
along with an `Events` bit-field to track and indicate specific changes
that occur within the table. The `SignalTableChanged()` method is
updated to accept these events, replacing the previous parameterless
version. A new `LogEvents()` method is also added to log a summary of
the changes whenever the table is updated, improving debugging and
visibility into the router table's state.
This commit refactors the verification logic for Distributed Border
Router (DBR) tests in the Nexus framework to enhance robustness and
reliability.
Key changes include:
- Introduced verify_utils.check_nwd_prefix_flags() to handle complex
Thread Network Data structures, allowing for precise verification of
Prefix TLV flags and Border Router sub-TLV flags even when multiple
prefixes are present.
- Updated verify_1_3_DBR_TC_1.py and verify_1_3_DBR_TC_2.py to use
the new helper and improved the identification of OMR and ULA
prefixes in Network Data by iterating through TLV types.
- Added verification for Preferred and Valid Lifetimes in ICMPv6 Prefix
Information Options (PIO) within Router Advertisements.
- Enhanced pktverify to support icmpv6.opt.pio_valid_lifetime and
ensured proper mapping of PIO lifetime fields.
- Simplified MLE Data Response filtering in verify_1_3_DBR_TC_1.py
for better maintainability.
This commit introduces the 1_3_DBR_TC_2 nexus test case to verify
bi-directional reachability between Thread and infrastructure devices
in a topology with multiple Border Routers.
Key changes:
- Implement test_1_3_DBR_TC_2.cpp for step-by-step execution logic.
- Implement verify_1_3_DBR_TC_2.py for pcap-based verification.
- Enable OPENTHREAD_CONFIG_BORDER_ROUTING_TESTING_API_ENABLE in nexus
platform configuration to support prefix manipulation.
- Add icmpv6.opt.pio_preferred_lifetime to pktverify layer fields.
- Register the new test case in CMakeLists.txt and the default nexus
test run script.
- Refactor verify_1_3_DBR_TC_1.py and verify_1_3_DBR_TC_2.py to move
nested helper functions to the top level for better modularity.
- Remove an unnecessary Deinit() call in test_1_3_DBR_TC_1.cpp and
its definition in nexus_infra_if.hpp.
The test verifies:
- Border Router adoption of existing OMR prefixes in the network.
- Router Advertisement (RA) behavior on the infrastructure link,
including correct RIO options and suppression of non-deprecating PIOs
when another BR is present.
- Bi-directional reachability between Thread End Devices and Adjacent
Infrastructure Link (AIL) hosts during BR transitions.
- Automatic election of a new Leader and promotion to Primary BR upon
loss of the previous Leader.
- Correct derivation of BR ULA prefixes from the Extended PAN ID.
Nexus test 1_2_BBR_TC_3 occasionally fails during Step 6 after a
device reboot. The failure occurs because the Backbone Router (BBR)
is reported as active in the mDNS state bitmap ('sb' record), but
the mandatory 'omr' record is not yet present in the response.
This transient state happens because the BBR function is enabled
immediately upon attachment, whereas the Routing Manager requires
a brief period to establish and favor an OMR prefix.
This commit updates the Python verification script to filter for
mDNS responses that include the 'omr' record in Steps 6 and 13. This
allows the test to wait for the complete state to be published
naturally, rather than failing on the first transient packet
received.
Validated with 50 successful sequential executions of the test.
This commit implements the 1_3_DBR_TC_1 nexus test case to verify
bi-directional reachability between Thread and infrastructure
devices with a single Border Router.
Key changes:
- Implement test_1_3_DBR_TC_1.cpp for step-by-step execution logic.
- Implement verify_1_3_DBR_TC_1.py for pcap-based verification.
- Enhance Nexus InfraIf platform to support Deinit() for AIL
disconnection.
- Update InfraIf::Receive() to check initialization status and
ignore kErrorDrop from SendRaw() to handle legitimate packet
drops in the stack.
- Register the new test case in CMakeLists.txt and the default
nexus test run script.
The test verifies:
- Automatic OMR and on-link prefix registration in Network Data.
- Periodic ND Router Advertisement multicast on the infrastructure
link with correct PIO/RIO options and Extended PAN ID derivation.
- Bi-directional reachability between Thread End Devices (OMR) and
Infrastructure Hosts (ULA).
- Strict enforcement of non-forwarding rules for link-local and
Mesh-Local EID traffic between the Thread and infrastructure
networks.
Nexus test 1_2_BBR_TC_2 was occasionally failing at Step 14.
In this step, the previous leader (Router_1) is disabled, and
the DUT (BR_1) is expected to become the new leader and the
Primary Backbone Router (BBR).
The original wait time was 200 seconds (kAttachToRouterTime).
However, analysis showed that routers wait for the MLE Router
ID Timeout (120 seconds) before initiating a new leader election.
Combined with election jitter and BBR registration time, this
sometimes exceeded the 200-second window.
This commit increases the wait time in Step 14 to 400 seconds
(kAttachToRouterTime * 2) to provide sufficient buffer for the
leader transition and BBR registration, effectively resolving
the flake.
This commit updates the `Tlv::Append()` method template to accept a
`uint16_t` for the `aLength` parameter instead of `uint8_t`. This
change aligns the template method with the underlying `AppendTlv()`
method, allowing it to correctly append both regular and extended
TLVs based on the provided length.
The Doxygen comments are also updated to clarify that the TLV is
appended as either a regular or an extended TLV depending on whether
the length is greater than `kBaseTlvMaxLength`.
This commit implements the BBR-TC-03 test case in the Nexus simulation
framework to verify that a Backbone Router (BBR) function can be
discovered using mDNS and that changes are correctly reflected.
Key implementation details include:
- Implementation of BBR-TC-03 in C++ simulating a topology with two
Border Routers (BR_1 as initial Primary BBR, BR_2 as Secondary)
and a non-Thread IPv6 Host used for mDNS queries.
- Use of direct method calls instead of OpenThread public APIs where
appropriate, following Nexus test conventions.
- Configuration of the test environment including fixed Operational
Datasets to ensure predictable verification.
- Simulation of various network states:
- Initial Primary/Secondary BBR discovery.
- BBR function persistence after device reboot.
- Role transition (Secondary becoming Primary) when the original
Primary BBR powers down.
- Secondary BBR discovery when the original Primary BBR rejoins.
- Addition of a Python verification script to validate mDNS packets on
the simulated infrastructure link, checking for:
- Correct mDNS query/response exchanges between Host and BBRs.
- Presence and format of mandatory TXT records (dn, bb, sq, rv, tv,
sb, nn, xp, omr).
- Proper state bitmap (sb) transitions reflecting Primary vs.
Secondary status.
- Inclusion of the full test specification as inline comments in both
C++ and Python files, adhering to strict formatting requirements.
- Registration of the new test case in tests/nexus/CMakeLists.txt and
the default test list in tests/nexus/run_nexus_tests.sh.
- Setting log level to 'note' for improved visibility into state
transitions.
This commit updates `ChildTableTlvEntry` to better support the packing
and parsing of child entries in a `ChildTableTlv`. It introduces an
`InitFrom()` method to encode an entry directly from a `Child`
object, and a `Parse()` method to extract values into a `ParseInfo`
struct, improving modularity and simplifying usage.
Additionally, it consolidates the logic for calculating the timeout
exponent and decoding it back to a timeout value directly within the
`ChildTableTlvEntry` class. It also introduces `ParseChildTable()` in
`NetworkDiagnostic::Client` to clean up the child table parsing
loop.
Update mDNS traffic simulation in the Nexus platform to flow through
the simulated infrastructure link. This ensures mDNS packets are
automatically written to the PCAP file generated by the simulated
infrastructure link.
Changes:
- Wrap mDNS messages in UDP/IPv6 headers and enqueue them on the
simulated infrastructure interface (InfraIf).
- Implement a new SendUdp overload in InfraIf that accepts a Message
payload.
- Update InfraIf::Receive to intercept mDNS UDP packets (port 5353)
and deliver them to the Mdns module.
- Remove the dedicated ProcessMdns loop and manual PendingTx list from
Core and Mdns, consolidating traffic processing through InfraIf.
- Initialize Mdns with a reference to the Node to allow access to
InfraIf.
- Add GetMulticastAddress static helper to Mdns for 'ff02::fb'.
This commit updates various CMake configuration files to simplify
the check for Apple platforms. It replaces the `CMAKE_CXX_COMPILER_ID`
check for `AppleClang` with the built-in `APPLE` variable across
multiple targets (such as `ftd`, `mtd`, `cli`, and others). This
ensures that Apple-specific linker and compiler flags (like `-Wl,-map`
and `-Wimplicit-int-conversion`) are correctly applied when building
on macOS, regardless of the specific compiler used.
Additionally, this commit updates `CMakeLists.txt` to explicitly set
the `CMAKE_AR` and `CMAKE_RANLIB` paths to the default system
locations (`/usr/bin/ar` and `/usr/bin/ranlib`) when the `APPLE`
variable is set.
This commit implements the BBR-TC-02 test case in the Nexus simulation
framework to verify that if two BBR Datasets are present in a network,
the Backbone Router (BBR) that is not elected as Primary will delete
its own BBR Dataset from the Network Data.
Key implementation details include:
- Implementation of BBR-TC-02 in C++ simulating a topology with two
Border Routers (BR_1 as DUT/initial Primary, BR_2) and a Thread
Router as Leader.
- Verification of BR_1's role switch from Primary to Secondary when it
detects a BBR Dataset with a higher sequence number (BR_2's dataset).
- Verification that BR_1 sends a Server Data notification to the Leader
to remove its BBR Dataset upon switching to the Secondary role.
- Verification that BR_1 (as Secondary BBR) correctly rejects MLR.req
messages with ST_MLR_BBR_NOT_PRIMARY.
- Verification that BR_1 automatically resumes the Primary BBR role
and becomes Leader when Router_1 and BR_2 are removed from the
network.
- Addition of a Python verification script to validate:
- Correct sequence of SVR_DATA.ntf CoAP requests for BBR Dataset
registration and removal.
- Correct handling of MLR.req with ST_MLR_BBR_NOT_PRIMARY error.
- Correct filtering of Thread Network Data TLVs in CoAP payloads.
- Inclusion of the full test specification as inline comments in both
the C++ and Python files.
- Use of direct core method calls in C++ and adherence to strict
formatting rules in both files.
- Registration of the new test case in tests/nexus/CMakeLists.txt and
tests/nexus/run_nexus_tests.sh.
The cli config `OPENTHREAD_CONFIG_CLI_BLE_SECURE_ENABLE` was
duplicated in `cli_config.h`.
Their default values were even conflicting.
Changes:
* Remove second define of `OPENTHREAD_CONFIG_CLI_BLE_SECURE_ENABLE`
(default value 0) in `cli_config.h` since it would have never
been reached.
Under interactive mode, the `ot-ctl` client treats lines starting with
"Error" as fatal command failures. It exits immediately and stop
receiving CLI output. As the `debug` command runs a sequence of
sub-commands; if one fails , the entire debug session would stop.
This change modifies the error prefix to "ERROR" for internal debug
commands, allowing ot-ctl to continue processing subsequent output.
Also, it adds an explicit `OutputLine("Done")` at the end of the debug
command processing to ensure the CLI client correctly detects the end
of the command.
This commit implements the BBR-TC-01 test case in the Nexus simulation
framework to verify that a Backbone Router (BBR) device automatically
sends its BBR dataset to the Leader if none exists in the network.
To support the Host receiving echo replies on its infrastructure
interface, the Nexus InfraIf class is extended to support custom
ICMPv6 Echo Reply handlers.
Key changes:
- Implement BBR-TC-01 C++ test case and Python verification script.
- Add EchoReplyHandler callback and registration to Nexus InfraIf.
- Update InfraIf::Receive to handle and dispatch ICMPv6 Echo Replies.
- Register 1_2_BBR_TC_1 in CMake and the test runner script.
This commit simplifies `MacCountersTlv` by replacing its individual
getter and setter methods with bulk operations:
- Adds an `Init()` method that takes a `Mac::Counters` to directly
populate the TLV fields from the MAC layer counters.
- Adds a `Read()` method to parse the TLV and populate a given
`NetworkDiagnostic::MacCounters` structure.
- Updates `NetworkDiagnostic::Server` and `Client` to use these new
methods, allowing the removal of their local helper methods
`AppendMacCounters()` and `ParseMacCounters()`.
- Introduces `Counters` as an alias for `otMacCounters` within the
`Mac` namespace.
This commit adds a new nexus test for MATN-TC-26: Multicast
registrations error handling by Thread Device.
The test verifies that a Thread Device correctly handles multicast
registration errors, such as when a Backbone Router (BBR) runs out of
resources or responds with a general failure.
Changes:
- Implemented test_1_2_MATN_TC_26.cpp to execute the test steps.
- Implemented verify_1_2_MATN_TC_26.py to verify pcap output.
- Updated CMakeLists.txt and run_nexus_tests.sh to include the
new test.
- Modified bbr_manager.cpp to correctly include failed addresses in
the MLR response when using configured error status for reference
devices.
The test ensures the DUT retries registration within the
Reregistration Delay after receiving an error and does not retry
if registration was successful until necessary.
This commit adds a new Nexus test case MATN-TC-23 to verify that a
Thread Device (DUT) automatically re-registers its multicast addresses
before the Multicast Listener Registration (MLR) timeout expires.
The test simulates a topology with two Border Routers (BR_1 and BR_2)
and a Thread Device (TD as DUT). BR_1 acts as the Primary Backbone
Router (BBR) and distributes a BBR Dataset with a configured MLR
timeout. The TD registers a multicast address and then automatically
sends a subsequent MLR.req to renew the registration before the
timeout period ends.
Implementation details:
- Added test_1_2_MATN_TC_23.cpp to execute the simulation using direct
method calls and 'note' log level.
- Added verify_1_2_MATN_TC_23.py to validate the MLR.req/rsp exchange
in the pcap output.
- Included the full test specification as inline comments in both
files, following strict indentation and formatting rules.
- Registered the new test in CMakeLists.txt and run_nexus_tests.sh.
This commit adds a new Nexus test case MATN-TC-22 to verify that a
Primary Backbone Border Router (BBR) that is configured with a low
value of Multicast Listener Registration (MLR) timeout
(< MLR_TIMEOUT_MIN) is interpreted as using an MLR timeout of
MLR_TIMEOUT_MIN by Thread Devices (DUT).
The test performs the following steps:
- Configures the Primary BBR (BR_1) with an MLR timeout of
MLR_TIMEOUT_MIN / 4.
- Verifies that the DUT registers a multicast address (MA1) at BR_1.
- Confirms that the DUT automatically re-registers for MA1 within
MLR_TIMEOUT_MIN seconds of the initial registration.
- Ensures that no more than 2 re-registrations occur within this time
period.
Included changes:
- New test implementation: test_1_2_MATN_TC_22.cpp.
- New verification script: verify_1_2_MATN_TC_22.py.
- Registration of the test in CMakeLists.txt and run_nexus_tests.sh.
The test implementation uses direct method calls in C++ and provides
step-by-step logging in both C++ and Python to match the test
specification.
This commit implements the MATN-TC-21 test case in the Nexus
simulation framework to verify that a Primary BBR correctly handles
incorrect or invalid multicast registrations from a Thread device.
Key implementation details include:
- Implementation of MATN-TC-21 in C++ simulating a topology with two
Border Routers (BR_1 as Primary/DUT, BR_2 as Secondary), a Thread
Router, and a Host.
- Verification of BR_1's handling of various invalid MLR registrations:
- Invalid unicast addresses (MAe1, MAe3) or unspecified address (MAe2).
- Link-local (MA6) and mesh-local (MA5) multicast addresses.
- Partial registration success when valid (MA1) and invalid (MA6)
addresses are mixed.
- Malformed IPv6 Addresses TLV with incorrect length (MAe4).
- Verification that only the Primary BBR (BR_1) accepts registrations,
while the Secondary BBR (BR_2) returns ST_MLR_BBR_NOT_PRIMARY.
- Addition of a Python verification script to validate:
- Correct error status codes in MLR responses (ST_MLR_INVALID,
ST_MLR_BBR_NOT_PRIMARY).
- Multicast forwarding from backbone to Thread for valid registrations.
- Handling of malformed TLVs by checking raw CoAP payloads.
- Inclusion of the full test specification as inline comments in
both the C++ and Python files.
- Registration of the new test case in tests/nexus/CMakeLists.txt
and tests/nexus/run_nexus_tests.sh.
This commit implements the MATN-TC-20 test case in the Nexus
simulation framework to verify that a Parent Router handling a
multicast registration on behalf of an MTD re-registers the
multicast address on behalf of its child before the MLR timeout
expires.
Key implementation details include:
- Implementation of the MATN-TC-20 test scenario in C++ simulating
a topology with a Router (DUT), a MED, and two Border Routers
(BR_1 as initial Primary BBR, BR_2 as Secondary BBR).
- Addition of a Python verification script to validate MLE Child
Update Request/Response exchanges and subsequent MLR.req CoAP
requests from the DUT to the Primary BBR.
- Verification that the DUT automatically re-registers the multicast
address when the MLR timeout is updated in the BBR Dataset.
- Inclusion of the full test specification as inline comments in
both the C++ and Python files, following strict formatting rules.
- Registration of the new test case in tests/nexus/CMakeLists.txt
and tests/nexus/run_nexus_tests.sh.
This commit introduces the `OPENTHREAD_CONFIG_IP6_INIT_EXT_ADDR_POOL_ENABLE`
configuration and the `otIp6Init()` API. When enabled, this feature
allows the OpenThread stack to use externally provided memory buffers for
its external unicast and multicast address pools.
By decoupling the pool sizes from build-time configurations
(`OPENTHREAD_CONFIG_IP6_MAX_EXT_UCAST_ADDRS` and
`OPENTHREAD_CONFIG_IP6_MAX_EXT_MCAST_ADDRS`), the OpenThread stack can be
compiled as a generic library without hardcoding the address pool sizes.
It delegates the memory allocation and configuration to the application
layer at run-time.
When the feature is enabled, `otIp6Init()` must be invoked to initialize
the `Netif` address pools before calling `otIp6SetEnabled()`.
This commit simplifies appending `ChannelPagesTlv` using the standard
`Tlv::Append<>()` with the the array of supported channel pages as
the TLV value.
In addition, a `ReadDiagData()` helper method is introduced in the
`NetworkDiagnostic::Client` to unify and simplify how `otNetworkDiagData`
arrays (e.g. `mNetworkData`, `mChannelPages`) are parsed and populated
from read TLVs.
This commit introduces the `MessageAllocator` template class using the
CRTP pattern to provide a unified implementation of the `NewMessage()`
methods. It standardizes the reserved header sizes for different
message types within `ReservedHeaderSize`. This removes boilerplate
code and redundant `NewMessage()` method implementations across the
`Ip6`, `Icmp`, `Udp`, `Udp::Socket`, and `CoapBase` classes.
This commit implements the Thread 1.2 test MATN-TC-19: Multicast
registration by MTD in the Nexus simulation framework. The test
verifies that an MTD can correctly register multicast addresses
through a parent Thread Router and receive multicast traffic from
the backbone.
Key implementation details:
- Created test_1_2_MATN_TC_19.cpp to simulate the network topology
(BR_1, BR_2, Router, MTD, and Host) and execute the test steps
using direct method calls.
- Implemented verify_1_2_MATN_TC_19.py for PCAP-based verification
of MLE Child Update exchanges, MLR registrations, and multicast
ICMPv6 Echo Request/Reply forwarding.
- Configured the test to use Note log level and included 1-line
log output for each step to match existing Nexus tests.
- Integrated the new test into the Nexus build system via
CMakeLists.txt and added it to the default test execution list
in run_nexus_tests.sh.
This commit adds a new Nexus test case MATN-TC-16 to verify that the
Primary Backbone Border Router (BBR) can handle a large number of
multicast group subscriptions.
The test performs 75 multicast registrations in 5 batches of 15
addresses each. It verifies the following behavior:
- The BBR correctly processes Multicast Listener Registration (MLR)
requests and returns a success status.
- Multicast packets sent to registered addresses on the backbone are
successfully forwarded to the Thread network.
- Multicast packets sent to unregistered addresses are not forwarded.
To accommodate the requirements of this test, Nexus configuration
limits are increased:
- OPENTHREAD_CONFIG_IP6_MAX_EXT_MCAST_ADDRS is increased from 4 to 80.
- The mTestVars array in Nexus Core is increased from 16 to 128
entries to support storing all multicast addresses for verification.
Included changes:
- New test files: test_1_2_MATN_TC_16.cpp and verify_1_2_MATN_TC_16.py.
- Registration of the test in CMakeLists.txt and run_nexus_tests.sh.
- Configuration updates in openthread-core-nexus-config.h and
nexus_core.hpp.
This commit implements the MATN-TC-15 test case in the Nexus simulation
framework to verify that a Thread End Device detects a change of Primary
Backbone Router (BBR) and triggers a re-registration of its multicast
groups.
Key implementation details include:
- Implementation of MATN-TC-15 in C++ simulating a topology with two
Border Routers (BR_1 and BR_2), a Thread Router, and a Thread End
Device (TD as DUT).
- Simulation of Primary BBR failover by stopping BR_1 and waiting for
BR_2 to become the new Primary BBR.
- Addition of a Python verification script to validate:
- Detection of Primary BBR change by the DUT.
- Multicast Listener Registration (MLR.req) sent by the DUT to BR_2.
- Correct forwarding of MLR.req and MLR.rsp by the intermediate
Thread Router.
- Successful registration response (MLR.rsp) from BR_2 to the DUT.
- Inclusion of the full test specification as inline comments in both
the C++ and Python files.
- Registration of the new test case in tests/nexus/CMakeLists.txt and
tests/nexus/run_nexus_tests.sh.
This commit implements the MATN-TC-12 test case in the Nexus
simulation framework to verify that a Primary BBR correctly
decrements the IPv6 Hop Limit when forwarding multicast packets
between the backbone link and the Thread network.
Key implementation details include:
- Implementation of MATN-TC-12 in C++ simulating a topology with a
Border Router (BR_1 as DUT), a Thread Router, and a Host.
- Enhancement of the Nexus platform to support hop limit processing:
- Updated InfraIf::Receive to decrement Hop Limit when forwarding
from the backbone to the Thread network.
- Updated Node::HandleReceive to decrement Hop Limit when forwarding
from the Thread network to the backbone.
- Added support for simulating packets with Hop Limit 0 by setting
mAllowZeroHopLimit in Node::SendEchoRequest.
- Addition of a Python verification script to validate:
- Multicast forwarding from backbone to Thread with decrement.
- Multicast forwarding from Thread to backbone with decrement.
- Dropping of packets with Hop Limit 1 (or 0) during forwarding.
- Use of unique ICMPv6 identifiers to reliably distinguish between
pings in different test steps.
- Inclusion of the full test specification as inline comments in
both the C++ and Python files.
- Registration of the new test case in tests/nexus/CMakeLists.txt
and tests/nexus/run_nexus_tests.sh.
This commit implements the MATN-TC-10 test case in the Nexus
simulation framework to verify that a Secondary BBR correctly
takes over forwarding of outbound multicast transmissions when
the Primary BBR fails, specifically focusing on BBR Dataset
distribution and MLDv2/BMLR registration behavior.
Key implementation details include:
- Implementation of the MATN-TC-10 test scenario in C++ simulating
a topology with two Border Routers (BR_1 as initial Primary,
BR_2 as Secondary/DUT), a Router, and a Host.
- Verification that BR_2 takes over as the Primary BBR and Leader
after BR_1 is stopped.
- Validation of BBR Dataset (PBBR) presence in Network Data.
- Addition of a Python verification script to validate:
- Multicast ping reachability.
- Correct BBR Dataset distribution.
- Outbound multicast registration (BMLR/MLDv2) on the backbone.
- Use of explicit multicast re-subscription in Step 14 to ensure
observable registration traffic within the simulation window.
- Robust packet filters for BMLR (port 61631) and MLDv2 to handle
platform-specific dissection variances.
- Inclusion of the full test specification as inline comments in
both the C++ and Python files.
- Registration of the new test case in tests/nexus/CMakeLists.txt
and tests/nexus/run_nexus_tests.sh.
This commit implements the MATN-TC-09 test case in the Nexus
simulation framework to verify that a Secondary BBR correctly
takes over forwarding of outbound multicast transmissions when
the Primary BBR fails.
Key implementation details include:
- Implementation of the MATN-TC-09 test scenario in C++ simulating
a topology with two Border Routers (BR_1 as initial Primary,
BR_2 as Secondary/DUT) and a Thread Router.
- Verification that BR_2 takes over as the Primary BBR and Leader
after BR_1 is stopped.
- Addition of a Python verification script to validate that only
the Primary BBR forwards outbound multicast packets to the
backbone link.
- Use of distinct ICMPv6 identifiers to reliably distinguish
between multicast pings sent before and after the Primary BBR
failure.
- Inclusion of the full test specification as inline comments in
both the C++ and Python files.
- Registration of the new test case in tests/nexus/CMakeLists.txt
and tests/nexus/run_nexus_tests.sh.
This commit implements the MATN-TC-07 test case in the Nexus
simulation framework to verify default multicast forwarding
behavior on Border Routers.
Key implementation details include:
- Implementation of the MATN-TC-07 test scenario in C++ to
trigger various multicast ping requests across different
IPv6 scopes (realm-local, admin-local, site-local, global,
and link-local).
- Enhancement of the Python verification script to strictly
validate that only the Primary BBR forwards multicast
packets to the backbone link using Ethernet source address
filtering.
- Support for Ethernet link type in Nexus PCAP generation by
prepending Ethernet headers to infrastructure IPv6 packets.
- Exposure of infrastructure MAC addresses (ethaddrs) in the
test information JSON to enable identification of the
forwarding node on the backbone link.
- Support for verifying source addresses of MPL-encapsulated
multicast packets by checking both outer and inner headers.
- Addition of FindGlobalAddress() helper in the Nexus node
platform.
Implement Thread 1.2 test MATN-TC-05: Re-registration to same Multicast
Group. This test verifies that a Primary Backbone Router (BBR)
correctly manages multicast address re-registration and handles UDP
multicast traffic between the backbone and Thread network.
Key additions:
- Added SendUdp to Nexus InfraIf to support simulated UDP multicast
traffic from backbone hosts.
- Implemented test_1_2_MATN_TC_5.cpp to simulate the network topology
(DUT, BR_2, Router, and Host) and the test steps.
- Implemented verify_1_2_MATN_TC_5.py for pcap-based verification of
multicast forwarding and BBR timeout behavior.
- Integrated the new test into the Nexus build system and the default
test execution script.
This commit simplifies how the SNTP request message is allocated and
constructed in `Client::Query()`. It removes the `NewMessage()`
helper method, replacing its use with a direct message allocation from
the socket followed by `Append()` to add the header. It also updates
the error cleanup path to use the `FreeMessage()` macro.
This commit moves the definitions of `MplOption`, `UdpHeader`,
`TcpHeader`, and `Icmp6Header` from their module-specific headers into
`net/ip6_headers.hpp`. The original class definitions in `Ip6::Udp`,
`Ip6::Tcp`, and `Ip6::Icmp` are replaced with `typedef` aliases to
maintain internal compatibility.
This consolidation centralizes IPv6 protocol header definitions,
ensuring that all header sizes are available when allocating or
cloning messages. This allows for calculating the proper reserved
header length in `NewMessage()`.
This commit updates `tests/unit/test_tcat.cpp` to properly handle the
`Error` return value from `NetworkName::Set()`, resolving compiler
warnings about unhandled return types.
In `TestInitInstanceTcat()`, `IgnoreError()` is used when setting
default test values since `NetworkName::Set()` returns `kErrorNone`
or `kErrorAlready` when the same name is set again.
Add MATN-TC-04 test case to verify that a Primary BBR removes a
multicast listener entry when it expires by timeout.
- Add test_1_2_MATN_TC_4.cpp implementing the simulation of two
Border Routers (BR_1 as Primary BBR, BR_2), a Router, and a Host.
- Verify that a registered multicast address expires after the
configured MLR timeout and that the BBR stops forwarding traffic
to the group.
- Verify that a new registration to the same group is accepted
after the previous one has expired.
- Use direct method calls for BBR configuration and management.
- Add verify_1_2_MATN_TC_4.py for automated packet verification.
- Fix a loopback issue in nexus_core.cpp where infra-if packets
were being delivered back to the sender.
- Register the new test case in tests/nexus/CMakeLists.txt and
tests/nexus/run_nexus_tests.sh.
Add MATN-TC-03 test case to verify that a Primary Backbone Router
(BBR) correctly handles Multicast Listener Registration (MLR)
requests and ignores a Timeout TLV when it is not sent by a
Commissioner.
- Add test_1_2_MATN_TC_3.cpp implementing the simulation of two
Border Routers (BR_1 as Primary BBR, BR_2), a Router, and an
external Host on the backbone.
- Verify that a Router can successfully register a multicast address.
- Verify that a Router attempting to deregister a multicast address
by sending an MLR.req with a Timeout TLV of 0 (without a
Commissioner Session ID) is handled correctly by the PBBR.
- Verify that the PBBR responds with Success and continues to
forward multicast traffic to the registered address, effectively
ignoring the invalid Timeout TLV.
- Add verify_1_2_MATN_TC_3.py for automated packet verification of
the test scenario.
- Register the new test case in tests/nexus/CMakeLists.txt and
tests/nexus/run_nexus_tests.sh.
Add MATN-TC-02 test case to verify Multicast Listener Registration
(MLR) and multicast traffic forwarding between a Thread network and
an infrastructure link (backbone).
- Add test_1_2_MATN_TC_2.cpp implementing the simulation of two
Border Routers (BR_1 as Primary BBR, BR_2), a Thread Device (TD),
and an external host on the backbone.
- Verify TD registration of multicast addresses at BR_1 via MLR.req.
- Verify BR_1 responses and backbone notifications (BMLR.ntf).
- Verify successful forwarding of multicast ICMPv6 Echo Requests
from the backbone to the Thread network by the Primary BBR.
- Verify that non-Primary BBRs and BBRs without active registrations
do not forward multicast traffic.
- Add verify_1_2_MATN_TC_2.py for automated packet verification of
the test scenario.
- Register the new test case in tests/nexus/CMakeLists.txt and
tests/nexus/run_nexus_tests.sh.
Add MATN-TC-01 test case to verify that a Primary BBR by default
blocks IPv6 multicast traffic from the backbone to the Thread
network when no devices have registered for the multicast groups.
- Add test_1_2_MATN_TC_1.cpp implementing the simulation of a
Border Router (BR_1 as Primary BBR), a Thread Router, and an
external host on the backbone.
- Send ICMPv6 Echo Requests from the backbone host to various
multicast addresses (admin-local, site-local, global, and
link-local).
- Add verify_1_2_MATN_TC_1.py for automated packet verification
to ensure the DUT (BR_1) does not forward these multicast
packets to its Thread Network.
- Register the new test case in tests/nexus/CMakeLists.txt and
tests/nexus/run_nexus_tests.sh.
Implement the InfraIf class and associated platform logic to simulate
a shared infrastructure link (backbone) between Border Routers and
external hosts within the Nexus simulation environment.
Infra interface simulation:
- Implement shared Ethernet-like link for IPv6 traffic delivery.
- Add automated SLAAC address configuration based on ICMPv6 RAs.
- Support sending/receiving ICMPv6 Neighbor Discovery (RS, RA, NS, NA).
- Implement manual ICMPv6 checksum calculation for raw packets.
- Add infrastructure-level loop prevention and destination filtering.
- Provide helper methods to find nodes by infrastructure addresses.
Platform integration:
- Implement otPlatInfraIf APIs and integrate with otInstance.
- Use native Message and MessageQueue for pending traffic management.
- Add support for custom test variables in SaveTestInfo() JSON output.
- Update Node::Reset() to properly clear pending infra interface tasks.
Core enhancements:
- Add MulticastListenersTable::Has() to check for address presence.
- Add PrefixInfoOption::GetPrefixLength() and SetPrefixLength().
- Enable MLR and Backbone Router multicast routing in Nexus config.
This commit introduces `CoapBase::SendAckResponseIfUnicastRequest()`,
which sends an ACK response with a CoAP Code mapped from an `Error`
value, provided the original request was confirmable and not sent to
a multicast address. It also adds `Message::MapErrorToCoapCode()` to
handle the translation of common `Error` types into their appropriate
CoAP Code equivalents (e.g., `kErrorBusy` to `kCodeServiceUnavailable`,
or `kErrorParse` to `kCodeBadRequest`).
The TMF handlers in `AnnounceBeginServer`, `EnergyScanServer`, and
`PanIdQueryServer` are updated to use this new method. Additionally,
all three servers now explicitly reject new requests with `kErrorBusy`
if they are already running an active scan or announce operation. The
state tracking in `PanIdQueryServer` (`mIsRunning`) is also added
to correctly check its running state when starting a query.
This commit updates the `CoapBase::Request` class to encapsulate its
internal state. The `mMessage` pointer and `mMetadata` struct are
now private, and their properties are accessed and modified through
explicit getter and setter methods (e.g., `GetMessage()`,
`IsConfirmable()`, `MarkAsAcknowledged()`).
By doing so, the code that manages pending requests no longer directly
manipulates the internal metadata fields, improving code structure and
maintainability.
Extend the pktverify framework to handle Raw IPv6 packets and parse CoAP
TLVs:
- Add support for verifying Raw IPv6 packets (DLT_RAW) captured on the
infrastructure link.
- Implement parsing for CoAP TLVs used in Multicast Listener
Registration (MLR) and Backbone MLR (BMLR) messages.
- Clean up magic numbers and improve summary output for better
traceability in test reports.
Enhance the Nexus Pcap class to support the pcapng format and logging from
multiple interfaces:
- Transition from pcap to pcapng format to support multiple interface
descriptions in a single capture file.
- Add support for logging both IEEE 802.15.4 (Thread) and Raw IPv6
(Backbone) traffic.
- Implement Interface Description Blocks (IDB) and Enhanced Packet
Blocks (EPB) for pcapng compliance.
This commit updates the following `otPlatInfraIf` platform APIs to
include an `otInstance *` as their first parameter:
- `otPlatInfraIfHasAddress()`
- `otPlatInfraIfSendIcmp6Nd()`
- `otPlatInfraIfDiscoverNat64Prefix()`
Other APIs under `otPlatInfraIf` already follow this pattern. Passing
the `otInstance` pointer is the required standard for all platform
and public APIs; however, it was missed during the initial design of
these specific APIs.
While missing this parameter is often not a blocker on platforms using
a single OpenThread instance, it has become a blocker for simulations,
especially when multiple Border Routers are emulated in the same
simulation setup.
This change introduces a compatibility break for existing platform
implementations, however, it is necessary to support new use cases
(simulation of BRs). It also helps ensure consistent API design
across the stack.
This commit simplfies `thread/uri_paths.cpp` by introducing the
`UriEntryMapList` X-Macro. This macro centralizes the mapping
between the URI path string, its `kUri*` enum value and its string
name representation used in `UriToString()`.
By using this macro, we avoid redundant lists and manual template
specializations. The `kEntries[]` array, the compile-time assertions
validating the sorting of the array, and the `UriToString<>()`
template specializations are now all automatically generated from
this single list, improving maintainability and reducing the chance
of mismatches.
This change updates the `PrevRoleRestorer` logic to use an increasing
timeout when a non-sleepy device sends `Child Update Request`
messages to restore its previous child role.
The timeout starts at 4 seconds and doubles with each subsequent
retransmission. This strategy is designed to handle scenarios where
the parent may also be restarting, such as after a network-wide power
outage, by allowing more time for the parent to recover. Over four
attempts, the device waits a total of 29 seconds (4 + 8 + 16 + 1)
before abandoning the restoration process.
Sleepy devices continue to use a short and fixed 1-second timeout
between retransmissions.
Additionally, if the restoring child receives a Child Update Request
from its former parent, it switches back to the shorter 1-second
timeout to expedite the restoration process and allow at least
two more Child Update attempts.
This commit updates the Nexus test framework to use the pcapng format
for packet capture instead of the legacy pcap format.
The pcapng format provides several advantages over legacy pcap,
most importantly the ability to support multiple interface captures
within a single file. This change prepares the Nexus framework for
more comprehensive border router testing, where capturing traffic
from both the Thread (802.15.4) and infrastructure (Ethernet)
interfaces simultaneously is required.
Changes:
- Implemented Section Header Block (SHB) and Interface Description
Block (IDB) in Pcap::Open.
- Updated Pcap::WriteFrame to use Enhanced Packet Block (EPB).
- Added proper 32-bit alignment padding for EPB records as required
by the pcapng specification.
- Updated the test runner script to use the .pcapng extension.
This commit updates `EnergyScanServer` to use `Tlv::StartTlv()` and
`Tlv::EndTlv()` when constructing the Energy List TLV for the report
message. By leveraging a `Tlv::Bookmark` (`mEnergyListTlvBookmark`),
the server no longer needs to manually track the number of scan
results (`mNumScanResults`) and calculate the exact offset to update
the TLV length.
Furthermore, `Tlv::EndTlv()` automatically manages the conversion to
an Extended TLV if the payload size exceeds the maximum length of a
standard TLV (255 bytes).
This commit updates `Commissioner::HandleTmf<kUriEnergyReport>()` to
read the energy list data directly into a local array instead of
using a dedicated TLV class.
The report handler now uses `Tlv::FindTlvValueOffsetRange()` to locate
the TLV value, which works correctly whether the TLV is encoded as a
standard or extended TLV. With this change, the `EnergyListTlv` class
definition is replaced with a simple typedef to `TlvInfo`.
This commit introduces a new `TlvTypeListIterator` helper class in
the network diagnostic `Server` to simplify the parsing of Type List
TLVs. This iterator handles deduplication of requested TLV types
using a `BitSet` and centralizes the offset management and iteration
logic.
The iterator is now used in `AppendRequestedTlvs()`,
`AppendRequestedTlvsForTcat()`, `PrepareAndSendAnswers()`, and
`HandleTmf<kUriDiagnosticReset>()`, replacing redundant manual
iteration and deduplication code.
Additionally, the `TypeListTlv` definition is simplified to a
`typedef` of `TlvInfo`, as the dedicated class structure is no
longer needed.
This commit fixes a logic error in the TCP receive buffer reassembly
logic. The issue occurred when an out-of-order segment was exactly
the size of the circular buffer and the write index was non-zero.
The original logic incorrectly used modulo-wrapped indices to check
if a write should be contiguous or split:
start_index + numbytes % size. When numbytes == size, end_index ==
start_index, which evaluates to true, leading to an incorrect memory
write if start_index > 0.
This commit updates the check to use the absolute write boundary:
if (start_index + numbytes <= chdr->size). This ensures that any
write spanning the buffer boundary is correctly split.
A regression test test_cbuf_reass_boundary is added to test_all.c
to verify the fix and prevent future regressions. The test Makefile
is also updated to use $(CC) for better portability.
This commit improves the robustness of CoAP option parsing by adding
rigorous validation checks to prevent potential overflows and null
pointer dereferences.
Summary of changes:
1. In 'ReadExtendedOptionField()', added an overflow check when
calculating extended lengths for 2-byte extensions. It now returns
'kErrorParse' if the value would exceed the 16-bit range.
2. In 'ReadBlockOptionValues()', added a check to ensure the block
option exists before accessing it. This prevents a crash when
'GetOption()' returns null.
3. In 'ReadBlockOptionValues()', added length validation to ensure the
option value does not exceed the local buffer size (5 bytes) before
copying.
4. Added a new unit test 'test_coap_overflow' to verify these validation
checks and ensure they correctly handle malformed or missing options.
This commit introduces a maximum recursion depth limit for 6LoWPAN
decompression to prevent potential stack exhaustion from maliciously
crafted frames with deep IPv6-in-IPv6 encapsulation.
- Added a private constant kMaxRecursionDepth in the Lowpan
class to define the maximum allowed recursion depth.
- Updated Lowpan::Decompress() to track and validate the current
recursion depth, returning kErrorParse if the limit is exceeded.
- Added a new unit test TestLowpanDecompressRecursion in
tests/unit/test_lowpan.cpp to verify the recursion limit and
ensure it correctly handles both excessive and legitimate
encapsulation levels.
This commit simplifies and updates `Ip6::DetermineAction()` regarding
how the `aForwardThread` flag is determined for multicast messages
with a scope larger than realm-local.
Such messages are sent using IP-in-IP encapsulation destined to the
`RealmLocalAllMplForwarders` address. Both the encapsulated
(outer) and embedded (inner) messages are processed. When processing
the embedded IPv6 message, regardless of its origin, we only need to
forward it to the Thread mesh if the device has a sleepy child
subscribed to the multicast address. `MeshForwarder::SendMessage()`
on an FTD will then check for these subscriptions and schedule
indirect transmissions to those children.
The behavior for FTDs remains functionally the same as before, though
the code has been refactored to be clearer and easier to follow.
The primary change applies to MTDs: if the multicast destination scope
is larger than realm-local, the message is no longer forwarded to
Thread, as an MTD cannot have any children to support.
This commit reorganizes the member variables in the `Commissioner`
class, ordering them to optimize memory packing. Additionally, it
shortens the local typedef names for callback function pointers, such
as renaming `otCommissionerEnergyReportCallback` to the more concise
`EnergyReportCallback`, improving overall readability. Finally, it
aligns parameter formatting in method signatures like
`SendEnergyScanQuery()` and `SendPanIdQuery()`.
This commit updates `EnergyScanServer::HandleTmf<kUriEnergyScan>()`
to use a local `OwnedPtr<Coap::Message>` when allocating and preparing
the initial energy report message. Previously, the method directly
modified `mReportMessage`, potentially leaving the object in an
inconsistent state or leaking memory if subsequent `Append()` operations
failed and exited early.
By building the message in a local `newMessage` first and only taking
ownership using `PassOwnership()` after all operations succeed, we
ensure the server's internal state remains consistent.
This commit updates the `CoapBase::Receive()` and
`CoapBase::ProcessReceivedResponse()` methods to utilize early returns
via `ExitNow()` and `VerifyOrExit()`. By doing so, it flattens the
nested conditional logic and improves the overall readability of the
code.
As a result of this change in `CoapBase::Receive()`, an invalid
message that fails CoAP header parsing will exit early, correctly
skipping the `Utils::Otns::EmitCoapReceive()` signal.
This commit updates the central CoAP resource handlers in TMF agents
(`Agent::HandleResource`, `BackboneTmfAgent::HandleResource`, and
`Manager::CoapDtlsSession::HandleResource`) to verify that the
incoming request method is a POST request. If the URI is recognized
but the method is not POST, a `kCodeMethodNotAllowed` response is
now sent.
Since all TMF requests are now guaranteed to be POST requests before
reaching their specific handlers, the `IsPostRequest()` checks in
individual handlers are removed. Additionally, the
`IsConfirmablePostRequest()` and `IsNonConfirmablePostRequest()`
helper methods in `Coap::Message` are removed and their usages are
simplified to `IsConfirmable()` and `IsNonConfirmable()` in the
respective handlers.
This commit removes several thread-cert Python tests that are now
covered by the Nexus test framework. Nexus provides more efficient
and reliable testing for these scenarios.
The following tests are removed:
- Cert_8_1_01_Commissioning.py
- Cert_8_1_02_Commissioning.py
- Cert_8_1_06_Commissioning.py
- Cert_8_2_01_JoinerRouter.py
- Cert_8_2_02_JoinerRouter.py
- Cert_8_2_05_JoinerRouter.py
- Cert_8_3_01_CommissionerPetition.py
This commit adds Nexus test 1.1.8.2.2, "On Mesh Commissioner Joining
with JR, any commissioner, single (incorrect)". This test verifies
that the Commissioner correctly handles a relayed DTLS handshake
from a Joiner using an incorrect PSKd.
The test verifies that:
- The Joiner, Joiner Router, and Commissioner correctly exchange
relayed DTLS handshake records (ClientHello, HelloVerifyRequest,
ServerHello, etc.) via RLY_RX.ntf and RLY_TX.ntf messages.
- The Commissioner detects the incorrect PSKd after receiving the
Client Finished message.
- The Commissioner responds with a DTLS-Alert (handshake failure
or bad record MAC) relayed through the Joiner Router via a
RLY_TX.ntf message.
- The session is correctly terminated without fatal alerts before
the expected handshake failure.
Changes:
- Added tests/nexus/test_1_1_8_2_2.cpp to implement the test logic,
using direct internal method calls and note-level logging.
- Added tests/nexus/verify_1_1_8_2_2.py to verify the captured
pcap traffic, adhering to specified formatting and fail conditions.
- Updated tests/nexus/CMakeLists.txt and tests/nexus/run_nexus_tests.sh
to include the new test.
This commit adds Nexus test 1.1.8.3.1, "On Mesh Commissioner -
Commissioner Petitioning, Commissioner Keep-alive messaging, Steering
Data Updating and Commissioner Resigning". This test verifies that
a Commissioner Candidate can register itself to the network, send
periodic keep-alive messages, update steering data, and unregister
itself.
The test verifies that:
- The Commissioner correctly sends a LEAD_PET.req to the Leader.
- The Leader responds with a LEAD_PET.rsp and propagates
Commissioning Data in its Network Data.
- The Commissioner sends periodic LEAD_KA.req messages to maintain
its active state.
- The Commissioner can update Steering Data via a
MGMT_COMMISSIONER_SET.req message, and the Leader correctly
propagates this update in the Network Data.
- The Commissioner can unregister itself by sending a LEAD_KA.req
with a Reject state, which the Leader accepts.
- The Leader increments the Commissioner Session ID when a new
Commissioner session is started.
Changes:
- Added tests/nexus/test_1_1_8_3_1.cpp to implement the test logic,
using direct internal method calls and note-level logging.
- Added tests/nexus/verify_1_1_8_3_1.py to verify the captured
pcap traffic, following specified formatting and verification rules.
- Updated tests/nexus/CMakeLists.txt and tests/nexus/run_nexus_tests.sh
to include the new test.
This commit removes the `android-ndk` platform support from the
`script/cmake-build` script and deletes the associated CI job from
the GitHub Actions workflow.
The `android-ndk` build was used to verify OpenThread compatibility
with the Android NDK. However, since OpenThread is now officially
included in the Android platform, maintaining a separate NDK-based
build in this repository is no longer necessary.
Changes:
- Remove `android-ndk` from `OT_PLATFORMS` in `script/cmake-build`.
- Remove NDK-specific configuration logic in `script/cmake-build`.
- Remove the `android-ndk` job from `.github/workflows/build.yml`.
This commit simplifies `CoapBase::SendMessage()` by updating how
outgoing requests are processed and added to the pending request
queue.
The logic to determine the clone length (full message for
confirmable, header only for non-confirmable), initialize request
metadata, and process observe options is moved from `SendMessage()`
into the updated `PendingRequests::Add()` method (previously
`AddClone()`). This encapsulates the request preparation logic
closer to where the request is queued.
Update the `GetType()` methods to return the `Type` enumeration
instead of a raw `uint8_t`. This improves type safety and clarifies
the return type for callers. The `mType` member variable is also
updated from `uint8_t` to `Type`.
Generally, when parsing header fields, we do not map the value directly
to an `enum` since the enum may not cover all possible values present in
a received header. However, in this case, the `Type` field in the CoAP
header is a 2-bit value, and all four possible values are explicitly
defined and accounted for in the `Type` enumeration. Therefore, we can
safely cast the read bits to the `Type` enum.
This commit updates several method names in `CoapBase` to better align
with RFC 7252 terminology and clarify their behavior.
Previously, the term "empty" was used ambiguously to mean either a
message with Code 0.00 (`kCodeEmpty`) or a message that lacked a
payload but contained a response code. For example, `SendEmptyAck()`
sent an ACK (`kTypeAck`) message that actually contained a non-zero
response code (e.g., `kCodeChanged`), which is a "response" message
per the RFC, not an "empty" message.
To address this:
- `SendReset()` and `SendAck()` are removed in favor of using
`SendEmptyMessage()` directly with `kTypeReset` or `kTypeAck`.
This restricts the use of "Empty" strictly to Code 0.00 messages.
- `SendHeaderResponse()` is renamed to `SendResponse()` to clarify
that it dynamically sends a response without a payload.
- `SendEmptyAck()` is renamed to `SendAckResponse()` to indicate it
sends a piggybacked ACK `kTypeAck` response without a payload.
- `SendNotFound()` is replaced with a direct call to `SendResponse()`
using `kCodeNotFound`.
- Documentation comments for these methods are updated to explain
their purpose and requirements clearly.
- Callers across the core modules are updated to use the new method
names.
This commit adds Nexus test 1.1.8.2.1, "On Mesh Commissioner Joining
with JR, any commissioner, single (correct)". This test verifies that
the Joiner Router (DUT) correctly relays DTLS traffic between a Joiner
and an on-mesh Commissioner via RLY_RX.ntf and RLY_TX.ntf messages. It
also verifies that the JOIN_ENT.ntf message is encrypted with the KEK.
Changes:
- Added tests/nexus/test_1_1_8_2_1.cpp to implement the test logic,
including DTLS key exporting for traffic decryption.
- Added tests/nexus/verify_1_1_8_2_1.py to verify the captured traffic
using pktverify, ensuring correct relaying and encryption.
- Updated tests/nexus/verify_utils.py to support parsing Joiner-related
CoAP TLVs (DTLS Encap, UDP Port, IID, Locator, KEK) and to handle
16-bit TLV lengths.
- Integrated the test into the build system and test runner via
tests/nexus/CMakeLists.txt and tests/nexus/run_nexus_tests.sh.
This commit adds Nexus test 1.1.8.1.6, "On-Mesh Commissioner Joining,
no JR, wrong Commissioner". This test verifies that an on-mesh
Commissioner correctly rejects a Joiner when the Provisioning URL in
the JOIN_FIN.req message is not recognized.
The test verifies the following sequence:
- Successful MLE Discovery and DTLS handshake between Joiner and
Commissioner.
- Joiner sends a JOIN_FIN.req containing an unrecognized
Provisioning URL.
- Commissioner responds with a JOIN_FIN.rsp with Reject state.
- Commissioner sends an encrypted JOIN_ENT.ntf message.
- Joiner responds with an encrypted JOIN_ENT.ntf dummy response.
- Joiner terminates the DTLS session with a close_notify alert.
Changes include:
- Implemented C++ test logic in tests/nexus/test_1_1_8_1_6.cpp.
- Implemented Python verification logic in tests/nexus/verify_1_1_8_1_6.py.
- Configured DTLS key exporting in the test to allow decryption and
verification of CoAP messages in tshark.
- Updated tests/nexus/CMakeLists.txt and tests/nexus/run_nexus_tests.sh
to include the new test.
This commit adds Nexus test 1.1.8.1.2, "On-Mesh Commissioner Joining,
no JR, any commissioner, single (incorrect)". This test verifies that
the DUT (on-mesh Commissioner) correctly detects and handles a Joiner
using an incorrect PSKd.
The test verifies that:
- The Commissioner and Joiner correctly perform the initial DTLS
handshake up to the Client Finished message.
- The Commissioner detects the incorrect PSKd used by the Joiner.
- The Commissioner responds with a DTLS Alert (handshake failure or
bad record MAC) and terminates the session.
Changes include:
- Implemented C++ test logic in tests/nexus/test_1_1_8_1_2.cpp.
- Implemented Python verification logic in tests/nexus/verify_1_1_8_1_2.py,
which uses exported DTLS keys to decrypt and verify the handshake.
- Added code to export DTLS session keys from the Joiner node to
facilitate decryption of the Finished record in tshark.
- Added the new test to tests/nexus/CMakeLists.txt and
tests/nexus/run_nexus_tests.sh.
This commit renames the low-level `Send()` method in `CoapBase` to
`Transmit()` to clearly differentiate it from the higher-level message
construction and scheduling logic of `SendMessage()`. The `Sender`
function pointer type and member have also been renamed to
`Transmitter` and `mTransmitter`, respectively, to align with the new
terminology.
Using `Transmit()` clearly communicates the action of handing off a
fully prepared CoAP datagram to the underlying transport layer for
transmission, resolving the naming ambiguity with `SendMessage()`.
This establishes a symmetric "Transmit/Receive" boundary between the
CoAP layer and the transport layer.
This commit addresses occasional failures in Nexus Test 1.1.8.1.1 by
improving simulation timing and packet verification robustness.
Changes:
- Increased kJoiningProcessTime from 30s to 60s in the C++ test to
provide a larger buffer for the joiner process to complete.
- Added a 1s delay after calling AddJoinerAny() to ensure the leader
processes the steering data update before discovery starts.
- Refactored the Python verification script to use pkts.copy() for
independent message exchanges (JOIN_ENT and DTLS Alert). This
allows the script to handle timing variations and out-of-order
packets in the simulated capture.
- Corrected the NM_PROVISIONING_URL_TLV constant to 32.
- Added dtls.alert_message.level to the pktverify library to enable
verification of DTLS alert severity levels.
This test was occasionally failing due to tight timing constraints.
The wait times after SSED-initiated messages were too short, causing
the CSL timer age verification to fail if the message delivery took
longer than expected.
This commit increases the wait times from 500ms to 1000ms and relaxes
the allowed CSL timer age in the verification helper to match.
This commit adds Nexus test 1.1.8.1.1, "On-Mesh Commissioner Joining, no
JR, any commissioner, single (correct)". This test verifies the MLE
discovery, DTLS handshake, and CoAP message exchange between an on-mesh
Commissioner and a Joiner.
Changes include:
- Enhanced MeshCoP::SecureTransport to support DTLS key exporting by
adding a KeylogCallback and SetKeylogCallback method.
- Exposed HandleMbedtlsExportKeys as a public method in
SecureTransport to facilitate key logging.
- Refactored SecureTransport to use named constants for internal
buffer sizes and avoid magic numbers.
- Implemented C++ test logic in tests/nexus/test_1_1_8_1_1.cpp which
uses the new key logging callback to save DTLS keys to a file.
- Implemented Python verification logic in
tests/nexus/verify_1_1_8_1_1.py which uses the exported keys to
decrypt and verify the captured network traffic.
- Used named constants and helper classes (e.g. Time) in the test
implementation and verification script to improve readability and
maintainability.
- Added the new test to tests/nexus/CMakeLists.txt and
tests/nexus/run_nexus_tests.sh.
This commit removes several legacy Python-based certification tests for
Low Power (CSL) and Thread 1.2 features, as they have been migrated to
the Nexus test framework.
Specifically, the following tests and their associated CI workflows
(including packet verification for low power) are removed:
- CSL Transmission and Timeout
- Enhanced Frame Pending and Keep-Alive
- Single Probe and Forward Tracking Series Link Metrics
- SSED Attachment and Parent Selection
The removal of these scripts from tests/scripts/thread-cert/ and
the corresponding GitHub Action workflows reduces CI overhead while
maintaining coverage through the more scalable Nexus tests.
The packet verification script for Nexus Test 1.1.5.6.2 occasionally
failed because it expected a CoAP ACK followed by an MLE Data Response
in a specific order. Since both packets are triggered by the same
Server Data Notification event, their relative order in the PCAP can
vary.
This commit updates the script to use `pkts.copy()` when searching for
the CoAP ACK. This allows the verification to find the ACK regardless
of whether it appears before or after the MLE Data Response, making
the test more robust.
This commit updates the pyshark dependency to version 0.6 and adapts the
packet verification logic to accommodate changes in pyshark's internal
API and field mapping.
Specifically, this commit:
- Updates requirements.in and requirements.txt to pyshark 0.6.
- Adjusts pktverify and Nexus utility scripts to use the restructured
pyshark API, importing BaseLayer from pyshark.packet.layers.base
instead of the deprecated pyshark.packet.layer.Layer.
- Updates verify_1_2_LP_5_3_8.py to utilize wpan.channel for channel
filtering instead of wpan_tap.ch_num, ensuring consistency with other
Nexus tests and improving verification reliability.
This commit implements Nexus test 1.2.LP.7.2.2 to verify that the
DUT (Leader) can successfully support a minimum of 6 simultaneous
children (3 SEDs and 3 SSEDs) performing link metrics operations.
Specifically, the test verifies that:
- The DUT correctly handles simultaneous Forward Series Link Metrics
Management Requests and Enhanced ACK probing requests.
- The DUT properly aggregates metrics for multiple concurrent series
with different configurations (MAC Data Requests, Link Layer data
frames, LQI, RSSI, and Link Margin).
- Aggregated results are accurately reported in MLE Data Responses
when queried by multiple children.
- The DUT successfully provides link metrics in Enhanced ACKs for
both SED and SSED children.
Changes:
- Added test_1_2_LP_7_2_2.cpp to implement the test logic, including
node configuration, management requests, and data collection.
- Added verify_1_2_LP_7_2_2.py for automated PCAP verification of
MLE TLVs and Enhanced ACK Vendor IEs.
- Updated verify_utils.py to include necessary layer fields for
Link Metrics verification in pktverify.
- Registered the new test in CMakeLists.txt and run_nexus_tests.sh.
This commit simplifies the handling of URI paths during the processing
of block-wise CoAP requests, effectively removing duplicated code.
Previously, `CoapBase::ProcessBlockwiseRequest()` manually iterated
through CoAP options to parse and construct the URI path string. This
logic was redundant as the same functionality is provided by the
`Message::ReadUriPathOptions()` method.
By calling `ReadUriPathOptions()` earlier in the request processing flow
within `CoapBase::ProcessReceivedRequest()`, we can populate the
`uriPath` string buffer and simply pass it down. Consequently, the
`aUriPath` parameter in `ProcessBlockwiseRequest()` has been updated to
a `const Message::UriPathStringBuffer &` to reflect its new role as a
read-only input. This change leads to cleaner, more cohesive code.
This commit updates the `Otns::EmitCoapStatus()` method to use the
`Coap::Message::UriPathStringBuffer` typedef for the `uriPath` local
variable, replacing an explicit character array definition. This
improves code consistency and matches the expected parameter type of
the `Coap::Message::ReadUriPathOptions()` method.
This commit moves the execution of nexus `core` and `trel` tests from
the `toranj.yml` GitHub Actions workflow to the `nexus.yml` workflow.
It separates the tests into dedicated jobs (`nexus-core-tests` and
`nexus-trel-tests`) to improve parallelism and organization. The
existing nexus test job is also renamed to `nexus-cert-tests` to
better reflect its purpose.
This commit introduces `AllocateAndInitPostMessageTo()` and
`AllocateAndInitPriorityPostMessageTo()` methods in `CoapBase`.
These methods simplify the creation of CoAP POST messages by combining
the allocation, initialization, and appending of the payload marker
into a single call. The message type (Confirmable vs. Non-Confirmable)
is automatically determined based on whether the destination address
is multicast.
The previous `InitAsPost()` method in `Coap::Message` is removed,
and all callers in `BbrManager`, `Commissioner`, and
`AddressResolver` are updated to use the new helper methods.
Updates the TCAT class public methods for doing Commissioner
authorization checks and clarifies the code, with minor updates to
PSKc cases handling.
Unit tests are added for checking Commissioner authorization. To do
these checks, a new test class UnitTester is added which has access to
private members of the TcatAgent class. Validation/mock functions are
added in the test code to keep the unit tests readable.
Also reverts the CommCert4 fix that was made in #12151.
For more background information see JIRA BHC-766.
This commit implements Nexus test 1.2.LP.7.2.1 to validate the Forward
Tracking Series Link Metrics functionality.
Specifically, the test verifies that:
- The DUT (Leader) correctly handles Forward Series Link Metrics
Management Requests from SED and SSED children.
- The DUT properly aggregates metrics for Forward Series (MAC Data
Requests for SED, all data frames for SSED).
- Aggregated results are accurately reported in MLE Data Responses
when queried.
- Forward Series can be successfully cleared, and unknown Series IDs
result in appropriate error statuses.
Summary of changes:
- Created test_1_2_LP_7_2_1.cpp to implement the test logic.
- Created verify_1_2_LP_7_2_1.py for automated packet verification.
- Updated verify_utils.py to include MLE TLV field definitions for
Link Metrics (e.g., forward series, flags, query ID).
- Registered the new test in tests/nexus/CMakeLists.txt and
tests/nexus/run_nexus_tests.sh.
This commit implements Nexus test 1.2.LP.7.1.2, which validates the
Single Probe Link Metrics without Enhanced ACKs functionality.
The test verifies that:
- The DUT (Leader) successfully responds to Single Probe Link Metrics
Requests from SED and SSED children using MLE Data Requests.
- The DUT correctly reports RSSI, Layer 2 LQI, and Link Margin metrics
in MLE Data Responses.
- The DUT reports different RSSI values when the transmission power
(simulated via MAC filter) is varied.
Changes:
- Add test_1_2_LP_7_1_2.cpp to implement the test logic using the
Nexus simulation platform.
- Add verify_1_2_LP_7_1_2.py for automated packet verification,
ensuring Link Metrics Query and Report TLVs are correctly formatted.
- Register the new test in tests/nexus/CMakeLists.txt.
- Add the test to the default test list in tests/nexus/run_nexus_tests.sh.
This commit implements Nexus test 1.2.LP.7.1.1, which validates the
Single Probe Link Metrics with Enhanced ACKs functionality.
The test verifies that:
- The DUT (Leader) successfully responds to Link Metrics Management
Requests from SED and SSED children.
- The DUT includes correct Link Metrics data in IEEE 802.15.4-2015
Enhanced ACKs when requested.
- The DUT correctly handles registration, clearing, and error cases
for Link Metrics configurations.
Changes:
- Add test_1_2_LP_7_1_1.cpp to implement the test logic using the
Nexus simulation platform.
- Add verify_1_2_LP_7_1_1.py for automated packet verification,
ensuring Link Metrics TLVs and Enhanced ACKs are correctly formatted.
- Register the new test in tests/nexus/CMakeLists.txt.
- Add the test to the default test list in tests/nexus/run_nexus_tests.sh.
This commit implements and verifies Nexus test case 1.2.LP.5.2.1, which
validates that the Leader (DUT) correctly manages the Frame Pending bit
in acknowledgments to MAC Data and Data Request frames for Thread V1.2
and V1.1 sleepy end devices.
Key changes:
- Created tests/nexus/test_1_2_LP_5_2_1.cpp to simulate the test
topology (Leader, Router_1, SED_1, SED_2, SED_3) and execution steps.
- Implemented tests/nexus/verify_1_2_LP_5_2_1.py to perform automated
packet verification of the test criteria.
- Integrated the new test into CMakeLists.txt and run_nexus_tests.sh.
- Used AllowList to specify links between nodes as per the test spec.
- Set log level to note and used direct method calls in C++.
- Verified that the DUT sets the Frame Pending bit correctly in ACKs
based on whether indirect messages are queued for the SEDs.
2026-03-05 20:12:48 -06:00
988 changed files with 92259 additions and 35491 deletions
### 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
Show the Multicast Listeners.
@@ -421,7 +396,7 @@ Requires the `OPENTHREAD_CONFIG_BORDER_AGENT_MESHCOP_SERVICE_ENABLE` feature.
The name can also be configured using the `OPENTHREAD_CONFIG_BORDER_AGENT_MESHCOP_SERVICE_BASE_NAME` configuration option (which is the recommended way to specify this name). This CLI command (and its corresponding API) is provided for projects where the name needs to be set after device initialization and at run-time.
Per the Thread specification, the service instance should be a user-friendly name identifying the device model or product. A recommended format is "VendorName ProductName". To construct the full name and ensure name uniqueness, the OpenThread Border Agent module will append the Extended Address of the device (as 16-character hex digits) to the given base name. Note that the same name will be used for the ephemeral key service `_meshcop-e._udp` when the ephemeral key feature is enabled and used.
Per the Thread specification, the service instance should be a user-friendly name identifying the device model or product. A recommended format is "VendorName ProductName". To construct the full name and ensure name uniqueness, the OpenThread Border Agent module appends a suffix (e.g., " #XXXX" where "XXXX" represents the last two bytes of the device's Extended Address in hex) to the given base name. If a name conflict is detected on the network, an additional index may be appended (e.g., " #XXXX (1)"). Note that the same name will be used for the ephemeral key service `_meshcop-e._udp` when the ephemeral key feature is enabled and used.
```bash
ba servicebasename OpenThreadBorderAgent
@@ -1536,11 +1511,10 @@ The generated output encompasses the following information:
- Version
- Current state
- Uptime and attach time
-Channel
-PAN IDs, extended MAC address, and RLOC16
-Extended MAC address and RLOC16
-Active Operational Dataset (redacted)
- Unicast and multicast IPv6 address list
- Network Data
- Partition ID
- Leader Data
- Buffer info
- Network statistics
@@ -1960,34 +1934,6 @@ Set the Thread Domain Name for Thread 1.2 device.
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
Print the EID-to-RLOC cache entries.
@@ -2557,7 +2503,7 @@ Locate the closest destination of an anycast address (i.e., find the destination
`OPENTHREAD_CONFIG_TMF_ANYCAST_LOCATOR_ENABLE` is required.
The closest destination is determined based on the the current routing table and path costs within the Thread mesh.
The closest destination is determined based on the current routing table and path costs within the Thread mesh.
Locate the leader using its anycast address:
@@ -3597,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
@@ -3610,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
@@ -3620,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'.
Some files were not shown because too many files have changed in this diff
Show More
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.