Commit Graph

7260 Commits

Author SHA1 Message Date
Abtin Keshavarzian 8bc25042ba [test] fix unused returned value warning in test_hdlc (#9256)
This commit updates unit test `test_hdlc` to check the returned
error from `SaveFrame()` (which was recently changed in #9244).
thread-reference-20230706
2023-07-06 20:27:43 -07:00
dependabot[bot] 6fe8b6f380 Bump grpcio from 1.20.1 to 1.53.0 in /tools/harness-simulation/harness (#9257)
Bumps [grpcio](https://github.com/grpc/grpc) from 1.20.1 to 1.53.0.
- [Release notes](https://github.com/grpc/grpc/releases)
- [Changelog](https://github.com/grpc/grpc/blob/master/doc/grpc_release_schedule.md)
- [Commits](https://github.com/grpc/grpc/compare/v1.20.1...v1.53.0)

---
updated-dependencies:
- dependency-name: grpcio
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-07-06 20:27:18 -07:00
Eduardo Montoya 37fb770989 [cli] fix childsupervision commands documentation (#9201)
Previous documentation could be wrongly interpreted as that the
supervision interval should be set on the parent (FTD).
2023-07-05 10:21:11 -07:00
Zhanglong Xia f7b189c882 [posix] fix the snprintf buffer overflow issue (#9251) 2023-07-05 10:20:07 -07:00
Eduardo Montoya cc6fa77b42 [mac] remove duplicated method for getting the MAC frame length (#9254) 2023-07-05 10:02:11 -07:00
hemanth-silabs 4eace79c98 [spinel] return error from SaveFrame if not enough space is available (#9244) 2023-07-05 10:01:22 -07:00
dependabot[bot] 6736ef2676 github-actions: bump actions/setup-python from 4.6.0 to 4.6.1 (#9252)
Bumps [actions/setup-python](https://github.com/actions/setup-python) from 4.6.0 to 4.6.1.
- [Release notes](https://github.com/actions/setup-python/releases)
- [Commits](https://github.com/actions/setup-python/compare/57ded4d7d5e986d7296eab16560982c6dd7c923b...bd6b4b6205c4dbad673328db7b31b7fab9e241c0)

---
updated-dependencies:
- dependency-name: actions/setup-python
  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-07-05 06:56:39 -07:00
Abtin Keshavarzian 0f7e8491e2 [routing-manager] PdPrefixManager to clear prefix bits when extending length (#9249)
This commit updates the `RoutingManager::PdPrefixManager::Process()`
method to `Tidy()` the prefix before setting the prefix length and
potentially extending the prefix to `kOmrPrefixLength` (64 bits).
This ensures that extended bits in the prefix are set to zero.
2023-07-03 05:52:11 -07:00
Abtin Keshavarzian 809cdc40be [ncp] keep timeout zero during ramp-down in spinel ADDRESS_CACHE_TABLE (#9247)
This commit updates the NCP code to set the timeout field in spinel
`SPINEL_PROP_THREAD_ADDRESS_CACHE_TABLE` as zero when in ramp-down
mode. This ensures that the behavior of the NCP remains unchanged and
that test cases like `ncp/test-039-address-cache-table-snoop.py`,
which expect the timeout to reach zero, to pass.
2023-07-02 18:35:44 -07:00
Martin Zimmermann 8081664d37 [csl] add APIs to retrieve status (#8793) 2023-07-01 13:42:22 -07:00
Abtin Keshavarzian 96eb2a4386 [address-resolver] implement ramp-down mechanism for retry delay (#9162)
Address resolver retry delay determines how long the device needs to
wait after a failed address query for a target address to allow a
next query attempt. This is tracked per target (in `CacheEntry`).

The retry delay starts with an initial value (15 seconds). If
consecutive queries fail, the retry delay doubles each time, up to a
maximum value (120 seconds). In the current code, the retry delay is
only reset to the initial value after a successful address
resolution.

This commit implements a new mechanism to reduce the retry delay over
time when there is no activity (no queries for the target address).
The ramp-down countdown starts after a previous retry delay has
expired. If no query is requested within the maximum retry delay
interval (120 seconds), the retry delay is divided by two. This
process is repeated until the retry delay reaches the initial
(minimum) value.

If a query is requested during the ramp-down process, the ramp-down is
stopped. The next actions are determined based on whether the query
is successful or fails. If the query is successful, the retry delay
is reset to the initial value. If the query fails, the retry delay
timeout is applied and the ramp-down process is started again after
the retry delay duration has expired.

This commit also updates the `test-014-address-resolver`  to validate
the newly added ramp-down behavior.
2023-07-01 11:12:25 -07:00
Abtin Keshavarzian 422f673c7c [routing-manager] determine route preference from parent link quality (#9080)
This commit updates how `RoutePublisher` determines the published
route preference:
- Medium preference is used on a border router (BR) acting as a router
  or a BR acting as an end-device (ED) connected to a parent with
  link quality 3.
- An ED BR with lower link quality publishes its route with low
  preference.

For ED BRs, the preference is updated if the parent's link quality
changes. However, to avoid frequent preference changes due to link
variability, the following rules are used:
- If the link quality goes to 1 or 2, the route preference is
  immediately changed to low.
- On transition to link quality 3, we wait for 5 minutes before
  changing the preference to medium.
- If the ED BR switches parents, the link quality to the new parent is
  used to determine preference.

It also adds new APIs and related CLI commands to allow users to get
and manually set the published route preference. A new test script
`test-021-br-route-prf.py` is added to validate the selection of
route preference by BR.

This commit also adds a new mechanism to detect when the link quality
to the parent changes and signal it using a newly added `Notifier`
event.
2023-07-01 07:50:01 -07:00
Jonathan Hui 3d5cb364f2 [mesh-forwarder] only mark Key ID Mode 0 and 1 as secure 2023-07-01 07:40:25 -07:00
cw8466 561966a01f [posix] fix missing nullptr pointer check (#9179)
Avoid segmentation fault for interfaces without link.
2023-07-01 07:28:28 -07:00
Jonathan Hui e772e8a86f [examples] remove example platform redirects (#9246) 2023-06-30 15:14:26 -07:00
Jonathan Hui de5afd0e36 [build] cleanup autotools references (#9242) 2023-06-30 15:14:13 -07:00
Jonathan Hui bad7994c28 [mac] move ack processing to HandleTransmitDone() (#9245) 2023-06-30 15:14:00 -07:00
Abtin Keshavarzian ef8deb506f [mle] delay router role downgrade on security policy change (#9187)
This commit adds a mechanism to delay the downgrade of routers or
leader when the security policy TLV changes in the Active Operational
Dataset such that the device is no longer eligible to act as a
router.

If the decision to become a child is made due to a security policy
change, the device first delays a random period up to the "router
selection jitter" before downgrading. If the device is the leader, an
additional fixed delay of 10 seconds is added to the random period.

If the security policy changes again while the device is waiting to
downgrade such that it becomes router-eligible again, the downgrade
is cancelled and the device remains in its current role.

This commit adds a `test_router_downgrade_on_sec_policy_change` to
validate the behavior of newly added mechanism.

This commit also updates the CLI `dataset` sub-commands to allow
getting and setting the "version threshold for routing" (VR) field in
security policy.
2023-06-30 15:09:50 -07:00
Jonathan Hui 60db56f0c0 [dataset] add build option for GenerateLocal (#9215) 2023-06-30 09:53:28 -07:00
Abtin Keshavarzian 77d1f3d1b5 [dns] add otDnsEncodeTxtData() API (#9214)
This commit adds the `otDnsEncodeTxtData()` public API, which encodes
a given list of TXT record entries (key/value pairs) into TXT data
(following the format specified by RFC 6763). The decoding of TXT
data was previously provided by the `otDnsGetNextTxtEntry()` API.
2023-06-29 10:37:02 -07:00
Joakim Andersson 9fd1da5b9e [meshcop] fix compilation error mbedtls_base64_encode not defined (#9206)
Fix compilation error mbedtls_base64_encode not defined when compiling
with MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED disabled.

The logic for including the mbedtls/base64.h header file is doing the
wrong define check.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2023-06-28 20:20:05 -07:00
andrei-menzopol c4a8badcda [message] allow heap usage when using non-thread commissioning (#9205)
Signed-off-by: Andrei Menzopol <andrei.menzopol@nxp.com>
2023-06-28 20:02:17 -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
Lorenzo Rai d91ecc5cdd [message] remove child mask from message metadata in MTD (#9213)
Saves a few bytes in MTD message metadata since they don't need the
child mask.
2023-06-28 07:42:27 -07:00
Jonathan Hui 52e157b17b [tmf] BRs default to 256 address cache entries (#9078) 2023-06-27 14:35:00 -07:00
Zhangwx d2f828f6d0 [logging] fix print format related to infra netif logs (#9212) 2023-06-27 11:18:33 -07:00
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