8777 Commits

Author SHA1 Message Date
e99a523726 [routing-manager] remove duplicate logging of RA header (#11604) 2025-06-18 23:10:42 +09:00
41320dc809 [license] fix typo (#11608) 2025-06-18 23:09:47 +09:00
c11e0f4659 github-actions: bump codecov/codecov-action from 5.4.2 to 5.4.3 (#11597)
Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 5.4.2 to 5.4.3.
- [Release notes](https://github.com/codecov/codecov-action/releases)
- [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md)
- [Commits](ad3126e916...18283e04ce)

---
updated-dependencies:
- dependency-name: codecov/codecov-action
  dependency-version: 5.4.3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-06-17 21:32:17 +09:00
48407719cd [crypto] avoid directly include config/crypto.h (#11603)
This commit avoids directly including `config/crypto.h` which breaks
configuration in project headers.
2025-06-17 21:06:48 +09:00
a640f85db8 [posix] reliable transport for virtual time (#10984)
This commit changes the virtual time event transport from UDP to
SEQPACKET unix socket to ensure events are delivered successfully.
2025-06-17 21:05:24 +09:00
b945928d72 [gn] move gn build into etc (#11577) 2025-06-17 14:21:37 +09:00
3dd19d9123 [trel] fix a format error of log (#11586)
According to precedents in other parts of the OpenThread source code,
a 32-bit unsigned integer should be printed using `%lu` instead of
`%u`.
2025-06-17 13:48:17 +09:00
3fd719063f [posix] fix MdnsSocket iteration over message queue (#11599)
This commit updates how `MdnsSocket::SendQueuedMessages()` iterates
over the message queue. The iteration is changed to get the next
message before processing the current one. This is necessary because
the current message may be dequeued and freed within the loop, which
would invalidate the pointer to the next message.
2025-06-17 13:47:05 +09:00
aab0c29793 [mle] move AnnounceHandler methods together (#11598)
This commit moves the `Mle::AnnounceHandler` methods to be located
together in the same section.

The `AnnounceHandler` sub-component was added in a previous commit,
but its methods were intentionally left in their original locations
to keep the `git diff` small and easy to review. This change simply
relocates the methods to their proper place and includes no logical
modifications.
2025-06-17 13:46:29 +09:00
00e4e42c57 [cli] fix output of fractional part of ping average round-trip time (#11587)
This commit addresses an issue where the fractional part of the ping
average round-trip time (RTT) was not consistently formatted.
Previously, it used ".%u" with `(avgRoundTripTime % 1000)` which
could omit leading zeros for fractional values. It now uses ".%03u"
to ensure three digits are always displayed, padding with leading
zeros when necessary.
2025-06-17 13:45:49 +09:00
8a19434b8a [routing-manager] enhance MultiAilDetector (#11589)
This commit counts only reachable peer BRs for quick multi-AIL detection
when peer BR moves to a different infrastructure link.
2025-06-12 22:03:48 +09:00
baf13fc994 [posix] fix region configuration loading order (#11585)
Fix the initialization order in ProcessRadioUrl() to ensure that
configuration files are loaded before region settings are applied.

Previously, the region code was set before configuration files
(product-config-file and factory-config-file) were processed. This
caused region-specific settings such as target power to be applied
from stale configuration data rather than the newly loaded
configuration file.

The fix reorders the parameter processing sequence:
1. Basic radio parameters (fem-lnagain, cca-threshold)
2. Configuration file loading (product-config-file, factory-config-file)
3. Region setting (region)
4. Other parameters (bus-latency, max-power-table, coex settings)

This ensures that when a region is set, it will use the correct
configuration data from the newly loaded files, allowing region-specific
power settings and other parameters to be properly refreshed.

Change-Id: Idcf16d194eea65d3efe3ae380d6fa90e71bd5499
2025-06-11 06:38:06 +09:00
6b03321cb2 [style] apply IWYU to public headers (#11580)
It would be easier to use OpenThread public headers if they are
self-contained and follows the IWYU style guide. This commit fixes some
style issues to make the public headers self-contained and IWYU. The
existing pretty check is also extended to verify the OpenThread public
headers are self-contained and follows IWYU.
2025-06-11 06:37:41 +09:00
c8714060ea [test] stabilize Cert_5_1_05_RouterAddressTimeout (#11564)
With the router restoration, longer delay is expected. This commit
defines the router restoration delay and apply it on the unstable test
case Cert_5_1_05_RouterAddressTimeout.
2025-06-10 22:09:33 +09:00
b0e7b14963 github-actions: bump github/codeql-action from 3.28.18 to 3.28.19 (#11581)
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 3.28.18 to 3.28.19.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/github/codeql-action/compare/v3.28.18...fca7ace96b7d713c7035871441bd52efbe39e27e)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-version: 3.28.19
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-06-10 06:34:22 +09:00
cbb04be4a6 [routing-manager] use consistent Dhcp6Pd term & update unit test (#11579)
This commit renames DHCPv6-PD related types and methods in
`RoutingManager` to consistently use the `Dhcp6Pd` term.

This commit also updates the related unit test in
`test_routing_manager`. The test is renamed to `TestDhcp6Pd()`, and
the code style is updated to align with other test cases in the same
file. No changes are made to the actual test steps or what is covered
by the test itself. The method for reporting PD prefixes to the
OpenThread stack is modified within the unit test. Instead of using
`otPlat` APIs, `RoutingManager` methods are now directly invoked.
This helps make the unit tests independent of the configuration,
allowing for more flexible models where platform-provided APIs may
not be provided (e.g., DHCPv6 client as part of OpenThread code).
2025-06-10 06:24:23 +09:00
6191d3b139 [otci] support reliable transport (#11575)
This commit adds reliable transport in OTCI and switch the OTCI tests to
use the reliable simulation transport.
2025-06-06 09:11:34 -07:00
7d64173fd3 [history-tracker] add missing UpdateAgedEntries() method to EntryList (#11576)
Adds missing method `UpdateAgedEntries` for the template
specialization of `EntryList` when size is 0.
2025-06-06 09:08:47 -07:00
1662ca8001 [simulation] add reliable virtual time transport (#11029)
This commit adds a reliable transport based on SEQPACKET unix socket to
simulation platform and use this for tests on simulation platform.
2025-06-04 23:32:25 -07:00
a1de12fd49 [dhcp6] introduce Option::Iterator class (#11574)
This commit adds the `Option::Iterator` class for searching for and
iterating over DHCPv6 options with a specific code within a message.
The iteration can cover the entire message or be constrained to a
given `OffsetRange`.

The `Option::Iterator` is used to simplify the `Dhcp6::Client` and
`Dhcp6.Server` implementations, particularly when iterating over
`IaAddressOption`s within an `IaNaOption`.
2025-06-04 23:30:42 -07:00
4b43f6de76 [coap] match only token for multicast and anycast (#11570) (#11571) 2025-06-04 17:20:01 -07:00
5201231daa [test] fix warning of escape in regex string (#11566) 2025-06-04 13:35:36 -07:00
206698702d [fuzz] load only value enum values (#11573) 2025-06-04 13:25:32 -07:00
5c8351b43d [github-actions] update fuzz workflow to latest recommended (#11563) 2025-06-04 11:21:26 -07:00
45fc50cb2e [fuzz] allow border router services to start (#11561) 2025-06-04 11:19:35 -07:00
a1e170cb94 [routing-manager] fix typo (#11568) 2025-06-04 07:32:53 -07:00
7533b1d93a [secure-transport] add ~SecureTransport() destructor (#11562)
This commit adds a destructor for `SecureTransport` that closes the
socket, and disconnects and removes any tracked sessions.

Removing the sessions ensures that the `SecureSession` instances and
any data allocated within them are properly freed. This handles the
case where the `otInstance` itself is destroyed, ensuring that all
heap-allocated items are cleaned up correctly to prevent memory
leaks.
2025-06-03 22:34:22 -07:00
2ae5522bed [style] avoid deprecated setDaemon (#11565) 2025-06-03 22:33:17 -07:00
e4ac7162eb [mle] introduce AnnounceHandler class (#11558)
This commit introduces the `AnnounceHandler` class within `Mle` to
encapsulate logic for handling Announce messages. This change
simplifies the `Mle` module and makes the code easier to read and
follow.

The `AnnounceHandler` class handles received Announce messages with a
newer timestamp and different channel and/or PAN ID. It can delay
processing to collect and handle subsequent Announce messages.

It also manages starting the "announce attach" process, where the device
attempts to attach using the parameters from a processed Announce
message.
- If the attach is successful, this class sends an Announce on the old
  channel to inform other devices. This is done immediately after
  attaching as a MTD child or after a router transition attempt
  completes (on FTD).
- If the attach fails, the class ensures the channel and PAN ID are
  restored to their original values.

In particular, the new `AnnounceHandler` uses its own `Timer` to delay
the start of an announce attach. Previously, the `AttachTimer` was
repurposed for this, in addition to its use for attach state
management.
2025-06-03 13:33:49 -07:00
18c731764a [dhcp6] enhance DUID parsing and generation (#11559)
This commit updates and enhances the parsing and generation of the
DHCPv6 DUID in Client/Server Identifier Options.

DHCPv6 DUIDs can be specified in a variety of ways, and clients and
servers must treat them as opaque values that are compared for
equality. This change adds an `Eui64Duid` type to represent a DHCPv6
DUID based on the EUI-64 Link-Layer address format (DUID-LL).

A set of common helper methods are added to parse, match, and append
the DUID in a Client or Server Identifier option:
- `ReadDuid()`: Reads the raw DUID as a blob of data.
- `ReadAsEui64Duid()`: Reads a DUID, validating that it follows the
  DUID-LL format, and parses the EUI-64 address.
- `MatchesEui64Duid()`: Reads a DUID and checks that it matches a
  given EUI-64 address.
- `AppendWithEui64Duid()`: Appends a Client/Server ID option with a
  DUI using the DUID-LL format.

This commit also introduces `Option::AppendOption()` which appends a
DHCPv6 Option with a given code and data to a message.

These methods are then used to simplify the `Dhcp6::Server` and
`Dhcp6::Client` code.
2025-06-03 10:46:48 -07:00
4e52d8eb7c [nexus] add missing case in ConnectEventToString() (#11560) 2025-06-03 10:43:57 -07:00
1804273276 [posix] set sin6_scope_id / ipi6_ifindex for all transmits to link-local (#11555)
This will avoid the problem that scope id or ifindex remains 0 for a
link-local transmission. If 0, the OS cannot decide which network
interface to use based on address alone.
2025-06-03 09:22:41 -07:00
151cf324bc [tcp][posix] ensure struct fields are initialized (#11552)
This aims to fix some instances in core/tcp6 and posix/udp where the
complete struct was not initialized. In otPlatUdpJoinMulticastGroup
and otPlatUdpLeaveMulticastGroup an explicit redundant setting to '0'
is added just for clarity for people reading the code.
2025-06-03 08:24:09 -07:00
5050bec030 [cli] add "dataset active|pending -ns" support (#11518)
This CLI command argument "-ns" prints out the dataset fields and
redact the sensitive values, including the network key and PSKc
fields.
2025-06-03 08:20:49 -07:00
ea3a3da0ee [border-agent] add epskc journey statistics (#11530)
This commit adds some new statistics for ePSKc to show the time
duration of various sub process during the credential sharing.

A Nexus unit test is added to verify the stats are counted correctly.

A few small points to be noted:
* The `StopReason` which was used internally in `EphemeralKeyManager`
  is renamed as `DeactivationReason`, defined as public and is mapped
  to the public enum `otHistoryTrackerEpskcDeactivationReason`.
* The original reason `Timeout` is renamed to `SessionTimeout` to
  indicate this is a timeout of the secure session. This is to
  differentiate with the epskc mode timeout.
* A new reason `EpskcTimeout` to indicate the timeout is due to epskc
  mode timeout.
2025-06-02 22:23:07 -07:00
f9be8f76ee [fuzz] enable border router services (#11557)
- Border Routing Manager
- DHCPv6 PD
- NAT64
- SRP Server
- TCP
2025-06-02 15:58:25 -07:00
7fb682f928 [posix] fix misleading log message in DNS resolver (#11545)
The log message "No domain name servers found in %s, default to
127.0.0.1" is misleading because the code does not actually default to
127.0.0.1 if no nameservers are found.

This commit updates the log message to accurately reflect the
behavior.
2025-06-02 15:22:17 -07:00
eb8a926037 [routing-manager] simplify PD prefix processing (#11554)
This commit simplifies the processing of PD prefixes provided by the
platform to `PdPrefixManager`. The platform can report DHCPv6 PD
prefixes in two ways: through a Router Advertisement (RA) message
containing Prefix Information Options (PIOs) or by providing a PD
prefix directly.

Previously, these two paths were processed in a single method, which
made the code harder to read and follow. This commit refactors the
logic to separate these two paths while using common helper methods.

This change introduces `EvaluateCandidatePrefix()`, which evaluates a
single candidate prefix and tracks the most favored one. After all
candidates are evaluated, `ApplyFavoredPrefix()` is called to apply
the most favored prefix and update the current PD prefix if
necessary.
2025-06-02 12:55:02 -07:00
02b8b2cda6 [dhcp6] add helper methods for option parsing and generation (#11551)
This commit introduces new helper methods for DHCPv6 Option parsing
and generation.

- It adds `Option::FindOption()` to search and parse the first DHCPv6
  option with a given code within a specified range of a `Message`.
- It also adds `Option::UpdateOptionLengthInMessage()`, which updates
  the Option length in a message based on the number of  bytes
  appended, simplifying the appending of variable-length options
  (e.g., `IaNaOption`, which can contain multiple sub-options).
- Additionally, `StatusCodeOption::ReadStatusFrom()` is added to read
  the status code from a Status Code Option in a specified range
  within a `Message`. The absence of a Status Code option implies
  success.
- Helper methods to search for and append `RapidCommitOption` are also
  included.

These new helper methods are then used by `Dhcp6::Server` and
`Dhcp6::Client`, simplifying the code, particularly for processing
options in received DHCPv6 messages.

This commit also adds a new `test-036-dhcp-prefix-netdata.py` test to
validate the publishing of prefixes with the DHCP flag in Network
Data and the behavior of the DHCPv6 client and server.
2025-06-02 12:51:48 -07:00
c2de9f646a [trel] manage mDNS/DNSSD and peer discovery in core (#11528)
This commit enhances the TREL module to manage mDNS/DNSSD service
registration and peer discovery (browse and resolving for TREL
services). This feature can be controlled through
`OPENTHREAD_CONFIG_TREL_MANAGE_DNSSD_ENABLE` (and/or the CMake option
`OT_TREL_MANAGE_DNSSD`).

When enabled, TREL will utilize the `Dnssd` module, which provides
mDNS-related APIs. This can be tied to OpenThread's native mDNS
implementation or to `otPlatDnssd` (i.e., provided by the platform
layer).

This commit also adds support for the TREL platform in the `Nexus`
test framework and uses this to add a detailed `test_trel` case. This
test covers basic TREL peer discovery and operation, along with
specific scenarios such as peer removal delay, delayed mDNS start,
TREL service name conflict resolution, host address changes, and
supporting multiple services on the same host (while unlikely in
actual deployments, this can be useful for testing and simulation
where a single machine may act as multiple Thread nodes, thus
advertising multiple TREL services from the same hostname. This is
explicitly supported by the implementation and covered in the
tests).
2025-06-02 12:45:39 -07:00
c020f86230 [posix] DNS resolver to handle link-local server address (#11548)
When `sendto` is used with a Link-Local IPv6 destination, the index of
the outgoing network interface must be included.
2025-06-02 11:09:27 -07:00
a7a45b0913 [secure-transport] add ~SecureSession(void) destructor (#11553)
This commit adds a destructor for `SecureSession` which ensures the
freeing of any mbedTls allocated items. This addresses memory leaks
detected by fuzzer tests when `otInstance` is destroyed, though this
situation is unlikely in typical OpenThread stack integrations.
2025-06-02 10:07:08 -07:00
634605f940 github-actions: bump docker/build-push-action from 6.17.0 to 6.18.0 (#11556)
Bumps [docker/build-push-action](https://github.com/docker/build-push-action) from 6.17.0 to 6.18.0.
- [Release notes](https://github.com/docker/build-push-action/releases)
- [Commits](1dc7386353...263435318d)

---
updated-dependencies:
- dependency-name: docker/build-push-action
  dependency-version: 6.18.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-06-02 08:56:19 -07:00
de0739239b [message] add destructors for MessageQueue and PriorityQueue (#11550)
This commit adds destructors for `MessageQueue` and `PriorityQueue`.
This ensures that allocated `Message` instances in different queues
are freed when the `ot::Instance` is destroyed.
2025-05-30 14:06:26 -07:00
2bc5eec091 [notifier] streamline event delivery to core modules (#11546)
This commit updates the `Notifier` to directly signal events to
`BackboneRouter::Leader`, `Dhcp6::Server`, `Dhcp6::Client`, and
`NeighborDiscovery::Agent`. These classes were previously notified
indirectly through `Mle::HandleNotifierEvent()`.
2025-05-30 14:04:33 -07:00
cbe3654ce7 [fuzz] avoid undefined enum values (#11549) 2025-05-30 11:18:22 -07:00
16d9b2ad2a [posix] add runtime configuration file path support (#11514)
This commit enhances the POSIX platform configuration system to support
dynamic configuration file paths at runtime instead of only build-time paths.

ConfigFile class:
- Replace const char* mFilePath with char mFilePath[kFilePathMaxSize] to allow
  dynamic path updates after construction
- Add SetFilePath() and GetFilePath() methods
- Update constructor to use SetFilePath() with proper bounds checking

Configuration class:
- Add SetFactoryConfigFile() and SetProductConfigFile() methods to update
  factory and product config file paths

Radio URL parameter support:
- Add support for 'product-config-file' parameter in radio URL
- Add support for 'factory-config-file' parameter in radio URL
2025-05-29 21:52:07 -07:00
3a31754ee5 [dhcp6] style fixes and minor enhancements (#11543)
This commit contains style fixes and smaller enhancements in
DHCP6-related definitions and types. Mainly, the DHCP6 `Option`
sub-classes are renamed to include the `Option` suffix
(e.g., `IaAddressOption`), harmonizing the naming style with `Tlv`
and other `Option` classes (e.g., `Nd6` or `Dns` options).
2025-05-29 19:58:40 -07:00
976c2bc4a6 [trel] explicitly request trel ack for broadcast tx to known neighbors (#11537)
This commit modifies the TREL module to explicitly request TREL acknowledgements
for broadcast transmissions directed to known neighbors. This ensures quicker
discovery of when a TREL peer is no longer available.
2025-05-29 19:00:22 -07:00
6d40977782 [fuzz] migrate fuzz framework to nexus platform (#11538) 2025-05-28 18:32:04 -07:00