Commit Graph

381 Commits

Author SHA1 Message Date
Li Cao 8dadae2ea1 [format] upgrade clang-format to 19 (#11783)
We just updated the version from 14 to 16. But very unfortunately
clang-format-16 was just deprecated recently. So this time we update
the version to the latest available one. There are newer releases than
19 (like 20) but as I tested, sudo apt-get install -y clang-format-19
can work while 20 doesn't work.

misc-include-cleaner in clang-tidy-19 exerts a very strict check which
requires to directly include all headers for every symbols in the
source file. However in our current code we intentionally use some
indirect include. So this commit disables misc-include-cleaner.
2025-08-06 10:49:52 -07:00
Li Cao 34bb0e4ab1 [test] remove the node type rcp-ncp (#11752)
The type `rcp-ncp` was meant to run nodes of NCP on posix. But we
don't have NCP on posix anymore. So this can be removed.
2025-07-28 11:20:43 -07:00
Yakun Xu 2f1183f387 [git-tool] do not use GITHUB_TOKEN (#11730)
This commit stops using GITHUB_TOKEN in git-tool for better security.
2025-07-16 07:11:17 -07:00
Yakun Xu d4734df8bb [size-report] checkout pull request head (#11724) 2025-07-15 10:48:46 -07:00
Yakun Xu f4e239e651 [size-report] migrate to GitHub Actions (#11681) 2025-07-14 16:01:32 -07:00
Li Cao 6c6e99ee7c [style] upgrade clang-format and clang-tidy from 14 to 16 (#11682) 2025-07-10 18:19:26 -07:00
Abtin Keshavarzian a495a2284b [otns] make various enhancements to Otns (#11643)
This commit contains various enhancements to the `Otns` class:

- Makes `Otns` methods non-static. This aligns their use with the
  clang-tidy `readability-static-accessed-through-instance` check,
  which disallows accessing static methods through an instance.
- Updates the `make-pretty` script to enable OTNS and include it in
  `clang-tidy` checks.
- Adds a stub implementation of `otPlatOtnsStatus()` in the simulation
  and fake platforms. This allows the OTNS feature to be enabled in
  `make-pretty` builds and covered by GitHub Action CI checks.
- Simplifies the `EmitStatus` methods to use the `String` class for
  constructing the status string.
- Adds a new helper method to construct the CoAP status string,
  removing duplicated code.
2025-06-30 14:39:30 -07:00
Yakun Xu 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
Yakun Xu 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
Jonathan Hui 37b417a3ee [test] update OTBR Dockerfile path (#11390) 2025-04-02 10:14:33 -07:00
xusiyu 036256729c [spinel] add coprocessor reset failure callback (#11284)
Add a coprocessor reset failure callback to handle the coprocessor
reset failure instead of letting the program crash directly.
2025-03-24 08:49:27 -07:00
Yakun Xu 8c23a588ca [script] install gtest and gmock (#11358) 2025-03-24 08:29:53 -07:00
Abtin Keshavarzian babbccd4c6 [srp-server] introduce "fast start mode" feature (#11305)
This commit adds "Fast Start Mode" feature for SRP server. This
feature is designed for scenarios where a device, often a mobile
device, needs to act as a provisional SRP server (e.g., functioning
as a temporary Border Router). The SRP server function is enabled
only if no other Border Routers are already providing the SRP
service within the Thread network. A common use case is a mobile
device joining a Thread network where it may be the first, or only,
BR. Importantly, Fast Start Mode allows the device to quickly start
its SRP server functionality upon joining the network, allowing other
Thread devices to quickly connect and register their services without
the typical delays associated with standard Border Router
initialization and SRP server startup (using NetData Publisher).
2025-02-28 13:49:30 -08:00
Li Cao 33a1f09569 [test] fix socat version to 1.7.4.4 (#11243)
This commit changes the installation of socat from using 'apt' to
manual installation.

We found the latest socat version 1.8.0.3 has an issue when running
with OTBR docker. To avoid the error caused by version and facilitate
local development, the commit provides a script to install socat of
version 1.7.4.4 and replaces the installation in CI and scripts..

We add the install script in openthread and ot-br-posix will use the
script in openthread to install socat.
2025-02-25 07:48:18 -08:00
Yakun Xu 7bd3abd67b [script] allow specify old commit for check-size (#11147) 2025-01-10 09:41:56 -08:00
Yakun Xu b6a7f076c2 [script] enhance check-size for local use (#11116)
This simplifies doing local check by enhancing the script to accept
extra cmake options and specifying the commit to compare.

Example usage:

```bash
OT_SHA_OLD=e4a390f34 ./script/check-size nrf52840 -DOT_FULL_LOGS=ON
```
2025-01-06 16:20:04 -08:00
Jonathan Hui ff19e03afa [scripts] SC2317: command appears to be unreachable (#10821) 2024-10-11 20:45:56 -07:00
Jonathan Hui f3715b4596 [check-size] SC2004: $/${} is unnecessary on arithmetic variables (#10820) 2024-10-11 13:38:40 -07:00
Song GUO 7cd179e23a [routing-manager] stop PD if there is another prefix with higher preference in netdata (#10289)
This commit adds a new IDLE state to PdPrefixManager.

PdPrefixManager enters idle state when PD is enabled and there is
already a BR requesting PD prefix. When there are multiple BRs
publishing PD prefix at the same time, the one with lexcial smaller
prefix wins.
2024-09-29 23:27:30 -07:00
Damian Królik bc50521cfa [mac] multipurpose wake-up frame support (#10728)
1. Add OT_WAKEUP_COORDINATOR and OT_WAKEUP_END_DEVICE build
   options.
2. Add support for parsing and constructing 802.15.4
   Multipurpose frames.
3. Add support for parsing and constructing wake-up
   frames.
2024-09-23 09:02:15 -07:00
Jonathan Hui 2f51cababf [github-actions] migrate version 1.3 checks to 1.4 (#10694) 2024-09-11 07:25:32 -07:00
Yakun Xu c0690e78fc [build] set default Thread version to 1.4 (#10690)
This commit updates the default Thread version to 1.4, so that most
latest features will be enabled by default. This commit also explicitly
enable the epskc feature just like other features in the build script.
2024-09-10 13:39:38 -07:00
Li Cao c36c0ed760 [ncp] add NCP based implementation (empty) of platform InfraIf APIs (#10638)
This implementation will be used on all platforms for NCP nodes
(simulation, any vendor platforms). However the simulation platform
already has a different implementation. To avoid conflicts, the commit
adds a control flag in simulation config so that we can choose whether
to enable the simulation implementation.
2024-09-04 07:48:59 -07:00
Yakun Xu 706013fa7b [git-tool] explicit disable rebase (#10645)
This commit adds `--no-rebase` to `git` command when applying
dependencies because recent git versions doesn't have a default rebase
strategy anymore.
2024-08-27 19:58:17 -07:00
Yakun Xu af18582b4e [test] set default paths of expect scripts (#10530)
This commit adds default paths for expect scripts to make it easier for
running expect scripts. With this change, we can run expect tests as
follows:

```bash
./script/cmake-build simulation
./script/cmake-build posix
./tests/scripts/expect/cli-ping.exp
OT_NODE_TYPE=rcp ./tests/scripts/expect/cli-ping.exp
```

This commit also updates an existing test to cover the change.
2024-07-24 06:50:17 -07:00
Abtin Keshavarzian 8d4119c914 [routing-manager] track router age (#10453)
This commit adds a new mechanism in `RoutingManager` to track the
duration since a router is first discovered. This information is now
provided in `otBorderRoutingRouterEntry`, and the CLI `br routers`
command is updated to include this information for each router.

To enable tracking of longer durations, `Uptime` is used, which tracks
milliseconds since the start of `ot::Instance` as a `uint64_t` value.
`TimerMilli::GetNow()` is not suitable for this purpose because it
utilizes `uint32_t` intervals, which would limit the maximum
trackable time to roughly 49 days due to potential overflow.
2024-07-09 09:57:57 -07:00
Zhanglong Xia 215c23f2a6 [diag] add diag output callback (#10354)
The length of diag output messages is limited by the diag buffer size.
Developers have to change the diag buffer size to allow diag module to
output long messages. If diag output messages become longer and
longer, developers have to keep changing the diag buffer size.

This commit adds an output callback to diag module to output diag
messages.  Then the length of diag output messages won't be limited by
the diag buffer size.
2024-06-19 20:27:35 -07:00
Abtin Keshavarzian 5dbbab175b [dnssd-server] implement DNS-SD discovery proxy functionality in core (#10050)
This commit implements a generic discovery proxy in the DNS-SD server.
It uses a set of newly added `otPlatDnssd` platform DNS-SD(mDNS) APIs
to start or stop browsers, SRV/TXT resolvers, and IPv6/IPv4 address
resolvers. These APIs closely match the native OpenThread mDNS
implementation.

OpenThread DNS-SD's existing `QueryCallback` mechanism, enabling
customized discovery proxy implementations, remains supported.

This commit includes a comprehensive unit test. This test validates
the discovery proxy's behavior, covering: standard use cases, request
timeout, s hared resolver/browser usage for multiple queries with the
same name, filtering of invalid addresses, and various edge cases.
2024-06-10 12:16:24 -07:00
Łukasz Duda c96e3b9504 [mbedtls] migrate to MbedTLS v3.6.0 (#10286)
This commit updates the in-tree version of MbedTLS to v3.6.0.

Signed-off-by: Łukasz Duda <lukasz.duda@nordicsemi.no>
2024-05-28 12:07:57 -07:00
Suvesh Pratapa a074684110 [clang-format] accept different patch versions of clang-format (#10042)
Homebrew installation of clang-format (satisfying >14.0 requirement)
outputs the following version string:
```
Homebrew clang-format version 14.0.6
```

This change fixes the following error while running make-pretty:
```
 *** ERROR: Homebrew clang-format version 14.0.6; clang-format 14.0 required
```
2024-05-14 08:42:54 -07:00
Yakun Xu 39ce8117a5 [simulation] support simulating radio over IPv6 (#10194)
This commit adds support to simulate Thread radio over IPv6.

With this commit, a simulation will be simulated over either IPv6 or IPv4.
If it's simulated on IPv6, it communicates with other simulation nodes
in IPv6 group `ff02::116`. And if it's simulated on IPv4, it communicates
with other simulation nodes in IPv4 group `224.0.0.116`.

Note that simulating virtual time is not included in this commit.
2024-05-13 09:27:54 -07:00
Mason Tran 502797c0b3 [spinel] add support for logging crash dumps (#10061)
This commit adds a new feature that allows platforms to log crash logs.

### Additions
- `void otPlatLogCrashDump(void)` - API that logs a crash dump using
  OpenThread Logging APIs
- `SPINEL_PROP_RCP_LOG_CRASH_DUMP` - spinel prop that calls
  `otPlatLogCrashDump()` when `Set`
- `SPINEL_CAP_RCP_LOG_CRASH_DUMP` - spinel capability denoting that a
  RCP supports logging crash dumps

### Usage
- For `ot-cli-ftd|mtd`, `otPlatLogCrashDump()` is called at the end of
  app initialization, before the main loop. See [main.c]
- For Host/RCP setups, during initialization, the Host gets the RCP
  capabilities. If the RCP has the `SPINEL_CAP_RCP_LOG_CRASH_DUMP`
  capability, the Host will `Set` the `SPINEL_PROP_RCP_LOG_CRASH_DUMP`
  property, triggering the RCP to call `otPlatLogCrashDump()`.
  - If RCP Recovery is enabled, the this will also happen once the RCP
    has been restored
2024-04-29 09:09:54 -07:00
Abtin Keshavarzian 4737231d64 [dnssd] allow Dnssd platform to use native OT mDNS modules (#9944)
Updates the `Dnssd` module to allow it use

- Either the native OT mDNS implementation
- Or use the platform `otPlatDnssd` APIs (delegated to platform)

Also adds `OPENTHREAD_CONFIG_MULTICAST_DNS_AUTO_ENABLE_ON_INFRA_IF`
for mDNS module to be automatically enabled/disabled on the same
infra-if used for border routing based on infra-if state.
2024-04-19 10:20:46 -07:00
Martin Zimmermann 4db6520d17 [channel-manager] add local csl channel selection on SSED (#9641)
This commit enables channel manager on SSED, together with channel monitor,
auto-selecting a better CSL channel for the link between child and its parent.

It also fixes tracking of CcaSuccessRate on CslChannel and adds toranj tests
for auto-channel selection and thread_cert test for autocsl-channel selection.
2024-03-25 14:06:29 -07:00
Przemysław Bida 3ae275f1ac [simulation] add simulation tests framework for tcat (#9724)
This commit adds simulation framework for tcat based on posix udp
sockets.
2024-03-22 10:30:59 -07:00
Abtin Keshavarzian b212a0a748 [srp] implement AdvertisingProxy and define Dnssd platform APIs (#9268)
This commit adds a generic SRP Advertising Proxy implementation to
OpenThread core, which uses a set of newly defined `otPlatDnssd`
platform APIs for DNS-SD (mDNS) support on infrastructure network on
a Border Router.

`Srp::Server` provides `ServiceUpdateHandler` callback mechanism that
allows platforms to implement their own advertising proxy function.
While this is still supported, the new generic advertising proxy
implementation makes it easier to port and support the proxy function
on new platforms. The platform needs to provide the DNS-SD platform
APIs, which are designed to be simple and easy to implement.

The `AdvertisingProxy` directly interacts with `Srp::Server` and its
registered `Host` and `Service` entries, tracking whether an entry
has been successfully advertised, is currently being advertised, or
has been replaced by a new registration.

The `AdvertisingProxy` ensures that consecutive SRP updates for the
same host or service are committed on the server in the order they
are received, even if their advertisements are finished in a
different order. This is important for SRP Replication support, as
the server may receive a large number of SRP updates back-to-back for
the same host.

The `AdvertisingProxy` will also register key records for SRP host and
service instance names. This will keep the claim on the name of a
removed entry while its key lease is not expired. It is also used
when an SRP host registration has no off-mesh routable address.

This commit adds a detailed unit test `test_srp_adv_proxy` that
validates the `AdvertisingProxy` under many scenarios. The test
covers a range of cases, including delayed registration callbacks and
timeouts, new registrations replacing outstanding advertisements,
platform DNS-SD state changes and failures, host address changes
adding/removing OMR addresses.
2024-02-09 10:43:47 -08:00
parag-silabs 6e7135e4e1 [spinel] make kTxWaitUs configurable during compile time (#9687)
It is useful in case RCP needs to wait for longer than the hardcoded
value in kTxWaitUs.
2023-12-06 14:42:37 -08:00
Przemysław Bida 5cab15840d [tcat] initial commit of bluetooth-based commissioning (#9210)
This commit introduces first implementation of Bluetooth based
comissioning for thread devices.

Co-authored-by: Arnulf Rupp <a.rupp@inventronicsglobal.com>
Co-authored-by: Piotr Jasinski <piotr.jasinski@nordicsemi.no>
2023-12-04 12:09:25 -08:00
Mason Tran 0b0db37a13 [api] add API to reset to bootloader mode (#9523) 2023-10-27 15:54:15 -07:00
Abtin Keshavarzian 1528c8831d [core] define core/instance folder for instance modules (#9561)
This commit moves the `instance` module to a newly added folder
`core/instance` (from `core/common`.  Header file `extension.hpp`
and its example is also moved to the same folder.
2023-10-26 05:08:24 -07:00
Zhanglong Xia 7568e31c08 [spinel] create spinel interface based on the radio url protocol (#9393)
The posix platform is able to support the HDLC, SPI and vendor spinel
interfaces, but the spinel interface type can't be changed
dynamically. It is inconvenient to use different spinel interfaces for
Thread stack in Android. This commit enables the posix platform to
support the HDLC, SPI and vendor interface at the same time, and the
final spinel interface type is determined by the radio url protocol.

Some other changes:
1. Not use CRTP style for the radio spinel.
2. Deprecate the OT_POSIX_CONFIG_RCP_BUS and
   OPENTHREAD_POSIX_CONFIG_RCP_TIME_SYNC_INTERVAL.
2023-10-10 10:15:32 -07:00
whd 17286dbd24 [script] exclude ot_testing and __pycache__ when building the OTBR docker (#9457)
This commit excludes `ot_testing` and `__pycache__` directories when
copying the files before building the docker.

Such files are usually generated by root user and will cause errors
when copying them as a non-root user.
2023-09-27 10:41:07 -07:00
whd a383e366ba [firewall] implement packet filtering in OT core (#9402)
This commit implements the packet logic in OT core. It aims to have
the same effect as what's already achieved by our iptables-based
firewall. Instead of leveraging iptables, this commit filters the
border routing packets in user space by checking the
source/destination addresses of a packet.

This commit also adds a job to do BR regression test when this feature
is enabled and iptables-based firewall is disabled.
2023-09-15 11:52:26 -07:00
Abtin Keshavarzian 5c051ffeb5 [script] check-size to generate formatted table on push (#9382)
This commit updates the `check-size` script to generate a formatted
table on a branch push. The table will first include the code size
difference for all binary files, followed by the difference for all
library files. This allows us to use the `check-size` script on local
machines during development to get a full size impact report, similar
to what will be reported on the GitHub Action branch push.

This commit also generates a size report for posting on a pull request
in Markdown format. In particular, the table with the size difference
for all library files is added as a collapsible section after the
main table for binary files.
2023-09-06 11:13:18 -07:00
Li Cao 8c2abba2f8 [link-metrics] implement link metrics manager (#9375)
This commit implements a new module LinkMetricsManager, which utilizes
the Link Metrics feature to get the Link Metrics data from neighboring
devices.

The commit also adds a few tests to the module:
- Unit Test: tests/unit/test_link_metrics_manager.cpp, will be run in
  `unit-tests` in `unit.yml`.
- Expect Test: tests/scripts/expect/v1_2-linkmetricsmgr.exp, will be
  run in `expects` in `simulation-1.2.yml`.
- Simulation Test:
  tests/scripts/thread-cert/v1_2_LowPower_test_link_metrics_manager.py,
  will be run in `packet-verification-low-power` in
  `simulation-1.2.yml`.
2023-09-02 08:14:24 -07:00
Abtin Keshavarzian d5a09415be [script] update the check-size report (#9368)
This commit updates the `check-size` script and how the OpenThread
size report is generated and reported.

The size report now includes four device types:
- FTD (not acting as a BR)
- MTD (including SED)
- Border Router (BR)
- RCP

Each type uses its own example config header file (e.g., BR uses
`examples/config/ot-core-config-check-size-br.h`). These header files
specify all the OT configs and enable/disable the set of features
that make sense for the given type.

This replaces the previous model where the same set of configs were
used for all types. This change allows us to track the code size of a
typical BR build, as well as the code size of other device types.

In order to build and generate a size report for the BR configuration
example with BR-specific features enabled (such as Border Routing
Manager or NAT64), we need an implementation of the related platform
APIs that are used by these features (e.g. `otPlatInfraIf` APIs).
This commit adds mock empty implementations of these APIs, which are
only included in the size-report builds.
2023-08-25 11:29:39 -07:00
Jonathan Hui 1f1c155dc2 [clang-tidy] move config to .clang-tidy file (#9308) 2023-07-24 11:45:18 -07:00
Jonathan Hui de5afd0e36 [build] cleanup autotools references (#9242) 2023-06-30 15:14:13 -07:00
Yakun Xu 11a38a63de [build] remove autotools (#9027)
This commit removes autotools support from OpenThread project.
2023-06-28 08:54:23 -07:00
Jonathan Hui 434ea2c0d0 [script] properly configure dataset in check-posix-pty (#9202) 2023-06-24 12:51:50 -07:00