372 Commits

Author SHA1 Message Date
37b417a3ee [test] update OTBR Dockerfile path (#11390) 2025-04-02 10:14:33 -07:00
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
8c23a588ca [script] install gtest and gmock (#11358) 2025-03-24 08:29:53 -07:00
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
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
7bd3abd67b [script] allow specify old commit for check-size (#11147) 2025-01-10 09:41:56 -08:00
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
ff19e03afa [scripts] SC2317: command appears to be unreachable (#10821) 2024-10-11 20:45:56 -07:00
f3715b4596 [check-size] SC2004: $/${} is unnecessary on arithmetic variables (#10820) 2024-10-11 13:38:40 -07:00
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
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
2f51cababf [github-actions] migrate version 1.3 checks to 1.4 (#10694) 2024-09-11 07:25:32 -07:00
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
0b0db37a13 [api] add API to reset to bootloader mode (#9523) 2023-10-27 15:54:15 -07:00
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
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
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
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
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
1f1c155dc2 [clang-tidy] move config to .clang-tidy file (#9308) 2023-07-24 11:45:18 -07:00
de5afd0e36 [build] cleanup autotools references (#9242) 2023-06-30 15:14:13 -07:00
11a38a63de [build] remove autotools (#9027)
This commit removes autotools support from OpenThread project.
2023-06-28 08:54:23 -07:00
434ea2c0d0 [script] properly configure dataset in check-posix-pty (#9202) 2023-06-24 12:51:50 -07:00
4b0b93ad00 [radio] add radio statistics of tx/rx/sleep cycle (#9071)
This commit implements time counting in radio to collect the time when
radio is in sleep/tx/rx time. 2 new APIs are added to get and reset
the statistics. This feature is only available on FTD and MTD. This PR
also adds cli commands to call the APIs on example cli firmware.  This
feature is by default disabled in OT core config. It's enabled on
simulation platform by default now.

Regarding implementation, this feature is totally implemented by
software.  It uses a simplified model to calculate the time. It may
not be very accurate, but it should be enough to give us an overview
of the time.
2023-06-14 13:30:02 -07:00
b2116446bc [spinel] remove fetching the ncp dataset (#9140) 2023-06-09 00:00:32 -07:00
9cb667c01f [routing-manager] initial PD support with platform generated RA (#9050)
This commit adds the following new API:
- otBorderRoutingProcessIcmp6Ra

And related APIs:
- otBorderRoutingDhcp6PdSetEnabled
- otBorderRoutingGetPdOmrPrefix

They are used to support the DHCPv6 PD on Thread Border Routers. On a
typical OS, the DHCPv6 Client of the platform network stack will
request a IPv6 subnet via DHCPv6-PD, then invoke the daemon for
sending router advertisements on the given interface.

With this commit, the RA will be catched by the processTransmit in
netif.cpp, which will then pass the message to
otBorderRoutingAddPrefixByRouterAdvertisement, RoutingManager will
then add the prefix according to the PIO in the router advertisement,
and take care of the lifetime of the prefix added.
2023-06-07 22:52:39 -07:00
80eb7f512f [toranj] update build.sh script to use CMake for all builds (#9115) 2023-06-01 21:39:45 -07:00
8f5d4376c6 [build] delete the removed child supervision config in cmake-build (#9111) 2023-05-31 13:26:39 -07:00
f64b7cc73c [test] add code spell check and correct wrong spelling (#9066) 2023-05-22 18:04:09 -07:00
dae3ff2c50 [cli] support adding vendor command list to cli apps (#9001) 2023-05-16 19:59:20 -07:00
f86d560e0a [build] add CMake Android NDK support (#9010) 2023-05-09 11:01:51 -07:00
874b6beca8 [border-agent] fix BorderAgentId compile and enable it in CI tests (#9030) 2023-05-08 09:09:46 -07:00