Commit Graph

7234 Commits

Author SHA1 Message Date
Jonathan Hui 3901e29e89 [tests] properly configure operational dataset in BR tests (#9209) 2023-06-26 22:23:53 -07:00
Abtin Keshavarzian 8e9bbbc88e [netdata] mechanism to detect & signal when network data gets full (#9073)
This commit adds a new mechanism to detect when Network Data (local or
leader) becomes full. When this happens, a callback function is
invoked. This callback function can be set using a newly added OT
API. The callback is invoked whenever:
- The device is acting as the leader and receives a Network Data
  registration from a Border Router (BR) that it cannot add to
  Network Data (running out of space).
- The device is acting as a BR and new entries cannot be added to its
  local Network Data.
- The device is acting as a BR and tries to register its local Network
  Data entries with the leader, but determines that its local entries
  will not fit.

The `OPENTHREAD_CONFIG_BORDER_ROUTER_SIGNAL_NETWORK_DATA_FULL` config
controls the new mechanism and its API. It is enabled by default when
`OPENTHREAD_CONFIG_BORDER_ROUTING_ENABLE` is enabled.

This commit also adds CLI support for the new mechanism and adds a
test case to validate its behavior.
2023-06-26 18:08:13 -07:00
Jonathan Hui 1a682fe2c8 [toranj-cli] properly configure operational dataset (#9207) 2023-06-26 18:04:55 -07:00
Jonathan Hui 3f4dcbc2ec [unit-test] properly configure operational dataset (#9203) 2023-06-26 17:18:24 -07:00
Abtin Keshavarzian 0cc1de7b5a [srp-server] allow service instance label with dot character (#9198)
This commit updates the `Srp::Server` class to correctly handle the
case where a service is registered with a dot character in its
service instance name. The first label in a service instance name is
intended as a user-friendly name and can contain dot characters
(it has fewer restrictions than other labels in a DNS name).

In particular, this commit contains the following changes:
- The `PtrRecords::ReadPtrName()` method is used in `Srp::Server` to
  read and validate the first label and the rest of the labels
  separately. This also validates the format of the parsed PTR
  record.
- The `Service::Description` class now remembers the instance label in
  addition to the full instance name. This allows the instance label
  to be easily retrieved.
- The `Dns::Name::ReadName()` method is updated to only verify that
  the labels after the first label do not contain any dot characters.
  This allows it to be used to read instance service names.
- The tests are updated to validate the behavior of the SRP server
  when the instance label contains a dot character.
2023-06-26 12:55:45 -07:00
dependabot[bot] 97e9f58026 github-actions: bump ossf/scorecard-action from 2.1.3 to 2.2.0 (#9204)
Bumps [ossf/scorecard-action](https://github.com/ossf/scorecard-action) from 2.1.3 to 2.2.0.
- [Release notes](https://github.com/ossf/scorecard-action/releases)
- [Changelog](https://github.com/ossf/scorecard-action/blob/main/RELEASE.md)
- [Commits](https://github.com/ossf/scorecard-action/compare/80e868c13c90f172d68d1f4501dee99e2479f7af...08b4669551908b1024bb425080c797723083c031)

---
updated-dependencies:
- dependency-name: ossf/scorecard-action
  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>
2023-06-26 09:25:25 -07:00
Jonathan Hui 434ea2c0d0 [script] properly configure dataset in check-posix-pty (#9202) 2023-06-24 12:51:50 -07:00
Abtin Keshavarzian aa7ce0d4da [test] update unit test emulating radio (#9200)
This commit updates the unit tests that emulate the radio platform API
to define `otPlatRadioGetCaps()`, which returns the ACK_TIMEOUT and
CSMA capabilities. This is to avoid having CSMA being implemented by
the `SubMac`, which then uses the microsecond timer that is not
emulated in the unit test platform.

It also updates the `InitTest()` function to clear the radio platform
variable `sRadioTxOngoing`. This is to avoid the possible
(though unlikely) situation where an earlier test finishes in the
middle of a transmission, causing an extra `TxDone` event in the
following test.
2023-06-22 15:00:40 -07:00
gavinmcgovern 79b056add6 [docs] add radio defgroup for proper documentation (#9195) 2023-06-22 14:59:21 -07:00
Eduardo Montoya 337ea25da3 [csl] ensure child is synchronized when preparing a CSL transmission (#9199)
Avoid potential CSL Transmitter crash when using a CSL period with
0 value in `GetNextCslTransmissionDelay`.
2023-06-22 14:01:40 -07:00
Jonathan Hui dad7754752 [otci] properly configure operational dataset (#9190) 2023-06-21 10:44:42 -07:00
Jonathan Hui 330c8088b9 [thread-cert] properly configure operational dataset (#9189) 2023-06-21 10:44:28 -07:00
Song GUO e4aca89f09 [posix] add posix support for sending RA messages to routing manager (#9160) 2023-06-20 20:38:39 -07:00
Eduardo Montoya e1bfbe80a3 [cli] expose otLinkSetEnabled (#9193) 2023-06-20 19:33:49 -07:00
dependabot[bot] 88cc6c8ef3 github-actions: bump actions/checkout from 3.5.2 to 3.5.3 (#9192)
Bumps [actions/checkout](https://github.com/actions/checkout) from 3.5.2 to 3.5.3.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/8e5e7e5ab8b370d6c329ec480221332ada57f0ab...c85c95e3d7251135ab7dc9ce3241c5835cc595a9)

---
updated-dependencies:
- dependency-name: actions/checkout
  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>
2023-06-19 06:10:25 -07:00
Jonathan Hui 36b1b838d9 [expect] properly configure operational dataset (#9183) 2023-06-16 11:38:09 -07:00
Przemysław Bida 5ffdab8302 [thci] revert spellcheck in THCI method names (#9175)
Reverting name change intialize -> initalize. To fix thread harness
issues.
2023-06-16 10:12:44 -07:00
Jonathan Hui 6d557383e8 [coap] fix minor typo (#9180) 2023-06-14 20:07:24 -07:00
Abtin Keshavarzian d629ddc947 [netif] simplify signaling address events (#9173)
This commit adds two new methods, `SignalUnicastAddressChange()` and
`SignalMulticastAddressChange()`. These methods signal changes to
unicast or multicast addresses to the `Notifier`, `HistoryTracker`,
and user address callback.
2023-06-14 13:41:20 -07:00
Eduardo Montoya 068ec09135 [mac] enable/disable radio together with MAC (#9156)
Fix the behavior of `Mac::SetEnabled` for also enabling/disabling
the radio.

This ensures that the radio is turned off when `otLinkSetEnabled(false)`
is used.
2023-06-14 13:31:49 -07:00
Li Cao 55e3440ee2 [cli] add command to get tcp results (#9142)
This commit updates the cli command of TCP benchmark so that the
result of TCP benchmark could be queried any time. This enables test
scripts to automate TCP benchmark test. Currently the command `tcp
benchmark` is asynchronous and return immediately. If we use `ot-ctl
tcp benchmark` on posix, it's hard to fetch the test results. With the
newly added command, we can write a script to poll and get the result.
2023-06-14 13:31:09 -07:00
Li Cao 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
Jonathan Hui 0178ac83e5 [routing-manager] remove unnecessary kOnMeshPrefixLength decl (#9176) 2023-06-14 12:33:32 -07:00
Zhanglong Xia 4e2ed6476c [spinel] move SpiFrame implementation to spi_frame.hpp (#9151)
The `SpiFrame` is used by `ncp_spi.hpp` and `spi_interface.hpp`. This
commit moves the `SpiFrame` implementation from `ncp_spi.hpp` to
`spi_frame.hpp` as a dependent module.
2023-06-13 14:39:28 -07:00
Abtin Keshavarzian cbc62cda08 [cli] update OutputEidCacheEntry() (#9171)
This commit updates `OutputEidCacheEntry()` and how it converts
cache entry state to string.
2023-06-13 13:36:48 -07:00
Abtin Keshavarzian b128deec01 [mesh-diag] fix initializing of mEndOffset in ChildIterator (#9172) 2023-06-13 13:34:18 -07:00
Jonathan Hui 3a2969d922 [routing-manager] require valid on-link prefix to be /64 (#9167) 2023-06-13 12:28:44 -07:00
Abtin Keshavarzian d56059e022 [config] add mesh_forwarder.h config header file (#9164)
This commit adds the `config/mesh_forwarder.h` header file, which
defines all of the configurations used by the `MeshForwarder`.
These configs were previously included in `misc.h`.
2023-06-12 11:46:23 -07:00
dependabot[bot] 8157e5d0e2 github-actions: bump codecov/codecov-action from 3.1.3 to 3.1.4 (#9166)
Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 3.1.3 to 3.1.4.
- [Release notes](https://github.com/codecov/codecov-action/releases)
- [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/codecov/codecov-action/compare/894ff025c7b54547a9a2a1e9f228beae737ad3c2...eaaf4bedf32dbdc6b720b63067d99c4d77d6047d)

---
updated-dependencies:
- dependency-name: codecov/codecov-action
  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>
2023-06-12 11:40:39 -07:00
Zhanglong Xia 47f15e3483 [spinel] move the MultiFrameBuffer implementation to multi_frame_buffer.hpp (#9150)
The `MultiFrameBuffer` is not only used by `hdlc.hpp`, it is also used
by `spi_interface.hpp` and `radio_spinel.hpp`. This commit moves the
`MultiFrameBuffer` implementation from `hdlc.hpp` to
`multi_frame_buffer.hpp` as a dependent module.
2023-06-12 11:32:23 -07:00
Abtin Keshavarzian 90c090f1ef [mle] send unicast Link Request to 1.2 parent on router role promo (#9154)
This commit adds a new mechanism to send a unicast MLE Link Request to
the device's former parent if its version is earlier than 1.3.0, when
the device is promoted from a child to a router role. This is to
address a potential compatibility issue with some non-OpenThread
stacks which may ignore MLE Advertisements from a previous/existing
child.
2023-06-12 11:29:06 -07:00
gavinmcgovern 9b99fbfd09 [docs] cli cmd doc updates (mliid - multiradio neighbor) (#9155) 2023-06-09 15:52:38 -07:00
Abtin Keshavarzian ff57bce41a [toranj] update build.sh script to use Thread version 1.3.1 (#9159)
This commit updates toranj `build.sh` script to use Thread version
1.3.1. This ensures that we can cover features that are restricted to
this version in `toranj` test-cases.
2023-06-09 15:52:04 -07:00
Eduardo Montoya 6acff9a9ad [csl] improved CSL debug logging (#9040)
Improve logging in CSL debug mode by properly calculating the drift
of the received frame compared with the established CSL sample time.

The new log also shows what was the accepted margin for the drift at
the reception time, and increases the logging level when the drift
is outside the margin.

Neither kCslReceiveTimeAhead or kMinReceiveOn* are considered for
the margin since they have no impact on understanding possible drift
errors between transmitter and receiver.
2023-06-09 13:15:54 -07:00
Abtin Keshavarzian cc851aacda [mle] restrict otDeviceProperties to version 1.3.1 or later (#9157)
This commit restricts the `otDeviceProperties` functionality to
OpenThread builds with `OT_THREAD_VERSION` set to `1.3.1` or later.
This functionality was added in PR #8670 and is used to calculate and
set the local Leader Weight on the device based on its properties,
such as power supply configuration and whether or the device is
acting as a Border Router, etc.
2023-06-09 12:51:16 -07:00
Zhanglong Xia b2116446bc [spinel] remove fetching the ncp dataset (#9140) 2023-06-09 00:00:32 -07:00
Abtin Keshavarzian e7b591e0e7 [cmake] fix OT_THREAD_VERSION comparison in CMake (#9158)
This commit fixes the check for CMake `OT_THREAD_VERSION` against
different version strings ("1.1", 1.2", "1.3", and "1.3.1"). The
previous check used `EQUAL`, which would do a numerical match and
would treat `1.3` and `1.3.1` as equal. This commit changes the check
to use `STREQUAL`, which does a string match and will correctly
distinguish between `1.3` and `1.3.1`.

This commit also adds new `message(STATUS)` commands to output the
selected Thread version. This makes it easier to see which version of
Thread is being built.
2023-06-08 20:44:02 -07:00
Abtin Keshavarzian 82b31adfd0 [bbr] simplify DomainPrefixEvent (#9152)
- Rename to `DomainPrefixEvent` from `DomainPrefixState`
- Remove the unused `kDomainPrefixNone` enumeration
2023-06-08 19:54:59 -07:00
Song GUO 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
Abtin Keshavarzian edc1a3fe23 [tlvs] new helper to find the start and end offsets of a TLV value (#9144)
This commit adds two changes to the `Tlvs` class:
- A new method, `FindTlvValueStartEndOffsets()`, has been added to
  find the start and end offsets of a TLV value within a `Message`.
  This method is useful for code that needs to find the value of a
  TLV and then search within that value.
- The unused method, `FindTlvOffset()`, has been removed. This method
  was previously only used by the `Tlvs` class itself.
2023-06-07 13:25:09 -07:00
Zhanglong Xia 4c5320168c [spinel] fix the non-virtual destructor error (#9139) 2023-06-07 10:33:11 -07:00
Zhanglong Xia cc09029188 [posix] replace fd_sets with the mainloop context (#9127) 2023-06-06 22:44:39 -07:00
Lorenzo Rai 439b58279b [logging] fix rtt logging not using defined buffer index (#9133) 2023-06-06 21:48:46 -07:00
Yakun Xu fd46c16a5c [netif] use fix type to u8 for addr_gen_mode (#9147)
From the kernel code, addr_gen_mode should be uint8_t.
2023-06-06 21:11:49 -07:00
Abtin Keshavarzian b69dfef1cc [mlr] use Array<> to track old registered MLR addresses (#9134) 2023-06-06 18:10:58 -07:00
Abtin Keshavarzian 6a549d1cdb [cli] add helper ProcessEnableDisable() methods (#9138) 2023-06-06 15:49:40 -07:00
Abtin Keshavarzian 982057e095 [mle] simplify tracking of registered DUA address by child (#9137) 2023-06-06 15:06:21 -07:00
Zhanglong Xia 7e8f77b55e [posix] unify the spinel interface functions (#9107)
This commit adds all Spinel interface functions to the `SpinelInterface`
as pure virtual functions and inherits all Spinel interfaces from
`SpinelInterface`, so that the Thread Network HAL can dynamically
create the Spinel interface based on the configuration of the radio URL
in Android. This commit also removes the macro guard from the Spinel
interface header files.
2023-06-05 14:59:38 -07:00
dependabot[bot] 98fe3f3875 github-actions: bump actions/checkout from 3.3.0 to 3.5.2 (#9132)
Bumps [actions/checkout](https://github.com/actions/checkout) from 3.3.0 to 3.5.2.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/ac593985615ec2ede58e132d2e21d2b1cbd6127c...8e5e7e5ab8b370d6c329ec480221332ada57f0ab)

---
updated-dependencies:
- dependency-name: actions/checkout
  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>
2023-06-05 12:40:25 -07:00
Abtin Keshavarzian 161a7fddcf [bbr] move BBR constants to related source files (#9129)
This commit moves BBR and DUA related constants to the related source
files (from `mle_types.hpp`). Additionally, unused constant variables
are removed. Some of the constants are renamed to make the definition
more clear.
2023-06-05 12:34:28 -07:00