Compare commits

..

501 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).
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
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
Abtin Keshavarzian 41d6fc861c [cli] add CLI Backbone Router (Bbr) sub-module (#9128)
This commit adds `Bbr` CLI sub-module that implements all
"bbr" sub-commands.
2023-06-05 12:32:25 -07:00
Abtin Keshavarzian 977ac21743 [sntp-client] smaller enhancements (#9125)
This commit contains the following changes in the `Sntp::Client` class:

- The `Header` and `QueryMetadata` classes are moved to be internal
  (nested) classes of `Client`.
- The `Header` constructor is removed and replaced with an `Init()`
  method. This is to avoid unnecessary initialization of a `Header`
  instances when reading it from a received message.
- The `QueryMetadata` constructor has been removed.
- The `QueryMetadata` uses `Callback<>` for `ResponseHandler`.
2023-06-05 12:31:26 -07:00
Jonathan Hui fd1a247ae4 [github-actions] update ubuntu to 22.04 on ot-commissioner test (#9130) 2023-06-05 08:29:09 -07:00
Abtin Keshavarzian 80eb7f512f [toranj] update build.sh script to use CMake for all builds (#9115) 2023-06-01 21:39:45 -07:00
Abtin Keshavarzian 9bff9f0807 [routing-manager] fix deprecating on-link prefix from inactive router (#9121)
This commit fixes `RemoveOrDeprecateEntriesFromInactiveRouters()`
to ensure to skip over an already deprecating on-link prefix (and
not remove it).
2023-06-01 17:49:50 -07:00
Abtin Keshavarzian 3eb48ca00c [backbone-router] use Clamp to check MLR timeout value (#9119) 2023-06-01 13:05:06 -07:00
Abtin Keshavarzian 87e3250a51 [core] use Min(), Max() to clip values (#9117) 2023-06-01 13:04:09 -07:00
Abtin Keshavarzian 8f5d4376c6 [build] delete the removed child supervision config in cmake-build (#9111) 2023-05-31 13:26:39 -07:00
Song GUO 9c7e679ed1 [posix] add unified platform API for setting NAT64 CIDR during runtime (#8947)
We should notice that the default CIDR (`192.168.255.0/24`) is not
safe to use, however, in most cases, the CIDR used can only be
determined during runtime since the single binary might be distributed
to BRs in different network conditions. And we cannot conclude an
always safe CIDR in all conditions.

This commit will emit an event when NAT64 CIDR is changed. So the
platform driver can update the route for NAT64.
2023-05-30 23:16:43 -07:00
Li Cao fa81b21f4c [link-quality] fix corner case of ScaleRawValueToRssi (#9102)
Currently if we call `ScaleRawValueToRssi` with value 0 or 1, the
result is incorrect.  Because it tries to static_cast `-130` or `-129`
to `int8_t`. I think it's not worthwhile to widen int8_t to int16_t
only for the 2 corner cases. So I prefer returning the smallest value
-128 for the 2 cases.
2023-05-30 22:31:14 -07:00
Damian Królik 74c5e4ba01 [posix] fix setting non-standard baudrate on mac (#9090)
tcsetattr() fails on mac OS when a non-standard baudrate,
such as 1000000, is used. There is a separate ioct() that
accepts non-standard baudrates though.
2023-05-30 19:25:44 -07:00
Abtin Keshavarzian f05f222b44 [routing-manager] update logs (#9095)
This commit updates logs in the `RoutingManager` module:
- The log module name is changed to "RoutingManager".
- State changes are logged (enabling, disabling, starting, etc.).
- The `ScheduleRoutingPolicyEvaluation()` log will show the delay in
  both milliseconds and "<mm>:<ss>.<msec>" format(e.g. `05:15.234`).
- Logging of PIOs and RIOs are harmonized (when preparing RA to send
  or processing a received RA).
- Local on-link prefix logs are harmonized in `OnLinkPrefixManager`.
- `RsSender` logs are simplified.
2023-05-30 13:26:08 -07:00
Abtin Keshavarzian edf539ce27 [random] add Fill<ObjectType>() function (#9097)
This commit adds template `Fill<ObjectType>(ObjectType &aObject)`
functions for both `Crypto` and `NonCrypto` random number generation
modules. These functions fill a given object with random byes.
2023-05-30 13:25:10 -07:00
Damian Królik b14646b5a8 [csl] fix 15.4-secured broadcast frames (#9103)
The CSL present flag was not cleared in the frame structure,
causing that the MAC security was not be processed for Key
ID Mode 2 frames. Consequently, MLE Announcements would be
rejected by the sub-MAC layer after a CSL receiver detached
from its parent.

Signed-off-by: Damian Krolik <damian.krolik@nordicsemi.no>
2023-05-30 11:31:57 -07:00
Zhanglong Xia c187e4d049 [posix] add Thread network default interface name configuration (#9089)
The default Thread interface name `wpan0` has been occupied by
other programs in Android. Thread network has to use other
network interface name. Then users have to specify an interface
name when they are using the command `ot-ctl`. It's very inconvenient.

This commit adds a configuration for developers to set the default
Thread interface name.
2023-05-29 10:14:44 -07:00
dependabot[bot] 4650e341a4 github-actions: bump github/codeql-action from 2.3.3 to 2.3.5 (#9100)
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 2.3.3 to 2.3.5.
- [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/29b1f65c5e92e24fe6b6647da1eaabe529cec70f...0225834cc549ee0ca93cb085b92954821a145866)

---
updated-dependencies:
- dependency-name: github/codeql-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-05-29 10:12:36 -07:00
Li Cao c092fab737 [radio] fix return code doc of link metrics api (#9098) 2023-05-29 10:12:10 -07:00
Jonathan Hui 73ce42c6e6 [docs] remove redundant "This method" and "This function" (#9096)
- "This method "
- "This static method "
- "This function "
- "This structure "
- "This enumeration "
- "This class "
- "This methods "
- "This constructor "
- "This struct "
- "This type "
- "This template method "
- "This template class "
- "This const method "
- "This macro "
2023-05-29 10:11:10 -07:00
Abtin Keshavarzian 77d4b78a69 [cli] update documentation of Process() method in CLI sub-modules (#9093) 2023-05-26 15:41:09 -07:00
Abtin Keshavarzian 323ffd894b [cli] add CLI MacFilter sub-module (#9088)
This commit adds `MacFilter` CLI sub-module that implements all
"macfilter" sub-commands. It also simplifies the implementation by
adding a common `OutputFilter()` method that can output either the
Address filter, the RSS filter, or both.
2023-05-26 08:57:45 -07:00
Abtin Keshavarzian 9ad692488c [cli] add helper OutputNat64Counters() (#9087)
This commit adds a new helper method `OutputNat64Counters()` which
outputs a table row for NAT64 counters (4to6/6to4 packets/bytes).
This helps simplify the `nat64` commands.
2023-05-25 20:32:32 -07:00
whd c6ea8afc85 [tests] check whether the unreachable address is included in the DNS-SD response (#9075)
This commit enhances the DNS-SD server test that it verifies if the
unreachable address is included in the DNS-SD response.
2023-05-24 15:28:01 -07:00
Abtin Keshavarzian b82cfddd68 [uptime] requires UPTIME feature to be enabled on FTD build (#9079) 2023-05-23 12:36:18 -07:00
David Smith afe5041d07 [alarm] otPlatAlarm requirements clarification (#9067)
The requirement in the code comments is not completely accurate wrt to
the example implementations. As such, the requirements are updated to
match what is implemented for the posix platform.
2023-05-23 09:50:39 -07:00
Zhanglong Xia f64b7cc73c [test] add code spell check and correct wrong spelling (#9066) 2023-05-22 18:04:09 -07:00
dependabot[bot] cba9363627 github-actions: bump actions/setup-go from 4.0.0 to 4.0.1 (#9076)
Bumps [actions/setup-go](https://github.com/actions/setup-go) from 4.0.0 to 4.0.1.
- [Release notes](https://github.com/actions/setup-go/releases)
- [Commits](https://github.com/actions/setup-go/compare/4d34df0c2316fe8122ab82dc22947d607c0c91f9...fac708d6674e30b6ba41289acaab6d4b75aa0753)

---
updated-dependencies:
- dependency-name: actions/setup-go
  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-05-22 14:50:14 -07:00
Abtin Keshavarzian 804ba31056 [notifier] add missing event in EventToString() (#9072) 2023-05-22 14:10:49 -07:00
Abtin Keshavarzian db4606871a [cli] add CLI DNS sub-module (#9069)
This commit adds `cli_dns` CLI module which contains implementation
of all "dns" sub-commands.
2023-05-19 11:58:18 -07:00
Zhanglong Xia 853f6eab0b [core] add the instance id (#9055)
It is difficult for testers to know whether the stack has been
automatically restarted in the background. This commit adds an
instance id to indicate whether the stack has been restarted.
The instance id is set to a random value when the OpenThread
instance is constructed and its value will not change after
initialization.
2023-05-18 15:40:45 -07:00
Abtin Keshavarzian b420a860ab [cli] fix config check for "vendor" command (#9068)
The "vendor" command should be available on both FTD and MTD.
2023-05-18 13:44:01 -07:00
Piotr Koziar deaec54dbf [ncp] fix RegisterPeekPokeDelegates call (#9064)
This commit fixes an issue where `RegisterPeekPoke` was called instead
of `RegisterPeekPokeDelegates`, causing compilation errors in some
builds.
2023-05-18 13:01:54 -07:00
Kangping 62f8205993 [border-agent] set Border Agent ID via CLI (#9049)
This commit adds:
1. A new `otBorderAgentSetId()` API to override the auto generated
   random ID
2. CLI commands to read write the Border Agent ID.
2023-05-18 11:12:35 -07:00
Abtin Keshavarzian d9abe3071c [dns-client] new API resolve host and address (#9054)
This commit adds `otDnsClientResolveServiceAndHostAddress()` function
as a new DNS Client API. This function starts a DNS service instance
resolution for a given service instance, with a potential follow-up
address resolution for the host name discovered for the service
instance (when the server/resolver does not provide AAAA/A records
for the host name in the response to SRV query).

In order to test the behavior of the newly added function, `TestMode`
in `Dns::ServiceDiscovery::Server` is updated to add a new mode where
no RR is added in the Additional Data section of a DNS query response.

This commit adds a related CLI command for the new API and updates
`test_dns_client` to validate the behavior of new API using the new
`TestMode` on `Server`.
2023-05-17 17:03:46 -07:00
Abtin Keshavarzian f8f6cf95f6 [routing-manager] add OmrPrefixManager (#9062)
This commit adds the `OmrPrefixManager` class to the `RoutingManager`.
The `OmrPrefixManager` class manages OMR prefixes. In particular, it
determines the favored and local OMR prefixes, and decides when/if to
add/remove the local OMR prefix to/from Network Data.
2023-05-17 14:47:42 -07:00
Eduardo Montoya a44919038c [csl] split min receive window into MHR ahead and after times (#9041)
Existing `kMinCslWindow` does not account for needed radio on time
before MHR. Solve it by splitting the configuration option into both
ahead and after minimum times.
2023-05-17 13:29:14 -07:00
Song GUO caf9ce839a [ip6] add Tidy method to Ip6::Prefix (#9057)
Given the fact that we may accept a string from `otIp6Address`, this
commit makes a copy in `ToString()` to make result more consistent.
2023-05-17 12:31:07 -07:00
Nick Bertoldi dae3ff2c50 [cli] support adding vendor command list to cli apps (#9001) 2023-05-16 19:59:20 -07:00
Abtin Keshavarzian 0186152d40 [radio-spinel] add log on RCP timeout error during init (#9059)
This commit adds new logs to `HandleRcpTimeout()` when an RCP timeout
occurs during initialization. This error is often incorrectly
reported as a bug, but it is usually caused by an incorrect
configuration or a bad RCP image. The new logs aim to provide
information and hints to the user about the cause of the error.
2023-05-16 18:40:37 -07:00
Abtin Keshavarzian 9ed8a071c1 [mle] echo back "Supervision TLV" in Child ID Response (#9061)
This commit updates the `MleRouter` to echo back the "Supervision
TLV" in MLE Child ID Response message when it is included in
MLE Child ID Request by a child.
2023-05-16 18:39:18 -07:00
Jonathan Hui 7c5dca178f [tests] fix routing_manager unit tests (#9053) 2023-05-15 14:22:16 -07:00
Yi 73d3ea5449 [nat64] check OMR prefix when selecting favored NAT64 prefix (#8995)
This commit adds a check on OMR prefix before selecting AIL prefix as
the favored NAT64 prefix for publishing.
2023-05-15 09:57:20 -07:00
dependabot[bot] fc08dd62f5 github-actions: bump github/codeql-action from 2.2.12 to 2.3.3 (#9051)
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 2.2.12 to 2.3.3.
- [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/7df0ce34898d659f95c0c4a09eaa8d4e32ee64db...29b1f65c5e92e24fe6b6647da1eaabe529cec70f)

---
updated-dependencies:
- dependency-name: github/codeql-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-05-15 09:42:37 -07:00
Abtin Keshavarzian b200c968e7 [routing-manager] update OMR prefix def-route flag when publishing ::/0 (#9042)
This commit adds a new mechanism to update the default route flag on
the local OMR prefix based on whether or not the BR is publishing
the `::/0` external route prefix.

When `RoutePublisher` (the component that determines which route
prefix to publish) decides to publish/unpublish the default route as
`::/0`, it will inform `LocalOmrPrefix` (the component that manages
when the local OMR prefix is added/removed in Thread Network Data) of
the def-route flag to use.
- If the local OMR prefix is not yet added, the def-route flag will be
  remembered to be used when/if it is added.
- If the local OMR prefix is already added, the entry in Network Data
  is updated to use the new def-route flag.

This change addresses a backward compatibility issue with devices running
1.2 or earlier Thread versions. These devices may not correctly parse or
accept a zero-length `::/0` route prefix in the Network Data. Adding
the default-route flag on the OMR prefix ensures that these devices
can reach the border router that added the OMR prefix.
2023-05-12 12:02:01 -07:00
Jonathan Hui e2cb3c647d [alarm] update docs to explicitly require 32-bit alarms (#9043) 2023-05-12 11:34:42 -07:00
Abtin Keshavarzian 48abf12e00 [dns-client] check all responses in GetHostAddress() (#9044)
This commit fixes an issue with `ServiceResponse::GetHostAddress()`
method. The issue only occurs when separate queries (e.g., for SRV
and TXT records) are used, and therefore separate `Response` objects
are collected and chained together as a linked list. The change
ensures that we check every response in the list when getting host
addresses.
2023-05-11 19:37:13 -07:00
Abtin Keshavarzian 2f995999f4 [ip6] add new versions of NewMessage() (#9038)
This commit adds new versions of `NewMessage()` in `Ip6`, `Udp` with
different set of parameters. It also updated the code to avoid use of
default parameter value.
2023-05-11 11:49:46 -07:00
Li Cao cea434e98f [log] log the port for backbone (#9039)
To follow the convention to log any not well-known ports.
2023-05-11 11:26:42 -07:00
Abtin Keshavarzian 4cba902db1 [ip6] simplify and update NewMessageFromData() (#9037)
This commit simplifies and updates the `NewMessageFromData()` method
to always determine the priority from the IPv6 header, even if a
`Message::Settings` is provided. This change aligns the behavior of
`NewMessageFromData()` with the documented and intended behavior of
`otIp6NewMessageFromBuffer()`.
2023-05-10 17:59:32 -07:00
Jonathan Hui 161a4407e2 [github-actions] add arm-gcc {10,11,12} checks (#9035) 2023-05-10 16:42:28 -07:00
Nick Bertoldi 1203ea6426 Define posix radio RadioSpinel accessor (#9018)
When adding cli commands to be used by a posix platform is is useful
to have access to the spinel interface when trying to communicate with
a RCP using vendor specific spinel properties. It is inadvisable to
create a separate spinel interface for custom properties as the two
interfaces would need to avoid contention on the hardware interface.

This accessor method allows access to the static spinel interface
defined in radio.cpp for external code segments. Dependent source
files can do so with: `(RadioSpinel<InterfaceType,
ProcessContextType>*)Posix::Radio::getSpinelInstance()` or similar.
2023-05-09 18:37:54 -07:00
Jonathan Hui fb45cf23fd [network-name] consolidate default network name definition (#9036) 2023-05-09 14:51:33 -07:00
Abtin Keshavarzian c09b57392e [topology] track connection time of neighbors (#9007)
This commit introduces a mechanism to track the connection time of
neighbors as the number of seconds since the last successful link
establishment with the neighbor. This feature requires  the
configuration `OPENTHREAD_CONFIG_UPTIME_ENABLE` to be enabled which
is now enabled by default on FTD builds. The connection time of each
neighbor is available in the `otNeighborInfo` and `otChildInfo`
structures as the `mConnectionTime` member variable. A new CLI
command, `neighbor conntime`, has been added to display the
connection time and age of all neighbors.
2023-05-09 13:12:19 -07:00
Abtin Keshavarzian a259d23e7f [string] add StringParseUint8() helper function (#9026)
This commit adds a helper function to parse a decimal number from a
given string as `uint8_t` and skip over the parsed characters. This
is used to simplify the methods parsing IPv6/IPv4 address or prefix
from a string.
2023-05-09 12:54:39 -07:00
Przemysław Bida 5081882bb9 [link-metrics] fix compilation errors (#9033)
Link metric macros `OPENTHREAD_CONFIG_MLE_LINK_METRICS_INITIATOR_ENABLE`
and `OPENTHREAD_CONFIG_MLE_LINK_METRICS_SUBJECT_ENABLE` were guarding
incorrect parts of code.

Signed-off-by: Przemyslaw Bida <przemyslaw.bida@nordicsemi.no>
2023-05-09 11:33:54 -07:00
Mason Tran f86d560e0a [build] add CMake Android NDK support (#9010) 2023-05-09 11:01:51 -07:00
Mariusz Poslinski 3d3ed4fbc1 [tcp] remove EXCLUDE_TCPLP_LIB option (#8883)
Signed-off-by: Mariusz Poslinski <mariusz.poslinski@nordicsemi.no>
2023-05-08 21:23:40 -07:00
Abtin Keshavarzian 92b954ae1d [netdata] add otNetDataReplacePublishedExternalRoute() API (#9013)
This commit adds a public OT API to replace a previously published
external route entry in the Thread Network Data. It also adds a
related CLI command, and updates `test_netdata_publisher` to
validate the new behavior.
2023-05-08 20:05:21 -07:00
Kangping 874b6beca8 [border-agent] fix BorderAgentId compile and enable it in CI tests (#9030) 2023-05-08 09:09:46 -07:00
dependabot[bot] 9eb22897ea github-actions: bump codecov/codecov-action from 3.1.1 to 3.1.3 (#9031)
Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 3.1.1 to 3.1.3.
- [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/d9f34f8cd5cb3b3eb79b3e4b5dae3a16df499a70...894ff025c7b54547a9a2a1e9f228beae737ad3c2)

---
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-05-08 09:00:29 -07:00
Kangping eaa2779047 [settings] define new Settings key for Border Router ID (#8971)
This commit adds new Border Agent functionality that generates and
saves 16 bytes ID in settings.  The ID can be published in the MeshCoP
mDNS service and used by the client to identify a Border Router
device.

A new `otBorderAgentGetId()` API is defined and the ID is generated
the first time this API is called.
2023-05-05 10:48:57 -07:00
Song GUO 96ea73076e [posix] update upstream DNS addresses after a few minutes (#8972)
On some platforms, the /etc/resolv.conf might be a generated file, and
is not available at the first few minutes after boot.

This commit records the time when we read the DNS server addresses
from the upstream, and reload the server list when it expires.

We may want to use inotify or add a platform specific API to notify
the openthread about the change of DNS server list.
2023-05-04 20:59:06 -07:00
Li Cao 612f21e776 [link-metrics] refactor link metrics module (#8966)
This commit breaks Link Metrics Initiator and Subject into two classes
and fixes incorrect swtich guard. For example, code for Initiator was
guarded by macro of Subject.
2023-05-04 20:58:06 -07:00
Song GUO 9affbabc53 [cli] refactor br command prefix type (#9022)
We are adding another new type of prefix. This commit refactors
`ParsePrefixTypeArgs` to make it more flexible.
2023-05-04 10:41:46 -07:00
Yakun Xu 30b79ccee8 [test] migrate tests to cmake (#8929)
This commit migrate tests not targeting autotool to cmake.

* removed openthread-test-driver
* removed functional tests from autotool based check
* corrected file permission of python scripts
* added --run-directory to specify directory to collect logs and captures
* get test-ot-test-srp-server pass on POSIX platform
2023-05-04 09:59:24 -07:00
Abtin Keshavarzian 2caf6b818a [ip6] add otIp6PrefixFromString() (#9016)
This commit adds the `Ip6::Prefix::FromString()` method, which parses
a human-readable IPv6 prefix string into a binary representation. It
also updates the unit test `test_ip_address` to validate the new
method, and updates the `parse_cmdline` module to use the new
function.
2023-05-03 18:28:32 -07:00
Abtin Keshavarzian a7edd859ee [netdata] prefer BR acting as router over ED (when all other checks are same) (#9012)
This commit updates the `CompareRouteEntries()` method so that if all
of the earlier checks (preference, path cost) are the same, it will
prefer a border router (BR) acting as a router over one acting as an
end device. The reason is that a device can more accurately calculate
the path cost to a router node than to an end device. This is because
the link quality between an end device and its parent is not known to
other devices.
2023-05-03 17:20:38 -07:00
Abtin Keshavarzian 4fed5ea0f0 [net-diag] vendor name, model, and sw version TLVs (#8898)
This commit adds new Network Diagnostic TLVs for vendor name, vendor
model and vendor software version. The TLVs follow similar format as
the MeshCoP TLVs with the same name, i.e., all of them use UTF8
strings as value with name and model limited to 32 characters, and
software version to 16 characters.

The values for these TLVs can be set at build-time using a set of
newly added configs `OPENTHREAD_CONFIG_NET_DIAG_VENDOR_*`, or their
equivalent CMake options (e.g., `OT_VENDOR_NAME`).

It is recommended that these parameters are set at build time using
the configs. This way they are stored as constant strings and won't
consume RAM. However, for situations where the OT stack is integrated
as a library into different projects/products, we can enable a
feature for APIs to be added to set these strings at run-time. In
this case, the `OPENTHREAD_CONFIG_NET_DIAG_VENDOR_*` are treated as
the default values (used when OT stack is initialized).

This commit also adds Thread Stack Version TLV which has a string
value (up to 64 characters) and provides the version string from
`otGetVersionString()`.

This commit also adds CLI commands to get and set (when enabled) the
vendor name, model, and sw version on device. Also adds a test case
`test-020-net-diag-vendor-info.py`.
2023-05-03 13:57:25 -07:00
Abtin Keshavarzian 6f909a1d6a [mle] request "Route TLV" after quick re-attach as FED (#8956)
This commit allows an FED child to request Route TLV (in "TLV Request
TLV") in an MLE Data Request message. Parent will include the Route
TLV when requested by the child.

After successfully performing a quick re-attach upon reset, an FED
child requests Route TLV when sending MLE Data Request to its parent.
This is tracked by a newly added boolean `mRequestRouteTlv`, which is
set after quick re-attach and cleared when Route TLV is successfully
processed.

This commit also simplifies methods related to sending Data Request.
2023-05-02 23:15:33 -07:00
Abtin Keshavarzian b9a318092c [mle] fix how time per role is tracked after counters are reset (#9011)
This commit fixes an issue with tracking time spent in each role after
`Mle::ResetCounters()`. The  `mLastUpdatedTimestamp` is now updated
from `ResetCounters()`.
2023-05-02 12:05:17 -07:00
Nick Bertoldi 6b7cbbcd7b [posix] vendor support with lib dependencies (#8950)
A vendor interface implementation for the posix library is currently
supported through linking a specified c++ source file. However, this
is unable to accomodate dependencies for external libraries or header
files that this vendor implementation source file may need.

The posix vendor support is changed to allow a vendor to specify a
cmake RcpVendorDeps module file to resolve missing dependencies for a
provided vendor support source file.

Additionally, this commit adds the ability for a vendor to define a
radio url help message when the vendor rcp bus is selected instead of
defaulting to the UART help message.
2023-05-02 11:24:26 -07:00
Abtin Keshavarzian d6221f4d32 [routing-manager] RoutePublisher and new route publishing model (#8986)
This commit updates the `RoutingManager` module to implement a new
model for publishing routes. The new model replaces the previous
model, which explicitly published all discovered routes and on-link
prefixes (from processing Router Advertisements on AIL) as external
routes in the Network Data.

The new model simplifies this logic by publishing either a `fc00::/7`
(ULA) route or a `::/0` (default) route in the Network Data,
depending on the set of discovered routes and on-link prefixes, and
the currently favored OMR prefix.

This commit adds the `RoutePublisher` class, a nested sub-component of
the `RoutingManager` class. The `RoutePublisher` class is responsible
for determining the route prefix to publish and its preference. The
preference of the published route is determined based on the current
role of the Border Router (BR): low preference if the BR is a child,
and medium preference if the BR is acting as a router.

This commit also updates `test_routing_manager` unit test validating
the new behavior.
2023-05-01 18:30:14 -07:00
dependabot[bot] 2dcecb7ac0 github-actions: bump actions/setup-python from 4.5.0 to 4.6.0 (#9008)
Bumps [actions/setup-python](https://github.com/actions/setup-python) from 4.5.0 to 4.6.0.
- [Release notes](https://github.com/actions/setup-python/releases)
- [Commits](https://github.com/actions/setup-python/compare/d27e3f3d7c64b4bbf8e4abfb9b63b83e846e0435...57ded4d7d5e986d7296eab16560982c6dd7c923b)

---
updated-dependencies:
- dependency-name: actions/setup-python
  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-05-01 08:31:30 -07:00
Abtin Keshavarzian 34ecac8536 [mle] clear/update address cache entries on promotion of child to router (#8987)
This commit contains two related changes:
- On a parent, when we detect a former child has been promoted to
  router role by receiving an MLE Advertisement from it, we replace
  the address cache entries associated with the old (child) RLOC16
  with it new RLOC16.
- On leader, when we successfully reply to an "Address Solicit"
  message and assign a new RLOC16 to a node, we clear all entries
  associated with old RLOC16. We do not change to new RLOC16 since we
  cannot be sure that child will successfully receive the Address
  Solicit" response.
2023-04-29 10:41:45 -07:00
Abtin Keshavarzian c59eb37c60 [mle] add parent request callback config (#8989)
This commit adds `MLE_PARENT_RESPONSE_CALLBACK_API_ENABLE` config
which enables support for `otThreadRegisterParentResponseCallback()`
API. This API registers a callback to notify user of received
Parent Response message(s) during attach. This API is mainly intended
for debugging and therefore is is disabled by default. It is enabled
in `toranj-config` so to validate the code (i.e. it causes no build
errors) during CI GitHub action runs.
2023-04-28 20:36:42 -07:00
Abtin Keshavarzian 0ce28ba1c2 [dns-client] update API docs (#8962)
This commit updates `otDnsClient` API documentation making the service
resolution `otDnsClientResolveService()` behavior more clear, in
particular that it sends queries for SRV/TXT records. The new
documents also highlight how records in Additional Data section
in a query response is parsed and provided in the callbacks and that
servers/resolvers may not provide the records.
2023-04-28 15:42:06 -07:00
Mason Tran f3701b746a [build] add cmake option for generating .map files (#9006)
This adds the CMake option `OT_LINKER_MAP` which will generate `.map`
files for any executables built when the option is `ON`.
2023-04-28 13:39:59 -07:00
parag-silabs 2952d2389f [diag] implement diag stream command (#8975)
- Add `expect` simulation test.
- Update the diag/README.md
2023-04-28 12:01:09 -07:00
Yakun Xu 674cbfaa5c [otci] fix some style issues (#8996)
This commit fixes some style issues of otci. Also includes some minor
changes:
* added pytype check in otci
* exported `OTCommandHandler`
2023-04-27 20:05:02 -07:00
Nick Bertoldi 5657335de4 [cli] store cli user commands in container and support list prepend (#8977)
Calls to otCliSetUserCommand overwrite the pointer user command list
pointer each time it is invoked, which results in successive calls to
otCliSetUserCommand replacing the previously registered command list
instead of appending to it. This is particularly relevant for the
posix platform in which the main function registers a set of posix
specific commands without any way to extend the set.

This commit replaces the command list pointer with a container of
command lists associated with a registered context in order to support
prepending the active list of user commands up to a configurable value
which defaults to 1 to maintain current behavior.
2023-04-26 09:07:30 -07:00
Abtin Keshavarzian 5e15b93ff2 [daemon] remove log of CLI input (#8994)
This commit removes logging of the CLI input in `Daemon::Process()`.
This ensures that sensitive info (e.g. dataset and/or network key)
is not emitted in the logs. The CLI input/output can be logged using
the CLI related configs `OPENTHREAD_CONFIG_CLI_LOG_INPUT_OUTPUT_ENABLE`
and/or `OPENTHREAD_CONFIG_CLI_LOG_INPUT_OUTPUT_LEVEL`.
2023-04-26 06:41:36 -07:00
hemanth-silabs 25942910ab [crypto] allow key reference usage for ECDSA (#8961)
Add new class to handle ECDSA using key refs.
Update SRP to use key refs.
2023-04-25 21:48:53 -07:00
dependabot[bot] 4b0f566bd5 github-actions: bump step-security/harden-runner from 2.3.0 to 2.3.1 (#8991)
Bumps [step-security/harden-runner](https://github.com/step-security/harden-runner) from 2.3.0 to 2.3.1.
- [Release notes](https://github.com/step-security/harden-runner/releases)
- [Commits](https://github.com/step-security/harden-runner/compare/03bee3930647ebbf994244c21ddbc0d4933aab4f...6b3083af2869dc3314a0257a42f4af696cc79ba3)

---
updated-dependencies:
- dependency-name: step-security/harden-runner
  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-04-24 07:21:25 -07:00
Yakun Xu 6bfcc0d7d4 [test] require either mdns or avahi (#8959)
This commit relax the requirement of mDNS so that it's OK when either
mdns or avahi is present.
2023-04-20 19:11:19 -07:00
Abtin Keshavarzian 2a93eeabce [sub-mac] check key-id to match in SignalFrameCounterUsed() (#8978)
This commit ensures to check that `KeyId` on a frame matches the
current `mKeyId` from `SignalFrameCounterUsed()`. This addresses
corner-case situation where on key sequence change, an ongoing frame
tx or enhanced ack to a received frame, can be processed  after the
`mKeyId` change.
2023-04-20 17:42:58 -07:00
Abtin Keshavarzian 658179fa93 [dns-client] fix finalizing query from HandleTimer() (#8982)
This commit fixes an issue in `HandleTimer()` where we need to use
`break` instead of `continue` after calling `FinalizeQuery()`. Note
that we now have two loops, an outer loop on `mMainQueries` and then
an inner loop on queries associated with a `mainQuery`. When we
finalize a query, its related `mainQuery` (along with all its
sub-queries) are finalized and removed.
2023-04-20 17:40:48 -07:00
Jonathan Hui 6955fde6ae [github-actions] replace deprecated set-output commands (#8976) 2023-04-20 08:48:20 -07:00
Jonathan Hui 4a41cb48d5 [mle] enable Inform Previous Parent feature by default (#8969) 2023-04-18 21:51:03 -07:00
dependabot[bot] f0232d0f79 github-actions: bump github/codeql-action from 2.2.5 to 2.2.12 (#8968)
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 2.2.5 to 2.2.12.
- [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/32dc499307d133bb5085bae78498c0ac2cf762d5...7df0ce34898d659f95c0c4a09eaa8d4e32ee64db)

---
updated-dependencies:
- dependency-name: github/codeql-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-04-17 10:34:05 -07:00
Song GUO 9783c14e24 [nat64] add function for parsing IPv4 CIDR (#8954) 2023-04-17 10:14:08 -07:00
Abtin Keshavarzian 25fe46d8dd [mle] simplify parsing of Address Registration TLV entries (#8963)
This commit adds `ProcessAddressRegistrationTlv()` method which
finds an Address Registration TLV in a received MLE messages from
a child and processes its entries updating the child's registered
addresses.
2023-04-17 10:00:14 -07:00
Abtin Keshavarzian e63c5d321a [mle] simplify appending of Address Registration TLV entries (#8958)
This commit adds helper methods to append an IPv6 Address Entry in an
Address Registration TLV using compressed format where the entry
contains a lowpan context ID and the address's IID, or uncompressed
format where the full IPv6 address is appended.
2023-04-14 11:00:19 -07:00
Abtin Keshavarzian f9cd4b4182 [net-diags] fix GetNextDiagTlv() when skipping over unknown TLVs (#8957)
This commit fixes `GetNextDiagTlv()` to correctly return error
`kErrorNotFound` if the message happens to end with an unknown TLV.
We ensure to set the `error` after the end of `while()` loop. With
the previous code we could return `kErrorNone` (since we would
successfully read and skip over the unknown TLV which would set
`error`).
2023-04-13 23:03:04 -07:00
Yakun Xu 720965ae1b [test] disable INTER_OP_BBR by default (#8952)
This commit disables `INTER_OP_BBR` by default to avoid unnecessary
build in most times.
2023-04-13 22:58:07 -07:00
Abtin Keshavarzian 0ca01ae501 [mle] simplify SendChildUpdateRequest() (#8951)
This commit updates `Mle::SendChildUpdateRequest()`:
- It removes the use of default parameter.
- It adds a private version which accepts `ChildUpdateRequestMode`
  indicating actions like whether to append challenge TLV, or
  whether to append zero timeout value (used for graceful detach).
2023-04-12 13:49:21 -07:00
Zhanglong Xia e7a92f6aaa [posix] unify the RCP reset sequence (#8858)
This commit unifies the RCP reset sequence on the HDLC and SPI
interfaces. The host will try the software reset first, and then try
the hardware reset if the software reset fails or allowed.

Reasons for unifying the RCP reset sequence:
- The parameters of the Thread stack are fixed on Android. Developers
  can't use different parameters to specify SPI or HDLC interfaces to
  use different methods to reset RCP.
- If the Thread stack and the BLE stack are running on the same radio
  chip, the hardware reset chip will cause the BLE stack to crash. The
  host needs to software reset RCP first, and try the hardware reset
  if the software reset fails. This can reduce the impact on the BLE
  stack.
2023-04-12 11:11:21 -07:00
Jonathan Hui 3d39d24a21 [style] fix spelling errors (#8939) 2023-04-11 22:39:35 -07:00
dependabot[bot] 0fc8ce95ea github-actions: bump step-security/harden-runner from 2.2.1 to 2.3.0 (#8943)
Bumps [step-security/harden-runner](https://github.com/step-security/harden-runner) from 2.2.1 to 2.3.0.
- [Release notes](https://github.com/step-security/harden-runner/releases)
- [Commits](https://github.com/step-security/harden-runner/compare/1f99358870fe1c846a3ccba386cc2b2246836776...03bee3930647ebbf994244c21ddbc0d4933aab4f)

---
updated-dependencies:
- dependency-name: step-security/harden-runner
  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-04-10 19:07:28 -07:00
Song GUO 91e1be0b34 [posix] initialize pointers to avoid potential using uninitialized pointers (#8942) 2023-04-10 18:48:08 -07:00
Abtin Keshavarzian 0f94f26a20 [net-diag] introduce Server and Client classes (#8936)
This commit introduces `Server` and `Client` classes breaking the
`NetworkDiagnostic` module into two components. The `Server` responds
to queries and requests (handling Net Diag TMF commands), while
`Client` issues queries/requests and processes responses. The
`Server` is available under both FTD and MTD (which follows the
requirement of Thread spec). The client is enabled using newly added
`OPENTHREAD_CONFIG_TMF_NETDIAG_CLIENT_ENABLE` config option which is
also available as `OT_NETDIAG_CLIENT` CMake option or the autoconf
build switch `NETDIAG_CLIENT`. The client functionality is by default
enabled on Border Routers (tied to `CONFIG_BORDER_ROUTING_ENABLE`
config).

The previous `TMF_NETWORK_DIAG_MTD_ENABLE` config is now removed
along with its CMake `OT_MTD_NETDIAG` and autoconf switch. This
commit adds checks to trigger build error if the previous config
and/or its related CMake option are used.
2023-04-07 15:58:07 -07:00
Abtin Keshavarzian d9ea37a3bb [tmf] add local IPv6 DSCP values to indicate TMF message priority (#7869)
This commit adds new IPv6 header DSCP values which indicate a TMF
message priority. This allows intermediate routers forwarding TMF
message to be able to determine and use the TMF message priority that
originator of the message selects (e.g., address query/notification
use net-level priority whereas network diagnostics message use normal
priority). This replaces the previous behavior where on intermediate
routers all TMF messages were treated as net-level priority.

The new DSCP values are allocated from local codepoint range
`0bxxxx11` (per RFC 2474 - section 6). If the sender does not use
TMF-specific DSCP values, we use `kPriorityNet` as default on
intermediate router. This ensures that senders that are using older
code (do not use the new) experience the same behavior as before.
2023-04-07 12:23:01 -07:00
Abtin Keshavarzian cb40a45298 [joiner] use Clamp() function to calculate priority from RSS (#8937) 2023-04-07 09:26:38 -07:00
Abtin Keshavarzian 6865b83d7f [coap] avoid using default parameter values for common methods (#8932)
This commit adds overloads of commonly used methods in `Coap` and
`MessagePool` replacing default parameter values. This helps reduce
code size.
2023-04-06 09:52:33 -07:00
Abtin Keshavarzian 356b4a6a58 [build] address new warnings with clang-14 (#8924)
This commit adds two small changes to address new warnings when
building with clang-14.

It also updates `mbedtls` CMakeLists to set `MBEDTLS_FATAL_WARNINGS`
option as `OFF` (so that compiler warnings are not treated as errors).
This avoid issues with new warning for `unused-but-set-variable` emitted
by clang-14.
2023-04-06 09:51:29 -07:00
Zhanglong Xia b48544c3b8 [posix] reset the signal actions after processing signals (#8934)
When compiling the otbr-agent in Android, Android will link the
function debuggerd_init() and call it before calling the function
main(). The function debuggerd_init() sets signal handlers to
catch signals. This commit resets the signal actions to default and
re-raises the original signal to let the pre-configured functions
to catch signals.
2023-04-05 23:23:01 -07:00
Abtin Keshavarzian adde085fce [tmf] add UriToString() for logging (#8930)
This commit adds a helper function `UriToString<Uri>()` to convert
a given `Uri` enumeration value to a human-readable string. This is
used for logging.
2023-04-05 18:00:30 -07:00
Zhanglong Xia cbdabbc542 [spinel] add openthread config header file (#8928)
This commit adds the openthread config header file to the spinel config
file to allow developers to configure the spinel configurations in the
openthread config file.
2023-04-05 15:54:18 -07:00
Abtin Keshavarzian 3ffe8516f7 [dns-client] add ServiceMode to control service resolution (#8772)
This commit updates DNS client to add `otDnsServiceMode` to the
`otDnsQueryConfig`. This new config property determines which records
to query and allow the API user to control the behavior during
service resolution: We can query for SRV record only or TXT record
only, or query for both SRV and TXT records in the same message, or
in parallel in different messages, or an "optimized" mode where
client will first try to query for both records together in the same
message but if server responds with an error, it then retries using
two parallel separate queries.

This gives flexibility and control to the API user. It also helps
address situations where the server (DNS resolver) may not accept
queries with more than one questions.

To support this new feature, this commit updates and enhances the
internal design of the `Dns::Client`. A new mechanism is added to
allow multiple `Query` instances to be associated with each other
under a main `Query` and responses for the related queries are saved
until all are received and validated before finalizing the main
`Query` and invoking the callback and allowing caller to retrieve the
info.

This commit also adds a detailed unit test `test_dns_client` which
covers DNS client browse and service resolution validating behavior
under all service modes. In order to test `Client` functionality,
this commit also adds a `TestMode` in `Dns::ServiceDiscovery::Server`
allowing us to change server behavior, e.g., reject messages with
more than one question in query.
2023-04-05 15:49:08 -07:00
Abtin Keshavarzian e587d43e4b [tmf] skip copy of MessageInfo for empty ack (#8926) 2023-04-05 11:00:23 -07:00
Jonathan Hui 6e79add03f [data-poll-sender] clamp poll period based on child timeout (#8927) 2023-04-04 09:48:33 -07:00
dependabot[bot] 9ba91a4b8f github-actions: bump ossf/scorecard-action from 2.1.2 to 2.1.3 (#8925)
Bumps [ossf/scorecard-action](https://github.com/ossf/scorecard-action) from 2.1.2 to 2.1.3.
- [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/e38b1902ae4f44df626f11ba0734b14fb91f8f86...80e868c13c90f172d68d1f4501dee99e2479f7af)

---
updated-dependencies:
- dependency-name: ossf/scorecard-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-04-03 12:58:39 -07:00
Eduardo Montoya 4577fb21a7 [csl] take into account radio header for aiming at the CSL phase (#8743)
This commit fixes CSL operations timing taking into account that the
CSL phase should refer to the beginning of the SHR.

On the CSL transmitter, corrects the transmission delay timing taking
into account that the timestamp of the received frame from the CSL
receiver refers to the start of the PHR.

On the CSL receiver, no changes are needed assuming the platform
injects the proper CSL phase value.
2023-04-03 10:48:06 -07:00
Abtin Keshavarzian 61d13e291f [tmf] allow pan-id query on MTD (#8919) 2023-04-03 10:44:43 -07:00
Jeff Bumgardner daf704d87c [docs] remove clang-format tags and implement multi-line cparam tags (#8921) 2023-04-03 10:44:12 -07:00
Abtin Keshavarzian edce936b1c [network-data] change 6LoWPAN context ID reuse delay to 5 minutes (#8896)
This commit changes the context ID reuse delay from 48 hours to
5 minutes. It also updates `test-019-netdata-context-id.py` to
check the default value.
2023-04-03 10:37:47 -07:00
Song GUO fa6824c9cb [test] add tests for DNS forwarding (#8847)
This commit adds a new file
`tests/scripts/thread-cert/border_router/nat64/test_upstream_dns.py`
to test scripts for testing the DNS forwarding functions.

The test adds a record `test.domain` to the bind9 interface since when
adding to DNSSD tests, the OpenThread's DNSSD server will be conflict
with the Docker's DNS forwarding functions.
2023-03-30 15:06:55 -07:00
Lukasz Duda 59277d0925 [sub-mac] prefer scanning and RX after data poll over CSL RX (#8832)
Signed-off-by: Lukasz Duda <lukasz.duda@nordicsemi.no>
2023-03-30 15:02:39 -07:00
Lukasz Duda 1c190a4f6d [expect] split and extend tests for discovery (#8832)
Signed-off-by: Lukasz Duda <lukasz.duda@nordicsemi.no>
2023-03-30 15:02:39 -07:00
Lukasz Duda 7ec184d68e [discovery] allow (S)SED devices to perform MLE Discovery (#8832)
Signed-off-by: Lukasz Duda <lukasz.duda@nordicsemi.no>
2023-03-30 15:02:39 -07:00
Esko Dijk 2c8a0af244 [radio] clarify mTimestamp meaning in comments (#8894) 2023-03-29 16:06:13 -07:00
Łukasz Duda edd92c6cdf [netif] add diagnostic log for when no valid route is found (#8907)
The added log may assist in diagnosing problems where packet
transmission over the air is absent.

Signed-off-by: Lukasz Duda <lukasz.duda@nordicsemi.no>
2023-03-28 20:32:27 -07:00
Jeff Bumgardner c03ca44662 [docs] disable Doxygen autolink for the word "Joiner" (#8915) 2023-03-28 10:55:53 -07:00
Zhanglong Xia 7bdcf8a5d4 [spinel] abort host after receiving unexpected reset from RCP (#8909)
Some platforms, such as Android and CastOS, can monitor program crash.
And they can upload the crash dump to the crash server for developers
to analyze the crash reason.

This commit aborts the host after receiving a unexpected reset to
trigger platforms to upload the crash dump.
2023-03-27 23:03:26 -07:00
Abtin Keshavarzian 4b97fd7e46 [ip6] combine PassToHost() calls in Ip6::HandleDatagram() (#8908)
This commit simplifies `Ip6::HandleDatagram()` by combining the
two places where we call `PassToHost()` into one. It simplifies
how we perform the three actions `receive`, `forwardHost`, and
`forwardThread`.
2023-03-27 20:08:54 -07:00
dependabot[bot] 21c31b633e github-actions: bump actions/setup-go from 3.5.0 to 4.0.0 (#8910)
Bumps [actions/setup-go](https://github.com/actions/setup-go) from 3.5.0 to 4.0.0.
- [Release notes](https://github.com/actions/setup-go/releases)
- [Commits](https://github.com/actions/setup-go/compare/6edd4406fa81c3da01a34fa6f6343087c207a568...4d34df0c2316fe8122ab82dc22947d607c0c91f9)

---
updated-dependencies:
- dependency-name: actions/setup-go
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-03-27 10:57:25 -07:00
Suvesh Pratapa 57a3480871 [logging] fix print format for some variables requiring %u or %lu (#8899) 2023-03-24 21:50:35 -07:00
kylorene 3ef109c7cd [cli] add docs for partitionid through pollperiod (#8875) 2023-03-24 21:42:33 -07:00
Abtin Keshavarzian e8f3ec0fd3 [common] add Preference helper methods for 2-bit preference value (#8895)
This commit introduces a common `Preference` class which defines
constants and helper methods (e.g., to convert between an `int8_t`
preference and its 2-bit unsigned representation). This is used for
`RoutePreference` in Network Data entries and also for Parent
Priority in `ConnectivityTlv`.
2023-03-23 18:47:57 -07:00
Abtin Keshavarzian 84be135243 [srp] add support for short (4-bytes) lease option variant (#8879)
This commit updates SRP client and server to support short variant
format for Update Lease Option. The short variant includes the lease
interval only (4 bytes) vs the long variant which includes both lease
and key lease intervals (8 bytes). Client and server can parse and
process both formats in received messages. Client by default uses the
long variant. Server will also use the long variant in its response
unless the request message uses the short variant format, i.e., if
the client uses the short variant, the server will also respond using
the short variant. This behavior is required by the latest Update
Lease draft.

This commit also updates `test_srp_server` unit test, adding a new
test-case to validate the behavior of client and server when short
Update Lease Option is used. A new method (intended for testing and
and only available under `REFERENCE_DEVCIE` config) is added which
configures the client to use the short variant format changing the
default behavior.
2023-03-23 17:43:33 -07:00
Abtin Keshavarzian a43484ed44 [tlv] fix ReadStringTlv() (#8897)
This commit fixes `ReadStringTlv()` avoid returning an extra
character and making sure `\0` is added at the correct index
at `[length]`.
2023-03-22 18:48:14 -07:00
Abtin Keshavarzian a4f1c7afa7 [trel] protect against invalid long TXT data keys from TREL peer (#8891)
This commit adds checks to protect against an edge-case where TXT
data entries from a TREL peer may contain invalid and long keys. If
the TXT data happens to include keys longer than `Dns::kMaxKeyLength`,
the `mKey` in `Dns::TxtEntry` will be set to `nullptr` and the entire
entry will be provided in `mValue`. This commit adds code to skip over
such entries (check that `entry.mKey` is not null) at beginning of the
loop to avoid using a potential null `mKey` in `strcmp`.
2023-03-22 17:20:45 -07:00
Abtin Keshavarzian b8335e0772 [mle] add otDeviceProperties to calculate local leader weight (#8670)
This commit adds `otDeviceProperties` which represents a set of device
properties which are used to calculate and set the local Leader
Weight on the device.

The device property set contains a `otPowerSupplyConfig` enum value
specifying the device power supply:
- Battery powered.
- Externally powered (mains-powered).
- Stable external power with a battery backup or UPS.
- Unstable external power (e.g., a light bulb powered via a switch).

It also indicates whether or not device is a border router, supports
CCM, and specifies a Leader Weight adjustment value.

The `otDeviceProperties` can be set through the newly added OT public API
`otThreadSetDeviceProperties()`. Its default value (upon OT stack start)
can also be configured using OT configs:
- Newly added `OPENTHREAD_CONFIG_DEVICE_POWER_SUPPLY` specifies the
  default power supply config to use. This config can also be set
  using the newly added CMake option `OT_POWER_SUPPLY`.
- Existing `OPENTHREAD_CONFIG_BORDER_ROUTING_ENABLE` will indicate
  if device is acting as a BR.

This commit also adds CLI command `deviceprops` for getting/setting
the device config. It also adds a unit test to validate the Leader
Weight calculation algorithm from a given device config.
2023-03-21 22:51:49 -07:00
Suvesh Pratapa 07d69f30ce [dua] remove DUA address if network data no longer contains DUA prefix (#8874)
Fix for the following bug:

Leader/Parent (OTBR) is reset (taken off the network), leading to its
MTD child being detached. When the parent is brought back on the
network without configuring the previous DUA prefix, the MTD asserts
complaining that its DUA prefix is not valid anymore.

1. We don't assert anymore in this situation, rather the MTD just
   won't include the DUA address in its address registration TLV.

2. More importantly, we remove a "cached" DUA address if we find that
   the network leader is no longer configured with a DUA prefix.
2023-03-21 22:14:31 -07:00
Abtin Keshavarzian 32a538f773 [netif] simplify ThreadNetif (#8882)
This commit simplifies `ThreadNetif` class by removing methods
like `IsOnMesh()` and `SendMessage()` which just call same method
on other modules (`NetworkData::Leader` and `MeshForwarder`). It
also moves the `RouteLookup()` method to `Ip6` class.
2023-03-21 17:54:08 -07:00
kylorene b3dbc6c2e9 [cli] add docs for networkkey through parentpriority (#8868) 2023-03-21 17:32:22 -07:00
doru91 c7925dd1df [dua] avoid unnecessary time ticker processing (#8872)
If there is no DUA request sent/scheduled, then there is no need to
trigger the periodic one second ticker timer.

This helps SEDs to be more power efficient and to avoid unnecessary
wakeups.

Signed-off-by: Doru Gucea <doru-cristian.gucea@nxp.com>
2023-03-21 17:28:42 -07:00
dependabot[bot] da66f629c0 github-actions: bump step-security/harden-runner from 2.2.0 to 2.2.1 (#8885)
Bumps [step-security/harden-runner](https://github.com/step-security/harden-runner) from 2.2.0 to 2.2.1.
- [Release notes](https://github.com/step-security/harden-runner/releases)
- [Commits](https://github.com/step-security/harden-runner/compare/c8454efe5d0bdefd25384362fe217428ca277d57...1f99358870fe1c846a3ccba386cc2b2246836776)

---
updated-dependencies:
- dependency-name: step-security/harden-runner
  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-03-21 09:36:10 -07:00
Abtin Keshavarzian 922cf5ac98 [mle] update how we set/get Parent Priority on ConnectivityTlv (#8878)
This commit updates `ConnectivityTlv` methods which get/set the Parent
Priority field (high, medium, low). This change ensures that we do
not use bitwise shift of a signed and potentially negative value
(`a >> b` where `a` is negative). Note that the behavior of right
bitwise shift of a negative value is not specified by C++ standard
and it is implementation/toolchain dependent.
2023-03-18 23:05:13 -07:00
Abtin Keshavarzian 8ad7b2bd64 [netdata] simplify tracking of lowpan context IDs (#8876)
This commit simplifies how the 6LoWPAN Context IDs are assigned and
tracked by `NetworkData::Leader` using a new nested class
`ContextIds`. A Context ID can be in one of the 3 states:
- It is unallocated.
- It is allocated and in-use.
- It is scheduled to be removed (after reuse delay interval).

This commit also adds a test-case `test-019-netdata-context-id.py`
which validates the assignment and removal of Context IDs under
different scenarios.
2023-03-18 22:45:28 -07:00
Abtin Keshavarzian af031f3b50 [netdata] new API to get lowpan context IDs (#8870)
This commit adds `otNetDataGetNextLowpanContextInfo()` to iterate
through the list of LoWPAN Context entries in Thread Network Data
providing info about the prefix, its LoWPAN Context ID and Compress
flag (relating to `ContextTlv` sub-TLVs of `PrefixTlv`s in Network
Data).

This commit also updates CLI command `netdata show` to list the
context IDs in addition to prefixes, routes, and services.
2023-03-17 21:39:59 -07:00
Przemysław Bida 89d5799d76 [dns] implement DNS query over TCP (#8474)
This commit introduces DNS query over TCP protocol.
2023-03-17 09:44:26 -07:00
Abtin Keshavarzian 30be45dc5c [mle] add IncrementLinkQuality() to ConnectivityTlv (#8877)
This method helps when preparing the `ConnectivityTlv` and counting
the neighbors with which device shares a link at different
Link Quality values (1,2,3).
2023-03-17 09:07:15 -07:00
doru91 5a21384833 [mac] add build config for timeout for receiving a Data Frame (#8863)
This setting is targeted for SEDs which may need to decrease the
timeout for receiving a Data Frame (which follows an ACK with FP bit
set) for power saving reasons.

IEEE 802.15.4-2015 specification doesn't enforce a specific timeout
value for this parameter so the application should be able to
configure it.

Signed-off-by: Doru Gucea <doru-cristian.gucea@nxp.com>
2023-03-16 11:12:41 -07:00
Jonathan Hui 2542cabc20 [cli] update dataset to operate directly on TLVs (#8871) 2023-03-16 09:36:41 -07:00
Jonathan Hui fffd5bac8c [dataset] add otDatasetUpdateTlvs API (#8871) 2023-03-16 09:36:41 -07:00
Li Cao 41f051d69b [csl] add code comment & explanation for HandleCslTimer (#8867) 2023-03-16 09:27:31 -07:00
Abtin Keshavarzian 2d0d9bef88 [tcp] update otTcpConnect() doc to indicate currently supported behavior (#8835)
This commit updates the documentation for `otTcpConnect()` indicating
that caller need to wait for `otTcpEstablished` callback indicating
that TCP connection was established  before it can start sending
data (e.g., calling `otTcpSendByReference()`).

It also removes the mention of "TCP Fast Open" which is not yet
supported.
2023-03-13 22:17:51 -07:00
Abtin Keshavarzian 5ddd9d7346 [mle] update and enhance processing of Route TLV (#8851)
This commit updates how we process Route TLV in a received
"MLE Link Accept" message when device is already acting as
router or leader:

- We ensure that the Router ID Sequence number in the received
  Route TLV is more recent compared to the current one being
  used before adopting the Router ID Set. We still update
  the router table (next hops and costs) based on the received
  Route TLV even if Sequence number is older.
- We also check that the ID of the router which sent the Link
  Accept is marked as allocated in the Route TLV that it includes
  in the message. This protects against an edge-case where the
  sending router may be misbehaving.

In addition to the above two changes, this commit contains some
enhancements and simplifications:

- `RxMessage::ReadRouteTlv()` is added which reads and validates
  a `RouteTlv` from an `Mle::RxMessage`.
- `MleRouter::ReadAndProcessRouteTlvOnFed()` is added which reads
  and processes `RouteTlv` on an FED (avoid repeating same code).
- `MleRouter::ProcessRouteTlv()` is simplified.
2023-03-13 19:51:06 -07:00
Abtin Keshavarzian 7ecc5d104e [netdata] ensure to free context ID once (#8860)
This commit updates `NetworkData::Leader::HandleTimer()` such that
once the reuse delay time for a previously used Context ID is reached
and the ID is freed, the `mContextLastUsed` is also set to zero. This
ensures that context ID is freed only once from `HandleTimer
()` calls (which avoids incrementing the version again).
2023-03-13 16:52:13 -07:00
Abtin Keshavarzian c81e8d3fd0 [netdata] update StartContextReuseTimer() to start time if not running (#8859)
This commit contains two changes to `StartContextReuseTimer()`:
- We now start the context reuse timer only if the timer is not already
  scheduled (`mContextLastUsed` will be non-zero when reuse timer
  is already scheduled).
- The `mTimer` (which is used as a periodic timer) is only started
  if it is not already running.
2023-03-13 13:20:06 -07:00
Abtin Keshavarzian b2e813429b [mesh-diag] update kMaxTlvsToRequest constant (#8853)
This commit updates `kMaxTlvsToRequest` constant to account for the
recently added `VersionTlv`. It also moves its definition from header
file to cpp file in `SendDiagGetTo()` method so to make it easier to
track and update it when/if new TLV types are added.
2023-03-13 10:37:24 -07:00
dependabot[bot] baa796dd47 github-actions: bump docker/setup-buildx-action from 2.2.1 to 2.5.0 (#8856)
Bumps [docker/setup-buildx-action](https://github.com/docker/setup-buildx-action) from 2.2.1 to 2.5.0.
- [Release notes](https://github.com/docker/setup-buildx-action/releases)
- [Commits](https://github.com/docker/setup-buildx-action/compare/8c0edbc76e98fa90f69d9a2c020dcb50019dc325...4b4e9c3e2d4531116a6f8ba8e71fc6e2cb6e6c8c)

---
updated-dependencies:
- dependency-name: docker/setup-buildx-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-03-13 09:27:27 -07:00
kylorene 1616357d4c [cli] update dns docs (#8831) 2023-03-10 21:40:51 -08:00
Abtin Keshavarzian a0b5198c02 [dataset] add otDatasetConvertToTlvs() API (#8720)
This commit adds `otDatasetConvertToTlvs()` to covert a given
Operational Dataset `otOperationalDataset` to TLVs. It also adds a
related CLI command `dataset tlvs`.
2023-03-10 14:10:50 -08:00
Zhanglong Xia 295f63f370 [build] fix the -Wunused-command-line-argument warning on macOS (#8839)
Use the command `make -f src/posix/Makefile-posix` to build the posix
platform on macOS, it generates the `-Wunused-command-line-argument`
warning (refer to #8828).

This commit moves the linker option `-rdynamic` from `COMMONCFLAGS` to
the `LDFLAGS` to resolve the warning.
2023-03-09 16:55:46 -08:00
Abtin Keshavarzian 742f53f64a [version] introduce OT_THREAD_VERSION_1_3_1 (#8849)
This commit adds `OT_THREAD_VERSION_1_3_1` constant (equal to `5`) for
Thread Version 1.3.1. It also updates the build switch options for
CMake `OT_THREAD_VERSION` and autoconfig `THREAD_VERSION` and `BUILD.gn`
to support the new version value of "1.3.1".

Note that this commit does not change the default config value of
`OPENTHREAD_CONFIG_THREAD_VERSION` which is the default version to
use if it is not explicitly specified by build switches or in a
project config file.
2023-03-09 09:34:19 -08:00
Axel Le Bourhis 83307580fe [srp-server] fix -Werror=maybe-uninitialized (#8848)
Build errors are raised by arm-none-eabi-gcc toolchain when building
with -Og option.

Signed-off-by: Axel Le Bourhis <axel.lebourhis@nxp.com>
2023-03-09 09:32:09 -08:00
Abtin Keshavarzian 1f1a826d18 [net-diag] add Net Diag Version TLV (#8834)
This commit adds support for Net Diag Version TLV (TLV number 24)
which returns the Thread version of device (as `uint16_t`).
It also updated the `MeshDiag` to query for the Version TLV and
provide it in `otMeshDiagRouterInfo`. The related CLI commands
are also updated.
2023-03-08 16:11:10 -08:00
Song GUO 452132dd08 [dnssd] change OT_DNS_QUERY_UPSTREAM to OT_DNS_UPSTREAM_QUERY for consistency (#8846) 2023-03-08 13:26:02 -08:00
Jonathan Hui 8ff0734c75 [github-actions] update otns to python 3.9 (#8845) 2023-03-08 10:51:50 -08:00
Abtin Keshavarzian 3a688cb9cc [rcp] fix DecodeStreamRawTxRequest() to handle missing optional fields (#8844)
This commit updates `DecodeStreamRawTxRequest()` to set the read
boolean flags immediately after they are decoded (not wait till
all fields are read). This ensures correct processing of optional
fields.
2023-03-07 18:17:37 -08:00
Abtin Keshavarzian a94fc44425 [radio] mechanism to switch to PAN channel more quickly on CSL tx (#8701)
This commit adds `mRxChannelAfterTxDone` in `otRadioFrame` which
specifies the RX channel  after frame TX is done (after all retries
and ack received).

This is intended for situations where they may be delay in
interactions between OT stack and radio, as example this is used in
RCP and host architecture to make sure RCP switches to PAN channel
more quickly. In particular, this can help with CSL tx to a sleepy
child, where the child may use a different channel for CSL than the
PAN channel. After frame tx, we want the radio/RCP to go back to PAN
channel quickly to ensure that parent does not miss any tx from child
afterwards, e.g., child responding to the earlier CSL transmitted
frame from parent using PAN channel while radio still staying on CSL
channel.

This commit adds support for the `mRxChannelAfterTxDone` parameter in
spinel and posix host `RadioSpinel`. This is added in a backward
compatible way, i.e., if RCP is using a newer version but host is
older and does not provide the new parameter, RCP will use
`frame.mChannel` as default value for this, and if host is using a
newer version, older RCP will ignore it.
2023-03-07 13:09:34 -08:00
Li Cao 130ef49cc4 [thread-cert] add Low Power test case 7_1_02 (#8807) 2023-03-07 12:54:45 -08:00
Abtin Keshavarzian c661791e87 [netdata] mechanism to track max Network Data length since start/reset (#8826)
This commit adds new mechanism in `NetworkData::Leader` to track the
the maximum observed length of the Thread Network Data since OT stack
initialization or since the last time user reset the tracking
mechanism by calling `otNetDataResetMaxLength()`. This commit also
adds public OT API and  CLI commands for this.
2023-03-07 10:10:02 -08:00
Abtin Keshavarzian d756a2275b [mle] add InitNeighbor() method (#8836)
This commit adds a helper method `Mle::InitNeighbor()` which performs
common initialization of a `Neighbor`  using `RxInfo`, e.g., setting
the Extended MAC address from the sender's IPv6 address IID, updating
the `LinkInfo`, and setting `LastHeard` time. This method is used
from different methods in `Mle` and `MleRouter where a new neighbor
(router, child, or parent candidate) is initialized.
2023-03-07 10:09:02 -08:00
Abtin Keshavarzian d2d9aff012 [mle] send MLE Avd on router promo & accept former child as router (#8307)
This commit updates `MleRouter to send an immediate MLE Advertisement
on promotion to `router` role and assignment of new Router ID. This
helps inform our former parent of our newly allocated Router ID and
cause it to reset it own advertisement trickle timer. This can help
speed up the dissemination of the new Router ID to other routers. It
can also help with quicker link establishment with our former parent
and other routers.

It also removes tx of multicast Link Request (including its delay
mechanism) upon promotion to `router` role.

It also updates `Mle` so if we receive an MLE advertisement from a
former child (which is recently get promoted to router) to accept it
immediately and copy the info from `Child` entry to `Router`.

Finally this commit updates the following test-cases which are
impacted by the changes above (e.g., skipping the checks for
multicast Link Request):

- `v1_2_router_5_1_1`
- `Cert_5_1_01_RouterAttach`
- `Cert_5_2_04_REEDUpgrade`
- `Cert_5_5_02_LeaderReboot`
- `Cert_5_5_05_SplitMergeREED`
2023-03-06 21:15:32 -08:00
gabekassel 6e975c5875 [docs] dns browse: explain dns-sd proxy zone (#8824)
Explain dns-sd proxy zone with an example.
2023-03-06 15:43:13 -08:00
dependabot[bot] 391f526fbc github-actions: bump github/codeql-action from 2.1.39 to 2.2.5 (#8837)
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 2.1.39 to 2.2.5.
- [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/a34ca99b4610d924e04c68db79e503e1f79f9f02...32dc499307d133bb5085bae78498c0ac2cf762d5)

---
updated-dependencies:
- dependency-name: github/codeql-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-03-06 13:11:22 -08:00
Abtin Keshavarzian 0a79c30a20 [mesh-diag] new module and new API to discover network topology (#8682) 2023-03-02 00:43:46 -08:00
Song GUO d93521de06 [dnssd] add API for getting the upstream query status (#8815) 2023-03-01 22:42:29 -08:00
Jeff Bumgardner 3d8406b31c [docs] add plat-dns module to Doxygen menu (#8819)
New API module from #8668 wasn't added to the high-level Doxygen
menu. This causes the module to show up incorrectly when we import
reference docs into openthread.io.
2023-03-01 21:54:26 -08:00
whd a3d1aa7309 [pretty] fix script/clang-format (#8814)
`script/clang-format` is supposed to add an EOF newline for every file
passed in as an argument. However, the script only processed the first
file. This can cause `script/make-pretty check` to fail even after
`script/make-pretty clang`.
2023-03-01 18:10:28 -08:00
Abtin Keshavarzian 091f68ed70 [child-supervision] mechanism to inform interval from child to parent (#7993)
This commit contains changes to child supervision feature. It adds a
new mechanism for a child to inform its desired supervision interval
to its parent. A new optional MLE TLV is added with type 27 and value
of `uint16_t` indicating the supervision interval in seconds. This
TLV is included in MLE Child ID Request and MLE Child Update Request
(sent from the child). The parent echoes back this TLV in the
corresponding responses to indicate that it supports supervision. This
commit changes the parent implementation to track the supervision
interval per child.

This commit also updates the OT public APIs along with the related
CLI commands:
- API now allows the supervision interval to be set on a child.
- New field in `otChildInfo` to indicate the child's supervision
  interval.
- New counter is added to track the number of supervision check
  timeouts failures on a child (intended for testing and debugging).

This commit adds a test `test_child_supervision` to cover behavior of
child supervision and its new behaviors.

This change allows backward compatibility: If the parent does not
support child supervision, it ignores the new TLV in the MLE messages
and the child would fall back to periodically exchanging MLE Child
Update Request with parent. If the child does not support supervision
and/or does not indicate its desired child supervision interval, the
parent will fall back to use the configured default interval.
2023-02-28 23:01:43 -08:00
Abtin Keshavarzian 0491c8ff2c [mle-router] add common SetStateRouterOrLeader() (#8813)
`SetStateRouter()` and `SetStateLeader()` share a bunch of common
code (things that need to be updated on transition to either router
or leader role). This commit adds `SetStateRouterOrLeader()` method
for this.
2023-02-28 14:45:21 -08:00
Jeff Bumgardner 68b3e60ad0 [cli] fix bad CLI command tag (#8818) 2023-02-28 14:44:55 -08:00
kylorene 5714213d46 [cli] added documentation for rcp and route (#8800) 2023-02-28 11:11:43 -08:00
Abtin Keshavarzian ee32965f7e [mle] smaller enhancements (#8812)
This commit contains smaller enhancements in `MleRouter` class,
defining `kChallengeTimeout` constant, using ternary `? :` replacing
`if/else` checks, combining `#if` blocks, etc.
2023-02-28 10:26:56 -08:00
Abtin Keshavarzian 27802bc0df [message-pool] track max used buffers (#8796)
This commit updates `MessagePool` to track number of in use buffers
along with max used so far since OT stack initialization or since
last time counter was reset. This info is then provided in
`otBufferInfo` and in CLI command `bufferinfo`. A new OT API
`otMessageResetBufferInfo()` is added to reset this counter.
2023-02-27 23:14:55 -08:00
Li Cao 982327ac1e [time-sync] define cpp enum/types mirroring public definitions (#8811) 2023-02-27 21:19:49 -08:00
Abtin Keshavarzian 2caa934410 [routing-manager] new APIs to get state and new CLI commands (#8784)
This commit adds new public OT APIs in `border_routing.h` to get the
current state of `RoutingManager` and to get the current favored
on-link prefix.

This commit also updates CLI `br` commands:
- It moves the CLI `br` implementation into own `cli_br` module.
- It adds `br state` to get the current state
- It changes `br omrprefix`, `br onlinkprefix`, and `br nat64prefix`
  to output both local and favored prefixes when no additional arg
  is provided and allow the use of `local` or `favored` extra arg to
  specify the type.
- It updates the documentation of `br` related commands in the source
  code and also adding `cli/README_BR.md`.
2023-02-27 19:03:29 -08:00
Abtin Keshavarzian 2b8779ec0b [net-diag] define AppendDiagTlv() (#8805)
This commit adds `AppendDiagTlv()` to append a dig TLV with a given
type to a `Message`. It also simplifies the `AppendRequestedTlvs()`
to directly parse the "Type List TLV".
2023-02-27 11:43:25 -08:00
Abtin Keshavarzian ea9533cdaf [core] use Min() and Max() to track next timer fire time (#8808) 2023-02-27 10:53:08 -08:00
Abtin Keshavarzian 108ce57b9d [backbone-router] define C++ enum/types mirroring public definitions (#8809)
This commit defines C++ style types for use in core module mirroring
the public OT C definitions. It also contains renames and smaller
enhancements in BackBone Router modules.
2023-02-27 09:48:56 -08:00
Li Cao c49acfc385 [unit] add a README guide for unit tests (#8791) 2023-02-27 09:02:36 -08:00
dependabot[bot] ddae76b7bf github-actions: bump step-security/harden-runner from 2.1.0 to 2.2.0 (#8810)
Bumps [step-security/harden-runner](https://github.com/step-security/harden-runner) from 2.1.0 to 2.2.0.
- [Release notes](https://github.com/step-security/harden-runner/releases)
- [Commits](https://github.com/step-security/harden-runner/compare/18bf8ad2ca49c14cbb28b91346d626ccfb00c518...c8454efe5d0bdefd25384362fe217428ca277d57)

---
updated-dependencies:
- dependency-name: step-security/harden-runner
  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-02-27 09:00:55 -08:00
Abtin Keshavarzian 7f0b5fac4b [cmake] fix OT_TCP option (#8804)
This commit fixes the `OT_TCP` option (removes extra comma in the
definition).
2023-02-24 13:24:57 -08:00
Kangping f4f2d90d6a Add missing dependencies to "openthread-posix" target (#8801)
The `openthread-posix` library calls OT public APIs and library APIs
(e.g. radio_spinel, HDLC), but it doesn't link against the library
targets.

This commit also adds `extern "C"` for posix impl of `otPlatFree`
and `otPlatCAlloc`.
2023-02-24 10:52:39 -08:00
Diego Ismirlian 57ed65edf4 [commissioner] add joiner session timeout (#8776)
This commit adds a session timeout for the integrated Commissioner.

When the Joiner and Commissioner have a weak link, and the session
doesn't time out after a communication failure, the Joiner may fail to
join in subsequent attempts if the Commissioner is not stopped and
restarted. With the proposed modification, the Commissioner times out
the session after a configurable time, so the Joiner may be able to
join in a future attempt.
2023-02-23 09:08:15 -08:00
Kangping 952420a4fa [cli] update dataset readme with the latest output (#8790)
The dataset examples are generated by version 1.1 OT stack
where the Security Policy value has length of 3 bytes but 1.2
extends it to 4 bytes.

The real problem is that spec requires that **ZERO** Key Rotation
**SHALL NOT** be allowed:
```
Key rotation period in hours. The
minimum key rotation period SHALL be
1 hour and a key rotation period of 0
SHALL NOT be allowed.
```

But the example is using ZERO.

This commit fix this by updating the examples to 1.2 version.
This commit fix also problems that incomplete TLV HEX string
(Pending Timestamp and Delay Timer are missing) are used for
setting the Pending Dataset (e.g. `dataset set pending`).
2023-02-22 14:18:29 -08:00
Abtin Keshavarzian 9e1e8f546d [ip6] simplify Ip6::HandleDatagram() (#8787)
This commit updates `HandleDatagram()` simplifying the code related to
determining `forwardThread` and `forwardHost` based on the
destination address.
2023-02-22 14:15:45 -08:00
Song GUO 852d076f00 [dnssd] support forwarding DNS queries to platform upstream (#8668)
This commit adds a set of APsI for forwarding a DNS query to the
upstream DNS server via platform API and a posix platform
implementation.

This feature is disabled by default, and this PR adds a `dns server
upstream {enable|disable}` command CLI for enabling and disabling this
feature.

Tests will be added after ot-br-posix adds related support.
2023-02-21 21:15:03 -08:00
gavinmcgovern c311b85cc9 [docs] add Nabu Casa to supporter list (#8785) 2023-02-21 16:17:36 -08:00
whd 8c2187ee72 [docker] avoid unnecessary copying when building an image for testing (#8780)
This commit lets `do_build_otbr_docker()` skip unnecessary files when
copying the source code for building a docker image. It can save time
and disk space for the user.
2023-02-21 09:28:50 -08:00
Abtin Keshavarzian e3f5bd56a1 [build] add CMake option for enabling TCP (#8778)
This commit adds CMake option `OT_TCP` (`TCP` in `common-switches`)
which map to `OPENTHREAD_CONFIG_TCP_ENABLE` (enabling TCP).
2023-02-21 09:24:32 -08:00
dependabot[bot] af5eb1f945 github-actions: bump actions/upload-artifact from 3.1.1 to 3.1.2 (#8781)
Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 3.1.1 to 3.1.2.
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](https://github.com/actions/upload-artifact/compare/v3.1.1...0b7f8abb1508181956e8e162db84b466c27e18ce)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  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-02-20 21:30:27 -08:00
Abtin Keshavarzian 13ac7297a0 [routing-manager] use NA target address (#8777)
This commit updates `ProcessNeighborAdvertMessage()` method in
`RoutingManager` to use the Target Address included in Neighbor
Advertisement to find the related `Router` (instead of sender's
IPv6 address). This addresses situations where the router
responding may use a different address.
2023-02-20 21:20:57 -08:00
Yang Sun afbb2d5799 [trel] remove deprecated otTrelEnable/otTrelDisable APIs (#8775) 2023-02-17 22:41:58 -08:00
Yang Sun 72fa12a204 [test] allow TREL disabled by default (#8774) 2023-02-17 11:50:22 -08:00
sarveshkumarv3 2060039bbf [csl] fix indirect retransmission of frame previously transmitted via CSL (#8770)
Bug fix for an issue where any frame which fails CSL transmission gets
treated as a new frame (instead of a retransmission) for a subsequent
indirect retransmission (in the data poll handler). This fix checks
for the previous CSL transmit attempts and if it is greater than 0,
retransmits with the same frame counter, sequence number and key id as
previous attempt.
2023-02-16 09:49:14 -08:00
Abtin Keshavarzian a0ff14c475 [test] update test_srp_server to clear the service instances (#8768)
This commit updates `PrepareService()` functions to `memset` the
`Service` instance to zero before populating its fields. This ensures
that all new properties (e.g., recently added `mLease`/`mKeyLease`)
are set to zero and use the corresponding default value.
2023-02-15 22:34:43 -08:00
Li Cao 6020d01bfc [code-utils] use num_utils Min/Max to simplify code (#8762)
This commit uses Min and Max from num_utils to replace Ternary
operators.
2023-02-15 20:48:13 -08:00
Kangping 3c65092344 [tests] add build tests for BR features (#6570)
BR features are tested with "Border Router" CI task but it is built
with gcc by default. This commit adds BR features to posix build
checks which apply clang/clang++.
2023-02-15 13:20:59 -08:00
Stefan Agner 7a6546c2b7 [posix] set link type to none explicitly (#8526)
Linux kernels with CONFIG_MCTP enable (available in 5.16 or newer)
seem to have an issue when setting the link type to ARPHRD_VOID.
There seem to be no good reason why ARPHRD_VOID is used. Stick to
the default ARPHRD_NONE.
2023-02-15 10:22:57 -08:00
Jiachen Dong 242c7cc7c3 [harness-simulation] keep capture files in sync at runtime (#8138)
This commit keeps capture files in sync at runtime. Therefore, Harness
can obtain the addresses directly from the capture files in manual DUT
mode without having to enter the addresses manually.
2023-02-14 19:08:02 -08:00
Sylvain Baubeau 9ff2eefee0 [bootstrap] install bzip2 to uncompress arm toolchain (#8621) 2023-02-14 13:57:41 -08:00
esp-jiangguangming d28793c104 [net] fix typo multicast in comments (#8756) 2023-02-13 22:02:08 -08:00
Yakun Xu 4d14dad95d [posix] disable addrconf generating LL address (#8749)
This commit disables addrconf generating address by set addr_gen_mode to
IN6_ADDR_GEN_MODE_NONE, otherwise linux may generate a link local address
based on link type and presence of EUI64 address. This allows OpenThread
to fully manage link local address of its network interface.
2023-02-13 22:01:43 -08:00
Yang Sun 27e56b301b [trel] add otTrelSetEnabled API (#8731) 2023-02-13 21:30:39 -08:00
kylorene 4c5ee625d2 [tcp] correct misspelling in API docs (#8750) 2023-02-13 15:05:12 -08:00
dependabot[bot] b8eb7362c0 github-actions: bump actions/setup-go from 3.4.0 to 3.5.0 (#8748)
Bumps [actions/setup-go](https://github.com/actions/setup-go) from 3.4.0 to 3.5.0.
- [Release notes](https://github.com/actions/setup-go/releases)
- [Commits](https://github.com/actions/setup-go/compare/d0a58c1c4d2b25278816e339b944508c875f3613...6edd4406fa81c3da01a34fa6f6343087c207a568)

---
updated-dependencies:
- dependency-name: actions/setup-go
  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-02-13 09:49:46 -08:00
Abtin Keshavarzian 67fe9924fa [net-diag] simplify NetworkDiagnostic (#8746)
This commit contains smaller enactments in `NetworkDiagnostic`
class:

- `SendCommand()` method is updated to accept a `Uri` for the
  intended diag command.
- `PrepareMessageInfoForDest()` method is added which prepares a
  `Tmf::MessageInfo` for sending diag commands to a destination
  deciding which source address to use.
- The TLV class is renamed to `Tlv` from `NetworkDiagnosticTlv`
  (since it is under the namespace `NetworkDiagnostic` already).
  This makes it similar to TLVs from other modules, `Mle::Tlv`,
  `MeshCoP::Tlv`, etc).
- Logging in `NetworkDiagnostic` is updated and simplified, now
  using `Log(Action, Uri)` method. The logs provide more info
  like the IP6 address of sender/receiver of a message.
2023-02-13 08:45:39 -08:00
Abtin Keshavarzian 2b67cd8ebb [simul-platform] enhance radio nodeidfilter command (#8740)
This commit updates the custom CLI command `nodeidfilter` defined for
simulation platform enabling filtering at radio level. This commit
enhances this command so it can be used as both a deny-list or an
allow-list. It also adds support to output the list and filter mode
when no arg is given.
2023-02-13 08:42:36 -08:00
Abtin Keshavarzian a4223001f2 [history-tracker] track changes to router table (next hop, cost) (#8734)
This commit adds anew feature in `HistoryTracker` to track the history
of changes to routers. In particular we track when a new router is
added or removed, or when next hop and/or path cost towards a router
is changed. On a cost change the recorded entry, provides the old
cost value along with the new path cost. This helps to track the cost
changes more easily (no need to look back at history to find the old
cost value).

This commit also adds CLI command `history router` for the new
feature.
2023-02-13 08:41:42 -08:00
Jonathan Hui 3d7626f560 [cmake] guard unit tests with BUILD_TESTING (#8739) 2023-02-09 18:24:20 -08:00
Jonathan Hui 630099bde6 [github-actions] fix coverage reporting in unit workflow (#8737) 2023-02-09 18:24:03 -08:00
Eduardo Montoya bbd96473fd [mac] ensure CSL parameters are initialized to zero (#8736)
Fix bug that prevented to initialize CSL parameters for non-FTD builds.
2023-02-09 10:19:27 -08:00
Yakun Xu 0e667b8e03 [test] use cmake to run unit tests (#8724)
This commit migrates unit tests to cmake.
* build unit tests with cmake
* add missing tests in cmake
* use ctest
* add platform udp stubs for test platform
* skip some static_assert with gcc-4
2023-02-09 10:19:01 -08:00
Yakun Xu 6e6a2ae145 [ncp] remove legacy network support (#8723)
This commit removes legacy network support as it's not used anymore.
2023-02-08 22:36:53 -08:00
Abtin Keshavarzian 5507465290 [cli] nexthop command to output next hop and path cost table (#8729)
This commit extends `nexthop` command such that when it is used
without any input, it lists all currently allocated router IDs and
the next hop and path cost for each. Note that this info is
different from `router table` (which provides direct link along
with any backup next hop option).

This commit also adds a new API `otThreadIsRouterIdAllocated()` to
indicate whether or not a given router ID is currently allocated.
2023-02-08 15:07:19 -08:00
Abtin Keshavarzian f575021cdb [router-table] use Tasklet to signal changes (#8730)
This commit updates `RouterTable` class to use a `Tasklet` to track
and signal when there is any change to the table, e.eg., new router
added or removed and/or next hop or cost for a router gets changed.
2023-02-07 20:23:12 -08:00
Abtin Keshavarzian f9ab9dfd44 [ip6] add Option::ParseFrom() and common PadOption (#8719)
This commit contains changes related to handling of IPv6 Options. It
adds a new method `Option::ParseFrom()` which parses and validates an
IPv6 Option from a given message. This method handles the Pad1 Option
as well as other Option Types. This makes it easier (and safer) to
iterate through Options in an Extension Header. `Option::GetSize()`
is also updated to return the correct size for Pad1 Option since Pad1
Option does not follow the common Option format (has Type field with
no Length field).

This commit also adds a common `PadOption` class which based on the
desired padding size uses Pad1 or PadN as its type. It also provides
`InitToPadHeaderWithSize()` which prepares the option with proper
length to pad an Extension Header with a given current size (also
determining whether or not padding is needed).

This commit also updates `Ip6` methods to use `kLengthUnitSize`
constant.
2023-02-07 15:10:15 -08:00
kylorene 2e07758d78 [cli] add documentation for the DNS CLI commands (#8727) 2023-02-07 14:54:32 -08:00
Yang Sun 82e816b82f [mle] retransmit link request after router reset (#8704)
According to Thread 1.3.0 Section 4.7.1.3, router synchronization
after reset requires the multicast link request message to be
retransmitted until a response is received, or the maximum
transmission limit has been reached. If the router was a leader or had
more than 5 children prior to reset, it MUST be retransmitted as a
critical message. Each multicast retransmission of an MLE Message on a
TL1 or TL2 Link must be delayed by MLE_MULTICAST_RETRANSMISSION_DELAY
multiplied by a random value between 0.9 and 1.1 with a resolution of
at least 1 ms.

This commit implements the above requirement. With this requirement,
in the cases when a router is reset and there is no other router to
respond to the link request then it takes longer time for the router
to join thread network. Thus some test cases are modified to allow
longer router sync time in such cases.
2023-02-06 21:10:38 -08:00
Tristen Pierson 7aaf33478d [coap] copy token from block2 request message to next response token (#8700) 2023-02-06 14:12:40 -08:00
dependabot[bot] 5fe2b3e85a github-actions: bump actions/setup-python from 4.3.1 to 4.5.0 (#8725)
Bumps [actions/setup-python](https://github.com/actions/setup-python) from 4.3.1 to 4.5.0.
- [Release notes](https://github.com/actions/setup-python/releases)
- [Commits](https://github.com/actions/setup-python/compare/2c3dd9e7e29afd70cc0950079bde6c979d1f69f9...d27e3f3d7c64b4bbf8e4abfb9b63b83e846e0435)

---
updated-dependencies:
- dependency-name: actions/setup-python
  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-02-06 14:01:52 -08:00
Jonathan Hui eb6377f1d7 [tests] declare python dependencies with specific versions (#8721) 2023-02-04 21:09:54 -08:00
Abtin Keshavarzian 7defbc95bf [link-metrics] simplify HandleManagementRequest() (#8714) 2023-02-03 21:37:55 -08:00
Abtin Keshavarzian a3d353af8c [ip6] ensure to make room for new header at correct offset (#8717)
In `InsertMplOption()` we need to insert the Option at the original
end of Hop-by-hop Extension header which we track in `hbhSize`. Note
that the read `hbh` is updated (we increment the `Length` field which
increases the `hbh.GetSize()` by 8 bytes).

The code before this commit which inserted the header at the new
`hbh.GetSize()` offset still works correctly since we copy all the
bytes before the insertion offset back. It just copies more bytes than
necessary.
2023-02-03 21:31:19 -08:00
Abtin Keshavarzian 48128acb76 [ip6] remove default constructor for Ip6::Option (#8712)
All sub-classes of `Option` provide `Init()` method to initialize
the Option.

This commit also updates `Lowpan::CompressExtensionHeader()` to
check that we did read an option from message before checking if
it can be compressed.
2023-02-02 21:26:38 -08:00
Abtin Keshavarzian d0f6f8dc30 [cli] add documentation for dns resolve4 command (#8710) 2023-02-02 21:25:28 -08:00
Abtin Keshavarzian 213792f85b [github-actions] update toranj-ncp to trigger on pull request only (#8648)
This commit updates the github actions `toranj` workflow and the
toranj `start.sh` script to trigger `toranj-ncp` tests on a Pull
Request only if there are changes in any of the `src/ncp` files.
2023-02-02 12:52:08 -08:00
Abtin Keshavarzian 88b3367402 [message] add WriteBytesFromMessage() and Remove/InsertHeader() (#8708)
This commit updates `Message` class adding new methods. A new
method `WriteBytesFromMessage()` is added which writes bytes read
from another or potentially the same message to the message at
a given offset.  This method replaces the `CopyTo()` and unlike
`CopyTo()` it can be used to copy bytes within the same message
in either forward or backward directions.

This commit adds `RemoveHeader()` which removes header bytes from
the message at a given offset and length. It shrinks the message
and copies existing header bytes before the removed segment forward
to replace the removed bytes.

This commit also adds `InsertHeader()` method which grows the
message to make space for new header bytes at a given offset.
The existing header bytes are copied backward to make room for the
new header bytes.

Unit test `test_message` is updated to validated all the newly
added methods.
2023-02-02 11:01:24 -08:00
Abtin Keshavarzian e5530a7e5f [ip6] refer to correct RFC in comments/docs (#8711)
This commit updates comments to refer to correct RFC number. RFC 6052
instead of 6502 (typo in some comments).
2023-02-02 10:07:58 -08:00
Abtin Keshavarzian 632b63089c [ip6] rename Option sub-classes (#8709)
This commit renames the `Ip6::Option` and its sub-classes, e.g.,
we use `MplOption` instead of `OptionMpl` to follow similar naming
pattern as `Tlv`s.
2023-02-01 15:13:10 -08:00
Yakun Xu 7fc806fa38 [test] move tcplp tests into unit workflow (#8707)
The tcplp test is not testing POSIX platform. This commit creates a new
workflow unit to host this test. In future, we may put all unit tests
in this workflow after automake support is removed.
2023-02-01 15:10:14 -08:00
Yakun Xu 3eea48cc52 [posix] remove Android.mk (#8706)
This commit removes Android.mk to reduce maintenance effort.
2023-02-01 15:07:46 -08:00
Markus Becker 985f811804 [mle] add API for changing number of child router links (#8410)
Multicast has been proven to work unreliably with a low value of
OPENTHREAD_CONFIG_MLE_CHILD_ROUTER_LINKS for big dense networks.
Since there is no silver bullet value that suits all installations,
this commit makes it possible to configure its value at runtime.

Signed-off-by: Markus Becker <markus.becker@tridonic.com>
2023-01-31 18:31:24 -08:00
Michael Gebremariam c28bb194d4 [api] include mLinkMargin in otNeighborInfo (#8697) 2023-01-30 11:06:21 -08:00
dependabot[bot] abfa1371f0 github-actions: bump step-security/harden-runner from 2.0.0 to 2.1.0 (#8703)
Bumps [step-security/harden-runner](https://github.com/step-security/harden-runner) from 2.0.0 to 2.1.0.
- [Release notes](https://github.com/step-security/harden-runner/releases)
- [Commits](https://github.com/step-security/harden-runner/compare/ebacdc22ef6c2cfb85ee5ded8f2e640f4c776dd5...18bf8ad2ca49c14cbb28b91346d626ccfb00c518)

---
updated-dependencies:
- dependency-name: step-security/harden-runner
  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-01-30 09:19:31 -08:00
Eduardo Montoya 25506997f2 [cli-tcp] fix TLS configuration for different platforms (#8693)
This commit addresses two issues:
- Use agnostic crypto API regardless of `OPENTHREAD_CONFIG_CRYPTO_LIB`
  choice.
- Limits the configured ciphersuites in order to avoid client-server
  conflicts during handshake.
2023-01-26 10:02:16 -08:00
Abtin Keshavarzian abbf38570d [core] use AppendBytesFromMessage() to copy bytes between messages (#8686)
This commit updates multiple core modules to use the `Message` helper
method `AppendBytesFromMessage()` to append bytes read from one
message at a given offset and length to the end of another message.
2023-01-25 21:33:29 -08:00
Abtin Keshavarzian 8b1d0a9d5a [net-diags] include link quality in child table entry (#8398)
This commit updates the `ChildTableEntry` which is included in Network
Diagnostic "Child Table TLV" to also provide the Link Quality In info
for the child (using the unused two-bit field in the existing entry
format).
2023-01-25 21:32:31 -08:00
Abtin Keshavarzian 3f50b606df [csl] reset tx attempt on mCslTxChild when msg is replaced/purged (#8683)
This commit contains two updates/fixes in `CslTxScheduler`:

In `CslTxScheduler::Update()` method, this commit adds a new call to
`ResetCslTxAttempts()` on `mCslTxChild` when the current indirect
message associated with the child gets changed (replaced or purged),
while MAC is busy with tx of a CSL frame to this child. This ensures
that the next CSL tx associated this child will be correctly treated
as a new frame (and not a retx) and gets its own frame counter.

This commit also updates `HandleSentFrame()` to ensure that we always
call `RescheduleCslTx()` from this method. `Update()` method is
called whenever there is a change to the head of indirect message
queue of any sleepy child. If we are not in the middle of CSL tx at
MAC layer, `RescheduleCslTx()` is called immediately to determine the
next CSL tx among all children and schedule it. Otherwise, we wait
for MAC to signal that frame TX is done. Current code only called
`RescheduleCslTx()` when there was a tx error in `HandleSentFrame()`.
This can cause the issue of not scheduling the next CSL in case
of tx success and/or if the current message was replaced/purged.
2023-01-24 20:55:32 -08:00
Abtin Keshavarzian dbadefa5c8 [ip6] add GetSize() to ExtensionHeader and OptionHeader (#8684)
This commit adds `GetSize()` to `Ip6::ExtensionHeader` and base
class `OptionHeader`. This method returns the size (number of bytes)
of the header/option. In case of `ExtensionHeader` the size is
derived from "Length" field which is in 8-bye unit and does not
count the first 8 bytes.
2023-01-24 20:54:53 -08:00
dependabot[bot] a1a223fcd1 github-actions: bump github/codeql-action from 2.1.37 to 2.1.39 (#8679)
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 2.1.37 to 2.1.39.
- [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/959cbb7472c4d4ad70cdfe6f4976053fe48ab394...a34ca99b4610d924e04c68db79e503e1f79f9f02)

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

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-01-23 12:57:05 -08:00
Zhanglong Xia 03c98e08eb [diag] add power calibration related diag commands (#8584)
he power calibration is supported by OT, this commit adds diag
commands that are used to measure the mapping between the actual power
and raw power settings, show the platform used power settings table.
1. Add "diag powersettings" to show the platform currently used power
   settings table.
2. Add "diag rawpowersetting" to make the platform to use the given
   raw power settings to transmit frames.
3. Add "diag cw" to transmit the continuous carrier wave.
2023-01-23 12:55:48 -08:00
Sam Kumar 65a8d520b1 [cli-tcp] add TLS mode to TCP CLI tool and TLS callbacks to TCP API (#8257)
This commit adds support for TLS in the TCP CLI tool, along with a
test of TLS functionality.

The main purpose of this is to provide an example of how to use
mbedTLS with TCPlp to run TLS. I felt it is important to have an
example because I expect that many applications that use TCP,
particularly those in which a Thread device exchanges data with a
device outside the Thread mesh, will need to run TLS over TCP for
security reasons.

A secondary benefit is to add TCP functionality to the TCP CLI
tool. Additionally, by having the example code be part of a "real"
application (the CLI tool), there is less risk of the code going stale
as OpenThread evolves.

I added an "expects" test for the TLS functionality in the CLI tool. I
also ran the code on two Nordic NRF52840-DK boards to make sure it
works.

The performance impact of TLS appears to be small. When using TCP
without TLS, I am able to achieve ~80 kb/s goodput between two
NRF52840-DK boards. With TLS in the same setup, I am able to achieve
~70-75 kb/s goodput.
2023-01-23 10:56:16 -08:00
Abtin Keshavarzian 30aebb5e74 [ip6-mpl] check the length when reading MPL Option (#8672)
This commit enhances/fixes how we validate an `OptionMpl` we read from
a received message. In `Mpl::ProcessOption()`, we first ensure that
we can read the minimum expected size of an MPL Option and then check
based on the read Control field, the Seed ID length and ensure we can
read the full `OptionMpl` under `kSeedIdLength2`.
2023-01-20 08:30:23 -08:00
Jonathan Hui e5383ca9db [github-actions] fix cmake 3.10.3 install (#8671) 2023-01-19 15:10:35 -08:00
Abtin Keshavarzian dbe1f7019c [radio] new API to update frame counter only if new value is larger (#8607)
This commit adds a new radio platform API which updates the MAC Frame
Counter only if the new value is larger than current value being used
by radio platform, i.e., `otPlatRadioSetMacFrameCounterIfLarger()`.
OT stack provides a default weak implementation of this API which
calls the existing `otPlatRadioSetMacFrameCouter()`.

This API is used when radio provides `OT_RADIO_CAPS_TRANSMIT_SEC`
capability and thereby is responsible for assigning the frame counter
to tx frames. It helps address an edge-case where OT stack may not
yet know of the latest frame counter values used by radio platform
(e.g., due to enhanced acks processed by radio platform directly or
due to delay between RCP and host) and then setting the value from OT
stack may cause the counter value on radio to move back (OT stack
will set the counter after appending it in `LinkFrameCounterTlv` on
all radios when multi-radio links feature is enabled).

This commit also updates spinel and RCP and `radio_spinel`
implementations to support the new API. This is added in a fully
compatible way, i.e., a new host firmware works with older RCP, and
similarly an old host can work with new RCP firmware.
2023-01-19 09:12:07 -08:00
Abtin Keshavarzian a1953a7a34 [ip6] check role to allow forwarding back to Thread (#8666)
This commit updates `Ip6::HandleDatagram()` to check the device role
to determine whether to allow messages received from the Thread mesh
to be forwarded back to the Thread mesh. This is allowed only when
device is acting as router or leader. This then lets us remove
`SetForwardingEnabled()` method.
2023-01-18 11:59:32 -08:00
Abtin Keshavarzian 75b1a56c3c [ip6] style enhancements and renames (#8665)
This commit renames the method which passes a message to host
by invoking the registered receive callback to `PassToHost()`.
It also contains smaller style enhancements.
2023-01-18 11:57:55 -08:00
Zhangwx 62cfa5144a [logging] fix print format when enabling csl debug (#8667)
Fix some `uint32_t` variables using `%u` format when enabling csl debug.
2023-01-18 11:28:17 -08:00
Abtin Keshavarzian fe1cf3a294 [mac-frame] update InitMacHeader() (#8660)
This commit updates how we prepare the MAC headers:
- New `enum`s are defined in `Mac::Frame` to specify the frame
 `Type`,  `Version`, `SecurityLevel`, etc.
- `InitMacHeader()` will itself determine the Frame Control Field
  from the given address info.
- It now uses `FrameBuilder` to prepare the headers.
- New helper `MeshForwarder::PrepareMacHeaders()` is added which
  takes care of adding MAC (address, security header) along with
  any IE headers.
- These changes ensure that PAN ID Compression bit is properly
  set on MAC frames when using 2015 version (ensure that PAN
  IDs are not omitted when both addresses use Extended format).
2023-01-17 20:01:26 -08:00
Abtin Keshavarzian 57733ea668 [router-table] new API to get next hop and cost (#8653)
This commit updates `RouterTable` to provide a common method to
determine both the next hop and the path cost towards a given
destination. This helps us combine and reuse similar code.

This commit also adds `otThreadGetNextHopAndPathCost()` as a new
public OT API to get the next hop and path cost. It also adds a
related CLI command `nexthop`.

A new test `test-018-next-hop-and-path-cost.py` is added which
validates the next hop and path cost calculation on different
network topologies and from different nodes (FEDs, routers).
2023-01-17 13:31:44 -08:00
dependabot[bot] c766c8735e github-actions: bump actions/download-artifact from 3.0.1 to 3.0.2 (#8658)
Bumps [actions/download-artifact](https://github.com/actions/download-artifact) from 3.0.1 to 3.0.2.
- [Release notes](https://github.com/actions/download-artifact/releases)
- [Commits](https://github.com/actions/download-artifact/compare/9782bd6a9848b53b110e712e20e42d89988822b7...9bc31d5ccc31df68ecc42ccf4149144866c47d8a)

---
updated-dependencies:
- dependency-name: actions/download-artifact
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-01-17 10:09:12 -08:00
Eduardo Montoya 0614ff6e43 [data-poll-sender] faster rtx polling for CSL (#8654)
Make sure that retransmission of data polls happens at least at the
CSL period rate, when this is lower than
OPENTHREAD_CONFIG_MAC_RETX_POLL_PERIOD.

This greatly improves latency under situations of heavy traffic, where
CSL synchronization might be lost ocassionaly due to the mix of CSL
and indirect transmissions.
2023-01-17 09:58:27 -08:00
Abtin Keshavarzian b832cb2c49 [mle] keep router table next hop and cost on REED to router promotion (#8657)
This commit updates `MleRouter` such that on promotion from REED to
router role, we keep the router table's next hop and cost as what we
had as a REED, i.e., our parent being the next hop towards all other
routers and we tracked its cost towards them. As an FED, device may
have also established links with a subset of neighboring routers. We
ensure to clear the link to these neighbor to avoid using them since
the neighboring router will drop messages from us till we re-establish
link using our new RLOC16.
2023-01-17 09:45:23 -08:00
Abtin Keshavarzian 19475e3de8 [netdata] update CompareRouteEntries() on MTD to prefer self (#8656)
This commit updates `CompareRouteEntries()` so that on MTD we replace
the `PathCost()` check with a check to see if entry's RLOC matches
the device itself. This handles the uncommon case where an MTD itself
may be acting as a BR. This then allows us to remove the `MleRouter`
`PathCost()` method (which on MTD was returning zero).
2023-01-17 09:43:23 -08:00
Abtin Keshavarzian a1979fdd8e [mac] ensure to apply RSS filter on all rx frame including ack (#8651)
This commit updates how we apply `Mac::Filter` ensuring the fixed RSS
filter is applied to all rx frames including received ack frames.

We add a new method `Mac::Filter::ApplyToRxFrame()` which applies the
filter rules directly to a rx frame, potentially updating its signal
strength to a fixed RSS. This common method is then called from
`Mac::HandleReceivedFrame()` replacing the existing code and also
from `Mac::RecordFrameTransmitStatus()` to a received `aAckFrame`.
This ensures that fixed RSS is correctly tracked on the corresponding
neighbor.

This commit also updates `Mac::Filter` methods which do not change
the `Filter` to be marked as `const`.
2023-01-13 11:41:07 -08:00
Abtin Keshavarzian 23b5b2845f [trel] use same constant for noise-floor under TREL radio link only (#8650)
This commit applies to edge-case where OT is build with only TREL
radio link and no 15.4 radio link.

We define `Radio::kDefaultReceiveSensitivity` as the default rx
sensitivity value returned from `GetReceiveSensitivity()` and use the
same constant for noise floor returned from `SubMac::GetNoiseFloor()`.

This ensures that fixed RSS value applied through `macfilter add-lqi`
CLI command uses the same value for noise floor when calculating the
typical RSS for a given Link Quality value.
2023-01-12 21:16:48 -08:00
Abtin Keshavarzian b876cc3e03 [router-table] simplify UpdateRoutes() and how to reset Adv interval (#8644)
This commit changes `RouterTable::UpdateRoutes()`. Before updating the
routes, we track which routers have finite path cost. After the
update we check again to see if any path cost changed from finite to
infinite or vice versa and use this to decide whether to reset the
MLE Advertisement interval. This helps simplify the code and handle
some edge-cases related to resetting the Advertisement interval where
changing the Link Quality on the neighbor may impact the cost towards
routers which used it as next hop.
2023-01-12 12:03:13 -08:00
Abtin Keshavarzian 7b4f9e26fa [mle] always check for stale parent in HandleAdv() (#8646)
This commit contains smaller fixes and enhancements in `Mle` method
`Mle::HandleAdvertisement()`
- We add `VerifyOrExit(IsAttached())` at the top of the method.
- We always perform the check for stale parent i.e., check if we
  got an MLE Advertisement from parent but with a different RLOC16.
  The `MleRouter` method also does the same check, however in certain
  cases (e.g., when there is Partition ID or leader ID mismatch) the
  `MleRouter` method will exit early and expect the `Mle` method
  to handle these cases.
- When on `Mle` method we handle Partition ID or leader ID mismatch
  and then process `RouteTlv` we now also call `UpdateRoutesOnFed()`.
2023-01-11 23:19:28 -08:00
Abtin Keshavarzian 66933e4fcc [mle] update HandleAdv to not exit when deciding to promote to router (#8645)
This commit updates `MleRouter::HandleAdvertisement()` to not call
`ExitNow()` and exit early when as a child we decide to try to
promote to router role and set `mRouterSelectionJitterTimeout`. This
ensures that we continue processing the message and call
`UpdateRoutesOnFed()` and `router->SetLastHeard()`.
2023-01-11 23:12:15 -08:00
whd 22fa54dfa2 [infra-if] add API for querying infra link status (#8619)
This commit introduces 2 APIs to query infra link status:
- `otSysGetInfraNetifFlags` returns the `ifr_flags` of the infra
  network interface.
- `otSysCountInfraNetifAddresses` counts the numbers of LLA, ULA and
  GUA on the infra network interface.
2023-01-11 07:58:38 -08:00
Abtin Keshavarzian 7dd9543687 [mle] simplify HandleAdvertisement() (#8643)
This commit contains smaller enhancements in `MleRouter` method
`HandleAdvertisement()` processing received MLE Advertisement
message:
- We remove all the `IsFullThreadDevice()` checks in this method
  since it is only called from `Mle` when device is FTD (already
  checked by `Mle` before calling).
- Also this method is called only when device is attached (in child,
  router, or leader role). So we can simplify the checks related to
  the device's role.
- We pass the already read TLV values (e.g., `LeaderDataTlv`) to
  this method (to avoid re-reading the same TLVs from message).
2023-01-11 06:15:50 -08:00
Abtin Keshavarzian 1e5c664a9a [router-table] update cost on FED and enhance GetPathCost() (#8629)
This commit adds new method `RouterTable::UpdateRoutesOnFed()` which
tracks cost towards all routers on an FED child based the parent's
cost towards them. This method is called whenever we receive an MLE
Advertisement from the parent (replacing the code which tracked the
cost only towards the leader) and also during attach process upon
receiving a Child ID Response containing `RouteTlv` from the parent.

This commit also updates `GetPathCost()` to handle more case:
- Where device is detached or disabled, we return `kMaxRouteCost`.
- If device is a child, we derive the path cost as the link cost
  to the parent plus the cost from parent towards the destination.
- If device is a child and destination is another child of the
  same parent, we use link cost to parent plus an estimated cost
  towards the other child.

This commit also adds a new helper method `GetPathCostToLeader()`
which is then used in `MleRouter` to simplify the code, e.g.,
when deciding whether to respond to an MLE Parent Request to
to check the current path cost to leader.
2023-01-10 19:05:54 -08:00
Abtin Keshavarzian 6a21b5f9ae [netdiag] include netdiag.h header in network_diagnostic_tlvs.hpp (#8639)
The `network_diagnostic_tlvs.hpp` defines the net diag TLVs and uses
the public definitions (constants) from `openthread/netdiag.h` but
did not include it directly. This commit ensures we include it
directly.
2023-01-10 15:12:47 -08:00
Li Cao 00044dc821 [radio] refine the definition of SYMBOL_TIME (#8634)
This commit simplifies the definition of `OT_RADIO_SYMBOL_TIME` and
provided the reference of the value from IEEE 802.15.4-2015.
2023-01-10 15:12:25 -08:00
Li Cao 287ff433fb [posix] rename and move the configuration of host-rcp time sync interval (#8630)
This commit renames the configuration `RCP_TIME_OFFSET_CHECK_INTERVAL`
to `OPENTHREAD_POSIX_CONFIG_RCP_TIME_SYNC_INTERVAL` and moves it to
posix configuration file because this configuration may need to be
configured on different platforms.
2023-01-10 15:10:54 -08:00
Li Cao f02b8cd985 [cli] add csl info in single child info (#8606)
There's a use case to check the CSL state of one certain child from
the parent. For now this can only be done by showing the full child
table. This commit adds the CSL state in the display of single child
info (cli command `child <id>`).
2023-01-10 15:10:01 -08:00
Abtin Keshavarzian a32d1c0b64 [router-table] update FillRouteTlv() to use GetPathCost() (#8638) 2023-01-10 14:28:57 -08:00
Jonathan Hui f5e3078ec0 [github-actions] fix bootstrap on macos (#8640) 2023-01-10 13:16:16 -08:00
dependabot[bot] f4c5fa6d01 github-actions: bump actions/checkout from 3.1.0 to 3.3.0 (#8631)
Bumps [actions/checkout](https://github.com/actions/checkout) from 3.1.0 to 3.3.0.
- [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/93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8...ac593985615ec2ede58e132d2e21d2b1cbd6127c)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-01-09 21:07:51 -08:00
Abtin Keshavarzian e7eb94a693 [router-table] simplify GetNextHop() (#8624) 2023-01-09 19:35:57 -08:00
Abtin Keshavarzian b5fafccdef [router-table] move cost calc and related methods to RouterTable (#8623)
This commit moves existing methods for cost and next hop calculation
and updating router table entries to `RouterTable` class from
`MleRouter`.
2023-01-09 09:50:08 -08:00
Abtin Keshavarzian bf5576c93b [rcp] RCP to inform host of its supported RCP API version range (#8617)
This commit adds a new mechanism for RCP to inform host of the range
of RCP API versions that it can work with. This helps address
situations where RCP may be running a newer firmware (with higher
RCP API version) and host side is older, ensuring that version
checks can be performed correctly.

This commit introduces a new RCP-specific spinel property
`SPINEL_PROP_RCP_MIN_HOST_API_VERSION`. This new property is
available when RCP indicates that it has the newly added capability
`SPINEL_CAP_RCP_MIN_HOST_API_VERSION`. This is used on host side to
determine if we can get this property from RCP.

With addition of this new property, the `RadioSpinel` version check
code is changed to get the min version from RCP itself and then check
on the host side that its version is within the supported range.
2023-01-09 09:47:38 -08:00
Abtin Keshavarzian fd9f3237eb [toranj] add cli-based test-cases (#8599)
This commit updates cli-based `toranj` test framework and adds new
test-cases using this framework. The new test-cases re-implement all
the current ncp/wpantund based ones that cover OpenThread core
behavior (including the multi-radio and trel test-cases). Some of
the tests are enhanced (e.g. adding new checks) and some related
tests are combined into a single script.

This commit also updates the `toranj` CI GitHub workflow to use the
new cli-based model for multi-radio and trel (removing the ncp
based versions).
2023-01-05 22:49:06 -08:00
Abtin Keshavarzian ec494348f8 [netdata] use LeaderBase::FindNextMatchingPrefixTlv() (#8616)
This commit contains smaller changes in `NetworkData::Leader`
class:
- Use `FindNextMatchingPrefixTlv()` in methods to iterate over
  Prefix TLVs matching a given address.
- Simplify `IsOnMesh()` to iterate over Border Router sub-TLVs.
- Rename local variables to include `tlv` if they are a TLV.
2023-01-05 16:47:03 -08:00
Abtin Keshavarzian b64fab65cc [ip6] simplify SelectSourceAddress() (#8615)
This commit updates `Ip6::SelectSourceAddress()`. A new version of
is added which as its input gets a destination `Ip6::Address`
instead of an `Ip6::MessageInfo`, and returns the selected source
address as an `Ip6::Address *`. This helps simplify its use (no need
to create or pass `MessageInfo` instances). This commit also moves
the implementation of `otIp6SelectSourceAddress()` from `ip6_api.cpp`
to `Ip6` class adding a version of `SelectSourceAddress()` which
updates a passed-in `MessageInfo`directly.
2023-01-05 16:44:39 -08:00
Zhanglong Xia 28b40106b1 [posix] add posix config file configuration (#8612)
The ot-br-posix uses the posix platform's config file as its config
file. So the ot-br-posix can't set different configurations with posix
platform via the config file. This commit adds a config macro
`OPENTHREAD_POSIX_CONFIG_FILE` for ot-br-posix to specify a config
file to overwrite the posix platform's configurations.
2023-01-05 11:34:23 -08:00
Abtin Keshavarzian 6bb5eb50d0 [cli] new command to enable/disable discovery request callback (#8579)
This commit add `discover reqcallback {enable/disable}` CLI command
which registers callback to output whenever device gets a "MLE
Discovery Request". This command allows the callback to be explicitly
set when needed and avoid having it be enabled by default (since the
extra output from this callback can be treated as unexpected result by
tests that parse the CLI output).
2023-01-03 21:14:36 -08:00
Abtin Keshavarzian 3886436e46 [mle] define constants (C++ style) for OT configs used in MLE (#8602) 2023-01-03 20:56:22 -08:00
Abtin Keshavarzian e7493499ee [notifier] update to use Callback<HandlerType> (#8611)
This commit updates `Notifier` class to use the recently added
`Callback<HandlerType>` for the external callbacks.
2023-01-03 20:42:37 -08:00
Abtin Keshavarzian beb8a9040b [mle] add helper RxInfo::IsNeighborStateValid() (#8610)
This commit adds a new helper method in `RxInfo` to check whether or
not the `mNeighbor` field (the neighbor from which message was
received) is non-null and in valid state.
2023-01-03 17:09:53 -08:00
Jeff Bumgardner 41275372d3 [docs] fix typo in comment (#8609) 2023-01-03 17:08:15 -08:00
Abtin Keshavarzian cde7fd02c7 [mle] use DUA address directly in AppendAddressRegistrationTlv() (#8608)
This commit skips creating a local copy of DUA address and directly
uses `Get<DuaManager>().GetDomainUnicastAddress()` which will be fully
inlined.
2023-01-03 17:07:08 -08:00
dependabot[bot] 13a0df858c github-actions: bump github/codeql-action from 2.1.36 to 2.1.37 (#8600)
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 2.1.36 to 2.1.37.
- [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/v2.1.36...959cbb7472c4d4ad70cdfe6f4976053fe48ab394)

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

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-01-02 22:29:09 -08:00
Abtin Keshavarzian f2c02dfd18 [mle] update GetPathCost() calculation to handle child dest (#8586)
This commit updates `GetPathCost()` method to handle the cases where
the destination RLOC16 is the device itself or if it is the child of
the device. It also handles when the device itself is acting as a
child (cost is calculated if destination is the parent).

This change addresses situation where `GetPathCost()` is used in
`NetworkData::CompareRouteEntries()` to select between BRs (e.g.,
multiple BRs providing the same off-mesh route prefix) ensuring a
direct child BR is preferred over other routers that are multiple
hops away.
2022-12-30 13:55:37 -08:00
hastigondaliya 23135aa90d [tcplp] TCP support on 15.4 (#8590) (#8593)
This commit is fix to avoid dual processing on single TCP packet,
added fix which restricts TCP packet to pass from opentghread
stack. These changes are applicable only when openthread TCP stack is
used and it is implemented under feature flag -
OPENTHREAD_CONFIG_TCP_ENABLE
2022-12-29 21:03:00 -08:00
Abtin Keshavarzian 25c6e0ec89 [nat64] fix message leak when NAT64 translator is enabled (#8592)
This commit fixes a potential message leak when NAT64 translator
feature is enabled in `Ip6::ProcessReceiveCallback()` where a cloned
copy of message is not freed if `TranslateFromIp6()` returns an
error or if `mReceiveIp4DatagramCallback` is not set.

This commit updates how we track and free the message in this method
(to help simplify the code and avoid similar situations). Variable
`message` points to the `Message` instance we own in this method. If
we can take ownership of `aMessage`, we use it as `message`.
Otherwise, we may create a clone of it. `message` will be set to
`nullptr` if the message ownership is transferred to an invoked
callback. At the end of this method we free `message` if it is not
`nullptr` (indicating it was not passed to a callback.
2022-12-29 17:16:33 -08:00
Abtin Keshavarzian 3aab651adc [network-data] ensure ExternalRouteLookup() picks longest match (#8582)
This commit updates the `ExternalRouteLookup()` to ensure we pick
the longest match before checking the route preference.
2022-12-28 17:09:30 -08:00
dependabot[bot] 60700b1562 github-actions: bump ossf/scorecard-action from 2.1.0 to 2.1.2 (#8585)
Bumps [ossf/scorecard-action](https://github.com/ossf/scorecard-action) from 2.1.0 to 2.1.2.
- [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/937ffa90d79c7d720498178154ad4c7ba1e4ad8c...e38b1902ae4f44df626f11ba0734b14fb91f8f86)

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

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-12-28 17:05:33 -08:00
Abtin Keshavarzian 19e18753c1 [routing-manager] add feature to skip NS probe with router on same device (#8563)
This commit adds a new behavior in `RoutingManager` to skip performing
NS probe with a router with an address belonging to device infra
interface itself. This addresses the situation where platform may not
be be able to receive and pass the NA message responses from device
itself.
2022-12-22 19:23:51 -08:00
Sam Kumar 9bb00f7e2d [tcplp] fix code scanning alerts relating to integer overflow in multiplication (#8578) 2022-12-22 17:11:10 -08:00
Abtin Keshavarzian db0670e033 [routing-manager] determine RIO preference based on current role (#8574)
This commit updates how BR determines the preference to use when
advertising Route Info Options (RIO) in emitted Router Advertisement
(RA) messages.

User can explicitly set the preference by calling OpenThread API
`otBorderRoutingSetRouteInfoOptionPreference()`.

But if not set or the previously set value is cleared by user,
RIO preference is determined based on device's current role:
- Medium preference when device is in router/leader role,
- Low preference when in child role.

If a role change causes RIO preference to change, BR schedules
to send a new RA using the updated RIO preference.
2022-12-22 14:55:52 -08:00
Abtin Keshavarzian fcc9c7b70a [cli] add new command neighbor linkquality (#8508)
This commit adds a new CLI command `neighbor linkqulaity` which prints
the collected link quality info (such as frame error rate, message
error rate, average/last RSSI) for all neighbors.
2022-12-22 14:55:29 -08:00
Abtin Keshavarzian 289d24e06e [router-table] signal if router is removed from UpdateRouterIdSet() (#8573)
This commit updates the `RouterTable::RemoveRouter()` to check
if `Router` being removed is a neighbor and signal its removal.
This ensures that we correctly signal neighboring router removal
from a call to either `UpdateRouterIdSet()` or `Release(aRouterId)`.
2022-12-22 10:41:08 -08:00
Abtin Keshavarzian ddde5fa5d6 [mesh-forwarder] use constant for hopsLeft in lowpan MeshHeader (#8569)
This commit updates how we set the `hopsLeft` when preparing a lowpan
`MeshHeader` frame so to use a constant max value. The max hops lefts
value is determined based on `kMaxRouteCost`(estimate on max hops
between routers within Thread mesh) and additional guard increment
(e.g., adding for two for source or destination being child and
require one more hop).

This change replaces the previous model where number of hops was
predicted on source using the routing cost towards the destination.
While the cost can be a good estimate for number of hops, it may not
necessarily be correct, as the source's view of route cost may be
less than what its neighbor and next hops on the path currently have
(e.g., sender can have stale information).
2022-12-22 10:27:40 -08:00
Piotr Koziar 98e7c35da7 [link-metrics] fix build flags for Link Metrics Initiator (#8568)
This commit fixes the placement of the preprocessor directive to avoid
linking errors.
2022-12-21 23:43:07 -08:00
whd 9e0f4ae619 [routing-manager] GetFavoredOmrPrefix should return an error when Routing Manager is not running (#8565) 2022-12-21 21:14:15 -08:00
Abtin Keshavarzian 54acf042b9 [test] update toranj-cli logging to use log to file model (#8547)
This commit updates `toranj-cli` to use the simulation platforms "log
to file" feature and CLI feature to emit CLI input/output to log. This
helps simplify the log collection during testing and decouple it from
parsing/processing the CLI output while performing the test.
2022-12-21 20:52:43 -08:00
Abtin Keshavarzian c3b73283ef [common] add Callback<HandlerType> class (#8560)
This commit adds a new class `Callback<HandlerType>` which represents
a callback as a function pointer handler and a `void *` context pair.
The context is passed as one of the arguments to the function pointer
handler when the callback is invoked.

The `Callback` provides two specializations based on the position of
the context argument in the function pointer, i.e., whether it is
passed as the first argument or as the last argument. The
`Callback<HandlerType>` class automatically determines this at
compile-time based on the given `HandlerType` and passes the context
properly from `Invoke()` method.

The `Callback` class is used by OT core modules to simplify how
callbacks are defined and used.
2022-12-21 20:51:39 -08:00
Song GUO 4c70cbb162 [nat64] NAT64 translator should be active only when local prefix is published (#8558)
If an infrastructure-provided NAT64 prefix is present, we should
bypass the NAT64 translator to let the border router forward the
packet to the infra NAT64 service.
2022-12-21 17:52:00 -08:00
David Smith 438fb78720 [cli] fix incorrect mask "channel manager" CLI output (#8571) 2022-12-21 17:44:53 -08:00
Jonathan Hui 8e09b9f4d1 [github-actions] disable harden-runner in OTBR workflow (#8572)
The `harden-runner` action causes the OTBR workflow jobs to hang for
some reason. Disable until we are able to resolve the issue.
2022-12-21 16:29:22 -08:00
Abtin Keshavarzian e167a1f071 [core] use kThreadVersion1pX constants (#8562) 2022-12-21 11:36:38 -08:00
Abtin Keshavarzian 052fccbed8 [link-quality] move CostForLinkQuality() to link_quality.hpp (#8561)
This commit renames and moves the function which coverts a given
`LinkQuality` value to a link cost to `link_quality` source files.
2022-12-21 10:19:17 -08:00
Abtin Keshavarzian 11a4a70959 [simul-plat] new option to write logs to a given file (#8516)
This commit adds a new option in simulation platform to allow us to
specify a file name to write the logs into. This is applicable when
`LOG_OUTPUT` is set to `PLATFORM_DEFINED`. The filename can be
specified by `-l <name>` or `--log-file=<name>` options. If no log
file is provided then logs are emitted to syslog.
2022-12-21 10:16:44 -08:00
Zhanglong Xia 8b59f4d31e [posix] add power calibration support (#8293)
The actual output power of the Thread device may be determined by both
the Thread radio chip and the FEM. Consider the output power error of
the Thread radio chip and the gain error of the FEM, the actual output
power is inconsistent with the expected output power.  To guarantee
that the actual output power is accurate and meet the regulatory
requirements, the output power should be calibrated in the factory if
the output power is not accurate.

This commit contains the following changes:

- Adds a power calibration implementation
- Adds a config file to configure the target power for different
  countries
- Adds a tool for the factory to persist the power calibration data
2022-12-21 10:15:48 -08:00
Maciej Baczmański 9af0bfa60e [diag] modify gpio diag functions description (#8538)
This commit modifies descriptions of diag gpio functions to better
describe returned errors.
2022-12-20 11:14:20 -08:00
Abtin Keshavarzian ddc1c7c8b1 [netif] add helper to signal fixed multicast address changes (#8559)
This commit adds a private method `SignalMulticastAddressChange()`
which signals changes to fixes multicast addresses.
2022-12-20 09:27:49 -08:00
Thomas 1641eced0d [spinel] remove incorrect static_cast (#8512)
This should not be cast to an unsigned integer. If the
mRadioTimeOffset is negative, the resulting time instance is incorrect
and breaks e.g. CSL over RCP.
2022-12-19 14:50:54 -08:00
Abtin Keshavarzian 58c9ca84ff [pretty] combine strings in node.py (#8550) 2022-12-19 14:37:30 -08:00
David Smith 6a3ed83037 [docs] SRP Service Clarification (#8541)
Adding some clarification around the display of TXT records in `srp
server service`.
2022-12-19 13:40:49 -08:00
Abtin Keshavarzian a720d1422c [mle] add ShouldDowngrade() method (#8543)
This commit adds `MleRouter::ShouldDowngrade()` which determines
whether all conditions are satisfied for the router to downgrade
after receiving info for a neighboring router. This method is then
used in `HandleAdvertisement()`. It effectively combines some of the
other methods into one.
2022-12-19 12:50:48 -08:00
Abtin Keshavarzian 8d3c8dc79d [mle] define constant for "Child ID Response" timeout (#8536)
This commit defines `kChildIdResponseTimeout` as a new constant
in `mle_types.hpp` which is used as maximum wait time to receive
a "Child ID Response" message from parent during attach. This
commit also removes the now unused `kMaxChildUpdateResponseTimeout`.
2022-12-19 12:22:41 -08:00
Abtin Keshavarzian a09e8813f9 [test] replace sprintf with snprintf in otPlatDiagProcess() (#8549)
It also removes stale comments in `ncp_hdlc.cp` about use of
`sprintf`.
2022-12-19 12:12:45 -08:00
Abtin Keshavarzian b366867de2 [mle] simplify IsSingleton() methods (#8548) 2022-12-19 12:11:25 -08:00
Abtin Keshavarzian 81487725b0 [cli] add config for log level for emitting cli input/output to logs (#8545)
This commit adds `OPENTHREAD_CONFIG_CLI_LOG_INPUT_OUTPUT_LEVEL` to
specify the log level to use when CLI input/output is emitted to logs
(`OPENTHREAD_CONFIG_CLI_LOG_INPUT_OUTPUT_ENABLE` is enabled).
2022-12-19 12:05:00 -08:00
Abtin Keshavarzian 84308ca504 [mle] remove redundant OPENTHREAD_FTD checks in mle_router.cpp (#8544)
This commit removes the `#if` checks for `OPENTHREAD_FTD` in
`MleRouter` method implementations as the entire `mle_router.cpp` is
covered with a `#if OPENTHREAD_FTD` check at the top of the file.
2022-12-19 12:03:43 -08:00
dependabot[bot] 26edd52e77 github-actions: bump ossf/scorecard-action from 2.0.6 to 2.1.0 (#8552)
Bumps [ossf/scorecard-action](https://github.com/ossf/scorecard-action) from 2.0.6 to 2.1.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/99c53751e09b9529366343771cc321ec74e9bd3d...937ffa90d79c7d720498178154ad4c7ba1e4ad8c)

---
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>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-12-19 11:06:13 -08:00
Kangping 50ed30fcd9 [posix] make mInfraIfIndex non-static for posix::InfraIf (#8546)
We should not use static member fields given the `posix::InfraIf` is
already a singleton. Instead, let's make it consistent with the rest
of the fields which are all non-static.
2022-12-19 09:10:54 -08:00
Kangping a0d35548d9 [posix] add build option for posix infra if implementation (#8540)
On some platforms, we need to support the cases that:
1. The infrastructure interface can't be determined when the Thread
   daemon is started and we need to enable the Border Router features
   after the infra interface is available.
2. Some BR devices want to send/recv RAs in a coordinated way to be
   more efficient and consistent. For example, a BR which is also a
   Wi-Fi router may want to send/recv RAs by a single component.

This commit add a new `OPENTHREAD_POSIX_CONFIG_INFRA_IF_ENABLE` for
disabling the default posix infra if implementation so that posix
platforms can add their own version.
2022-12-19 08:37:52 -08:00
whd eff14060c1 [otci] fix parsing route flags (#8537)
A route in network data's output may have more than one flag. For
example, a NAT64 route can have `sn` as its flags. The previous
`__parse_routes` would crash when processing such a route.
2022-12-19 08:33:19 -08:00
Song GUO 117c8519ec [posix] add / delete route to NAT64 CIDR according to NAT64 translator state (#8505)
Adds a callback for platform getting adding / removing the NAT64 route
when NAT64 translator is enabled / disabled.

The cases of adding / removing routes to NAT64 CIDR:

- NAT64 inactive -> active:
  - interface down: noop
  - interface up: add route
- NAT64 active -> inactive:
  - interface down: noop
  - interface up: delete route
- interface down -> up:
  - NAT64 enabled: add route
  - NAT64 disabled: noop
- interface up -> down:
  - Noop, kernel will delete all routes on the interface
2022-12-16 02:53:08 -08:00
Abtin Keshavarzian 0f3de13ca8 [mle] fix NeighborHasComparableConnectivity() (#8535)
This commit updates `NeighborHasComparableConnectivity()` method which
is used as one of conditions to decide whether the router needs to
downgrade to REED. This method check whether a given neighboring
router has as good or better-quality links to all our neighboring
routers with two-way link quality of two or better.

The previous implementation assumed that routers in `RouterTable`
would match the same set of routers and their order as in the
received `RouteTlv` from the peer router. This may not necessarily be
the case (particularly after #8483). This commit changes the
implementation so that we iterate over all Router IDs and directly
track the index of each allocated router ID in the received
`RouteTlv`.
2022-12-15 22:38:38 -08:00
parag-silabs f2ed78770e [rcp] fix transaction ID caching and guard max power table code (#8408)
- Separate out max power table related code.
- Cache the transaction ID for async response only if
  otLinkRawTransmit() succeeds.
2022-12-15 21:37:12 -08:00
Abtin Keshavarzian 8ec9ede47a [router-table] add documentation for {Get/Set}RouterIdRange() (#8532) 2022-12-15 20:49:01 -08:00
Abtin Keshavarzian 6e50af9b0e [toranj update build.sh to use cmake for CLI builds (#8529) 2022-12-15 20:47:58 -08:00
Abtin Keshavarzian 6ab41a7383 [cmake] add OT_15_4 option for RADIO_LINK_IEEE_802_15_4_ENABLE (#8529)
This commit adds new cmake option `OT_15_4` to enable 802.15. radio
link. It also adds additional `message(STATUS)` to output the common
`OT_APP_CLI/NCP/RCP` and `OT_FTD/MTD/RCP` options.
2022-12-15 20:47:58 -08:00
Abtin Keshavarzian 281732fa3d [mle] avoid multiple return in HasSmallNumberOfChildren() (#8534) 2022-12-15 16:41:38 -08:00
Jonathan Hui 6d87e1a28b [continuous-integration] remove LGTM.com (#8528) 2022-12-14 14:11:51 -08:00
whd 01f9e89ffb [posix] enable receiving Neighbor Advertisement on infra interface (#8521)
This commit enables receiving Neighbor Advertisements (NA) on the
infra link.

OTBR relies on receiving Neighbor Advertisement to check if a router
is active. Without receiving NA, OTBR may wrongly see a router as
inactive and remove the discovered prefixes from Network Data too
early, which breaks the border routing feature.
2022-12-14 13:28:17 -08:00
Abtin Keshavarzian 144d480ca9 [router-table] simplify tracking of routers and allocated IDs (#8483)
This commit simplifies how `RouterTable` tracks the allocated Router
IDs and the `Router` entries. A new class `RouterIdMap` is added
which tracks the currently allocated Router IDs. For allocated IDs,
it also tracks the index of the `Router` entry in `mRouters` array.
For unallocated IDs, it tracks the remaining reuse delay time in
seconds (using the same underlying `uint8_t` per Router ID). This new
class makes it easier to find a `Router` by its ID. With this change,
we no longer need to keep the `mRouters` array sorted based on Router
ID (this was used when populating `RouteTlv`).

This commit also changes the `mRouters` to use `Array<Router>` which
will then tracks its length and also simplify range-based `for`
iteration over `RouterTable` entries.
2022-12-13 23:07:45 -08:00
Song GUO 2db38b0335 [test] ensure NAT64 is enabled when running NAT64 tests (#8520)
We cannot ensure NAT64 is enabled when running tests, and calling an
extra nat64_set_enabled has no side-effects.
2022-12-13 12:50:07 -08:00
Jonathan Hui b02bdb9e3b [github-actions] set top-level permissions to read (#8518) 2022-12-12 16:18:44 -08:00
whd c5ee313500 [tests] verify the RA/RS fields in border routing counters (#8494) 2022-12-12 16:18:13 -08:00
Jonathan Hui 98e644d538 [github-actions] apply step-security updates (#8509) 2022-12-10 16:12:12 -08:00
Eduardo Montoya 768072a6e0 [crypto] remove legacy otCryptoEcdsaSign (#8514)
This API was introduced for convenience but it's not used anymore.
2022-12-10 08:02:47 -08:00
Abtin Keshavarzian d27316c3e9 [simul-plat] fix parsing of "enable-energy-scan" option (#8515) 2022-12-09 22:08:49 -08:00
Eduardo Montoya da5434bc8f [cli] document pskcref (#8511) 2022-12-09 22:07:01 -08:00
Eduardo Montoya 35f51e2b17 [crypto] move Pskc generation to platform API (#8468) 2022-12-09 22:05:06 -08:00
Jonathan Hui 507d1b7971 [github-actions] enable OSSF Scorecards supply-chain security analysis (#8506) 2022-12-08 21:32:29 -08:00
Abtin Keshavarzian 80da0397d1 [mle] remember current RLOC16 in a member variable (#8499)
This commit updates `Mle` to store the current RLOC16 in a member
variable `mRloc16` (in addition to setting it on `Mac` as device's
short address). This allows `Mle::GetRloc16()` to be defined as an
inline method instead of using `Get<Mac::Mac>().GetShortAddress()`.
2022-12-08 17:55:47 -08:00
whd c9f3d08843 [tests] verify that SRP services are removed when their host expires (#8493)
This commit adds a step in `test_srp_lease.py` to verify that SRP
services are removed when their host expires.
2022-12-08 17:28:39 -08:00
Abtin Keshavarzian 927ac66735 [mle] allow rx-on/off with no re-attach based on initial attach mode (#8498)
This commit adds a new variable `mInitiallyAttachedAsSleepy` which
tracks whether or not device was initially attached as a sleepy
child. This is then used to determine whether or not we need to
re-attach on mode changes between rx-on and sleepy (rx-off). If we
initially attach as sleepy, then rx-on/off mode changes are allowed
without re-attach (device sends "Child Update Request" to its parent
to update its mode). Otherwise mode transition from rx-on to sleepy
requires a re-attach.
2022-12-08 17:27:37 -08:00
Mason Tran f765e1fa30 [clang-tidy] add missing symlinks to bootstrap (#8507)
I needed to add these symlinks because `script/clang-tidy` couldn't
find these files.
2022-12-08 14:20:22 -08:00
Abtin Keshavarzian 99a615bec2 [clang-format] use AllowShortFunctionsOnASingleLine: All (#8502)
This commit updates `AllowShortFunctionsOnASingleLine` to `All`
from `InlineOnly`.
2022-12-08 09:34:05 -08:00
Jonathan Hui 48c0582e4e [shellcheck] fix SC2155 warning (#8490)
Declare and assign separately to avoid masking return values.
2022-12-07 16:23:20 -08:00
Jonathan Hui 864236cbf1 [clang-tidy] apply v14 changes (#8490) 2022-12-07 16:23:20 -08:00
Jonathan Hui 49c5736f70 [clang-tidy] update to v14 (#8490) 2022-12-07 16:23:20 -08:00
Jonathan Hui 9c467a23ae [clang-format] apply v14 changes (#8490) 2022-12-07 16:23:20 -08:00
Jonathan Hui 351298e85f [clang-format] update to v14 (#8490) 2022-12-07 16:23:20 -08:00
Jonathan Hui b9514bf025 [docs] add security policy (#8497) 2022-12-07 16:21:29 -08:00
Jonathan Hui 2bfbd6b3f5 [github-actions] add codeql workflow (#8355) 2022-12-07 14:20:28 -08:00
Abtin Keshavarzian 6f1631aeba [mle] re-attach on FTD/MTD mode changes or from rx-on to sleepy (#8484)
This commit updates behavior when device mode gets changed
so to re-attach on switching between MTD/FTD modes and also on
switching from rx-on to sleepy (rx-off) mode (when attached as a
child).

This commit also updates `test-027-child-mode-change.py` to match
the new behavior.
2022-12-07 11:11:45 -08:00
Zhangwx e609eef7cc [logging] fix print format using %lu for uint32_t variables (#8495) 2022-12-07 10:14:22 -08:00
Abtin Keshavarzian 27be812bad [mpl] use TimeTicker for aging mSeedSet entries (#8488)
This commit updates the `Ip6::Mpl` to use `TimeTicker` instead of
its own `Timer` to age the entries in its `mSeedSet`. This commit
also updates the default number of seed entries by 3 to use the
memory saved by using `TimeTicker`.
2022-12-06 16:04:57 -08:00
Zang MingJie e8b34a46a7 [cli] add platform command which returns current platform (#8444)
Sometime we need to identify which platform we are currently using,
especially in a test cases, where a unified interface is provided to
control devices, the test cases have no idea about current platform.
2022-12-06 13:23:55 -08:00
Abtin Keshavarzian 9950ccf2fa [mpl] smaller enhancements in Ip6::Mpl (#8475)
- Use MLE `GetMeshLocal16()` to check if seed ID can be elided
  (remove `mMatchingAddress).
- When processing MPL option if seed ID is elided, we ensure that
  sender's address is RLOC format and use the RLOC16 as seed ID.
- When preparing MPL option directly use device's RLOC16 as seed ID
  (removing `Mpl::Get/SetSeedId()` methods).
- Determine number of timer expirations (MPL retransmission) based
  on device's current role.
2022-12-06 12:40:10 -08:00
Abtin Keshavarzian 852bc76f48 [mpl] reset seed entry lifetime on rx/tx (#8482)
This commit updates `Mpl::UpdateSeedSet()` to reset the `SeedEntry`
lifetime to `kSeedEntryLifetime` if we rx/tx a message with same
ID and sequence. This ensures that the entry is kept in the array
while other routers are forwarding the same message.
2022-12-05 21:27:06 -08:00
Abtin Keshavarzian cf4e514d00 [netdata] ensure to update version on leader if there is any change (#8472)
This commit updates `RegisterNetdataData()` to ensure that versions
are updated if there is any change even if there is an error during
integration of new entries (e.g., running out of space in Network
Data, or failing to allocate new service ID).
2022-12-05 14:11:33 -08:00
Yi 2167fda5a8 [nat64] delete nat64_set_enabled() when starting BR in tests (#8476)
NAT64 is enabled by default.
2022-12-05 11:53:21 -08:00
Abtin Keshavarzian 27b43146a9 [mle] rename variables to indicate if they are a TLV (#8465) 2022-12-01 21:26:40 -08:00
Abtin Keshavarzian 0337ff3e7e [csl] ensure current window is not missed when preparing CSL frame (#8464)
This commit fixes how we determine the CSL timings when preparing a
frame for CSL transmission. When scheduling the next CSL, we use
`mCslFrameRequestAheadUs` time in `GetNextCslTransmissionDelay()`. We
basically schedule `Mac` to start the CSL tx operation a bit earlier
than the desired CSL tx time. In `HandleFrameRequest()` (when we are
preparing the frame to be sent) we should be already within
`mCslFrameRequestAheadUs` time from the tx time. So this commit changes
the code such that we invoke `GetNextCslTransmissionDelay()` with zero
`aAheadUs` interval when preparing the frame. This ensures that we do not
skip the current CSL window and move to the next.

This commit also adds a check in `HandleFrameRequest()` to ensure that
we did not miss the current CSL window. This situation can happen if
`Mac` happens to be busy with some other operation and therefore late
to start CSL tx and invoke `HandleFrameRequest()`. In such a case we
don't want to use delay tx time for next CSL window (which may be way
later) and instead we abort the current CSL tx operation by returning
a `nullptr` frame.
2022-12-01 21:00:17 -08:00
Abtin Keshavarzian 89e403815a [mle] update RouteTlv to check number of allocated IDs (#8463)
This commit contains smaller enhancements in `RouteTlv`:

- `RouteTlv::IsValid()` checks that number of allocated IDs in
  the Router ID Mask is less than max number of routers.
- It also checks that the TLV contains correct number of Route
  Data entries matching the number of allocated router IDs.
- A new method `SetRouteData()` is added to set all the
  data fields (link quality in/out and route cost) for a given
  router index.
- These changes help ensure that messages containing invalid
  `RouteTlv` are rejected (avoid situation where we may have
  more allocated router IDs than max routers).
2022-12-01 19:45:31 -08:00
whd 87284f22eb [netdata] increase kInfoStringSize (#8454) 2022-11-29 19:43:18 -08:00
Jonathan Hui 0759de4fc5 [dependabot] update commit message prefix (#8457) 2022-11-29 10:45:21 -08:00
Jonathan Hui e61e64d2b7 [github-actions] exclude dependabot branches (#8456) 2022-11-29 10:45:03 -08:00
Eduardo Montoya 45c2cb4332 [indirect-sender] reset CSL Tx attempts in DataPollHandler (#8455)
Fix an issue in which a CSL Transmitter would start to send malformed
frames to the radio in the ocassion of a data poll arriving while a
delayed CSL transmission was already scheduled.

Notice that `CslTxScheduler::HandleSentFrame` is reseting both CSL Tx
attempts and Indirect Tx attempts, so it makes sense to do the same
in `DataPollHandler::HandleSentFrame`.
2022-11-29 10:19:14 -08:00
andrei-menzopol 1b88b045d0 [logging] fix format strings (#8446)
This commit fixes the format string in logging functions.

When openthread is included in other projects that use the -Werror
option in their builds, such as Matter, these format string errors
appear. In this case, it can be seen in radio.h that the structure
members are uint32_t but printed with %u.

The size of types depends on the target, there needs to be a casing.
2022-11-29 08:29:52 -08:00
whd 746557d52c [build] fix LOCAL_EXPORT_CFLAGS (#8453)
`LOCAL_EXPORT_CFLAGS` is exporting `OPENTHREAD_PROJECT_CFLAGS` which
contains quotes. This sometimes can cause compile errors due to
limitation of Android build system.

Also, `ot-cli` is repeating the flags in `LOCAL_CFLAGS`, which can
cause macro redefinition error. Since `ot-cli` depends on `ot-core`,
it already gets the flags from `LOCAL_EXPORT_CFLAGS`.
2022-11-28 21:14:06 -08:00
Abtin Keshavarzian d2e1c1e14d [router-table] move FillRouteTlv() to RouterTable (#8437)
This commit moves `FillRouteTlv()` method to `RouterTable` class.
2022-11-28 21:12:21 -08:00
Abtin Keshavarzian 43a6430083 [router-table] add new helper methods FindNextHopOf() and renames (#8437)
This commit contains smaller enhancements in `RouterTable` class:

- New method `FindNextHopOf()` is added to find the next hop of a
  given router.
- Methods which find router are renamed: `FindRouterById()` to search
  for a given Router ID, `FindRouterByRloc16()` to search for a given
  RLOC16.
- The methods which find a neighbor router are declared as `private`
  and only used by `friend` class `NeighborTable`. Other modules use
  `NeighborTable` methods to find neighbors.
2022-11-28 21:12:21 -08:00
dependabot[bot] d88ea9a463 github-actions: bump actions/upload-artifact from 1 to 3 (#8448)
Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 1 to 3.
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](https://github.com/actions/upload-artifact/compare/v1...v3)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-11-28 12:13:45 -08:00
dependabot[bot] 25d8f54d56 github-actions: bump docker/setup-buildx-action from 1 to 2 (#8447)
Bumps [docker/setup-buildx-action](https://github.com/docker/setup-buildx-action) from 1 to 2.
- [Release notes](https://github.com/docker/setup-buildx-action/releases)
- [Commits](https://github.com/docker/setup-buildx-action/compare/v1...v2)

---
updated-dependencies:
- dependency-name: docker/setup-buildx-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-11-28 12:13:09 -08:00
jinran-google e66c21c3da [api] include Thread version in neighbor info (#8435) 2022-11-23 21:34:13 -08:00
Abtin Keshavarzian eeb6ab0c8e [routing-manager] ensure local prefix is changed on xpanid change (#8436)
This commit updates `RoutingManager` to check if a change to xpanid
does impact the generated local on-link prefix. This can address two
situations: (1) when BR is started before Thread/MLE operation where
we can get a signal that xpanid is changed on MLE start (without it
actually changing), (2) if the xpanid does change but since not all
the xpanid bytes are used in the derivation of the local prefix, it
can remain as before.

This commit also updates the unit test to start the BR early (along
with MLE operation) under the `TestSavedOnLinkPrefixes()` case.
2022-11-22 22:04:55 -08:00
Song GUO b468a25a61 [nat64] use dbus API for NAT64 tests (#8392) 2022-11-22 21:39:11 -08:00
Abtin Keshavarzian afcc48edde [router-table] remove duplicate method (#8434)
This commit removes `RouterTable::GetActiveLinkCount()` and uses
`GetNeighborCount()` instead (which does the same).
2022-11-22 18:21:13 -08:00
Abtin Keshavarzian 2b579767ad [test] test_routing_manager to check duplicate PIO/RIO prefixes (#8431)
This commit updates the `RoutingManager` unit test to check that
there are no duplicate PIO/RIO prefixes in the emitted RA message.

It also updates the `TestSavedOnLinkPrefixes()` to check behavior
after device resets/restarts while it was advertising its local
on-link prefix or deprecating it.
2022-11-22 18:20:31 -08:00
Abtin Keshavarzian c5af37fbc7 [router-table] fix router next hop change on Release(aRouterId) (#8433) 2022-11-22 17:54:57 -08:00
Abtin Keshavarzian 4e44471431 [meshcop] update processing of UDP Encapsulation TLV (#8427)
This commit updates how UDP Encapsulation TLV is processed. In
particular, when handling a received TMF `kUriProxyTx` message
containing this TLV, we allow the TLV to be extended or not. This is
aligned with the Thread specification for this TLV. When appending
this TLV in `kUriProxyRx` TMF message, we continue to use Extended
TLV so to keep the behavior same as before.
2022-11-22 13:12:52 -08:00
Abtin Keshavarzian b102e4172c [tlv] add private helper methods to parse and find TLVs in a message (#8421)
This commit adds new private type `ParsedInfo` in `Tlv` class
which contains parsed TLV info such as TLV type, length, size,
value offset. This class provides `ParseFrom()` and `FindIn()`
methods to parse or find a TLV from a message.

This commit also adds a unit test `test_tlv` to validate the TLV
methods.
2022-11-22 12:52:21 -08:00
whd 9f702782bd [telemetry] implement RA/RS counters (#8416) 2022-11-22 09:23:58 -08:00
dependabot[bot] a8367287a5 github-actions: bump actions/download-artifact from 2 to 3 (#8426)
Bumps [actions/download-artifact](https://github.com/actions/download-artifact) from 2 to 3.
- [Release notes](https://github.com/actions/download-artifact/releases)
- [Commits](https://github.com/actions/download-artifact/compare/v2...v3)

---
updated-dependencies:
- dependency-name: actions/download-artifact
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-11-21 22:44:48 -08:00
dependabot[bot] 49cf1e1dc2 github-actions: bump docker/login-action from 1 to 2 (#8425)
Bumps [docker/login-action](https://github.com/docker/login-action) from 1 to 2.
- [Release notes](https://github.com/docker/login-action/releases)
- [Commits](https://github.com/docker/login-action/compare/v1...v2)

---
updated-dependencies:
- dependency-name: docker/login-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-11-21 22:44:28 -08:00
dependabot[bot] d3b3a0b5ef github-actions: bump actions/setup-python from 1 to 4 (#8424)
Bumps [actions/setup-python](https://github.com/actions/setup-python) from 1 to 4.
- [Release notes](https://github.com/actions/setup-python/releases)
- [Commits](https://github.com/actions/setup-python/compare/v1...v4)

---
updated-dependencies:
- dependency-name: actions/setup-python
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-11-21 22:44:07 -08:00
dependabot[bot] c8ff3ba445 github-actions: bump codecov/codecov-action from 2 to 3 (#8423)
Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 2 to 3.
- [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/v2...v3)

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

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-11-21 22:43:47 -08:00
dependabot[bot] 233b589cdb github-actions: bump actions/setup-go from 1 to 3 (#8422)
Bumps [actions/setup-go](https://github.com/actions/setup-go) from 1 to 3.
- [Release notes](https://github.com/actions/setup-go/releases)
- [Commits](https://github.com/actions/setup-go/compare/v1...v3)

---
updated-dependencies:
- dependency-name: actions/setup-go
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-11-21 22:43:21 -08:00
Ewout ter Hoeven bf33e2b4bc [github-actions] add Dependabot configuration for GitHub Actions updates (#8418)
Add a Dependabot configuration that checks once a week if the GitHub
Actions are still using the latest version. If not, it opens a PR to
update them.

It will actually open few PRs, since only major versions are specified
(like v3), so only on a major release (like v4) it will update and
open a PR. But it helps actively keep GitHub Actions workflows up to
date and secure.
2022-11-21 19:22:55 -08:00
Zhanglong Xia 5e9c7d914d [spinel] update the updating/adding RCP spinel property guideline (#7937)
When adding a new spinel property or updating the existing spinel
property, it may cause the host can't work with the old RCP. The
host can be updated independently on some of our products. If the
compatibility issue happens, it causes the host dies after the
host is updated.

To reduce the compatibility issues between the host and RCP, this
commit updates the guideline of updating/adding RCP spinel properties.
2022-11-21 08:52:56 -08:00
Abtin Keshavarzian faeea3d2b9 [tlv] helper methods to read/find/append TLVs with UTF8 string value (#8417)
This commit adds new methods in `Tlv` to read, find, or append simple
TLVs with a UTF8 string value. `StringTlvInfo<Type, kMaxStringLen>`
can be used to define constants and types for such TLVs. This helps
simplify implementation of many such TLVs, e.g., Vendor Name TLV,
Provisioning URL TLV, Network Name TLV, etc.
2022-11-18 19:49:20 -08:00
Abtin Keshavarzian 411a20a62b [mle] use Tlv::FindTlvValueOffset() instead of FindTlvOffset() (#8413)
This commit updates `Mle` modules to use `FindTlvValueOffset()`
instead of `FindTlvOffset()` when trying to find a variable length
TLV (e.g., Network Data TLV or Address Registration TLV). This helps
simplify the code (we avoid reading the TLV again and can directly
read and process the TLV's value).
2022-11-18 13:01:56 -08:00
Yakun Xu 564d667790 [doc] add doc for coex command (#8415) 2022-11-18 12:58:30 -08:00
Abtin Keshavarzian 4e83caf42d [commissioner] fix provisioning URL comparison (#8411)
This commit fixes the comparison of the received Provisioning URL
string with the commissioner's one when handling Joiner Finalize TMF
message.
2022-11-17 19:45:37 -08:00
Jonathan Hui 439a5ba234 [docker] update ubuntu to 22.04 (#8405) 2022-11-17 09:05:47 -08:00
Abtin Keshavarzian 16c6b04537 [meshcop] simplify StateTlv (#8404)
This commit simplifies `StateTlv` and updates the reading of TLV in
`DatasetManager::HandleMgmtSetResponse()` (which could previously
allow a TLV with empty value).
2022-11-17 09:05:27 -08:00
canisLupus1313 593c2b0a8d [bootstrap] remove brew from apt package installations (#8399)
This commit chages incorrect pkg manager tool used in
`install_packages_pretty_format` from brew to apt-get.
2022-11-17 08:52:22 -08:00
Abtin Keshavarzian 4a7c447f6c [cli] update OutputSpaces() to use literal format string (#8394)
This commit updates `OutputSpaces()` to use literal format string.
2022-11-16 20:28:43 -08:00
Jonathan Hui 2caab0c331 [spinel] fix printf style output (#8401) 2022-11-16 13:02:46 -08:00
Jonathan Hui dadd60f88a [github-actions] fix macos build checks (#8397)
- install `ninja` binary directly
- use pre-installed clang on macos
2022-11-15 09:14:13 -08:00
Zhanglong Xia 3e138d3f5d [diag] add gpio mode commands (#8391)
This commit adds diag commands for setting the GPIO mode to resolve
the conflict https://github.com/openthread/openthread/issues/8362.
2022-11-12 04:51:24 +01:00
whd caec27dcf1 [tests] add tests for Border Routing Counters (#8341)
This commit adds tests for verifying the functionality of the D-BUS
API `GetBorderRoutingCounters`.
2022-11-12 04:42:58 +01:00
whd 902ce1ca7f [build] add build option OT_BORDER_ROUTING_COUNTERS (#8389) 2022-11-10 09:15:43 +01:00
Zhanglong Xia 3d4f617a00 [spinel] log radio spinel frame (#8342) 2022-11-09 11:40:14 +01:00
whd 8045c829d7 [cli] add commands for Border Routing counters (#8372) 2022-11-09 11:31:11 +01:00
Abtin Keshavarzian 537002352f [netdata] update Notifier to prepare and send SVR_DATA.ntf msg (#8376)
This class moves all the related code for preparing and sending
`kUriServerData` message to `NetworkData::Notifier`. In particular,
`RemoveStaleChildEntries()` and `UpdateInconsistentData()` are moved
to the `Notifier` class.
2022-11-08 19:14:46 +01:00
Abtin Keshavarzian f4d7f1a719 [netdata] add helper method to compare two BR entries (#8375)
This commit adds `CompareRouteEntries()` which performs a three-way
comparison between two network data BR route entries:
- Entry with higher preference is selected first.
- If the same preference, prefer BR that is this device itself.
- If all same, prefer the one with lower mesh path cost.
2022-11-08 18:29:53 +01:00
Jonathan Hui 8d39d9c075 [tests] fix comparison width warning (#8380) 2022-11-08 16:33:50 +01:00
Abtin Keshavarzian fd23fb1add [netdata] simplify RouteLookup() methods (#8374)
This commit updates the `RouteLookup()` methods in `NetworkData`
and `ThreadNetif`:
- Removes the unused `aPrefixMatchLength` parameter.
- Requires `aRloc` to be a reference instead of a pointer.
2022-11-08 11:49:31 +01:00
Jonathan Hui 73c48595b7 [cli] fix printf style output (#8377)
When `OPENTHREAD_CONFIG_PLATFORM_KEY_REFERENCES_ENABLE` is enabled.
2022-11-08 11:15:22 +01:00
Zhanglong Xia 91fa1f455a [posix] use __GLIBC__ instead of __linux__ in backtrace (#8373)
he `execinfo.h` is a glibc specific header, and the glibc doesn't
exist under openwrt. It causes the compile errors under openwrt in
ot-br-posix. This commit uses __GLIBC__ instead of __linux__ to avoid
the compile errors when the OS doesn't contain the glibc.
2022-11-07 22:23:24 +01:00
Abtin Keshavarzian 6b03d55cc4 [cli] add compile-time printf style arg check in CLI (#8369)
This commit adds compile-time check of format string to all CLI
`Output` methods. It also updates CLI module to  make arg string
formats consistent. In particular we use `'%lu` for `uint32_t`
arguments and they are explicitly cast to `unsigned long` using
`ToUlong()`.
2022-11-07 22:05:55 +01:00
Abtin Keshavarzian 4e52ffb54e [net-diag] simplify processing of TLVs, allow extended TLV (#8368)
This commit updates `NetworkDiagnostic` class's generation and
processing of TLVs. When appending list based TLVs (IPv6 Address List
TLV or Child Table TLV) depending on the number of entries we use
regular or extended TLV. When processing the message and reading the
TLVs, this commit updates the code to handle extended TLVs as well.

This commit changes the behavior of `GetNextDiagTlv()`. The
`otNetworkDiagTlv` data structure defines limited-size arrays for
IPv6 address list and child table. When processing a received message
if the number of entries is larger than the array size, the first set
entries (as many as fits in the array) are read and the rest are
ignored. This changes the existing behavior which returned a
`kErrorPrase` error in such a case.
2022-11-07 09:41:46 +01:00
Abtin Keshavarzian 727002e9fe [cli] add OutputUint64() for 64-bit integer value in decimal format (#8354)
This commit also adds a helper `Uint64ToString()` method to convert a
`uint64_t` to decimal format string. The new methods allow us to
output `uint64_t` values without needing to cast to `unsigned long
long` and/or use of `%llu` (which may not be provided by certain
embedded libraries).
2022-11-07 09:35:27 +01:00
Jonathan Hui ba826ffb2a [clang-tidy] add readability-redundant-control-flow (#8365) 2022-11-04 16:34:37 -07:00
Jonathan Hui 8e020b4018 [clang-tidy] add modernize-loop-convert (#8361) 2022-11-04 10:36:42 -07:00
Abtin Keshavarzian 7ec7620975 [tlv] ReadTlvValue() to handle regular or extended TLVs (#8364)
This commit changes `ReadTlv()` methods so that they can be used
independent of whether the read TLV is an Extended TLV or not. This
makes them similar to `FindTlv()` methods.
2022-11-04 08:53:52 -07:00
Abtin Keshavarzian 13223b0104 [net-diag] add a common SendDiagnosticCommand() method (#8357)
This commit adds a common `SendDiagnosticCommand()` which is then
used for sending `DiagnosticGet` or `DiagnosticReset` commands.
2022-11-04 08:51:04 -07:00
Zhanglong Xia d92520c3e2 [posix] add backtrace support (#8358)
This commit logs the backtrace when the Thread crashes on the Linux
and Android.
2022-11-04 08:48:03 -07:00
whd df20f3d91a [telemetry] border routing packet counters (#8280)
This commit introduces `otBorderRoutingCounters` which contains the
number of packets and bytes forwarded via border routing.

The counters have 4 categories: inbound unicast, inbound multicast,
outbound unicast, outbound multicast.

I've verified this feature locally on a BR device by ping command in
following scenarios:
- A host pings an ED's OMR.
- An ED pings a host's onlink address.
- A host pings a multicast address which an ED subscribes to.
- An ED pings a multicast address which a host subscribes to.
2022-11-04 00:13:10 -07:00
andrei-menzopol a532ce6e57 [crypto] add ECDSA API (#8273)
- remove ecdsa tinycrypt implementation
- add crypto API, move default implementation in crypto_platform.c
- define crypto ecdsa structures and format
2022-11-03 09:40:51 -07:00
Abtin Keshavarzian f5367f6238 [log] add arg format check to otLog{Level}Plat() functions (#8356) 2022-11-02 22:45:05 -07:00
Abtin Keshavarzian d7de66671a [net-diag] reuse similar MLE TLV definitions (#8350)
This commit updates some of the `NetworkDiagnostic` TLV definitions
to reuse similar MLE TLVs (e.g. `LeaderDataTlv`). It also updates
the code to reuse helper methods to parse `Mle::DeviceMode` and
`Mle::LeaderData`.
2022-11-02 08:57:07 -07:00
1154 changed files with 56165 additions and 54282 deletions
+1 -1
View File
@@ -11,7 +11,7 @@ AlignTrailingComments: true
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortBlocksOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: InlineOnly
AllowShortFunctionsOnASingleLine: All
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: true
AlwaysBreakAfterDefinitionReturnType: None
+20
View File
@@ -0,0 +1,20 @@
aanother
acount
addrss
afile
aline
anumber
ans
aother
aparent
apending
asender
asent
ect
intialize
nd
ot
shashes
ue
unknwn
unsecure
-18
View File
@@ -18,21 +18,3 @@
*.png binary !eol
*.jpg binary !eol
*.gif binary !eol
# Files normalized to always keep Unix line endings
.default-version eol=lf
bootstrap* eol=lf
config.guess eol=lf
config.status eol=lf
configure eol=lf
libtool eol=lf
libtoolize eol=lf
autoreconf eol=lf
mkversion eol=lf
*.sh eol=lf
*-sh eol=lf
*.m4 eol=lf
configure.ac eol=lf
Makefile.am eol=lf
Makefile.in eol=lf
Makefile eol=lf
@@ -1,5 +1,5 @@
#
# Copyright (c) 2016, The OpenThread Authors.
# Copyright (c) 2022, The OpenThread Authors.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
@@ -26,13 +26,13 @@
# POSSIBILITY OF SUCH DAMAGE.
#
include $(abs_top_nlbuild_autotools_dir)/automake/pre.am
EXTRA_DIST = \
OpenThread.py \
OpenThread.png \
deviceInputFields.xml \
README.md \
$(NULL)
include $(abs_top_nlbuild_autotools_dir)/automake/post.am
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
commit-message:
prefix: "github-actions"
rebase-strategy: "disabled"
open-pull-requests-limit: 1
+162 -38
View File
@@ -28,24 +28,38 @@
name: Build
on: [push, pull_request]
on:
push:
branches-ignore:
- 'dependabot/**'
pull_request:
branches:
- 'main'
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || (github.repository == 'openthread/openthread' && github.run_id) || github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
pretty:
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- name: Harden Runner
uses: step-security/harden-runner@6b3083af2869dc3314a0257a42f4af696cc79ba3 # v2.3.1
with:
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
with:
submodules: true
- name: Bootstrap
run: |
sudo rm /etc/apt/sources.list.d/* && sudo apt-get update
sudo apt-get --no-install-recommends install -y clang-format-9 clang-tidy-9 shellcheck
sudo apt-get --no-install-recommends install -y clang-format-14 clang-tidy-14 shellcheck
python3 -m pip install yapf==0.31.0
sudo snap install shfmt
- name: Check
@@ -55,24 +69,58 @@ jobs:
markdown-lint-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: gaurav-nelson/github-action-markdown-link-check@v1
- name: Harden Runner
uses: step-security/harden-runner@6b3083af2869dc3314a0257a42f4af696cc79ba3 # v2.3.1
with:
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
- uses: gaurav-nelson/github-action-markdown-link-check@5c5dfc0ac2e225883c0e5f03a85311ec2830d368 # v1
with:
use-verbose-mode: 'yes'
max-depth: 3
cmake-version:
runs-on: ubuntu-20.04
spell-check:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- name: Harden Runner
uses: step-security/harden-runner@6b3083af2869dc3314a0257a42f4af696cc79ba3 # v2.3.1
with:
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
with:
submodules: true
- name: Bootstrap
run: |
sudo pip3 install -U scikit-build
sudo pip3 install -U cmake==3.10.3
python -m pip install --upgrade pip
pip install codespell
- name: Check
run: |
script/code-spell check
cmake-version:
runs-on: ubuntu-20.04
steps:
- name: Harden Runner
uses: step-security/harden-runner@6b3083af2869dc3314a0257a42f4af696cc79ba3 # v2.3.1
with:
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
with:
submodules: true
- name: Bootstrap
run: |
sudo apt-get --no-install-recommends install -y build-essential ninja-build libreadline-dev libncurses-dev
sudo apt-get remove cmake
sudo apt-get purge --auto-remove cmake
wget http://www.cmake.org/files/v3.10/cmake-3.10.3.tar.gz
tar xf cmake-3.10.3.tar.gz
cd cmake-3.10.3
./configure
sudo make install
cmake --version | grep 3.10.3
sudo apt-get --no-install-recommends install -y ninja-build libreadline-dev libncurses-dev
- name: Build
run: |
OT_NODE_TYPE=rcp ./script/test build
@@ -94,7 +142,12 @@ jobs:
CC: ${{ matrix.compiler_c }}
CXX: ${{ matrix.compiler_cpp }}
steps:
- uses: actions/checkout@v3
- name: Harden Runner
uses: step-security/harden-runner@6b3083af2869dc3314a0257a42f4af696cc79ba3 # v2.3.1
with:
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
with:
submodules: true
- name: Bootstrap
@@ -106,15 +159,20 @@ jobs:
script/test package
scan-build:
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- name: Harden Runner
uses: step-security/harden-runner@6b3083af2869dc3314a0257a42f4af696cc79ba3 # v2.3.1
with:
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
with:
submodules: true
- name: Bootstrap
run: |
sudo rm /etc/apt/sources.list.d/* && sudo apt-get update
sudo apt-get --no-install-recommends install -y clang-tools-9 ninja-build
sudo apt-get --no-install-recommends install -y clang-tools-14 ninja-build
- name: Run
run: |
script/check-scan-build
@@ -122,14 +180,19 @@ jobs:
mbedtls3-build:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- name: Harden Runner
uses: step-security/harden-runner@6b3083af2869dc3314a0257a42f4af696cc79ba3 # v2.3.1
with:
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
with:
submodules: true
- name: Bootstrap
run: |
sudo apt-get --no-install-recommends install -y ninja-build libreadline-dev libncurses-dev
rm -rf third_party/mbedtls/repo
- uses: actions/checkout@v3
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
with:
repository: ARMmbed/mbedtls
ref: v3.2.1
@@ -160,20 +223,38 @@ jobs:
- gcc_ver: 9
gcc_download_url: https://developer.arm.com/-/media/Files/downloads/gnu-rm/9-2019q4/RC2.1/gcc-arm-none-eabi-9-2019-q4-major-x86_64-linux.tar.bz2
gcc_extract_dir: gcc-arm-none-eabi-9-2019-q4-major
- gcc_ver: 10
gcc_download_url: https://developer.arm.com/-/media/Files/downloads/gnu-rm/10.3-2021.10/gcc-arm-none-eabi-10.3-2021.10-x86_64-linux.tar.bz2
gcc_extract_dir: gcc-arm-none-eabi-10.3-2021.10
- gcc_ver: 11
gcc_download_url: https://developer.arm.com/-/media/Files/downloads/gnu/11.3.rel1/binrel/arm-gnu-toolchain-11.3.rel1-x86_64-arm-none-eabi.tar.xz
gcc_extract_dir: arm-gnu-toolchain-11.3.rel1-x86_64-arm-none-eabi
- gcc_ver: 12
gcc_download_url: https://developer.arm.com/-/media/Files/downloads/gnu/12.2.rel1/binrel/arm-gnu-toolchain-12.2.rel1-x86_64-arm-none-eabi.tar.xz
gcc_extract_dir: arm-gnu-toolchain-12.2.rel1-x86_64-arm-none-eabi
steps:
- uses: actions/checkout@v3
- name: Harden Runner
uses: step-security/harden-runner@6b3083af2869dc3314a0257a42f4af696cc79ba3 # v2.3.1
with:
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
with:
submodules: true
- name: Bootstrap
run: |
cd /tmp
sudo rm /etc/apt/sources.list.d/* && sudo apt-get update
sudo apt-get --no-install-recommends install -y lib32z1 ninja-build gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf
wget --tries 4 --no-check-certificate --quiet ${{ matrix.gcc_download_url }} -O gcc-arm.tar.bz2
tar xjf gcc-arm.tar.bz2
# use the minimal required cmake version
sudo pip3 install -U scikit-build
sudo pip3 install -U cmake==3.10.3
sudo apt-get --no-install-recommends install -y build-essential lib32z1 ninja-build gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf
wget --tries 4 --no-check-certificate --quiet ${{ matrix.gcc_download_url }} -O gcc-arm
tar xf gcc-arm
sudo apt-get remove cmake
sudo apt-get purge --auto-remove cmake
wget http://www.cmake.org/files/v3.10/cmake-3.10.3.tar.gz
tar xf cmake-3.10.3.tar.gz
cd cmake-3.10.3
./configure
sudo make install
cmake --version | grep 3.10.3
- name: Build
env:
@@ -193,7 +274,12 @@ jobs:
CC: gcc-${{ matrix.gcc_ver }}
CXX: g++-${{ matrix.gcc_ver }}
steps:
- uses: actions/checkout@v3
- name: Harden Runner
uses: step-security/harden-runner@6b3083af2869dc3314a0257a42f4af696cc79ba3 # v2.3.1
with:
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
with:
submodules: true
- name: Bootstrap
@@ -221,7 +307,12 @@ jobs:
CC: clang-${{ matrix.clang_ver }}
CXX: clang++-${{ matrix.clang_ver }}
steps:
- uses: actions/checkout@v3
- name: Harden Runner
uses: step-security/harden-runner@6b3083af2869dc3314a0257a42f4af696cc79ba3 # v2.3.1
with:
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
with:
submodules: true
- name: Bootstrap
@@ -254,7 +345,12 @@ jobs:
CXXFLAGS: -m32 -Wconversion
LDFLAGS: -m32
steps:
- uses: actions/checkout@v3
- name: Harden Runner
uses: step-security/harden-runner@6b3083af2869dc3314a0257a42f4af696cc79ba3 # v2.3.1
with:
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
with:
submodules: true
- name: Bootstrap
@@ -277,7 +373,12 @@ jobs:
gn:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- name: Harden Runner
uses: step-security/harden-runner@6b3083af2869dc3314a0257a42f4af696cc79ba3 # v2.3.1
with:
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
with:
submodules: true
- name: Bootstrap
@@ -308,27 +409,50 @@ jobs:
CC: ${{ matrix.CC }}
CXX: ${{ matrix.CXX }}
steps:
- uses: actions/checkout@v3
- name: Harden Runner
uses: step-security/harden-runner@6b3083af2869dc3314a0257a42f4af696cc79ba3 # v2.3.1
with:
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
with:
submodules: true
- name: Bootstrap
run: |
rm -f '/usr/local/bin/2to3'
brew update
brew install automake m4 ninja
[ ${{ matrix.CC }} != clang ] || brew install llvm
wget --tries 4 https://github.com/ninja-build/ninja/releases/download/v1.11.1/ninja-mac.zip
unzip ninja-mac.zip && mv ninja /usr/local/bin/.
- name: Build
run: |
export PATH=$(brew --prefix m4)/bin:$PATH
script/check-posix-build
script/check-simulation-build
android:
runs-on: ubuntu-20.04
android-ndk:
name: android-ndk
runs-on: ubuntu-22.04
container:
image: openthread/environment
steps:
- uses: actions/checkout@v3
- name: Harden Runner
uses: step-security/harden-runner@6b3083af2869dc3314a0257a42f4af696cc79ba3 # v2.3.1
with:
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
with:
submodules: true
- name: Install unzip
run: apt update && apt install -y unzip
- name: Setup NDK
id: setup-ndk
uses: nttld/setup-ndk@v1
with:
ndk-version: r25c
local-cache: true
- name: Build
env:
NDK: ${{ steps.setup-ndk.outputs.ndk-path }}
run: |
docker run --rm -v $PWD:/build/openthread openthread/android-trusty /build/openthread/script/check-android-build
rm -rf build/ && OT_CMAKE_NINJA_TARGET="ot-daemon ot-ctl" script/cmake-build android-ndk
rm -rf build/ && OT_CMAKE_NINJA_TARGET="ot-cli" script/cmake-build android-ndk
+85
View File
@@ -0,0 +1,85 @@
#
# Copyright (c) 2022, The OpenThread Authors.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# 3. Neither the name of the copyright holder nor the
# names of its contributors may be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
name: "CodeQL"
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
permissions: # added using https://github.com/step-security/secure-workflows
contents: read
jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write
strategy:
fail-fast: false
matrix:
language: [ 'cpp', 'python' ]
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
steps:
- name: Harden Runner
uses: step-security/harden-runner@6b3083af2869dc3314a0257a42f4af696cc79ba3 # v2.3.1
with:
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
- name: Checkout repository
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
- name: Bootstrap
run: |
sudo apt-get --no-install-recommends install -y ninja-build libreadline-dev libncurses-dev
- name: Initialize CodeQL
uses: github/codeql-action/init@0225834cc549ee0ca93cb085b92954821a145866 # v2.3.5
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# queries: security-extended,security-and-quality
- run: |
./script/test build
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@0225834cc549ee0ca93cb085b92954821a145866 # v2.3.5
with:
category: "/language:${{matrix.language}}"
+22 -8
View File
@@ -28,12 +28,21 @@
name: Docker
on: [push, pull_request]
on:
push:
branches-ignore:
- 'dependabot/**'
pull_request:
branches:
- 'main'
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || (github.repository == 'openthread/openthread' && github.run_id) || github.ref }}
cancel-in-progress: true
permissions: # added using https://github.com/step-security/secure-workflows
contents: read
jobs:
buildx:
@@ -45,7 +54,12 @@ jobs:
include:
- docker_name: environment
steps:
- uses: actions/checkout@v3
- name: Harden Runner
uses: step-security/harden-runner@6b3083af2869dc3314a0257a42f4af696cc79ba3 # v2.3.1
with:
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
with:
submodules: true
@@ -59,17 +73,17 @@ jobs:
TAGS="--tag ${DOCKER_IMAGE}:${VERSION}"
echo ::set-output name=docker_image::${DOCKER_IMAGE}
echo ::set-output name=version::${VERSION}
echo ::set-output name=buildx_args::--platform ${DOCKER_PLATFORMS} \
echo "docker_image=${DOCKER_IMAGE}" >> $GITHUB_OUTPUT
echo "version=${VERSION}" >> $GITHUB_OUTPUT
echo "buildx_args=--platform ${DOCKER_PLATFORMS} \
--build-arg OT_GIT_REF=${{ github.sha }} \
--build-arg VERSION=${VERSION} \
--build-arg BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ') \
--build-arg VCS_REF=${GITHUB_SHA::8} \
${TAGS} --file ${DOCKER_FILE} .
${TAGS} --file ${DOCKER_FILE} ." >> $GITHUB_OUTPUT
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
uses: docker/setup-buildx-action@4b4e9c3e2d4531116a6f8ba8e71fc6e2cb6e6c8c # v2.5.0
- name: Docker Buildx (build)
run: |
@@ -77,7 +91,7 @@ jobs:
- name: Login to DockerHub
if: success() && github.repository == 'openthread/openthread' && github.event_name != 'pull_request'
uses: docker/login-action@v1
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a # v2.1.0
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
+15 -4
View File
@@ -28,29 +28,40 @@
name: CIFuzz
on: [pull_request]
on:
pull_request:
branches:
- 'main'
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || (github.repository == 'openthread/openthread' && github.run_id) || github.ref }}
cancel-in-progress: true
permissions: # added using https://github.com/step-security/secure-workflows
contents: read
jobs:
Fuzzing:
runs-on: ubuntu-20.04
steps:
- name: Harden Runner
uses: step-security/harden-runner@6b3083af2869dc3314a0257a42f4af696cc79ba3 # v2.3.1
with:
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
- name: Build Fuzzers
uses: google/oss-fuzz/infra/cifuzz/actions/build_fuzzers@master
uses: google/oss-fuzz/infra/cifuzz/actions/build_fuzzers@c0e4bb8d15a68b7f8cc731ea75523e48a2301bcf # master
with:
oss-fuzz-project-name: 'openthread'
dry-run: false
- name: Run Fuzzers
uses: google/oss-fuzz/infra/cifuzz/actions/run_fuzzers@master
uses: google/oss-fuzz/infra/cifuzz/actions/run_fuzzers@c0e4bb8d15a68b7f8cc731ea75523e48a2301bcf # master
with:
oss-fuzz-project-name: 'openthread'
fuzz-seconds: 1800
dry-run: false
- name: Upload Crash
uses: actions/upload-artifact@v1
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
if: failure()
with:
name: artifacts
+16 -2
View File
@@ -28,17 +28,31 @@
name: Makefile Check
on: [push, pull_request]
on:
push:
branches-ignore:
- 'dependabot/**'
pull_request:
branches:
- 'main'
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || (github.repository == 'openthread/openthread' && github.run_id) || github.ref }}
cancel-in-progress: true
permissions: # added using https://github.com/step-security/secure-workflows
contents: read
jobs:
makefile-check:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- name: Harden Runner
uses: step-security/harden-runner@6b3083af2869dc3314a0257a42f4af696cc79ba3 # v2.3.1
with:
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
with:
submodules: true
- name: Check
+22 -13
View File
@@ -28,12 +28,21 @@
name: Border Router
on: [push, pull_request]
on:
push:
branches-ignore:
- 'dependabot/**'
pull_request:
branches:
- 'main'
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || (github.repository == 'openthread/openthread' && github.run_id) || github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
backbone-router:
@@ -53,7 +62,7 @@ jobs:
# of OMR prefix and Domain prefix is not deterministic.
BORDER_ROUTING: 0
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
with:
submodules: true
- name: Build OTBR Docker
@@ -77,11 +86,11 @@ jobs:
export CI_ENV="$(bash <(curl -s https://codecov.io/env)) -e GITHUB_ACTIONS -e COVERAGE"
echo "CI_ENV=${CI_ENV}"
sudo -E ./script/test cert_suite ./tests/scripts/thread-cert/backbone/*.py || (sudo chmod a+r *.log *.json *.pcap && false)
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
with:
name: cov-thread-1-3-backbone-docker
path: /tmp/coverage/
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
if: ${{ failure() }}
with:
name: thread-1-3-backbone-results
@@ -94,7 +103,7 @@ jobs:
- name: Generate Coverage
run: |
./script/test generate_coverage gcc
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
with:
name: cov-thread-1-3-backbone
path: tmp/coverage.info
@@ -163,7 +172,7 @@ jobs:
NAT64: ${{ matrix.nat64 }}
MAX_JOBS: 3
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
- name: Build OTBR Docker
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
@@ -186,11 +195,11 @@ jobs:
export CI_ENV="$(bash <(curl -s https://codecov.io/env)) -e GITHUB_ACTIONS -e COVERAGE"
echo "CI_ENV=${CI_ENV}"
sudo -E ./script/test cert_suite ${{ matrix.cert_scripts }} || (sudo chmod a+r *.log *.json *.pcap && false)
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
with:
name: cov-thread-border-router-docker
path: /tmp/coverage/
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
if: ${{ failure() }}
with:
name: thread-border-router-results
@@ -203,7 +212,7 @@ jobs:
- name: Generate Coverage
run: |
./script/test generate_coverage gcc
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
with:
name: cov-thread-border-router
path: tmp/coverage.info
@@ -214,13 +223,13 @@ jobs:
- thread-border-router
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
with:
submodules: true
- name: Bootstrap
run: |
sudo apt-get --no-install-recommends install -y lcov
- uses: actions/download-artifact@v2
- uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2
with:
path: coverage/
- name: Combine Coverage
@@ -229,7 +238,7 @@ jobs:
script/test combine_coverage
- name: Upload Coverage
continue-on-error: true
uses: codecov/codecov-action@v2
uses: codecov/codecov-action@eaaf4bedf32dbdc6b720b63067d99c4d77d6047d # v3.1.4
with:
files: final.info
fail_ci_if_error: true
@@ -238,7 +247,7 @@ jobs:
needs: upload-coverage
runs-on: ubuntu-20.04
steps:
- uses: geekyeggo/delete-artifact@v2
- uses: geekyeggo/delete-artifact@54ab544f12cdb7b71613a16a2b5a37a9ade990af # v2.0.0
with:
name: cov-*
useGlob: true
+25 -8
View File
@@ -28,12 +28,21 @@
name: OTCI
on: [push, pull_request]
on:
push:
branches-ignore:
- 'dependabot/**'
pull_request:
branches:
- 'main'
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || (github.repository == 'openthread/openthread' && github.run_id) || github.ref }}
cancel-in-progress: true
permissions: # added using https://github.com/step-security/secure-workflows
contents: read
jobs:
cli-sim:
@@ -44,25 +53,33 @@ jobs:
matrix:
virtual_time: [0, 1]
env:
REFERENCE_DEVICE: 1
VIRTUAL_TIME: ${{ matrix.virtual_time }}
REAL_DEVICE: 0
steps:
- uses: actions/checkout@v3
- name: Harden Runner
uses: step-security/harden-runner@6b3083af2869dc3314a0257a42f4af696cc79ba3 # v2.3.1
with:
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
- name: Bootstrap
run: |
sudo rm /etc/apt/sources.list.d/* && sudo apt-get update
sudo apt-get --no-install-recommends install -y g++-multilib python3-setuptools python3-wheel
sudo apt-get --no-install-recommends install -y g++-multilib ninja-build python3-setuptools python3-wheel
python3 -m pip install -r tests/scripts/thread-cert/requirements.txt
python3 -m pip install pytype adb-shell
- name: Style check
run: |
PYTHONPATH=./tests/scripts/thread-cert pytype tools/otci
- name: Build
run: |
./bootstrap
make -f examples/Makefile-simulation THREAD_VERSION=1.3 DUA=1 MLR=1 BACKBONE_ROUTER=1 CSL_RECEIVER=1
./script/cmake-build simulation -DOT_THREAD_VERSION=1.3 -DOT_DUA=ON -DOT_MLR=ON -DOT_BACKBONE_ROUTER=ON \
-DOT_CSL_RECEIVER=ON -DOT_SIMULATION_VIRTUAL_TIME=${VIRTUAL_TIME}
- name: Install OTCI Python Library
run: |
(cd tools/otci && python3 setup.py install --user)
(cd tools/otci && python3 -m pip install .)
- name: Run
run: |
export PYTHONPATH=./tests/scripts/thread-cert/
export OT_CLI=./output/simulation/bin/ot-cli-ftd
export OT_CLI=./build/simulation/examples/apps/cli/ot-cli-ftd
python3 tools/otci/tests/test_otci.py
+55 -34
View File
@@ -28,7 +28,13 @@
name: OTNS
on: [push, pull_request]
on:
push:
branches-ignore:
- 'dependabot/**'
pull_request:
branches:
- 'main'
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || (github.repository == 'openthread/openthread' && github.run_id) || github.ref }}
@@ -42,25 +48,32 @@ env:
MAX_NETWORK_SIZE: 999
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
permissions: # added using https://github.com/step-security/secure-workflows
contents: read
jobs:
unittests:
name: Unittests
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v1
- name: Harden Runner
uses: step-security/harden-runner@6b3083af2869dc3314a0257a42f4af696cc79ba3 # v2.3.1
with:
go-version: '1.14'
- name: Set up Python 3.6
uses: actions/setup-python@v1
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
- uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 # v4.0.1
with:
python-version: 3.6
go-version: "1.20"
- name: Set up Python
uses: actions/setup-python@bd6b4b6205c4dbad673328db7b31b7fab9e241c0 # v4.6.1
with:
python-version: "3.9"
- name: Bootstrap
run: |
sudo rm /etc/apt/sources.list.d/* && sudo apt-get update
sudo apt-get --no-install-recommends install -y g++-multilib lcov ninja-build
./bootstrap
- name: Run
run: |
export OT_DIR=$PWD
@@ -69,7 +82,7 @@ jobs:
cd /tmp/otns
./script/test py-unittests
)
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
if: ${{ failure() }}
with:
name: unittests-pcaps
@@ -79,28 +92,27 @@ jobs:
- name: Generate Coverage
run: |
./script/test generate_coverage gcc
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
with:
name: cov-otns-unittests
path: tmp/coverage.info
examples:
name: Examples
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v1
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
- uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 # v4.0.1
with:
go-version: '1.14'
- name: Set up Python 3.6
uses: actions/setup-python@v1
go-version: "1.20"
- name: Set up Python
uses: actions/setup-python@bd6b4b6205c4dbad673328db7b31b7fab9e241c0 # v4.6.1
with:
python-version: 3.6
python-version: "3.9"
- name: Bootstrap
run: |
sudo rm /etc/apt/sources.list.d/* && sudo apt-get update
sudo apt-get --no-install-recommends install -y g++-multilib lcov ninja-build
./bootstrap
- name: Run
run: |
export OT_DIR=$PWD
@@ -109,7 +121,7 @@ jobs:
cd /tmp/otns
./script/test py-examples
)
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
if: ${{ failure() }}
with:
name: examples-pcaps
@@ -119,14 +131,14 @@ jobs:
- name: Generate Coverage
run: |
./script/test generate_coverage gcc
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
with:
name: cov-otns-examples
path: tmp/coverage.info
stress-tests:
name: Stress ${{ matrix.suite }}
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
@@ -146,19 +158,23 @@ jobs:
env:
STRESS_LEVEL: ${{ matrix.stress_level }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v1
- name: Harden Runner
uses: step-security/harden-runner@6b3083af2869dc3314a0257a42f4af696cc79ba3 # v2.3.1
with:
go-version: '1.14'
- name: Set up Python 3.6
uses: actions/setup-python@v1
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
- uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 # v4.0.1
with:
python-version: 3.6
go-version: "1.20"
- name: Set up Python
uses: actions/setup-python@bd6b4b6205c4dbad673328db7b31b7fab9e241c0 # v4.6.1
with:
python-version: "3.9"
- name: Bootstrap
run: |
sudo rm /etc/apt/sources.list.d/* && sudo apt-get update
sudo apt-get --no-install-recommends install -y g++-multilib lcov ninja-build
./bootstrap
- name: Run
run: |
export OT_DIR=$PWD
@@ -167,7 +183,7 @@ jobs:
cd /tmp/otns
./script/test stress-tests ${{ matrix.suite }}
)
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
if: ${{ failure() }}
with:
name: stress-tests-${{ matrix.suite }}-pcaps
@@ -177,7 +193,7 @@ jobs:
- name: Generate Coverage
run: |
./script/test generate_coverage gcc
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
with:
name: cov-otns-stress-tests-${{ matrix.suite }}
path: tmp/coverage.info
@@ -187,13 +203,18 @@ jobs:
- unittests
- examples
- stress-tests
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- name: Harden Runner
uses: step-security/harden-runner@6b3083af2869dc3314a0257a42f4af696cc79ba3 # v2.3.1
with:
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
- name: Bootstrap
run: |
sudo apt-get --no-install-recommends install -y lcov
- uses: actions/download-artifact@v2
- uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2
with:
path: coverage/
- name: Upload Coverage
+82 -68
View File
@@ -28,12 +28,21 @@
name: POSIX
on: [push, pull_request]
on:
push:
branches-ignore:
- 'dependabot/**'
pull_request:
branches:
- 'main'
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || (github.repository == 'openthread/openthread' && github.run_id) || github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
expects-linux:
@@ -42,7 +51,12 @@ jobs:
CFLAGS: -DCLI_COAP_SECURE_USE_COAP_DEFAULT_HANDLER=1 -DOPENTHREAD_CONFIG_MLE_MAX_CHILDREN=15
CXXFLAGS: -DCLI_COAP_SECURE_USE_COAP_DEFAULT_HANDLER=1 -DOPENTHREAD_CONFIG_MLE_MAX_CHILDREN=15
steps:
- uses: actions/checkout@v3
- name: Harden Runner
uses: step-security/harden-runner@6b3083af2869dc3314a0257a42f4af696cc79ba3 # v2.3.1
with:
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
- name: Bootstrap
run: |
sudo apt-get --no-install-recommends install -y expect ninja-build lcov socat
@@ -51,13 +65,17 @@ jobs:
ulimit -c unlimited
./script/test prepare_coredump_upload
OT_OPTIONS='-DOT_READLINE=OFF -DOT_FULL_LOGS=ON -DOT_LOG_OUTPUT=PLATFORM_DEFINED' VIRTUAL_TIME=0 OT_NODE_TYPE=rcp ./script/test build expect
- name: Run ot-fct
run: |
OT_CMAKE_NINJA_TARGET="ot-fct" script/cmake-build posix
tests/scripts/expect/ot-fct.exp
- name: Check Crash
if: ${{ failure() }}
run: |
CRASHED=$(./script/test check_crash | tail -1)
[[ $CRASHED -eq "1" ]] && echo "Crashed!" || echo "Not crashed."
echo "CRASHED_RCP=$CRASHED" >> $GITHUB_ENV
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
if: ${{ failure() && env.CRASHED_RCP == '1' }}
with:
name: core-expect-rcp
@@ -66,7 +84,7 @@ jobs:
- name: Generate Coverage
run: |
./script/test generate_coverage gcc
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
with:
name: cov-expects-linux-1
path: tmp/coverage.info
@@ -77,6 +95,7 @@ jobs:
sudo apt-get install --no-install-recommends -y bind9-host ntp socat
sudo systemctl restart ntp
sudo socat 'UDP6-LISTEN:53,fork,reuseaddr,bind=[::1]' UDP:127.0.0.53:53 &
socat 'TCP6-LISTEN:2000,fork,reuseaddr' TCP:127.0.0.53:53 &
host ipv6.google.com 127.0.0.53
host ipv6.google.com ::1
ulimit -c unlimited
@@ -88,13 +107,13 @@ jobs:
CRASHED=$(./script/test check_crash | tail -1)
[[ $CRASHED -eq "1" ]] && echo "Crashed!" || echo "Not crashed."
echo "CRASHED_TUN=$CRASHED" >> $GITHUB_ENV
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
if: ${{ failure() && env.CRASHED_TUN == '1' }}
with:
name: core-expect-linux
path: |
./ot-core-dump/*
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
if: ${{ failure() }}
with:
name: syslog-expect-linux
@@ -102,89 +121,51 @@ jobs:
- name: Generate Coverage
run: |
./script/test generate_coverage gcc
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
with:
name: cov-expects-linux-2
path: tmp/coverage.info
tcplp-buffering:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
with:
submodules: true
- name: Build
run: make -C third_party/tcplp/lib/test/
- name: Run
run: third_party/tcplp/lib/test/test_all
thread-cert:
runs-on: ubuntu-20.04
env:
COVERAGE: 1
PYTHONUNBUFFERED: 1
READLINE: readline
REFERENCE_DEVICE: 1
THREAD_VERSION: 1.1
VIRTUAL_TIME: 1
VIRTUAL_TIME_UART: 1
steps:
- uses: actions/checkout@v3
- name: Harden Runner
uses: step-security/harden-runner@6b3083af2869dc3314a0257a42f4af696cc79ba3 # v2.3.1
with:
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
with:
submodules: true
- name: Bootstrap
run: |
sudo rm /etc/apt/sources.list.d/* && sudo apt-get update
sudo apt-get --no-install-recommends install -y libreadline6-dev python3-setuptools python3-wheel lcov
sudo apt-get --no-install-recommends install -y lcov ninja-build python3-setuptools python3-wheel
python3 -m pip install -r tests/scripts/thread-cert/requirements.txt
- name: Build
run: |
./bootstrap
make -f examples/Makefile-simulation
make -f src/posix/Makefile-posix
OT_NODE_TYPE=rcp ./script/test build
- name: Run
run: |
VERBOSE=1 OT_CLI_PATH="$PWD/output/posix/bin/ot-cli -v" RADIO_DEVICE="$PWD/output/simulation/bin/ot-rcp" make -f src/posix/Makefile-posix check
- uses: actions/upload-artifact@v3
MAX_JOBS=$(getconf _NPROCESSORS_ONLN) ./script/test cert_suite ./tests/scripts/thread-cert/Cert_*.py ./tests/scripts/thread-cert/test_*.py
- uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
if: ${{ failure() }}
with:
name: thread-cert
path: build/posix/tests/scripts/thread-cert
path: ot_testing
- name: Generate Coverage
run: |
./script/test generate_coverage gcc
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
with:
name: cov-thread-cert
path: tmp/coverage.info
ncp-rcp-migrate:
runs-on: ubuntu-20.04
env:
COVERAGE: 1
steps:
- uses: actions/checkout@v3
with:
submodules: true
- name: Bootstrap
run: |
sudo rm /etc/apt/sources.list.d/* && sudo apt-get update
sudo apt-get --no-install-recommends install -y expect lcov
- name: Build
run: |
./bootstrap
script/check-ncp-rcp-migrate build
- name: Run
run: |
script/check-ncp-rcp-migrate check
- name: Generate Coverage
run: |
./script/test generate_coverage gcc
- uses: actions/upload-artifact@v3
with:
name: cov-ncp-rcp-migrate
path: tmp/coverage.info
pty-linux:
name: pty-linux OT_DAEMON=${{ matrix.OT_DAEMON }}
runs-on: ubuntu-20.04
@@ -197,7 +178,12 @@ jobs:
OT_DAEMON: ${{ matrix.OT_DAEMON }}
OT_READLINE: 'readline'
steps:
- uses: actions/checkout@v3
- name: Harden Runner
uses: step-security/harden-runner@6b3083af2869dc3314a0257a42f4af696cc79ba3 # v2.3.1
with:
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
- name: Bootstrap
run: |
sudo rm /etc/apt/sources.list.d/* && sudo apt-get update
@@ -225,7 +211,7 @@ jobs:
- name: Generate Coverage
run: |
./script/test generate_coverage gcc
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
with:
name: cov-pty-linux-${{ matrix.DAEMON }}
path: tmp/coverage.info
@@ -241,10 +227,24 @@ jobs:
OT_DAEMON: ${{ matrix.OT_DAEMON }}
OT_READLINE: 'off'
steps:
- uses: actions/checkout@v3
- name: Harden Runner
uses: step-security/harden-runner@6b3083af2869dc3314a0257a42f4af696cc79ba3 # v2.3.1
with:
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
- name: Bootstrap
run: |
rm -f '/usr/local/bin/2to3'
rm -f /usr/local/bin/2to3
rm -f /usr/local/bin/2to3-3.11
rm -f /usr/local/bin/idle3
rm -f /usr/local/bin/idle3.11
rm -f /usr/local/bin/pydoc3
rm -f /usr/local/bin/pydoc3.11
rm -f /usr/local/bin/python3
rm -f /usr/local/bin/python3.11
rm -f /usr/local/bin/python3-config
rm -f /usr/local/bin/python3.11-config
brew update
brew install ninja socat
- name: Build
@@ -257,7 +257,12 @@ jobs:
rcp-stack-reset:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- name: Harden Runner
uses: step-security/harden-runner@6b3083af2869dc3314a0257a42f4af696cc79ba3 # v2.3.1
with:
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
- name: Bootstrap
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
@@ -273,7 +278,7 @@ jobs:
- name: Generate Coverage
run: |
./script/test generate_coverage gcc
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
with:
name: cov-rcp-stack-reset
path: tmp/coverage.info
@@ -281,25 +286,29 @@ jobs:
upload-coverage:
needs:
- expects-linux
- ncp-rcp-migrate
- pty-linux
- thread-cert
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- name: Harden Runner
uses: step-security/harden-runner@6b3083af2869dc3314a0257a42f4af696cc79ba3 # v2.3.1
with:
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
with:
submodules: true
- name: Bootstrap
run: |
sudo apt-get --no-install-recommends install -y lcov
- uses: actions/download-artifact@v2
- uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2
with:
path: coverage/
- name: Combine Coverage
run: |
script/test combine_coverage
- name: Upload Coverage
uses: codecov/codecov-action@v2
uses: codecov/codecov-action@eaaf4bedf32dbdc6b720b63067d99c4d77d6047d # v3.1.4
with:
files: final.info
fail_ci_if_error: true
@@ -308,7 +317,12 @@ jobs:
needs: upload-coverage
runs-on: ubuntu-20.04
steps:
- uses: geekyeggo/delete-artifact@v2
- name: Harden Runner
uses: step-security/harden-runner@6b3083af2869dc3314a0257a42f4af696cc79ba3 # v2.3.1
with:
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
- uses: geekyeggo/delete-artifact@54ab544f12cdb7b71613a16a2b5a37a9ade990af # v2.0.0
with:
name: cov-*
useGlob: true
+100
View File
@@ -0,0 +1,100 @@
#
# Copyright (c) 2022, The OpenThread Authors.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# 3. Neither the name of the copyright holder nor the
# names of its contributors may be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
# This workflow uses actions that are not certified by GitHub. They are provided
# by a third-party and are governed by separate terms of service, privacy
# policy, and support documentation.
name: Scorecards supply-chain security
on:
# For Branch-Protection check. Only the default branch is supported. See
# https://github.com/ossf/scorecard/blob/main/docs/checks.md#branch-protection
branch_protection_rule:
# To guarantee Maintained check is occasionally updated. See
# https://github.com/ossf/scorecard/blob/main/docs/checks.md#maintained
schedule:
- cron: '33 12 * * 0'
push:
branches: [ "main" ]
# Declare default permissions as read only.
permissions: read-all
jobs:
analysis:
name: Scorecards analysis
runs-on: ubuntu-latest
permissions:
# Needed to upload the results to code-scanning dashboard.
security-events: write
# Needed to publish results and get a badge (see publish_results below).
id-token: write
# Uncomment the permissions below if installing in a private repository.
# contents: read
# actions: read
steps:
- name: "Checkout code"
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
with:
persist-credentials: false
- name: "Run analysis"
uses: ossf/scorecard-action@08b4669551908b1024bb425080c797723083c031 # v2.2.0
with:
results_file: results.sarif
results_format: sarif
# (Optional) "write" PAT token. Uncomment the `repo_token` line below if:
# - you want to enable the Branch-Protection check on a *public* repository, or
# - you are installing Scorecards on a *private* repository
# To create the PAT, follow the steps in https://github.com/ossf/scorecard-action#authentication-with-pat.
# repo_token: ${{ secrets.SCORECARD_TOKEN }}
# Public repositories:
# - Publish results to OpenSSF REST API for easy access by consumers
# - Allows the repository to include the Scorecard badge.
# - See https://github.com/ossf/scorecard-action#publishing-results.
# For private repositories:
# - `publish_results` will always be set to `false`, regardless
# of the value entered here.
publish_results: true
# Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF
# format to the repository Actions tab.
- name: "Upload artifact"
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.0
with:
name: SARIF file
path: results.sarif
retention-days: 5
# Upload the results to GitHub's code scanning dashboard.
- name: "Upload to code-scanning"
uses: github/codeql-action/upload-sarif@0225834cc549ee0ca93cb085b92954821a145866 # v2.1.27
with:
sarif_file: results.sarif
+96 -75
View File
@@ -28,39 +28,22 @@
name: Simulation 1.1
on: [push, pull_request]
on:
push:
branches-ignore:
- 'dependabot/**'
pull_request:
branches:
- 'main'
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || (github.repository == 'openthread/openthread' && github.run_id) || github.ref }}
cancel-in-progress: true
jobs:
permissions:
contents: read
distcheck:
runs-on: ubuntu-20.04
env:
CC: clang
CXX: clang++
REFERENCE_DEVICE: 1
THREAD_VERSION: 1.1
VIRTUAL_TIME: 1
steps:
- uses: actions/checkout@v3
with:
submodules: true
- name: Bootstrap
run: |
sudo rm /etc/apt/sources.list.d/* && sudo apt-get update
sudo apt-get --no-install-recommends install -y llvm-runtime python3-setuptools python3-wheel
python3 -m pip install -r tests/scripts/thread-cert/requirements.txt
- name: Run
run: |
export ASAN_SYMBOLIZER_PATH=`which llvm-symbolizer`
export ASAN_OPTIONS=symbolize=1
export DISTCHECK_CONFIGURE_FLAGS= CPPFLAGS=-DOPENTHREAD_SIMULATION_VIRTUAL_TIME=1
export DISTCHECK_BUILD=1
./bootstrap
VERBOSE=1 make -f examples/Makefile-simulation distcheck
jobs:
packet-verification:
runs-on: ubuntu-20.04
@@ -71,7 +54,12 @@ jobs:
VIRTUAL_TIME: 1
MULTIPLY: 3
steps:
- uses: actions/checkout@v3
- name: Harden Runner
uses: step-security/harden-runner@6b3083af2869dc3314a0257a42f4af696cc79ba3 # v2.3.1
with:
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
with:
submodules: true
- name: Bootstrap
@@ -88,7 +76,7 @@ jobs:
- name: Run
run: |
./script/test cert_suite ./tests/scripts/thread-cert/Cert_*.py ./tests/scripts/thread-cert/test_*.py
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
if: ${{ failure() }}
with:
name: packet-verification-pcaps
@@ -98,7 +86,7 @@ jobs:
- name: Generate Coverage
run: |
./script/test generate_coverage gcc
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
with:
name: cov-packet-verification
path: tmp/coverage.info
@@ -114,30 +102,34 @@ jobs:
THREAD_VERSION: 1.1
VIRTUAL_TIME: 1
steps:
- uses: actions/checkout@v3
- name: Harden Runner
uses: step-security/harden-runner@6b3083af2869dc3314a0257a42f4af696cc79ba3 # v2.3.1
with:
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
with:
submodules: true
- name: Bootstrap
run: |
sudo rm /etc/apt/sources.list.d/* && sudo apt-get update
sudo apt-get --no-install-recommends install -y g++-multilib python3-setuptools python3-wheel lcov
sudo apt-get --no-install-recommends install -y lcov ninja-build g++-multilib python3-setuptools python3-wheel
python3 -m pip install -r tests/scripts/thread-cert/requirements.txt
- name: Build
run: |
./bootstrap
make -f examples/Makefile-simulation
./script/test build
- name: Run
run: |
VERBOSE=1 make -f examples/Makefile-simulation check
- uses: actions/upload-artifact@v3
./script/test cert_suite ./tests/scripts/thread-cert/Cert_*.py ./tests/scripts/thread-cert/test_*.py
- uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
if: ${{ failure() }}
with:
name: cli-ftd-thread-cert
path: build/simulation/tests/scripts/thread-cert
path: ot_testing
- name: Generate Coverage
run: |
./script/test generate_coverage gcc
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
with:
name: cov-cli-ftd
path: tmp/coverage.info
@@ -160,30 +152,34 @@ jobs:
VIRTUAL_TIME: 1
MESSAGE_USE_HEAP: ${{ matrix.message_use_heap }}
steps:
- uses: actions/checkout@v3
- name: Harden Runner
uses: step-security/harden-runner@6b3083af2869dc3314a0257a42f4af696cc79ba3 # v2.3.1
with:
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
with:
submodules: true
- name: Bootstrap
run: |
sudo rm /etc/apt/sources.list.d/* && sudo apt-get update
sudo apt-get --no-install-recommends install -y g++-multilib python3-setuptools python3-wheel lcov
sudo apt-get --no-install-recommends install -y lcov ninja-build g++-multilib python3-setuptools python3-wheel
python3 -m pip install -r tests/scripts/thread-cert/requirements.txt
- name: Build
run: |
./bootstrap
make -f examples/Makefile-simulation
./script/test build
- name: Run
run: |
VERBOSE=1 make -f examples/Makefile-simulation check
- uses: actions/upload-artifact@v3
./script/test cert_suite ./tests/scripts/thread-cert/Cert_*.py ./tests/scripts/thread-cert/test_*.py
- uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
if: ${{ failure() }}
with:
name: cli-mtd-thread-cert
path: build/simulation/tests/scripts/thread-cert
path: ot_testing
- name: Generate Coverage
run: |
./script/test generate_coverage gcc
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
with:
name: cov-cli-mtd-${{ matrix.message_use_heap }}
path: tmp/coverage.info
@@ -197,33 +193,36 @@ jobs:
COVERAGE: 1
REFERENCE_DEVICE: 1
THREAD_VERSION: 1.1
TIME_SYNC: 1
VIRTUAL_TIME: 1
steps:
- uses: actions/checkout@v3
- name: Harden Runner
uses: step-security/harden-runner@6b3083af2869dc3314a0257a42f4af696cc79ba3 # v2.3.1
with:
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
with:
submodules: true
- name: Bootstrap
run: |
sudo rm /etc/apt/sources.list.d/* && sudo apt-get update
sudo apt-get --no-install-recommends install -y g++-multilib python3-setuptools python3-wheel lcov
sudo apt-get --no-install-recommends install -y g++-multilib lcov ninja-build python3-setuptools python3-wheel
python3 -m pip install -r tests/scripts/thread-cert/requirements.txt
- name: Build
run: |
./bootstrap
make -f examples/Makefile-simulation
OT_OPTIONS="-DOT_TIME_SYNC=ON" ./script/test build
- name: Run
run: |
VERBOSE=1 make -f examples/Makefile-simulation check
- uses: actions/upload-artifact@v3
./script/test cert_suite ./tests/scripts/thread-cert/Cert_*.py ./tests/scripts/thread-cert/test_*.py
- uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
if: ${{ failure() }}
with:
name: cli-time-sync-thread-cert
path: build/simulation/tests/scripts/thread-cert
path: ot_testing
- name: Generate Coverage
run: |
./script/test generate_coverage gcc
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
with:
name: cov-cli-time-sync
path: tmp/coverage.info
@@ -235,7 +234,12 @@ jobs:
CXXFLAGS: -DCLI_COAP_SECURE_USE_COAP_DEFAULT_HANDLER=1 -DOPENTHREAD_CONFIG_MLE_MAX_CHILDREN=15
THREAD_VERSION: 1.1
steps:
- uses: actions/checkout@v3
- name: Harden Runner
uses: step-security/harden-runner@6b3083af2869dc3314a0257a42f4af696cc79ba3 # v2.3.1
with:
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
- name: Bootstrap
run: |
sudo apt-get --no-install-recommends install -y expect ninja-build lcov socat
@@ -250,7 +254,7 @@ jobs:
CRASHED=$(./script/test check_crash | tail -1)
[[ $CRASHED -eq "1" ]] && echo "Crashed!" || echo "Not crashed."
echo "CRASHED_CLI=$CRASHED" >> $GITHUB_ENV
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
if: ${{ failure() && env.CRASHED_CLI == '1' }}
with:
name: core-expect-cli
@@ -259,17 +263,22 @@ jobs:
- name: Generate Coverage
run: |
./script/test generate_coverage gcc
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
with:
name: cov-expects
path: tmp/coverage.info
ot-commissioner:
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
env:
THREAD_VERSION: 1.1
steps:
- uses: actions/checkout@v3
- name: Harden Runner
uses: step-security/harden-runner@6b3083af2869dc3314a0257a42f4af696cc79ba3 # v2.3.1
with:
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
with:
submodules: true
- name: Bootstrap
@@ -302,7 +311,7 @@ jobs:
- name: Generate Coverage
run: |
./script/test generate_coverage gcc
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
with:
name: cov-ot-commissioner
path: tmp/coverage.info
@@ -311,35 +320,37 @@ jobs:
runs-on: ubuntu-20.04
env:
COVERAGE: 1
MULTIPLE_INSTANCE: 1
REFERENCE_DEVICE: 1
THREAD_VERSION: 1.1
VIRTUAL_TIME: 1
CXXFLAGS: "-DOPENTHREAD_CONFIG_LOG_PREPEND_UPTIME=0"
steps:
- uses: actions/checkout@v3
- name: Harden Runner
uses: step-security/harden-runner@6b3083af2869dc3314a0257a42f4af696cc79ba3 # v2.3.1
with:
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
with:
submodules: true
- name: Bootstrap
run: |
sudo apt-get --no-install-recommends install -y python3-setuptools python3-wheel lcov
sudo apt-get --no-install-recommends install -y lcov ninja-build python3-setuptools python3-wheel
python3 -m pip install -r tests/scripts/thread-cert/requirements.txt
- name: Build
run: |
./bootstrap
make -f examples/Makefile-simulation
OT_OPTIONS="-DOT_MULTIPLE_INSTANCE=ON" ./script/test build
- name: Run
run: |
VERBOSE=1 make -f examples/Makefile-simulation check
- uses: actions/upload-artifact@v3
./script/test cert_suite ./tests/scripts/thread-cert/Cert_*.py ./tests/scripts/thread-cert/test_*.py
- uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
if: ${{ failure() }}
with:
name: multiple-instance-thread-cert
name: ot_testing
path: build/simulation/tests/scripts/thread-cert
- name: Generate Coverage
run: |
./script/test generate_coverage gcc
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
with:
name: cov-multiple-instance
path: tmp/coverage.info
@@ -355,20 +366,25 @@ jobs:
- multiple-instance
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- name: Harden Runner
uses: step-security/harden-runner@6b3083af2869dc3314a0257a42f4af696cc79ba3 # v2.3.1
with:
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
with:
submodules: true
- name: Bootstrap
run: |
sudo apt-get --no-install-recommends install -y lcov
- uses: actions/download-artifact@v2
- uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2
with:
path: coverage/
- name: Combine Coverage
run: |
script/test combine_coverage
- name: Upload Coverage
uses: codecov/codecov-action@v2
uses: codecov/codecov-action@eaaf4bedf32dbdc6b720b63067d99c4d77d6047d # v3.1.4
with:
files: final.info
fail_ci_if_error: true
@@ -377,7 +393,12 @@ jobs:
needs: upload-coverage
runs-on: ubuntu-20.04
steps:
- uses: geekyeggo/delete-artifact@v2
- name: Harden Runner
uses: step-security/harden-runner@6b3083af2869dc3314a0257a42f4af696cc79ba3 # v2.3.1
with:
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
- uses: geekyeggo/delete-artifact@54ab544f12cdb7b71613a16a2b5a37a9ade990af # v2.0.0
with:
name: cov-*
useGlob: true
+69 -23
View File
@@ -28,12 +28,21 @@
name: Simulation 1.3
on: [push, pull_request]
on:
push:
branches-ignore:
- 'dependabot/**'
pull_request:
branches:
- 'main'
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || (github.repository == 'openthread/openthread' && github.run_id) || github.ref }}
cancel-in-progress: true
permissions: # added using https://github.com/step-security/secure-workflows
contents: read
jobs:
thread-1-3:
@@ -47,6 +56,7 @@ jobs:
THREAD_VERSION: 1.3
VIRTUAL_TIME: 1
INTER_OP: 1
INTER_OP_BBR: 1
CC: ${{ matrix.compiler.c }}
CXX: ${{ matrix.compiler.cxx }}
strategy:
@@ -55,7 +65,12 @@ jobs:
compiler: [{c: "gcc", cxx: "g++", gcov: "gcc"}, { c: "clang-10", cxx: "clang++-10", gcov: "llvm"}]
arch: ["m32", "m64"]
steps:
- uses: actions/checkout@v3
- name: Harden Runner
uses: step-security/harden-runner@6b3083af2869dc3314a0257a42f4af696cc79ba3 # v2.3.1
with:
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
with:
submodules: true
- name: Bootstrap
@@ -80,12 +95,12 @@ jobs:
CRASHED=$(./script/test check_crash | tail -1)
[[ $CRASHED -eq "1" ]] && echo "Crashed!" || echo "Not crashed."
echo "CRASHED=$CRASHED" >> $GITHUB_ENV
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
if: ${{ failure() }}
with:
name: thread-1-3-${{ matrix.compiler.c }}-${{ matrix.arch }}-pcaps
path: "*.pcap"
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
if: ${{ failure() && env.CRASHED == '1' }}
with:
name: core-packet-verification-thread-1-3
@@ -94,7 +109,7 @@ jobs:
- name: Generate Coverage
run: |
./script/test generate_coverage "${{ matrix.compiler.gcov }}"
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
with:
name: cov-thread-1-3-${{ matrix.compiler.c }}-${{ matrix.arch }}
path: tmp/coverage.info
@@ -111,7 +126,12 @@ jobs:
INTER_OP: 1
INTER_OP_BBR: 0
steps:
- uses: actions/checkout@v3
- name: Harden Runner
uses: step-security/harden-runner@6b3083af2869dc3314a0257a42f4af696cc79ba3 # v2.3.1
with:
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
with:
submodules: true
- name: Bootstrap
@@ -139,14 +159,14 @@ jobs:
CRASHED=$(./script/test check_crash | tail -1)
[[ $CRASHED -eq "1" ]] && echo "Crashed!" || echo "Not crashed."
echo "CRASHED=$CRASHED" >> $GITHUB_ENV
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
if: ${{ failure() }}
with:
name: packet-verification-low-power-pcaps
path: |
*.pcap
*.json
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
if: ${{ failure() && env.CRASHED == '1' }}
with:
name: core-packet-verification-low-power
@@ -155,7 +175,7 @@ jobs:
- name: Generate Coverage
run: |
./script/test generate_coverage gcc
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
with:
name: cov-packet-verification-low-power
path: tmp/coverage.info
@@ -167,9 +187,15 @@ jobs:
VIRTUAL_TIME: 1
PACKET_VERIFICATION: 1
THREAD_VERSION: 1.3
INTER_OP_BBR: 1
MULTIPLY: 3
steps:
- uses: actions/checkout@v3
- name: Harden Runner
uses: step-security/harden-runner@6b3083af2869dc3314a0257a42f4af696cc79ba3 # v2.3.1
with:
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
with:
submodules: true
- name: Bootstrap
@@ -186,7 +212,7 @@ jobs:
- name: Run
run: |
./script/test cert_suite ./tests/scripts/thread-cert/Cert_*.py ./tests/scripts/thread-cert/test_*.py
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
if: ${{ failure() }}
with:
name: packet-verification-1.1-on-1.3-pcaps
@@ -196,7 +222,7 @@ jobs:
- name: Generate Coverage
run: |
./script/test generate_coverage gcc
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
with:
name: cov-packet-verification-1-1-on-1-3
path: tmp/coverage.info
@@ -208,7 +234,12 @@ jobs:
THREAD_VERSION: 1.3
VIRTUAL_TIME: 0
steps:
- uses: actions/checkout@v3
- name: Harden Runner
uses: step-security/harden-runner@6b3083af2869dc3314a0257a42f4af696cc79ba3 # v2.3.1
with:
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
with:
submodules: true
- name: Bootstrap
@@ -225,7 +256,7 @@ jobs:
CRASHED=$(./script/test check_crash | tail -1)
[[ $CRASHED -eq "1" ]] && echo "Crashed!" || echo "Not crashed."
echo "CRASHED=$CRASHED" >> $GITHUB_ENV
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
if: ${{ failure() && env.CRASHED == '1' }}
with:
name: core-expect-1-3
@@ -234,7 +265,7 @@ jobs:
- name: Generate Coverage
run: |
./script/test generate_coverage gcc
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
with:
name: cov-expects
path: tmp/coverage.info
@@ -251,7 +282,12 @@ jobs:
VIRTUAL_TIME: 1
INTER_OP: 1
steps:
- uses: actions/checkout@v3
- name: Harden Runner
uses: step-security/harden-runner@6b3083af2869dc3314a0257a42f4af696cc79ba3 # v2.3.1
with:
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
with:
submodules: true
- name: Bootstrap
@@ -278,12 +314,12 @@ jobs:
CRASHED=$(./script/test check_crash | tail -1)
[[ $CRASHED -eq "1" ]] && echo "Crashed!" || echo "Not crashed."
echo "CRASHED=$CRASHED" >> $GITHUB_ENV
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
if: ${{ failure() }}
with:
name: thread-1-3-posix-pcaps
path: "*.pcap"
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
if: ${{ failure() && env.CRASHED == '1' }}
with:
name: core-thread-1-3-posix
@@ -292,7 +328,7 @@ jobs:
- name: Generate Coverage
run: |
./script/test generate_coverage gcc
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
with:
name: cov-thread-1-3-posix
path: tmp/coverage.info
@@ -306,20 +342,25 @@ jobs:
- thread-1-3-posix
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- name: Harden Runner
uses: step-security/harden-runner@6b3083af2869dc3314a0257a42f4af696cc79ba3 # v2.3.1
with:
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
with:
submodules: true
- name: Bootstrap
run: |
sudo apt-get --no-install-recommends install -y lcov
- uses: actions/download-artifact@v2
- uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2
with:
path: coverage/
- name: Combine Coverage
run: |
script/test combine_coverage
- name: Upload Coverage
uses: codecov/codecov-action@v2
uses: codecov/codecov-action@eaaf4bedf32dbdc6b720b63067d99c4d77d6047d # v3.1.4
with:
files: final.info
fail_ci_if_error: true
@@ -328,7 +369,12 @@ jobs:
needs: upload-coverage
runs-on: ubuntu-20.04
steps:
- uses: geekyeggo/delete-artifact@v2
- name: Harden Runner
uses: step-security/harden-runner@6b3083af2869dc3314a0257a42f4af696cc79ba3 # v2.3.1
with:
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
- uses: geekyeggo/delete-artifact@54ab544f12cdb7b71613a16a2b5a37a9ade990af # v2.0.0
with:
name: cov-*
useGlob: true
+16 -2
View File
@@ -28,18 +28,32 @@
name: Size
on: [push, pull_request]
on:
push:
branches-ignore:
- 'dependabot/**'
pull_request:
branches:
- 'main'
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || (github.repository == 'openthread/openthread' && github.run_id) || github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
size-report:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- name: Harden Runner
uses: step-security/harden-runner@6b3083af2869dc3314a0257a42f4af696cc79ba3 # v2.3.1
with:
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
- name: Bootstrap
if: "github.event_name == 'push'"
run: |
+59 -40
View File
@@ -28,12 +28,21 @@
name: Toranj
on: [push, pull_request]
on:
push:
branches-ignore:
- 'dependabot/**'
pull_request:
branches:
- 'main'
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || (github.repository == 'openthread/openthread' && github.run_id) || github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
toranj-ncp:
@@ -42,12 +51,19 @@ jobs:
strategy:
fail-fast: false
matrix:
TORANJ_RADIO: ['15.4', 'trel', 'multi']
TORANJ_RADIO: ['15.4']
env:
COVERAGE: 1
TORANJ_RADIO : ${{ matrix.TORANJ_RADIO }}
TORANJ_NCP : 1
TORANJ_EVENT_NAME: ${{ github.event_name }}
steps:
- uses: actions/checkout@v3
- name: Harden Runner
uses: step-security/harden-runner@6b3083af2869dc3314a0257a42f4af696cc79ba3 # v2.3.1
with:
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
with:
submodules: true
- name: Bootstrap
@@ -55,48 +71,30 @@ jobs:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
run: |
sudo rm /etc/apt/sources.list.d/* && sudo apt-get update
sudo apt-get --no-install-recommends install -y dbus libdbus-1-dev
sudo apt-get --no-install-recommends install -y autoconf-archive
sudo apt-get --no-install-recommends install -y libarchive-tools
sudo apt-get --no-install-recommends install -y libtool
sudo apt-get --no-install-recommends install -y libglib2.0-dev
sudo apt-get --no-install-recommends install -y lcov
sudo add-apt-repository universe
sudo apt-get update
sudo apt-get --no-install-recommends install -y libboost-all-dev python2
script/git-tool clone --depth=1 --branch=master https://github.com/openthread/wpantund.git
cd wpantund
./bootstrap.sh
./configure
sudo make -j2
sudo make install
sudo apt-get --no-install-recommends install -y ninja-build lcov
python3 -m pip install -r tests/scripts/thread-cert/requirements.txt
- name: Build & Run
run: |
top_builddir=$(pwd)/build/toranj ./tests/toranj/start.sh
- name: Generate Coverage
if: "matrix.TORANJ_RADIO != 'multi'"
run: |
./script/test generate_coverage gcc
- uses: actions/upload-artifact@v3
if: "matrix.TORANJ_RADIO != 'multi'"
with:
name: cov-toranj-ncp-${{ matrix.TORANJ_RADIO }}
path: tmp/coverage.info
toranj-cli:
name: toranj-cli-${{ matrix.TORANJ_RADIO }}
runs-on: ubuntu-20.04
strategy:
matrix:
TORANJ_RADIO: ['15.4']
TORANJ_RADIO: ['15.4', 'trel', 'multi']
env:
COVERAGE: 1
TORANJ_RADIO : ${{ matrix.TORANJ_RADIO }}
TORANJ_CLI: 1
steps:
- uses: actions/checkout@v3
- name: Harden Runner
uses: step-security/harden-runner@6b3083af2869dc3314a0257a42f4af696cc79ba3 # v2.3.1
with:
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
with:
submodules: true
- name: Bootstrap
@@ -104,7 +102,7 @@ jobs:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
run: |
sudo rm /etc/apt/sources.list.d/* && sudo apt-get update
sudo apt-get --no-install-recommends install -y lcov
sudo apt-get --no-install-recommends install -y ninja-build lcov
python3 -m pip install -r tests/scripts/thread-cert/requirements.txt
- name: Build & Run
run: |
@@ -113,7 +111,7 @@ jobs:
if: "matrix.TORANJ_RADIO != 'multi'"
run: |
./script/test generate_coverage gcc
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
if: "matrix.TORANJ_RADIO != 'multi'"
with:
name: cov-toranj-cli-${{ matrix.TORANJ_RADIO }}
@@ -123,7 +121,12 @@ jobs:
name: toranj-unittest
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- name: Harden Runner
uses: step-security/harden-runner@6b3083af2869dc3314a0257a42f4af696cc79ba3 # v2.3.1
with:
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
with:
submodules: true
- name: Bootstrap
@@ -137,29 +140,40 @@ jobs:
python3 -m pip install -r tests/scripts/thread-cert/requirements.txt
- name: Build & Run
run: |
./tests/toranj/build.sh cmake
./tests/toranj/build.sh all
ninja test
# Validate posix builds with different radio configs
git clean -dfx
./tests/toranj/build.sh posix-15.4
git clean -dfx
./tests/toranj/build.sh posix-15.4+trel
git clean -dfx
./tests/toranj/build.sh posix-trel
upload-coverage:
needs:
- toranj-ncp
- toranj-cli
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- name: Harden Runner
uses: step-security/harden-runner@6b3083af2869dc3314a0257a42f4af696cc79ba3 # v2.3.1
with:
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
with:
submodules: true
- name: Bootstrap
run: |
sudo apt-get --no-install-recommends install -y lcov
- uses: actions/download-artifact@v2
- uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2
with:
path: coverage/
- name: Combine Coverage
run: |
script/test combine_coverage
- name: Upload Coverage
uses: codecov/codecov-action@v2
uses: codecov/codecov-action@eaaf4bedf32dbdc6b720b63067d99c4d77d6047d # v3.1.4
with:
files: final.info
fail_ci_if_error: true
@@ -168,7 +182,12 @@ jobs:
needs: upload-coverage
runs-on: ubuntu-20.04
steps:
- uses: geekyeggo/delete-artifact@v2
- name: Harden Runner
uses: step-security/harden-runner@6b3083af2869dc3314a0257a42f4af696cc79ba3 # v2.3.1
with:
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
- uses: geekyeggo/delete-artifact@54ab544f12cdb7b71613a16a2b5a37a9ade990af # v2.0.0
with:
name: cov-*
useGlob: true
+137
View File
@@ -0,0 +1,137 @@
#
# Copyright (c) 2023, The OpenThread Authors.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# 3. Neither the name of the copyright holder nor the
# names of its contributors may be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
name: Unit
on:
push:
branches-ignore:
- 'dependabot/**'
pull_request:
branches:
- 'main'
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || (github.repository == 'openthread/openthread' && github.run_id) || github.ref }}
cancel-in-progress: true
permissions: # added using https://github.com/step-security/secure-workflows
contents: read
jobs:
tcplp-buffering:
runs-on: ubuntu-20.04
steps:
- name: Harden Runner
uses: step-security/harden-runner@6b3083af2869dc3314a0257a42f4af696cc79ba3 # v2.3.1
with:
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
with:
submodules: true
- name: Build
run: make -C third_party/tcplp/lib/test/
- name: Run
run: third_party/tcplp/lib/test/test_all
unit-tests:
runs-on: ubuntu-20.04
env:
COVERAGE: 1
steps:
- name: Harden Runner
uses: step-security/harden-runner@6b3083af2869dc3314a0257a42f4af696cc79ba3 # v2.3.1
with:
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
with:
submodules: true
- name: Bootstrap
run: |
sudo rm /etc/apt/sources.list.d/* && sudo apt-get update
sudo apt-get --no-install-recommends install -y ninja-build lcov
- name: Build Simulation
run: ./script/cmake-build simulation
- name: Test Simulation
run: cd build/simulation && ninja test
- name: Build POSIX
run: ./script/cmake-build posix
- name: Test POSIX
run: cd build/posix && ninja test
- name: Generate Coverage
run: |
./script/test generate_coverage gcc
- uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
with:
name: cov-unit-tests
path: tmp/coverage.info
upload-coverage:
needs: unit-tests
runs-on: ubuntu-20.04
steps:
- name: Harden Runner
uses: step-security/harden-runner@6b3083af2869dc3314a0257a42f4af696cc79ba3 # v2.3.1
with:
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
with:
submodules: true
- name: Bootstrap
run: |
sudo apt-get --no-install-recommends install -y lcov
- uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2
with:
path: coverage/
- name: Combine Coverage
run: |
script/test combine_coverage
- name: Upload Coverage
uses: codecov/codecov-action@eaaf4bedf32dbdc6b720b63067d99c4d77d6047d # v3.1.4
with:
files: final.info
fail_ci_if_error: true
delete-coverage-artifacts:
needs: upload-coverage
runs-on: ubuntu-20.04
steps:
- name: Harden Runner
uses: step-security/harden-runner@6b3083af2869dc3314a0257a42f4af696cc79ba3 # v2.3.1
with:
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
- uses: geekyeggo/delete-artifact@54ab544f12cdb7b71613a16a2b5a37a9ade990af # v2.0.0
with:
name: cov-*
useGlob: true
+13 -2
View File
@@ -28,17 +28,28 @@
name: API Version
on: [pull_request]
on:
pull_request:
branches:
- 'main'
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || (github.repository == 'openthread/openthread' && github.run_id) || github.ref }}
cancel-in-progress: true
permissions: # added using https://github.com/step-security/secure-workflows
contents: read
jobs:
api-version:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- name: Harden Runner
uses: step-security/harden-runner@6b3083af2869dc3314a0257a42f4af696cc79ba3 # v2.3.1
with:
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
with:
submodules: true
- name: Check
-34
View File
@@ -1,63 +1,29 @@
*.a
*.bak
*.db
*.flash
*.gcda
*.gcno
*.log
*.o
*.lo
*.la
*.ninja*
*.opendb
*.orig
*.pcap
*.pyc
*.suo
*.swn
*.swo
*.swp
*.trs
*.user
*.bak
*~
.deps
.dirstamp
.DS_Store
.local-version
.libs
.vagrant
aclocal.m4
autom4te.cache
build
CMakeCache.txt
CMakeFiles
cmake_install.cmake
configure
config.log
config.status
doc/Doxyfile
doc/html
etc/cmake/openthread-config-generic.h
include/openthread-config.h
include/openthread-config.h.in
include/openthread-config-generic.h
include/openthread-config-generic.h.in
include/stamp-h1
ipch
libtool
Makefile
Makefile.in
output
third_party/nlbuild-autotools/repo/third_party/autoconf/compile
third_party/nlbuild-autotools/repo/third_party/autoconf/depcomp
third_party/nlbuild-autotools/repo/third_party/autoconf/ltmain.sh
third_party/nlbuild-autotools/repo/third_party/autoconf/m4/libtool.m4
third_party/nlbuild-autotools/repo/third_party/autoconf/m4/ltoptions.m4
third_party/nlbuild-autotools/repo/third_party/autoconf/m4/ltsugar.m4
third_party/nlbuild-autotools/repo/third_party/autoconf/m4/ltversion.m4
third_party/nlbuild-autotools/repo/third_party/autoconf/m4/lt~obsolete.m4
third_party/nlbuild-autotools/repo/third_party/autoconf/missing
/tmp/
# IDE / editor files
-665
View File
@@ -1,665 +0,0 @@
#
# Copyright (c) 2018, The OpenThread Authors.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# 3. Neither the name of the copyright holder nor the
# names of its contributors may be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
LOCAL_PATH := $(call my-dir)
ifeq ($(OPENTHREAD_ENABLE_ANDROID_MK),1)
OPENTHREAD_DEFAULT_VERSION := $(shell cat $(LOCAL_PATH)/.default-version)
OPENTHREAD_SOURCE_VERSION := $(shell git -C $(LOCAL_PATH) describe --always --match "[0-9].*" 2> /dev/null)
OPENTHREAD_PROJECT_CFLAGS ?= \
-DOPENTHREAD_PROJECT_CORE_CONFIG_FILE=\"openthread-core-posix-config.h\" \
$(NULL)
OPENTHREAD_PUBLIC_CFLAGS := \
-DOPENTHREAD_CONFIG_BORDER_AGENT_ENABLE=1 \
-DOPENTHREAD_CONFIG_BORDER_ROUTER_ENABLE=1 \
-DOPENTHREAD_CONFIG_CHILD_SUPERVISION_ENABLE=1 \
-DOPENTHREAD_CONFIG_DTLS_ENABLE=1 \
-DOPENTHREAD_CONFIG_IP6_SLAAC_ENABLE=1 \
-DOPENTHREAD_CONFIG_JAM_DETECTION_ENABLE=1 \
-DOPENTHREAD_CONFIG_JOINER_ENABLE=1 \
-DOPENTHREAD_CONFIG_LOG_LEVEL_DYNAMIC_ENABLE=1 \
-DOPENTHREAD_CONFIG_MAC_FILTER_ENABLE=1 \
-DOPENTHREAD_CONFIG_NCP_HDLC_ENABLE=1 \
-DOPENTHREAD_CONFIG_PING_SENDER_ENABLE=1 \
-DOPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE=1 \
-DOPENTHREAD_FTD=1 \
-DOPENTHREAD_PLATFORM_POSIX=1 \
-DOPENTHREAD_POSIX_CONFIG_RCP_PTY_ENABLE=1 \
-DOPENTHREAD_SPINEL_CONFIG_OPENTHREAD_MESSAGE_ENABLE=1 \
$(NULL)
OPENTHREAD_PRIVATE_CFLAGS := \
-DMBEDTLS_CONFIG_FILE=\"mbedtls-config.h\" \
-DPACKAGE=\"openthread\" \
-DPACKAGE_BUGREPORT=\"openthread-devel@googlegroups.com\" \
-DPACKAGE_NAME=\"OPENTHREAD\" \
-DPACKAGE_STRING=\"OPENTHREAD\ $(OPENTHREAD_DEFAULT_VERSION)\" \
-DPACKAGE_TARNAME=\"openthread\" \
-DPACKAGE_URL=\"http://github.com/openthread/openthread\" \
-DPACKAGE_VERSION=\"$(OPENTHREAD_SOURCE_VERSION)\" \
-DSPINEL_PLATFORM_HEADER=\"spinel_platform.h\" \
-DVERSION=\"$(OPENTHREAD_DEFAULT_VERSION)\" \
$(NULL)
# Enable required features for on-device tests.
ifeq ($(TARGET_BUILD_VARIANT),eng)
OPENTHREAD_PUBLIC_CFLAGS += \
-DOPENTHREAD_CONFIG_DIAG_ENABLE=1 \
$(NULL)
endif
ifeq ($(USE_OTBR_DAEMON), 1)
OPENTHREAD_PUBLIC_CFLAGS += \
-DOPENTHREAD_CONFIG_PLATFORM_NETIF_ENABLE=1 \
-DOPENTHREAD_CONFIG_PLATFORM_UDP_ENABLE=1 \
-DOPENTHREAD_POSIX_CONFIG_DAEMON_ENABLE=1 \
$(NULL)
else
OPENTHREAD_PUBLIC_CFLAGS += -DOPENTHREAD_CONFIG_UDP_FORWARD_ENABLE=1
endif
ifeq ($(USE_OT_RCP_BUS), spi)
OPENTHREAD_PUBLIC_CFLAGS += -DOPENTHREAD_POSIX_CONFIG_RCP_BUS=OT_POSIX_RCP_BUS_SPI
else
OPENTHREAD_PUBLIC_CFLAGS += -DOPENTHREAD_POSIX_CONFIG_RCP_BUS=OT_POSIX_RCP_BUS_UART
endif
# Enable all optional features for CI tests.
ifeq ($(TARGET_PRODUCT),generic)
OPENTHREAD_PUBLIC_CFLAGS += \
-DOPENTHREAD_CONFIG_COAP_API_ENABLE=1 \
-DOPENTHREAD_CONFIG_DHCP6_CLIENT_ENABLE=1 \
-DOPENTHREAD_CONFIG_DHCP6_SERVER_ENABLE=1 \
-DOPENTHREAD_CONFIG_DNS_CLIENT_ENABLE=1 \
-DOPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE=0 \
-DOPENTHREAD_CONFIG_TMF_NETWORK_DIAG_MTD_ENABLE=1 \
$(NULL)
endif
include $(CLEAR_VARS)
LOCAL_MODULE := spi-hdlc-adapter
LOCAL_MODULE_TAGS := eng
LOCAL_SRC_FILES := tools/spi-hdlc-adapter/spi-hdlc-adapter.c
include $(BUILD_EXECUTABLE)
include $(CLEAR_VARS)
LOCAL_MODULE := ot-core
LOCAL_MODULE_TAGS := eng
LOCAL_C_INCLUDES := \
$(OPENTHREAD_PROJECT_INCLUDES) \
$(LOCAL_PATH)/include \
$(LOCAL_PATH)/src \
$(LOCAL_PATH)/src/cli \
$(LOCAL_PATH)/src/core \
$(LOCAL_PATH)/src/ncp \
$(LOCAL_PATH)/src/posix/platform \
$(LOCAL_PATH)/src/posix/platform/include \
$(LOCAL_PATH)/third_party \
$(LOCAL_PATH)/third_party/mbedtls \
$(LOCAL_PATH)/third_party/mbedtls/repo/include \
$(LOCAL_PATH)/third_party/mbedtls/repo/library \
$(NULL)
LOCAL_CFLAGS := \
$(OPENTHREAD_PUBLIC_CFLAGS) \
$(OPENTHREAD_PRIVATE_CFLAGS) \
$(OPENTHREAD_PROJECT_CFLAGS) \
$(NULL)
LOCAL_EXPORT_CFLAGS := \
$(OPENTHREAD_PUBLIC_CFLAGS) \
$(OPENTHREAD_PROJECT_CFLAGS) \
$(NULL)
LOCAL_EXPORT_C_INCLUDE_DIRS := \
$(OPENTHREAD_PROJECT_INCLUDES) \
$(LOCAL_PATH)/include \
$(LOCAL_PATH)/src \
$(NULL)
LOCAL_CPPFLAGS := \
-std=c++11 \
-Wno-error=non-virtual-dtor \
-pedantic-errors \
$(NULL)
ifeq ($(ANDROID_NDK),1)
LOCAL_SHARED_LIBRARIES := libcutils
LOCAL_CFLAGS += \
-DOPENTHREAD_ENABLE_ANDROID_NDK=1 \
-Wno-sign-compare \
$(NULL)
endif
LOCAL_SRC_FILES := \
src/core/api/backbone_router_api.cpp \
src/core/api/backbone_router_ftd_api.cpp \
src/core/api/border_agent_api.cpp \
src/core/api/border_router_api.cpp \
src/core/api/border_routing_api.cpp \
src/core/api/channel_manager_api.cpp \
src/core/api/channel_monitor_api.cpp \
src/core/api/child_supervision_api.cpp \
src/core/api/coap_api.cpp \
src/core/api/coap_secure_api.cpp \
src/core/api/commissioner_api.cpp \
src/core/api/crypto_api.cpp \
src/core/api/dataset_api.cpp \
src/core/api/dataset_ftd_api.cpp \
src/core/api/dataset_updater_api.cpp \
src/core/api/diags_api.cpp \
src/core/api/dns_api.cpp \
src/core/api/dns_server_api.cpp \
src/core/api/error_api.cpp \
src/core/api/heap_api.cpp \
src/core/api/history_tracker_api.cpp \
src/core/api/icmp6_api.cpp \
src/core/api/instance_api.cpp \
src/core/api/ip6_api.cpp \
src/core/api/jam_detection_api.cpp \
src/core/api/joiner_api.cpp \
src/core/api/link_api.cpp \
src/core/api/link_metrics_api.cpp \
src/core/api/link_raw_api.cpp \
src/core/api/logging_api.cpp \
src/core/api/message_api.cpp \
src/core/api/multi_radio_api.cpp \
src/core/api/nat64_api.cpp \
src/core/api/netdata_api.cpp \
src/core/api/netdata_publisher_api.cpp \
src/core/api/netdiag_api.cpp \
src/core/api/network_time_api.cpp \
src/core/api/ping_sender_api.cpp \
src/core/api/random_crypto_api.cpp \
src/core/api/random_noncrypto_api.cpp \
src/core/api/server_api.cpp \
src/core/api/sntp_api.cpp \
src/core/api/srp_client_api.cpp \
src/core/api/srp_client_buffers_api.cpp \
src/core/api/srp_server_api.cpp \
src/core/api/tasklet_api.cpp \
src/core/api/tcp_api.cpp \
src/core/api/tcp_ext_api.cpp \
src/core/api/thread_api.cpp \
src/core/api/thread_ftd_api.cpp \
src/core/api/trel_api.cpp \
src/core/api/udp_api.cpp \
src/core/backbone_router/backbone_tmf.cpp \
src/core/backbone_router/bbr_leader.cpp \
src/core/backbone_router/bbr_local.cpp \
src/core/backbone_router/bbr_manager.cpp \
src/core/backbone_router/multicast_listeners_table.cpp \
src/core/backbone_router/ndproxy_table.cpp \
src/core/border_router/infra_if.cpp \
src/core/border_router/routing_manager.cpp \
src/core/coap/coap.cpp \
src/core/coap/coap_message.cpp \
src/core/coap/coap_secure.cpp \
src/core/common/appender.cpp \
src/core/common/binary_search.cpp \
src/core/common/crc16.cpp \
src/core/common/data.cpp \
src/core/common/error.cpp \
src/core/common/frame_builder.cpp \
src/core/common/frame_data.cpp \
src/core/common/heap.cpp \
src/core/common/heap_data.cpp \
src/core/common/heap_string.cpp \
src/core/common/instance.cpp \
src/core/common/log.cpp \
src/core/common/message.cpp \
src/core/common/notifier.cpp \
src/core/common/random.cpp \
src/core/common/settings.cpp \
src/core/common/string.cpp \
src/core/common/tasklet.cpp \
src/core/common/time_ticker.cpp \
src/core/common/timer.cpp \
src/core/common/tlvs.cpp \
src/core/common/trickle_timer.cpp \
src/core/common/uptime.cpp \
src/core/crypto/aes_ccm.cpp \
src/core/crypto/aes_ecb.cpp \
src/core/crypto/crypto_platform.cpp \
src/core/crypto/ecdsa.cpp \
src/core/crypto/ecdsa_tinycrypt.cpp \
src/core/crypto/hkdf_sha256.cpp \
src/core/crypto/hmac_sha256.cpp \
src/core/crypto/mbedtls.cpp \
src/core/crypto/pbkdf2_cmac.cpp \
src/core/crypto/sha256.cpp \
src/core/crypto/storage.cpp \
src/core/diags/factory_diags.cpp \
src/core/mac/channel_mask.cpp \
src/core/mac/data_poll_handler.cpp \
src/core/mac/data_poll_sender.cpp \
src/core/mac/link_raw.cpp \
src/core/mac/mac.cpp \
src/core/mac/mac_filter.cpp \
src/core/mac/mac_frame.cpp \
src/core/mac/mac_links.cpp \
src/core/mac/mac_types.cpp \
src/core/mac/sub_mac.cpp \
src/core/mac/sub_mac_callbacks.cpp \
src/core/meshcop/announce_begin_client.cpp \
src/core/meshcop/border_agent.cpp \
src/core/meshcop/commissioner.cpp \
src/core/meshcop/dataset.cpp \
src/core/meshcop/dataset_local.cpp \
src/core/meshcop/dataset_manager.cpp \
src/core/meshcop/dataset_manager_ftd.cpp \
src/core/meshcop/dataset_updater.cpp \
src/core/meshcop/dtls.cpp \
src/core/meshcop/energy_scan_client.cpp \
src/core/meshcop/extended_panid.cpp \
src/core/meshcop/joiner.cpp \
src/core/meshcop/joiner_router.cpp \
src/core/meshcop/meshcop.cpp \
src/core/meshcop/meshcop_leader.cpp \
src/core/meshcop/meshcop_tlvs.cpp \
src/core/meshcop/network_name.cpp \
src/core/meshcop/panid_query_client.cpp \
src/core/meshcop/timestamp.cpp \
src/core/net/checksum.cpp \
src/core/net/dhcp6_client.cpp \
src/core/net/dhcp6_server.cpp \
src/core/net/dns_client.cpp \
src/core/net/dns_dso.cpp \
src/core/net/dns_types.cpp \
src/core/net/dnssd_server.cpp \
src/core/net/icmp6.cpp \
src/core/net/ip4_types.cpp \
src/core/net/ip6.cpp \
src/core/net/ip6_address.cpp \
src/core/net/ip6_filter.cpp \
src/core/net/ip6_headers.cpp \
src/core/net/ip6_mpl.cpp \
src/core/net/nat64_translator.cpp \
src/core/net/nd6.cpp \
src/core/net/nd_agent.cpp \
src/core/net/netif.cpp \
src/core/net/sntp_client.cpp \
src/core/net/socket.cpp \
src/core/net/srp_client.cpp \
src/core/net/srp_server.cpp \
src/core/net/tcp6.cpp \
src/core/net/tcp6_ext.cpp \
src/core/net/udp6.cpp \
src/core/radio/radio.cpp \
src/core/radio/radio_callbacks.cpp \
src/core/radio/radio_platform.cpp \
src/core/radio/trel_interface.cpp \
src/core/radio/trel_link.cpp \
src/core/radio/trel_packet.cpp \
src/core/thread/address_resolver.cpp \
src/core/thread/announce_begin_server.cpp \
src/core/thread/announce_sender.cpp \
src/core/thread/anycast_locator.cpp \
src/core/thread/child_table.cpp \
src/core/thread/csl_tx_scheduler.cpp \
src/core/thread/discover_scanner.cpp \
src/core/thread/dua_manager.cpp \
src/core/thread/energy_scan_server.cpp \
src/core/thread/indirect_sender.cpp \
src/core/thread/key_manager.cpp \
src/core/thread/link_metrics.cpp \
src/core/thread/link_metrics_types.cpp \
src/core/thread/link_quality.cpp \
src/core/thread/lowpan.cpp \
src/core/thread/mesh_forwarder.cpp \
src/core/thread/mesh_forwarder_ftd.cpp \
src/core/thread/mesh_forwarder_mtd.cpp \
src/core/thread/mle.cpp \
src/core/thread/mle_router.cpp \
src/core/thread/mle_types.cpp \
src/core/thread/mlr_manager.cpp \
src/core/thread/neighbor_table.cpp \
src/core/thread/network_data.cpp \
src/core/thread/network_data_leader.cpp \
src/core/thread/network_data_leader_ftd.cpp \
src/core/thread/network_data_local.cpp \
src/core/thread/network_data_notifier.cpp \
src/core/thread/network_data_publisher.cpp \
src/core/thread/network_data_service.cpp \
src/core/thread/network_data_tlvs.cpp \
src/core/thread/network_data_types.cpp \
src/core/thread/network_diagnostic.cpp \
src/core/thread/panid_query_server.cpp \
src/core/thread/radio_selector.cpp \
src/core/thread/router_table.cpp \
src/core/thread/src_match_controller.cpp \
src/core/thread/thread_netif.cpp \
src/core/thread/time_sync_service.cpp \
src/core/thread/tmf.cpp \
src/core/thread/topology.cpp \
src/core/thread/uri_paths.cpp \
src/core/utils/channel_manager.cpp \
src/core/utils/channel_monitor.cpp \
src/core/utils/child_supervision.cpp \
src/core/utils/flash.cpp \
src/core/utils/heap.cpp \
src/core/utils/history_tracker.cpp \
src/core/utils/jam_detector.cpp \
src/core/utils/otns.cpp \
src/core/utils/parse_cmdline.cpp \
src/core/utils/ping_sender.cpp \
src/core/utils/slaac_address.cpp \
src/core/utils/srp_client_buffers.cpp \
src/lib/hdlc/hdlc.cpp \
src/lib/platform/exit_code.c \
src/lib/spinel/spinel.c \
src/lib/spinel/spinel_decoder.cpp \
src/lib/spinel/spinel_encoder.cpp \
src/lib/url/url.cpp \
src/posix/platform/alarm.cpp \
src/posix/platform/backbone.cpp \
src/posix/platform/daemon.cpp \
src/posix/platform/entropy.cpp \
src/posix/platform/firewall.cpp \
src/posix/platform/hdlc_interface.cpp \
src/posix/platform/infra_if.cpp \
src/posix/platform/logging.cpp \
src/posix/platform/mainloop.cpp \
src/posix/platform/memory.cpp \
src/posix/platform/misc.cpp \
src/posix/platform/multicast_routing.cpp \
src/posix/platform/netif.cpp \
src/posix/platform/radio.cpp \
src/posix/platform/radio_url.cpp \
src/posix/platform/settings.cpp \
src/posix/platform/spi_interface.cpp \
src/posix/platform/system.cpp \
src/posix/platform/trel.cpp \
src/posix/platform/udp.cpp \
src/posix/platform/utils.cpp \
third_party/tcplp/bsdtcp/tcp_usrreq.c \
third_party/tcplp/bsdtcp/tcp_subr.c \
third_party/tcplp/bsdtcp/tcp_output.c \
third_party/tcplp/bsdtcp/cc/cc_newreno.c \
third_party/tcplp/bsdtcp/tcp_reass.c \
third_party/tcplp/bsdtcp/tcp_timewait.c \
third_party/tcplp/bsdtcp/tcp_sack.c \
third_party/tcplp/bsdtcp/tcp_input.c \
third_party/tcplp/bsdtcp/tcp_timer.c \
third_party/tcplp/lib/bitmap.c \
third_party/tcplp/lib/cbuf.c \
third_party/tcplp/lib/lbuf.c \
$(OPENTHREAD_PROJECT_SRC_FILES) \
$(NULL)
include $(BUILD_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := libopenthread-mbedtls
LOCAL_MODULE_TAGS := eng
LOCAL_C_INCLUDES := \
$(OPENTHREAD_PROJECT_INCLUDES) \
$(LOCAL_PATH)/include \
$(LOCAL_PATH)/src \
$(LOCAL_PATH)/src/cli \
$(LOCAL_PATH)/src/core \
$(LOCAL_PATH)/src/posix/platform \
$(LOCAL_PATH)/src/posix/platform/include \
$(LOCAL_PATH)/third_party/mbedtls \
$(LOCAL_PATH)/third_party/mbedtls/repo/include \
$(NULL)
LOCAL_CFLAGS := \
-std=c99 \
$(OPENTHREAD_PUBLIC_CFLAGS) \
$(OPENTHREAD_PRIVATE_CFLAGS) \
$(OPENTHREAD_PROJECT_CFLAGS) \
LOCAL_SRC_FILES := \
third_party/mbedtls/repo/library/aes.c \
third_party/mbedtls/repo/library/aesni.c \
third_party/mbedtls/repo/library/arc4.c \
third_party/mbedtls/repo/library/aria.c \
third_party/mbedtls/repo/library/asn1parse.c \
third_party/mbedtls/repo/library/asn1write.c \
third_party/mbedtls/repo/library/base64.c \
third_party/mbedtls/repo/library/bignum.c \
third_party/mbedtls/repo/library/blowfish.c \
third_party/mbedtls/repo/library/camellia.c \
third_party/mbedtls/repo/library/ccm.c \
third_party/mbedtls/repo/library/certs.c \
third_party/mbedtls/repo/library/chacha20.c \
third_party/mbedtls/repo/library/chachapoly.c \
third_party/mbedtls/repo/library/cipher.c \
third_party/mbedtls/repo/library/cipher_wrap.c \
third_party/mbedtls/repo/library/cmac.c \
third_party/mbedtls/repo/library/constant_time.c \
third_party/mbedtls/repo/library/ctr_drbg.c \
third_party/mbedtls/repo/library/debug.c \
third_party/mbedtls/repo/library/des.c \
third_party/mbedtls/repo/library/dhm.c \
third_party/mbedtls/repo/library/ecdh.c \
third_party/mbedtls/repo/library/ecdsa.c \
third_party/mbedtls/repo/library/ecjpake.c \
third_party/mbedtls/repo/library/ecp.c \
third_party/mbedtls/repo/library/ecp_curves.c \
third_party/mbedtls/repo/library/entropy.c \
third_party/mbedtls/repo/library/entropy_poll.c \
third_party/mbedtls/repo/library/error.c \
third_party/mbedtls/repo/library/gcm.c \
third_party/mbedtls/repo/library/havege.c \
third_party/mbedtls/repo/library/hkdf.c \
third_party/mbedtls/repo/library/hmac_drbg.c \
third_party/mbedtls/repo/library/md.c \
third_party/mbedtls/repo/library/md2.c \
third_party/mbedtls/repo/library/md4.c \
third_party/mbedtls/repo/library/md5.c \
third_party/mbedtls/repo/library/memory_buffer_alloc.c \
third_party/mbedtls/repo/library/net_sockets.c \
third_party/mbedtls/repo/library/nist_kw.c \
third_party/mbedtls/repo/library/oid.c \
third_party/mbedtls/repo/library/padlock.c \
third_party/mbedtls/repo/library/pem.c \
third_party/mbedtls/repo/library/pk.c \
third_party/mbedtls/repo/library/pk_wrap.c \
third_party/mbedtls/repo/library/pkcs11.c \
third_party/mbedtls/repo/library/pkcs12.c \
third_party/mbedtls/repo/library/pkcs5.c \
third_party/mbedtls/repo/library/pkparse.c \
third_party/mbedtls/repo/library/pkwrite.c \
third_party/mbedtls/repo/library/platform.c \
third_party/mbedtls/repo/library/platform_util.c \
third_party/mbedtls/repo/library/poly1305.c \
third_party/mbedtls/repo/library/psa_crypto.c \
third_party/mbedtls/repo/library/psa_crypto_driver_wrappers.c \
third_party/mbedtls/repo/library/psa_crypto_se.c \
third_party/mbedtls/repo/library/psa_crypto_slot_management.c \
third_party/mbedtls/repo/library/psa_crypto_storage.c \
third_party/mbedtls/repo/library/psa_its_file.c \
third_party/mbedtls/repo/library/ripemd160.c \
third_party/mbedtls/repo/library/rsa.c \
third_party/mbedtls/repo/library/rsa_internal.c \
third_party/mbedtls/repo/library/sha1.c \
third_party/mbedtls/repo/library/sha256.c \
third_party/mbedtls/repo/library/sha512.c \
third_party/mbedtls/repo/library/ssl_cache.c \
third_party/mbedtls/repo/library/ssl_ciphersuites.c \
third_party/mbedtls/repo/library/ssl_cli.c \
third_party/mbedtls/repo/library/ssl_cookie.c \
third_party/mbedtls/repo/library/ssl_msg.c \
third_party/mbedtls/repo/library/ssl_srv.c \
third_party/mbedtls/repo/library/ssl_ticket.c \
third_party/mbedtls/repo/library/ssl_tls.c \
third_party/mbedtls/repo/library/ssl_tls13_keys.c \
third_party/mbedtls/repo/library/threading.c \
third_party/mbedtls/repo/library/timing.c \
third_party/mbedtls/repo/library/version.c \
third_party/mbedtls/repo/library/version_features.c \
third_party/mbedtls/repo/library/x509.c \
third_party/mbedtls/repo/library/x509_create.c \
third_party/mbedtls/repo/library/x509_crl.c \
third_party/mbedtls/repo/library/x509_crt.c \
third_party/mbedtls/repo/library/x509_csr.c \
third_party/mbedtls/repo/library/x509write_crt.c \
third_party/mbedtls/repo/library/x509write_csr.c \
third_party/mbedtls/repo/library/xtea.c \
include $(BUILD_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := libopenthread-cli
LOCAL_MODULE_TAGS := eng
LOCAL_C_INCLUDES := \
$(OPENTHREAD_PROJECT_INCLUDES) \
$(LOCAL_PATH)/include \
$(LOCAL_PATH)/src \
$(LOCAL_PATH)/src/cli \
$(LOCAL_PATH)/src/core \
$(LOCAL_PATH)/src/posix/platform \
$(LOCAL_PATH)/src/posix/platform/include \
$(LOCAL_PATH)/third_party/mbedtls \
$(LOCAL_PATH)/third_party/mbedtls/repo/include \
$(NULL)
LOCAL_CFLAGS := \
$(OPENTHREAD_PUBLIC_CFLAGS) \
$(OPENTHREAD_PRIVATE_CFLAGS) \
$(OPENTHREAD_PROJECT_CFLAGS) \
$(NULL)
LOCAL_CPPFLAGS := \
-std=c++11 \
-pedantic-errors \
$(NULL)
LOCAL_SRC_FILES := \
src/cli/cli.cpp \
src/cli/cli_coap.cpp \
src/cli/cli_coap_secure.cpp \
src/cli/cli_commissioner.cpp \
src/cli/cli_dataset.cpp \
src/cli/cli_history.cpp \
src/cli/cli_joiner.cpp \
src/cli/cli_network_data.cpp \
src/cli/cli_output.cpp \
src/cli/cli_srp_client.cpp \
src/cli/cli_srp_server.cpp \
src/cli/cli_tcp.cpp \
src/cli/cli_udp.cpp \
$(NULL)
include $(BUILD_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := ot-cli
LOCAL_MODULE_TAGS := eng
ifneq ($(ANDROID_NDK),1)
LOCAL_SHARED_LIBRARIES := libcutils
endif
LOCAL_C_INCLUDES := \
$(OPENTHREAD_PROJECT_INCLUDES) \
$(LOCAL_PATH)/include \
$(LOCAL_PATH)/src \
$(LOCAL_PATH)/src/cli \
$(LOCAL_PATH)/src/core \
$(LOCAL_PATH)/src/posix/platform \
$(LOCAL_PATH)/src/posix/platform/include \
$(LOCAL_PATH)/third_party/mbedtls \
$(LOCAL_PATH)/third_party/mbedtls/repo/include \
$(NULL)
LOCAL_CFLAGS := \
$(OPENTHREAD_PUBLIC_CFLAGS) \
$(OPENTHREAD_PRIVATE_CFLAGS) \
$(OPENTHREAD_PROJECT_CFLAGS) \
$(NULL)
LOCAL_CPPFLAGS := \
-std=c++11 \
-pedantic-errors \
$(NULL)
LOCAL_LDLIBS := \
-lanl \
-lrt \
-lutil
LOCAL_SRC_FILES := \
src/posix/cli_readline.cpp \
src/posix/cli_stdio.cpp \
src/posix/main.c \
$(NULL)
LOCAL_STATIC_LIBRARIES = libopenthread-cli ot-core libopenthread-mbedtls
include $(BUILD_EXECUTABLE)
ifeq ($(USE_OTBR_DAEMON), 1)
include $(CLEAR_VARS)
LOCAL_MODULE := ot-ctl
LOCAL_MODULE_TAGS := eng
LOCAL_CPPFLAGS := \
-std=c++11 \
-pedantic-errors \
$(NULL)
LOCAL_CFLAGS := \
$(OPENTHREAD_PUBLIC_CFLAGS) \
$(OPENTHREAD_PRIVATE_CFLAGS) \
$(OPENTHREAD_PROJECT_CFLAGS) \
$(NULL)
LOCAL_C_INCLUDES := \
$(OPENTHREAD_PROJECT_INCLUDES) \
$(LOCAL_PATH)/include \
$(LOCAL_PATH)/src/ \
$(LOCAL_PATH)/src/core \
$(LOCAL_PATH)/src/posix/platform \
$(LOCAL_PATH)/src/posix/platform/include \
$(NULL)
LOCAL_SRC_FILES := src/posix/client.cpp
include $(BUILD_EXECUTABLE)
endif # ($(USE_OTBR_DAEMON), 1)
ifneq ($(OPENTHREAD_PROJECT_ANDROID_MK),)
include $(OPENTHREAD_PROJECT_ANDROID_MK)
endif
endif # ($(OPENTHREAD_ENABLE_ANDROID_MK),1)
+13 -8
View File
@@ -33,6 +33,7 @@ file(READ .default-version OT_DEFAULT_VERSION)
string(STRIP ${OT_DEFAULT_VERSION} OT_DEFAULT_VERSION)
project(openthread VERSION ${OT_DEFAULT_VERSION})
include(CTest)
option(OT_BUILD_EXECUTABLES "Build executables" ON)
option(OT_COVERAGE "enable coverage" OFF)
@@ -106,13 +107,19 @@ endif()
message(STATUS "Package Version: ${OT_PACKAGE_VERSION}")
set(OT_THREAD_VERSION "1.3" CACHE STRING "Thread version chosen by the user at configure time")
set_property(CACHE OT_THREAD_VERSION PROPERTY STRINGS "1.1" "1.2" "1.3")
if(${OT_THREAD_VERSION} EQUAL "1.1")
set_property(CACHE OT_THREAD_VERSION PROPERTY STRINGS "1.1" "1.2" "1.3" "1.3.1")
if(${OT_THREAD_VERSION} STREQUAL "1.1")
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_THREAD_VERSION=OT_THREAD_VERSION_1_1")
elseif(${OT_THREAD_VERSION} EQUAL "1.2")
message(STATUS "Thread Version: 1.1 (OPENTHREAD_CONFIG_THREAD_VERSION=OT_THREAD_VERSION_1_1)")
elseif(${OT_THREAD_VERSION} STREQUAL "1.2")
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_THREAD_VERSION=OT_THREAD_VERSION_1_2")
elseif(${OT_THREAD_VERSION} EQUAL "1.3")
message(STATUS "Thread Version: 1.2 (OPENTHREAD_CONFIG_THREAD_VERSION=OT_THREAD_VERSION_1_2)")
elseif(${OT_THREAD_VERSION} STREQUAL "1.3")
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_THREAD_VERSION=OT_THREAD_VERSION_1_3")
message(STATUS "Thread Version: 1.3 (OPENTHREAD_CONFIG_THREAD_VERSION=OT_THREAD_VERSION_1_3)")
elseif(${OT_THREAD_VERSION} STREQUAL "1.3.1")
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_THREAD_VERSION=OT_THREAD_VERSION_1_3_1")
message(STATUS "Thread Version: 1.3.1 (OPENTHREAD_CONFIG_THREAD_VERSION=OT_THREAD_VERSION_1_3_1)")
else()
message(FATAL_ERROR "Thread version unknown: ${OT_THREAD_VERSION}")
endif()
@@ -172,6 +179,7 @@ list(APPEND OT_PUBLIC_INCLUDES ${PROJECT_SOURCE_DIR}/include)
if(OT_PLATFORM STREQUAL "posix")
target_include_directories(ot-config INTERFACE ${PROJECT_SOURCE_DIR}/src/posix/platform)
target_compile_definitions(ot-config INTERFACE OPENTHREAD_PLATFORM_POSIX=1)
add_subdirectory("${PROJECT_SOURCE_DIR}/src/posix/platform")
elseif(OT_PLATFORM STREQUAL "external")
# skip in this case
@@ -204,11 +212,8 @@ endif()
add_subdirectory(src)
add_subdirectory(third_party EXCLUDE_FROM_ALL)
if(OT_PLATFORM STREQUAL "simulation")
enable_testing()
endif()
add_subdirectory(tests)
add_subdirectory(tools)
add_custom_target(print-ot-config ALL
COMMAND ${CMAKE_COMMAND}
+1 -1
View File
@@ -109,7 +109,7 @@ This will open up a text editor where you can specify which commits to squash.
#### Coding Conventions and Style
OpenThread uses and enforces the [OpenThread Coding Conventions and Style](STYLE_GUIDE.md) on all code, except for code located in [third_party](third_party). Use `script/make-pretty` and `script/make-pretty check` to automatically reformat code and check for code-style compliance, respectively. OpenThread currently requires [clang-format v9.0.0](https://releases.llvm.org/download.html#9.0.0) for C/C++ and [yapf v0.31.0](https://github.com/google/yapf) for Python.
OpenThread uses and enforces the [OpenThread Coding Conventions and Style](STYLE_GUIDE.md) on all code, except for code located in [third_party](third_party). Use `script/make-pretty` and `script/make-pretty check` to automatically reformat code and check for code-style compliance, respectively. OpenThread currently requires [clang-format v14.0.0](https://releases.llvm.org/download.html#14.0.0) for C/C++ and [yapf v0.31.0](https://github.com/google/yapf) for Python.
As part of the cleanup process, you should also run `script/make-pretty check` to ensure that your code passes the baseline code style checks.
-189
View File
@@ -1,189 +0,0 @@
#
# Copyright (c) 2016, The OpenThread Authors.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# 3. Neither the name of the copyright holder nor the
# names of its contributors may be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
include $(abs_top_nlbuild_autotools_dir)/automake/pre.am
AM_MAKEFLAGS = --no-print-directory
AM_DISTCHECK_CONFIGURE_FLAGS = \
--enable-address-sanitizer \
--enable-cli \
--enable-ftd \
--enable-mtd \
--enable-ncp \
--enable-radio-only \
--enable-radio-cli \
--with-examples=simulation \
$(NULL)
SUBDIRS = \
include \
third_party \
src \
examples \
tests \
tools \
doc \
$(NULL)
EXTRA_DIST = \
.default-version \
bootstrap \
etc \
README.md \
NOTICE \
CONTRIBUTING.md \
LICENSE \
$(NULL)
BUILT_SOURCES = \
.local-version \
$(NULL)
dist_doc_DATA = \
$(NULL)
DISTCLEANFILES = \
.local-version \
$(NULL)
# Ignore the pseudo flash files on Posix platform during diskcheck
distcleancheck_listfiles = \
$(AM_V_at)find . -type f -name "*flash"
#
# Package version files:
#
# .default-version - The default package version. This file is ALWAYS checked
# in and should always represent the current baseline
# version of the package.
#
# .dist-version - The distributed package version. This file is NEVER
# checked in within the upstream repository, is auto-
# generated, and is only found in the package distribution.
#
# .local-version - The current source code controlled package version. This
# file is NEVER checked in within the upstream repository,
# is auto-generated, and can always be found in both the
# build tree and distribution.
#
# When present, the .local-version file is preferred first, the
# .dist-version second, and the .default-version last.
#
VERSION_FILE := $(if $(wildcard $(builddir)/.local-version),$(builddir)/.local-version,$(if $(wildcard $(srcdir)/.dist-version),$(srcdir)/.dist-version,$(srcdir)/.default-version))
#
# Override autotool's default notion of the package version variables.
# This ensures that when we create a source distribution that the
# version is always the current version, not the version when the
# package was bootstrapped.
#
OPENTHREAD_VERSION ?= $(shell cat $(VERSION_FILE) 2> /dev/null)
PACKAGE_VERSION = $(OPENTHREAD_VERSION)
VERSION = $(PACKAGE_VERSION)
distdir = $(PACKAGE)-$(shell \
if [ "$(origin OPENTHREAD_VERSION)" != "file" ]; then \
echo "$(OPENTHREAD_VERSION)" ; \
else \
$(abs_top_nlbuild_autotools_dir)/scripts/mkversion \
-b "$(OPENTHREAD_VERSION)" "$(top_srcdir)"; \
fi )
#
# check-file-.local-version
#
# Speculatively regenerate .local-version and check to see if it needs
# to be updated.
#
# If OPENTHREAD_VERSION has been supplied anywhere other than in this file
# (which is implicitly the contents of .local-version), then use that;
# otherwise, attempt to generate it from the SCM system.
#
# This is called from $(call check-file,.local-version).
#
define check-file-.local-version
if [ "$(origin OPENTHREAD_VERSION)" != "file" ]; then \
echo "$(OPENTHREAD_VERSION)" > "$(2)"; \
else \
$(abs_top_nlbuild_autotools_dir)/scripts/mkversion \
-b "$(OPENTHREAD_VERSION)" "$(top_srcdir)" \
> "$(2)"; \
fi
endef
#
# check-file-.dist-version
#
# Speculatively regenerate .dist-version and check to see if it needs
# to be updated.
#
# This is called from $(call check-file,.dist-version).
#
define check-file-.dist-version
cat "$(1)" > "$(2)"
endef
#
# A convenience target to allow package users to easily rerun the
# package configuration according to the current configuration.
#
.PHONY: reconfigure
reconfigure: $(builddir)/config.status
$(AM_V_at)$(<) --recheck
#
# Version file regeneration rules.
#
.PHONY: force
$(builddir)/.local-version: $(srcdir)/.default-version force
$(distdir)/.dist-version: $(builddir)/.local-version force
$(distdir)/.dist-version $(builddir)/.local-version:
$(call check-file,$(@F))
dist distcheck: $(BUILT_SOURCES)
dist-hook: $(distdir)/.dist-version
#
# Top-level convenience target for making a documentation-only
# distribution whose results appear at the top level of the build tree
# in the same fashion that the distribution would be for 'make dist'.
#
.PHONY: docdist
docdist: $(BUILT_SOURCES)
$(MAKE) -C doc docdistdir=$(abs_builddir) $(@)
include $(abs_top_nlbuild_autotools_dir)/automake/post.am
+2 -4
View File
@@ -1,4 +1,4 @@
[![OpenThread][ot-logo]][ot-repo] [![Build][ot-gh-action-build-svg]][ot-gh-action-build] [![Simulation][ot-gh-action-simulation-svg]][ot-gh-action-simulation] [![Docker][ot-gh-action-docker-svg]][ot-gh-action-docker] [![Language grade: C/C++][ot-lgtm-svg]][ot-lgtm] [![Coverage Status][ot-codecov-svg]][ot-codecov]
[![OpenThread][ot-logo]][ot-repo] [![Build][ot-gh-action-build-svg]][ot-gh-action-build] [![Simulation][ot-gh-action-simulation-svg]][ot-gh-action-simulation] [![Docker][ot-gh-action-docker-svg]][ot-gh-action-docker] [![Coverage Status][ot-codecov-svg]][ot-codecov]
---
@@ -22,14 +22,12 @@ More information about Thread can be found at [threadgroup.org](http://threadgro
[ot-gh-action-simulation-svg]: https://github.com/openthread/openthread/workflows/Simulation/badge.svg?branch=main&event=push
[ot-gh-action-docker]: https://github.com/openthread/openthread/actions?query=workflow%3ADocker+branch%3Amain+event%3Apush
[ot-gh-action-docker-svg]: https://github.com/openthread/openthread/workflows/Docker/badge.svg?branch=main&event=push
[ot-lgtm]: https://lgtm.com/projects/g/openthread/openthread/context:cpp
[ot-lgtm-svg]: https://img.shields.io/lgtm/grade/cpp/g/openthread/openthread.svg?logo=lgtm&logoWidth=18
[ot-codecov]: https://codecov.io/gh/openthread/openthread
[ot-codecov-svg]: https://codecov.io/gh/openthread/openthread/branch/main/graph/badge.svg
# Who supports OpenThread?
<a href="https://www.amazon.com/"><img src="https://github.com/openthread/openthread/raw/main/doc/images/ot-contrib-amazon.png" alt="Amazon" width="200px"></a><a href="https://www.arm.com/"><img src="https://github.com/openthread/openthread/raw/main/doc/images/ot-contrib-arm.png" alt="ARM" width="200px"></a><a href="https://www.cascoda.com/"><img src="https://github.com/openthread/openthread/raw/main/doc/images/ot-contrib-cascoda.png" alt="Cascoda" width="200px"></a><a href="https://www.eero.com/"><img src="https://github.com/openthread/openthread/raw/main/doc/images/ot-contrib-eero.png" alt="Eero" width="200px"></a><a href="https://www.espressif.com/"><img src="https://github.com/openthread/openthread/raw/main/doc/images/ot-contrib-espressif-github.png" alt="Espressif" width="200px"></a><a href="https://www.google.com/"><img src="https://github.com/openthread/openthread/raw/main/doc/images/ot-contrib-google.png" alt="Google" width="200px"></a><a href="https://www.infineon.com/"><img src="https://github.com/openthread/openthread/raw/main/doc/images/ot-contrib-infineon.png" alt="Infineon" width="200px"></a><a href="https://mmbnetworks.com/"><img src="https://github.com/openthread/openthread/raw/main/doc/images/ot-contrib-mmb-networks.png" alt="MMB Networks" width="200px"></a><a href="https://www.nanoleaf.me/"><img src="https://github.com/openthread/openthread/raw/main/doc/images/ot-contrib-nanoleaf.png" alt="Nanoleaf" width="200px"></a><a href="http://www.nordicsemi.com/"><img src="https://github.com/openthread/openthread/raw/main/doc/images/ot-contrib-nordic.png" alt="Nordic" width="200px"></a><a href="http://www.nxp.com/"><img src="https://github.com/openthread/openthread/raw/main/doc/images/ot-contrib-nxp.png" alt="NXP" width="200px"></a><a href="http://www.qorvo.com/"><img src="https://github.com/openthread/openthread/raw/main/doc/images/ot-contrib-qorvo.png" alt="Qorvo" width="200px"></a><a href="https://www.qualcomm.com/"><img src="https://github.com/openthread/openthread/raw/main/doc/images/ot-contrib-qc.png" alt="Qualcomm" width="200px"></a><a href="https://www.samsung.com/"><img src="https://github.com/openthread/openthread/raw/main/doc/images/ot-contrib-samsung.png" alt="Samsung" width="200px"></a><a href="https://www.silabs.com/"><img src="https://github.com/openthread/openthread/raw/main/doc/images/ot-contrib-silabs.png" alt="Silicon Labs" width="200px"></a><a href="https://www.st.com/"><img src="https://github.com/openthread/openthread/raw/main/doc/images/ot-contrib-stm.png" alt="STMicroelectronics" width="200px"></a><a href="https://www.synopsys.com/"><img src="https://github.com/openthread/openthread/raw/main/doc/images/ot-contrib-synopsys.png" alt="Synopsys" width="200px"></a><a href="https://www.telink-semi.com/"><img src="https://github.com/openthread/openthread/raw/main/doc/images/ot-contrib-telink-github.png" alt="Telink Semiconductor" width="200px"></a><a href="https://www.ti.com/"><img src="https://github.com/openthread/openthread/raw/main/doc/images/ot-contrib-ti.png" alt="Texas Instruments" width="200px"></a><a href="https://www.zephyrproject.org/"><img src="https://github.com/openthread/openthread/raw/main/doc/images/ot-contrib-zephyr.png" alt="Zephyr Project" width="200px"></a>
<a href="https://www.amazon.com/"><img src="https://github.com/openthread/openthread/raw/main/doc/images/ot-contrib-amazon.png" alt="Amazon" width="200px"></a><a href="https://www.arm.com/"><img src="https://github.com/openthread/openthread/raw/main/doc/images/ot-contrib-arm.png" alt="ARM" width="200px"></a><a href="https://www.cascoda.com/"><img src="https://github.com/openthread/openthread/raw/main/doc/images/ot-contrib-cascoda.png" alt="Cascoda" width="200px"></a><a href="https://www.eero.com/"><img src="https://github.com/openthread/openthread/raw/main/doc/images/ot-contrib-eero.png" alt="Eero" width="200px"></a><a href="https://www.espressif.com/"><img src="https://github.com/openthread/openthread/raw/main/doc/images/ot-contrib-espressif-github.png" alt="Espressif" width="200px"></a><a href="https://www.google.com/"><img src="https://github.com/openthread/openthread/raw/main/doc/images/ot-contrib-google.png" alt="Google" width="200px"></a><a href="https://www.infineon.com/"><img src="https://github.com/openthread/openthread/raw/main/doc/images/ot-contrib-infineon.png" alt="Infineon" width="200px"></a><a href="https://mmbnetworks.com/"><img src="https://github.com/openthread/openthread/raw/main/doc/images/ot-contrib-mmb-networks.png" alt="MMB Networks" width="200px"></a><a href="https://www.nabucasa.com/"><img src="https://github.com/openthread/openthread/raw/main/doc/images/ot-contrib-nabu-casa.png" alt="Nabu Casa" width="200px"></a><a href="https://www.nanoleaf.me/"><img src="https://github.com/openthread/openthread/raw/main/doc/images/ot-contrib-nanoleaf.png" alt="Nanoleaf" width="200px"></a><a href="http://www.nordicsemi.com/"><img src="https://github.com/openthread/openthread/raw/main/doc/images/ot-contrib-nordic.png" alt="Nordic" width="200px"></a><a href="http://www.nxp.com/"><img src="https://github.com/openthread/openthread/raw/main/doc/images/ot-contrib-nxp.png" alt="NXP" width="200px"></a><a href="http://www.qorvo.com/"><img src="https://github.com/openthread/openthread/raw/main/doc/images/ot-contrib-qorvo.png" alt="Qorvo" width="200px"></a><a href="https://www.qualcomm.com/"><img src="https://github.com/openthread/openthread/raw/main/doc/images/ot-contrib-qc.png" alt="Qualcomm" width="200px"></a><a href="https://www.samsung.com/"><img src="https://github.com/openthread/openthread/raw/main/doc/images/ot-contrib-samsung.png" alt="Samsung" width="200px"></a><a href="https://www.silabs.com/"><img src="https://github.com/openthread/openthread/raw/main/doc/images/ot-contrib-silabs.png" alt="Silicon Labs" width="200px"></a><a href="https://www.st.com/"><img src="https://github.com/openthread/openthread/raw/main/doc/images/ot-contrib-stm.png" alt="STMicroelectronics" width="200px"></a><a href="https://www.synopsys.com/"><img src="https://github.com/openthread/openthread/raw/main/doc/images/ot-contrib-synopsys.png" alt="Synopsys" width="200px"></a><a href="https://www.telink-semi.com/"><img src="https://github.com/openthread/openthread/raw/main/doc/images/ot-contrib-telink-github.png" alt="Telink Semiconductor" width="200px"></a><a href="https://www.ti.com/"><img src="https://github.com/openthread/openthread/raw/main/doc/images/ot-contrib-ti.png" alt="Texas Instruments" width="200px"></a><a href="https://www.zephyrproject.org/"><img src="https://github.com/openthread/openthread/raw/main/doc/images/ot-contrib-zephyr.png" alt="Zephyr Project" width="200px"></a>
# Getting started
+1
View File
@@ -0,0 +1 @@
To report a security issue, please use [https://g.co/vulnz](https://g.co/vulnz). We use g.co/vulnz for our intake, and do coordination and disclosure here on GitHub (including using GitHub Security Advisory). The Google Security Team will respond within 5 working days of your report on g.co/vulnz.
+1 -1
View File
@@ -116,7 +116,7 @@
- OpenThread uses `script/make-pretty` to reformat code and enforce code format and style. `script/make-pretty check` build target is included in OpenThread's continuous integration and must pass before a pull request is merged.
- `script/make-pretty` requires [clang-format v9.0.0](https://releases.llvm.org/download.html#9.0.0) for C/C++ and [yapf v0.31.0](https://github.com/google/yapf) for Python.
- `script/make-pretty` requires [clang-format v14.0.0](https://releases.llvm.org/download.html#14.0.0) for C/C++ and [yapf v0.31.0](https://github.com/google/yapf) for Python.
### File Names
-46
View File
@@ -1,46 +0,0 @@
#!/bin/bash
#
# Copyright (c) 2016, The OpenThread Authors.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# 3. Neither the name of the copyright holder nor the
# names of its contributors may be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
# Description:
# This file is a trampoline script to the nlbuild-autotools
# bootstrap script and augments it by providing the path to the
# nlbuild-autotools repository for this project.
#
# Set this to the relative location of nlbuild-autotools to this script
nlbuild_autotools_stem="third_party/nlbuild-autotools/repo"
abs_srcdir=$(cd "$(dirname "${0}")" && pwd)
# filter out knowning information from stderr which is causing GitHub annotation check warnings.
(cd "$abs_srcdir" && exec "$abs_srcdir/$nlbuild_autotools_stem/scripts/bootstrap" -I "$abs_srcdir/$nlbuild_autotools_stem" "${@}") 2> >(
grep -v "installing 'third_party/nlbuild-autotools/repo/third_party/autoconf/missing'" \
| grep -v "installing 'third_party/nlbuild-autotools/repo/third_party/autoconf/compile'" \
| grep -v "installing 'third_party/nlbuild-autotools/repo/third_party/autoconf/depcomp'" 1>&2
)
-1104
View File
File diff suppressed because it is too large Load Diff
+2 -2
View File
@@ -1144,7 +1144,7 @@ HTML_STYLESHEET =
# defined cascading style sheet that is included after the standard style sheets
# created by doxygen. Using this option one can overrule certain style aspects.
# This is preferred over using HTML_STYLESHEET since it does not replace the
# standard style sheet and is therefor more robust against future updates.
# standard style sheet and is therefore more robust against future updates.
# Doxygen will copy the style sheet file to the output directory. For an example
# see the documentation.
# This tag requires that the tag GENERATE_HTML is set to YES.
@@ -2029,7 +2029,7 @@ PREDEFINED = __attribute__(x)=
EXPAND_AS_DEFINED =
# If the SKIP_FUNCTION_MACROS tag is set to YES then doxygen's preprocessor will
# remove all refrences to function-like macros that are alone on a line, have an
# remove all references to function-like macros that are alone on a line, have an
# all uppercase name, and do not end with a semicolon. Such function macros are
# typically used for boiler-plate code, and will confuse the parser if not
# removed.
-128
View File
@@ -1,128 +0,0 @@
#
# Copyright (c) 2016, The OpenThread Authors.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# 3. Neither the name of the copyright holder nor the
# names of its contributors may be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
include $(abs_top_nlbuild_autotools_dir)/automake/pre.am
EXTRA_DIST = \
$(srcdir)/Doxyfile.in \
$(srcdir)/header.html \
$(srcdir)/images/Open-Thread-Logo-200x42.png \
$(srcdir)/images/openthread_logo.png \
$(srcdir)/images/ot-contrib-arm.png \
$(srcdir)/images/ot-contrib-cascoda.png \
$(srcdir)/images/ot-contrib-google.png \
$(srcdir)/images/ot-contrib-nordic.png \
$(srcdir)/images/ot-contrib-nxp.png \
$(srcdir)/images/ot-contrib-qc.png \
$(srcdir)/images/ot-contrib-qorvo.png \
$(srcdir)/images/ot-contrib-samsung.png \
$(srcdir)/images/ot-contrib-silabs.png \
$(srcdir)/images/ot-contrib-stm.png \
$(srcdir)/images/ot-contrib-synopsys.png \
$(srcdir)/images/ot-contrib-ti.png \
$(srcdir)/images/ot-contrib-zephyr.png \
$(srcdir)/ot_api_doc.h \
$(NULL)
#
# Override autotool's default notion of the package version variables.
# This ensures that when we create a doc distribution that the
# version is always the current version, not the version when the
# package was bootstrapped.
#
PACKAGE_VERSION = $(shell cat $(top_builddir)/.local-version)
VERSION = $(PACKAGE_VERSION)
docdistdir ?= .
openthread_docdist_alias = \
$(PACKAGE_TARNAME)-docs
openthread_docdist_name = \
$(openthread_docdist_alias)-$(VERSION)
openthread_docdist_archive = \
$(docdistdir)/$(openthread_docdist_name).tar.gz
CLEANFILES = \
Doxyfile \
$(openthread_docdist_archive) \
$(NULL)
if OPENTHREAD_BUILD_DOCS
openthreaddir = $(includedir)/openthread
dist_openthread_HEADERS = ot_api_doc.h
all-local: html/index.html
#
# We choose to manually transform Doxyfile.in into Doxyfile here in
# the makefile rather than in the configure script so that we can take
# advantage of live, at build time (rather than at configure time),
# updating of the package version number.
#
Doxyfile: $(srcdir)/Doxyfile.in Makefile
$(AM_V_GEN)$(SED) \
-e "s,\@DOXYGEN_USE_DOT\@,$(DOXYGEN_USE_DOT),g" \
-e "s,\@PACKAGE_NAME\@,$(PACKAGE_NAME),g" \
-e "s,\@PACKAGE_VERSION\@,$(PACKAGE_VERSION),g" \
-e "s,\@PERL\@,$(PERL),g" \
-e "s,\@abs_builddir\@,$(abs_builddir),g" \
-e "s,\@abs_srcdir\@,$(abs_srcdir),g" \
-e "s,\@abs_top_builddir\@,$(abs_top_builddir),g" \
-e "s,\@abs_top_srcdir\@,$(abs_top_srcdir),g" \
< "$(srcdir)/Doxyfile.in" > "$(@)"
html/index.html: Doxyfile
$(AM_V_GEN)$(DOXYGEN) $(<)
#
# Addition rules and commands to create a documentation-only
# distribution of openthread
#
$(openthread_docdist_name): html/index.html
$(AM_V_at)rm -f -r $(@)
$(call create-directory)
$(AM_V_at)cp -R html $(@)
$(openthread_docdist_archive): $(openthread_docdist_name)
$(AM_V_at)echo " TAR $(@)"
$(AM_V_at)tardir="$(<)" && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c > "$(@)" && rm -rf $(<)
docdist $(openthread_docdist_alias): $(openthread_docdist_archive)
clean-local:
$(AM_V_at)rm -f -r html
endif # OPENTHREAD_BUILD_DOCS
include $(abs_top_nlbuild_autotools_dir)/automake/post.am
Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

+4 -1
View File
@@ -53,7 +53,7 @@
* @defgroup api-net IPv6 Networking
* @{
*
* @defgroup api-dns DNSv6
* @defgroup api-dns DNS
* @defgroup api-dnssd-server DNS-SD Server
* @defgroup api-icmp6 ICMPv6
* @defgroup api-ip6 IPv6
@@ -139,8 +139,10 @@
* @defgroup api-history-tracker History Tracker
* @defgroup api-jam-detection Jam Detection
* @defgroup api-logging Logging - Thread Stack
* @defgroup api-mesh-diag Mesh Diagnostics
* @defgroup api-ncp Network Co-Processor
* @defgroup api-network-time Network Time Synchronization
* @defgroup api-radio Radio Statistics
* @defgroup api-random-group Random Number Generator
*
* @{
@@ -167,6 +169,7 @@
*
* @defgroup plat-alarm Alarm
* @defgroup plat-crypto Crypto - Platform
* @defgroup plat-dns DNS - Platform
* @defgroup plat-entropy Entropy
* @defgroup plat-factory-diagnostics Factory Diagnostics - Platform
* @defgroup plat-logging Logging - Platform
+82 -5
View File
@@ -34,6 +34,16 @@ option(OT_FTD "enable FTD" ON)
option(OT_MTD "enable MTD" ON)
option(OT_RCP "enable RCP" ON)
option(OT_LINKER_MAP "generate .map files for example apps" ON)
message(STATUS OT_APP_CLI=${OT_APP_CLI})
message(STATUS OT_APP_NCP=${OT_APP_NCP})
message(STATUS OT_APP_RCP=${OT_APP_RCP})
message(STATUS OT_FTD=${OT_FTD})
message(STATUS OT_MTD=${OT_MTD})
message(STATUS OT_RCP=${OT_RCP})
message(STATUS OT_THREAD_VERSION=${OT_THREAD_VERSION})
set(OT_CONFIG_VALUES
""
"ON"
@@ -69,17 +79,21 @@ macro(ot_option name ot_config description)
endif()
endmacro()
ot_option(OT_15_4 OPENTHREAD_CONFIG_RADIO_LINK_IEEE_802_15_4_ENABLE "802.15.4 radio link")
ot_option(OT_ANDROID_NDK OPENTHREAD_CONFIG_ANDROID_NDK_ENABLE "enable android NDK")
ot_option(OT_ANYCAST_LOCATOR OPENTHREAD_CONFIG_TMF_ANYCAST_LOCATOR_ENABLE "anycast locator")
ot_option(OT_ASSERT OPENTHREAD_CONFIG_ASSERT_ENABLE "assert function OT_ASSERT()")
ot_option(OT_BACKBONE_ROUTER OPENTHREAD_CONFIG_BACKBONE_ROUTER_ENABLE "backbone router functionality")
ot_option(OT_BACKBONE_ROUTER_DUA_NDPROXYING OPENTHREAD_CONFIG_BACKBONE_ROUTER_DUA_NDPROXYING_ENABLE "BBR DUA ND Proxy")
ot_option(OT_BACKBONE_ROUTER_MULTICAST_ROUTING OPENTHREAD_CONFIG_BACKBONE_ROUTER_MULTICAST_ROUTING_ENABLE "BBR MR")
ot_option(OT_BORDER_AGENT OPENTHREAD_CONFIG_BORDER_AGENT_ENABLE "border agent")
ot_option(OT_BORDER_AGENT_ID OPENTHREAD_CONFIG_BORDER_AGENT_ID_ENABLE "create and save border agent ID")
ot_option(OT_BORDER_ROUTER OPENTHREAD_CONFIG_BORDER_ROUTER_ENABLE "border router")
ot_option(OT_BORDER_ROUTING OPENTHREAD_CONFIG_BORDER_ROUTING_ENABLE "border routing")
ot_option(OT_BORDER_ROUTING_DHCP6_PD OPENTHREAD_CONFIG_BORDER_ROUTING_DHCP6_PD_ENABLE "dhcpv6 pd support in border routing")
ot_option(OT_BORDER_ROUTING_COUNTERS OPENTHREAD_CONFIG_IP6_BR_COUNTERS_ENABLE "border routing counters")
ot_option(OT_CHANNEL_MANAGER OPENTHREAD_CONFIG_CHANNEL_MANAGER_ENABLE "channel manager")
ot_option(OT_CHANNEL_MONITOR OPENTHREAD_CONFIG_CHANNEL_MONITOR_ENABLE "channel monitor")
ot_option(OT_CHILD_SUPERVISION OPENTHREAD_CONFIG_CHILD_SUPERVISION_ENABLE "child supervision")
ot_option(OT_COAP OPENTHREAD_CONFIG_COAP_API_ENABLE "coap api")
ot_option(OT_COAP_BLOCK OPENTHREAD_CONFIG_COAP_BLOCKWISE_TRANSFER_ENABLE "coap block-wise transfer (RFC7959)")
ot_option(OT_COAP_OBSERVE OPENTHREAD_CONFIG_COAP_OBSERVE_API_ENABLE "coap observe (RFC7641)")
@@ -93,7 +107,9 @@ ot_option(OT_DHCP6_CLIENT OPENTHREAD_CONFIG_DHCP6_CLIENT_ENABLE "DHCP6 client")
ot_option(OT_DHCP6_SERVER OPENTHREAD_CONFIG_DHCP6_SERVER_ENABLE "DHCP6 server")
ot_option(OT_DIAGNOSTIC OPENTHREAD_CONFIG_DIAG_ENABLE "diagnostic")
ot_option(OT_DNS_CLIENT OPENTHREAD_CONFIG_DNS_CLIENT_ENABLE "DNS client")
ot_option(OT_DNS_CLIENT_OVER_TCP OPENTHREAD_CONFIG_DNS_CLIENT_OVER_TCP_ENABLE "Enable dns query over tcp")
ot_option(OT_DNS_DSO OPENTHREAD_CONFIG_DNS_DSO_ENABLE "DNS Stateful Operations (DSO)")
ot_option(OT_DNS_UPSTREAM_QUERY OPENTHREAD_CONFIG_DNS_UPSTREAM_QUERY_ENABLE "Allow sending DNS queries to upstream")
ot_option(OT_DNSSD_SERVER OPENTHREAD_CONFIG_DNSSD_SERVER_ENABLE "DNS-SD server")
ot_option(OT_DUA OPENTHREAD_CONFIG_DUA_ENABLE "Domain Unicast Address (DUA)")
ot_option(OT_ECDSA OPENTHREAD_CONFIG_ECDSA_ENABLE "ECDSA")
@@ -103,21 +119,22 @@ ot_option(OT_HISTORY_TRACKER OPENTHREAD_CONFIG_HISTORY_TRACKER_ENABLE "history t
ot_option(OT_IP6_FRAGM OPENTHREAD_CONFIG_IP6_FRAGMENTATION_ENABLE "ipv6 fragmentation")
ot_option(OT_JAM_DETECTION OPENTHREAD_CONFIG_JAM_DETECTION_ENABLE "jam detection")
ot_option(OT_JOINER OPENTHREAD_CONFIG_JOINER_ENABLE "joiner")
ot_option(OT_LEGACY OPENTHREAD_CONFIG_LEGACY_ENABLE "legacy network")
ot_option(OT_LINK_METRICS_INITIATOR OPENTHREAD_CONFIG_MLE_LINK_METRICS_INITIATOR_ENABLE "link metrics initiator")
ot_option(OT_LINK_METRICS_SUBJECT OPENTHREAD_CONFIG_MLE_LINK_METRICS_SUBJECT_ENABLE "link metrics subject")
ot_option(OT_LINK_RAW OPENTHREAD_CONFIG_LINK_RAW_ENABLE "link raw service")
ot_option(OT_LOG_LEVEL_DYNAMIC OPENTHREAD_CONFIG_LOG_LEVEL_DYNAMIC_ENABLE "dynamic log level control")
ot_option(OT_MAC_FILTER OPENTHREAD_CONFIG_MAC_FILTER_ENABLE "mac filter")
ot_option(OT_MESH_DIAG OPENTHREAD_CONFIG_MESH_DIAG_ENABLE "mesh diag")
ot_option(OT_MESSAGE_USE_HEAP OPENTHREAD_CONFIG_MESSAGE_USE_HEAP_ENABLE "heap allocator for message buffers")
ot_option(OT_MLE_LONG_ROUTES OPENTHREAD_CONFIG_MLE_LONG_ROUTES_ENABLE "MLE long routes extension (experimental)")
ot_option(OT_MLR OPENTHREAD_CONFIG_MLR_ENABLE "Multicast Listener Registration (MLR)")
ot_option(OT_MTD_NETDIAG OPENTHREAD_CONFIG_TMF_NETWORK_DIAG_MTD_ENABLE "TMF network diagnostics on MTDs")
ot_option(OT_MULTIPLE_INSTANCE OPENTHREAD_CONFIG_MULTIPLE_INSTANCE_ENABLE "multiple instances")
ot_option(OT_NAT64_BORDER_ROUTING OPENTHREAD_CONFIG_NAT64_BORDER_ROUTING_ENABLE "border routing NAT64")
ot_option(OT_NAT64_TRANSLATOR OPENTHREAD_CONFIG_NAT64_TRANSLATOR_ENABLE "NAT64 translator support")
ot_option(OT_NEIGHBOR_DISCOVERY_AGENT OPENTHREAD_CONFIG_NEIGHBOR_DISCOVERY_AGENT_ENABLE "neighbor discovery agent")
ot_option(OT_NETDATA_PUBLISHER OPENTHREAD_CONFIG_NETDATA_PUBLISHER_ENABLE "Network Data publisher")
ot_option(OT_NETDIAG_CLIENT OPENTHREAD_CONFIG_TMF_NETDIAG_CLIENT_ENABLE "Network Diagnostic client")
ot_option(OT_OPERATIONAL_DATASET_AUTO_INIT OPENTHREAD_CONFIG_OPERATIONAL_DATASET_AUTO_INIT "operational dataset auto init")
ot_option(OT_OTNS OPENTHREAD_CONFIG_OTNS_ENABLE "OTNS")
ot_option(OT_PING_SENDER OPENTHREAD_CONFIG_PING_SENDER_ENABLE "ping sender" ${OT_APP_CLI})
ot_option(OT_PLATFORM_NETIF OPENTHREAD_CONFIG_PLATFORM_NETIF_ENABLE "platform netif")
@@ -129,6 +146,7 @@ ot_option(OT_SLAAC OPENTHREAD_CONFIG_IP6_SLAAC_ENABLE "SLAAC address")
ot_option(OT_SNTP_CLIENT OPENTHREAD_CONFIG_SNTP_CLIENT_ENABLE "SNTP client")
ot_option(OT_SRP_CLIENT OPENTHREAD_CONFIG_SRP_CLIENT_ENABLE "SRP client")
ot_option(OT_SRP_SERVER OPENTHREAD_CONFIG_SRP_SERVER_ENABLE "SRP server")
ot_option(OT_TCP OPENTHREAD_CONFIG_TCP_ENABLE "TCP")
ot_option(OT_TIME_SYNC OPENTHREAD_CONFIG_TIME_SYNC_ENABLE "time synchronization service")
ot_option(OT_TREL OPENTHREAD_CONFIG_RADIO_LINK_TREL_ENABLE "TREL radio link for Thread over Infrastructure feature")
ot_option(OT_TX_BEACON_PAYLOAD OPENTHREAD_CONFIG_MAC_OUTGOING_BEACON_PAYLOAD_ENABLE "tx beacon payload")
@@ -146,6 +164,53 @@ if(OT_FULL_LOGS)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_LOG_PREPEND_LEVEL=1")
endif()
set(OT_VENDOR_NAME "" CACHE STRING "set the vendor name config")
set_property(CACHE OT_VENDOR_NAME PROPERTY STRINGS ${OT_VENDOR_NAME_VALUES})
string(COMPARE EQUAL "${OT_VENDOR_NAME}" "" is_empty)
if (is_empty)
message(STATUS "OT_VENDOR_NAME=\"\"")
else()
message(STATUS "OT_VENDOR_NAME=\"${OT_VENDOR_NAME}\" --> OPENTHREAD_CONFIG_NET_DIAG_VENDOR_NAME=\"${OT_VENDOR_NAME}\"")
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_NET_DIAG_VENDOR_NAME=\"${OT_VENDOR_NAME}\"")
endif()
set(OT_VENDOR_MODEL "" CACHE STRING "set the vendor model config")
set_property(CACHE OT_VENDOR_MODEL PROPERTY STRINGS ${OT_VENDOR_MODEL_VALUES})
string(COMPARE EQUAL "${OT_VENDOR_MODEL}" "" is_empty)
if (is_empty)
message(STATUS "OT_VENDOR_MODEL=\"\"")
else()
message(STATUS "OT_VENDOR_MODEL=\"${OT_VENDOR_MODEL}\" --> OPENTHREAD_CONFIG_NET_DIAG_VENDOR_MODEL=\"${OT_VENDOR_MODEL}\"")
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_NET_DIAG_VENDOR_MODEL=\"${OT_VENDOR_MODEL}\"")
endif()
set(OT_VENDOR_SW_VERSION "" CACHE STRING "set the vendor sw version config")
set_property(CACHE OT_VENDOR_SW_VERSION PROPERTY STRINGS ${OT_VENDOR_SW_VERSION_VALUES})
string(COMPARE EQUAL "${OT_VENDOR_SW_VERSION}" "" is_empty)
if (is_empty)
message(STATUS "OT_VENDOR_SW_VERSION=\"\"")
else()
message(STATUS "OT_VENDOR_SW_VERSION=\"${OT_VENDOR_SW_VERSION}\" --> OPENTHREAD_CONFIG_NET_DIAG_VENDOR_SW_VERSION=\"${OT_VENDOR_SW_VERSION}\"")
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_NET_DIAG_VENDOR_SW_VERSION=\"${OT_VENDOR_SW_VERSION}\"")
endif()
set(OT_POWER_SUPPLY "" CACHE STRING "set the device power supply config")
set(OT_POWER_SUPPLY_VALUES
""
"BATTERY"
"EXTERNAL"
"EXTERNAL_STABLE"
"EXTERNAL_UNSTABLE"
)
set_property(CACHE OT_POWER_SUPPLY PROPERTY STRINGS ${OT_POWER_SUPPLY_VALUES})
string(COMPARE EQUAL "${OT_POWER_SUPPLY}" "" is_empty)
if (is_empty)
message(STATUS "OT_POWER_SUPPLY=\"\"")
else()
message(STATUS "OT_POWER_SUPPLY=${OT_POWER_SUPPLY} --> OPENTHREAD_CONFIG_DEVICE_POWER_SUPPLY=OT_POWER_SUPPLY_${OT_POWER_SUPPLY}")
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_DEVICE_POWER_SUPPLY=OT_POWER_SUPPLY_${OT_POWER_SUPPLY}")
endif()
set(OT_MLE_MAX_CHILDREN "" CACHE STRING "set maximum number of children")
if(OT_MLE_MAX_CHILDREN MATCHES "^[0-9]+$")
message(STATUS "OT_MLE_MAX_CHILDREN=${OT_MLE_MAX_CHILDREN}")
@@ -162,8 +227,6 @@ else()
message(FATAL_ERROR "Invalid max RCP restoration count: ${OT_RCP_RESTORATION_MAX_COUNT}")
endif()
option(OT_EXCLUDE_TCPLP_LIB "exclude TCPlp library from build")
if(NOT OT_EXTERNAL_MBEDTLS)
set(OT_MBEDTLS mbedtls)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_ENABLE_BUILTIN_MBEDTLS=1")
@@ -183,3 +246,17 @@ if(OT_POSIX_SETTINGS_PATH)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_POSIX_SETTINGS_PATH=${OT_POSIX_SETTINGS_PATH}")
endif()
#-----------------------------------------------------------------------------------------------------------------------
# Check removed/replaced options
macro(ot_removed_option name error)
# This macro checks for a remove option and emits an error
# if the option is set.
get_property(is_set CACHE ${name} PROPERTY VALUE SET)
if (is_set)
message(FATAL_ERROR "Removed option ${name} is set - ${error}")
endif()
endmacro()
ot_removed_option(OT_MTD_NETDIAG "- Use OT_NETDIAG_CLIENT instead - note that server function is always supported")
ot_removed_option(OT_EXCLUDE_TCPLP_LIB "- Use OT_TCP instead, OT_EXCLUDE_TCPLP_LIB is deprecated")
-32
View File
@@ -1,32 +0,0 @@
VERSION=0.1
all: arm32v7_linux x86_linux simulation
arm32v7_linux: arm32v7_ubuntu_wpantund
docker build -t openthread/wpantund_arm32v7_linux arm32v7_ubuntu_wpantund && \
docker push openthread/wpantund_arm32v7_linux && \
docker tag openthread/wpantund_arm32v7_linux openthread/wpantund_arm32v7_linux:$(VERSION) && \
docker push openthread/wpantund_arm32v7_linux:$(VERSION)
x86_linux: x86_ubuntu_wpantund
docker build -t openthread/wpantund_amd64_linux x86_ubuntu_wpantund && \
docker push openthread/wpantund_amd64_linux && \
docker tag openthread/wpantund_amd64_linux openthread/wpantund_amd64_linux:$(VERSION) && \
docker push openthread/wpantund_amd64_linux:$(VERSION)
simulation: ot_simulation
docker build -t openthread/simulation ot_sim && \
docker push openthread/simulation && \
docker tag openthread/simulation openthread/simulation:$(VERSION) && \
docker push openthread/simulation:$(VERSION)
publish_manifest:
docker manifest create openthread/wpantund openthread/wpantund_arm32v7_linux openthread/wpantund_amd64_linux
docker manifest annotate openthread/wpantund openthread/wpantund_arm32v7_linux --os linux --arch arm --variant 7
docker manifest annotate openthread/wpantund openthread/wpantund_amd64_linux --os linux --arch amd64
docker manifest push --purge openthread/wpantund
docker manifest create openthread/wpantund:$(VERSION) openthread/wpantund_arm32v7_linux:$(VERSION) openthread/wpantund_amd64_linux:$(VERSION)
docker manifest annotate openthread/wpantund:$(VERSION) openthread/wpantund_arm32v7_linux:$(VERSION) --os linux --arch arm --variant 7
docker manifest annotate openthread/wpantund:$(VERSION) openthread/wpantund_amd64_linux:$(VERSION) --os linux --arch amd64
docker manifest push --purge openthread/wpantund:$(VERSION)
+2 -1
View File
@@ -1,5 +1,5 @@
# Ubuntu image with tools required to build OpenThread
FROM ubuntu:18.04
FROM ubuntu:22.04
ENV DEBIAN_FRONTEND noninteractive
ENV LANG en_US.UTF-8
@@ -9,6 +9,7 @@ RUN set -x \
&& apt-get install -y locales \
&& localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8 \
&& apt-get --no-install-recommends install -fy \
bzip2 \
git \
ninja-build \
python3 \
+5 -2
View File
@@ -84,6 +84,9 @@ if (openthread_enable_core_config_args) {
# Enable border agent support
openthread_config_border_agent_enable = false
# Enable border agent ID
openthread_config_border_agent_id_enable = false
# Enable border router support
openthread_config_border_router_enable = false
@@ -174,8 +177,8 @@ if (openthread_enable_core_config_args) {
# Enable MLE long routes extension (experimental, breaks Thread conformance]
openthread_config_mle_long_routes_enable = false
# Enable TMF network diagnostics on MTDs
openthread_config_tmf_network_diag_mtd_enable = false
# Enable TMF network diagnostics client
openthread_config_tmf_netdiag_client_enable = false
# Enable multiple instances
openthread_config_multiple_instance_enable = false
-352
View File
@@ -1,352 +0,0 @@
#
# Copyright (c) 2016, The OpenThread Authors.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# 3. Neither the name of the copyright holder nor the
# names of its contributors may be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
# Don't allow this top-level makefile's targets to be built in parallel.
.NOTPARALLEL:
COVERAGE ?= 0
DEBUG ?= 0
# Enable most features by default to cover most code
ANYCAST_LOCATOR ?= 1
BORDER_AGENT ?= 1
BORDER_ROUTER ?= 1
COAP ?= 1
COAP_BLOCK ?= 1
COAP_OBSERVE ?= 1
COAPS ?= 1
COMMISSIONER ?= 1
CHANNEL_MANAGER ?= 1
CHANNEL_MONITOR ?= 1
CHILD_SUPERVISION ?= 1
DATASET_UPDATER ?= 1
DHCP6_CLIENT ?= 1
DHCP6_SERVER ?= 1
DIAGNOSTIC ?= 1
DNS_CLIENT ?= 1
DNS_DSO ?= 1
DNSSD_SERVER ?= 1
ECDSA ?= 1
HISTORY_TRACKER ?= 1
IP6_FRAGM ?= 1
JAM_DETECTION ?= 1
JOINER ?= 1
LEGACY ?= 1
LINK_RAW ?= 1
MAC_FILTER ?= 1
MTD_NETDIAG ?= 1
NEIGHBOR_DISCOVERY_AGENT ?= 1
NETDATA_PUBLISHER ?= 1
PING_SENDER ?= 1
REFERENCE_DEVICE ?= 1
SERVICE ?= 1
SNTP_CLIENT ?= 1
SRP_CLIENT ?= 1
SRP_SERVER ?= 1
UDP_FORWARD ?= 1
COMMONCFLAGS := \
-g \
$(NULL)
# If the user has asserted COVERAGE, alter the configuration options
# accordingly.
configure_OPTIONS = \
--enable-cli \
--enable-ftd \
--enable-mtd \
--enable-ncp \
--enable-radio-only \
--with-examples=simulation \
$(NULL)
# Platform specific switches
ifneq ($(DEBUG),1)
COMMONCFLAGS += \
-O2 \
$(NULL)
endif
ifeq ($(NCP_SPI),1)
COMMONCFLAGS += -DOPENTHREAD_CONFIG_NCP_SPI_ENABLE=1
else
COMMONCFLAGS += -DOPENTHREAD_CONFIG_NCP_HDLC_ENABLE=1
endif # NCP_SPI == 1
ifeq ($(OTNS),1)
VIRTUAL_TIME ?= 1
endif
ifeq ($(VIRTUAL_TIME),1)
COMMONCFLAGS += -DOPENTHREAD_SIMULATION_VIRTUAL_TIME=1
endif
ifeq ($(VIRTUAL_TIME_UART),1)
COMMONCFLAGS += -DOPENTHREAD_SIMULATION_VIRTUAL_TIME_UART=1
endif
ifneq ($(MAX_NETWORK_SIZE),)
COMMONCFLAGS += -DOPENTHREAD_SIMULATION_MAX_NETWORK_SIZE=$(MAX_NETWORK_SIZE)
endif
include $(dir $(abspath $(lastword $(MAKEFILE_LIST))))/common-switches.mk
TopSourceDir := $(dir $(shell readlink $(firstword $(MAKEFILE_LIST))))..
AbsTopSourceDir := $(dir $(realpath $(firstword $(MAKEFILE_LIST))))..
CONFIG_FILE = OPENTHREAD_PROJECT_CORE_CONFIG_FILE='\"openthread-core-simulation-config.h\"'
CONFIG_FILE_PATH = $(AbsTopSourceDir)/examples/platforms/simulation/
COMMONCFLAGS += \
-D$(CONFIG_FILE) \
-I$(CONFIG_FILE_PATH) \
CPPFLAGS += \
$(COMMONCFLAGS) \
$(NULL)
CFLAGS += \
$(COMMONCFLAGS) \
$(NULL)
CXXFLAGS += \
$(COMMONCFLAGS) \
$(NULL)
LDFLAGS += \
$(COMMONCFLAGS) \
$(NULL)
ECHO := @echo
INSTALL := /usr/bin/install
INSTALLFLAGS := -p
LN_S := ln -s
MAKE := make
MKDIR_P := mkdir -p
RM_F := rm -f
BuildJobs ?= 10
BuildPath = build
TopBuildDir = $(BuildPath)
AbsTopBuildDir = $(PWD)/$(TopBuildDir)
ResultPath = output
TopResultDir = $(ResultPath)
AbsTopResultDir = $(PWD)/$(TopResultDir)
TargetTuple = simulation
ifndef BuildJobs
BuildJobs := $(shell getconf _NPROCESSORS_ONLN)
endif
JOBSFLAG := -j$(BuildJobs)
#
# configure-arch <target>
#
# Configure OpenThread for the specified target.
#
# target - The target to configure.
#
define configure-target
$(ECHO) " CONFIG $(1)..."
(cd $(BuildPath)/$(1) && $(AbsTopSourceDir)/configure \
INSTALL="$(INSTALL) $(INSTALLFLAGS)" \
CPPFLAGS="$(CPPFLAGS)" CFLAGS="$(CFLAGS)" CXXFLAGS="$(CXXFLAGS)" LDFLAGS="$(LDFLAGS)" \
--prefix=/ \
--exec-prefix=/$(1) \
$(configure_OPTIONS))
endef # configure-target
#
# build-target <target>
#
# Build the OpenThread intermediate build products for the specified
# target.
#
# target - The target to build.
#
define build-target
$(ECHO) " BUILD $(1)"
$(MAKE) $(JOBSFLAG) -C $(BuildPath)/$(1) --no-print-directory \
all
endef # build-target
#
# check-target <target>
#
# Check (run unit tests) OpenThread for the specified target.
#
# target - The target to check.
#
define check-target
$(ECHO) " CHECK $(1)"
$(MAKE) $(JOBSFLAG) -C $(BuildPath)/$(1) --no-print-directory \
check
endef # check-target
#
# distcheck-target <target>
#
# Check (run unit tests) OpenThread for the specified target.
#
# target - The target to distcheck.
#
define distcheck-target
$(ECHO) " DISTCHECK $(1)"
$(MAKE) $(JOBSFLAG) -C $(BuildPath)/$(1) --no-print-directory \
distcheck
endef # distcheck-target
#
# coverage-target <target>
#
# Generate code coverage from unit tests for OpenThread for the
# specified target.
#
# target - The target to generate code coverage for.
#
define coverage-target
$(ECHO) " COVERAGE $(1)"
$(MAKE) $(JOBSFLAG) -C $(BuildPath)/$(1) --no-print-directory \
coverage
endef # coverage-target
#
# stage-target <target>
#
# Stage (install) the OpenThread final build products for the specified
# target.
#
# target - The target to stage.
#
define stage-target
$(ECHO) " STAGE $(1)"
$(MAKE) $(JOBSFLAG) -C $(BuildPath)/$(1) --no-print-directory \
DESTDIR=$(AbsTopResultDir) \
install
endef # stage-target
#
# TARGET_template <target>
#
# Define macros, targets and rules to configure, build, and stage
# OpenThread for a single target.
#
# target - The target to instantiate the template for.
#
define TARGET_template
CONFIGURE_TARGETS += configure-$(1)
BUILD_TARGETS += do-build-$(1)
CHECK_TARGETS += check-$(1)
DISTCHECK_TARGETS += distcheck-$(1)
COVERAGE_TARGETS += coverage-$(1)
STAGE_TARGETS += stage-$(1)
BUILD_DIRS += $(BuildPath)/$(1)
DIRECTORIES += $(BuildPath)/$(1)
configure-$(1): $(BuildPath)/$(1)/config.status
$(BuildPath)/$(1)/config.status: | $(BuildPath)/$(1)
$$(call configure-target,$(1))
do-build-$(1): configure-$(1)
do-build-$(1):
+$$(call build-target,$(1))
check-$(1): do-build-$(1)
check-$(1):
+$$(call check-target,$(1))
distcheck-$(1): do-build-$(1)
distcheck-$(1):
+$$(call distcheck-target,$(1))
coverage-$(1): do-build-$(1)
coverage-$(1):
+$$(call coverage-target,$(1))
stage-$(1): do-build-$(1)
stage-$(1): | $(TopResultDir)
$$(call stage-target,$(1))
$(1): stage-$(1)
endef # TARGET_template
.DEFAULT_GOAL := all
all: stage
# Instantiate an target-specific build template for the target.
$(eval $(call TARGET_template,$(TargetTuple)))
#
# Common / Finalization
#
configure: $(CONFIGURE_TARGETS)
build: $(BUILD_TARGETS)
check: $(CHECK_TARGETS)
distcheck: $(DISTCHECK_TARGETS)
coverage: $(COVERAGE_TARGETS)
stage: $(STAGE_TARGETS)
DIRECTORIES = $(TopResultDir) $(TopResultDir)/$(TargetTuple)/lib $(BUILD_DIRS)
CLEAN_DIRS = $(TopResultDir) $(BUILD_DIRS)
all: stage
$(DIRECTORIES):
$(ECHO) " MKDIR $@"
@$(MKDIR_P) "$@"
clean:
$(ECHO) " CLEAN"
@$(RM_F) -r $(CLEAN_DIRS)
help:
$(ECHO) "Simply type 'make -f $(firstword $(MAKEFILE_LIST))' to build OpenThread for the following "
$(ECHO) "target:"
$(ECHO) ""
$(ECHO) " $(TargetTuple)"
$(ECHO) ""
-50
View File
@@ -1,50 +0,0 @@
#
# Copyright (c) 2016, The OpenThread Authors.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# 3. Neither the name of the copyright holder nor the
# names of its contributors may be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
include $(abs_top_nlbuild_autotools_dir)/automake/pre.am
# Always package (e.g. for 'make dist') these subdirectories.
DIST_SUBDIRS = \
platforms \
apps \
$(NULL)
# Always build (e.g. for 'make all') these subdirectories.
SUBDIRS = \
platforms \
$(NULL)
if OPENTHREAD_ENABLE_EXAMPLES
SUBDIRS += \
apps \
$(NULL)
endif
include $(abs_top_nlbuild_autotools_dir)/automake/post.am
-74
View File
@@ -1,74 +0,0 @@
# Common switches
OpenThread allows you to [configure](https://openthread.io/guides/build#configuration) the stack for different functionality and behavior. This configuration is based on changing compile-time constants during the build process using common switches listed in `/examples/common-switches.mk`.
This page lists the available common switches with description. Unless stated otherwise, the switches are set to 0 by default. For build command examples, see [build examples](https://openthread.io/guides/build#build_examples).
| Makefile switch | CMake switch | Description |
| --- | --- | --- |
| ANYCAST_LOCATOR | OT_ANYCAST_LOCATOR | Enables anycast locator functionality. |
| BACKBONE_ROUTER | OT_BACKBONE_ROUTER | Enables Backbone Router functionality for Thread 1.2. |
| BIG_ENDIAN | OT_BIG_ENDIAN | Allows the host platform to use big-endian byte order. |
| BORDER_AGENT | OT_BORDER_AGENT | Enables support for border agent. In most cases, enable this switch if you are building On-mesh Commissioner or Border Router with External Commissioning support. |
| BORDER_ROUTER | OT_BORDER_ROUTER | Enables support for Border Router. This switch is usually combined with the BORDER_AGENT and UDP_FORWARD (or PLATFORM_UDP in case of RCP design) switches to build Border Router device. |
| BORDER_ROUTING | OT_BORDER_ROUTING | Enables bi-directional border routing between Thread and Infrastructure networks for Border Router. |
| BUILTIN_MBEDTLS_MANAGEMENT | OT_BUILTIN_MBEDTLS_MANAGEMENT | Enables the built-in mbedTLS management. Enable this switch if the external mbedTLS is used, but mbedTLS memory allocation and debug config should be managed internally by OpenThread. |
| CHANNEL_MANAGER | OT_CHANNEL_MANAGER | Enables support for channel manager. Enable this switch on devices that are supposed to request a Thread network channel change. This switch should be used only with an FTD build. |
| CHANNEL_MONITOR | OT_CHANNEL_MONITOR | Enables support for channel monitor. Enable this switch on devices that are supposed to determine the cleaner channels. |
| CHILD_SUPERVISION | OT_CHILD_SUPERVISION | Enables support for [child supervision](https://openthread.io/guides/build/features/child-supervision). Enable this switch on a parent or child node with custom OpenThread application that manages the supervision, checks timeout intervals, and verifies connectivity between parent and child. |
| COAP | OT_COAP | Enables support for the CoAP API. Enable this switch if you want to control Constrained Application Protocol communication. |
| COAP_OBSERVE | OT_COAP_OBSERVE | Enables support for CoAP Observe (RFC7641) API. |
| COAPS | OT_COAPS | Enables support for the secure CoAP API. Enable this switch if you want to control Constrained Application Protocol Secure (CoAP over DTLS) communication. |
| COMMISSIONER | OT_COMMISSIONER | Enables support for Commissioner. Enable this switch on device that is able to perform Commissioner role. |
| COVERAGE | OT_COVERAGE | Enables the generation of code-coverage instances. |
| CSL_RECEIVER | OT_CSL_RECEIVER | Enables CSL receiver feature for Thread 1.2. |
| DEBUG | not implemented | Allows building debug instance. Code optimization is disabled. |
| DHCP6_CLIENT | OT_DHCP6_CLIENT | Enables support for the DHCP6 client. The device is able to act as typical DHCP client. Enable this switch on a device that is supposed to request networking parameters from the DHCP server. |
| DHCP6_SERVER | OT_DHCP6_SERVER | Enables support for the DHCP6 server. The device is able to act as typical DHCP server. Enable this switch on a device that is supposed to provide networking parameters to devices with DHCP_CLIENT switch enabled. |
| DIAGNOSTIC | OT_DIAGNOSTIC | Enables diagnostic support. Enable this switch on a device that is tested in the factory production stage. |
| DISABLE_BUILTIN_MBEDTLS | not implemented | Disables OpenThread's mbedTLS build. Enable this switch if you do not want to use the built-in mbedTLS and you do not want to manage mbedTLS internally. Enabling this switch will disable support for such features as memory allocation and debug. |
| DISABLE_DOC | not implemented | Disables building of the documentation. |
| DISABLE_EXECUTABLE | not implemented | Disables building of executables. |
| DISABLE_TOOLS | not implemented | Disables building of tools. |
| DEBUG_UART | not implemented | Enables the Debug UART platform feature. |
| DEBUG_UART_LOG | not implemented | Enables the log output for the debug UART. Requires OPENTHREAD_CONFIG_ENABLE_DEBUG_UART to be enabled. |
| DNS_CLIENT | OT_DNS_CLIENT | Enables support for DNS client. Enable this switch on a device that sends a DNS query for AAAA (IPv6) record. |
| DNS_DSO | OT_DNS_DSO | Enables support for DNS Stateful Operations (DSO). |
| DNSSD_SERVER | OT_DNSSD_SERVER | Enables support for DNS-SD server. DNS-SD server use service information from local SRP server to resolve DNS-SD query questions. |
| DUA | OT_DUA | Enables the Domain Unicast Address feature for Thread 1.2. |
| DYNAMIC_LOG_LEVEL | not implemented | Enables the dynamic log level feature. Enable this switch if OpenThread log level is required to be set at runtime. See [Logging guide](https://openthread.io/guides/build/logs) to learn more. |
| ECDSA | OT_ECDSA | Enables support for Elliptic Curve Digital Signature Algorithm. Enable this switch if ECDSA digital signature is used by application. |
| EXCLUDE_TCPLP_LIB | OT_EXCLUDE_TCPLP_LIB | Exclude TCPlp library from the build. |
| EXTERNAL_HEAP | OT_EXTERNAL_HEAP | Enables support for external heap. Enable this switch if the platform uses its own heap. Make sure to specify the external heap Calloc and Free functions to be used by the OpenThread stack. |
| FULL_LOGS | OT_FULL_LOGS | Enables all log levels and regions. This switch sets the log level to OT_LOG_LEVEL_DEBG and turns on all region flags. See [Logging guide](https://openthread.io/guides/build/logs) to learn more. |
| HISTORY_TRACKER | OT_HISTORY_TRACKER | Enables support for History Tracker. |
| IP6_FRAGM | OT_IP6_FRAGM | Enables support for IPv6 fragmentation. |
| JAM_DETECTION | OT_JAM_DETECTION | Enables support for [Jam Detection](https://openthread.io/guides/build/features/jam-detection). Enable this switch if a device requires the ability to detect signal jamming on a specific channel. |
| JOINER | OT_JOINER | Enables [support for Joiner](https://openthread.io/reference/group/api-joiner). Enable this switch on a device that has to be commissioned to join the network. |
| LEGACY | OT_LEGACY | Enables support for legacy network. |
| LINK_RAW | OT_LINK_RAW | Enables the Link Raw service. |
| LOG_OUTPUT | not implemented | Defines if the LOG output is to be created and where it goes. There are several options available: `NONE`, `DEBUG_UART`, `APP`, `PLATFORM_DEFINED` (default). See [Logging guide](https://openthread.io/guides/build/logs) to learn more. |
| MAC_FILTER | OT_MAC_FILTER | Enables support for the MAC filter. |
| MLE_LONG_ROUTES | OT_MLE_LONG_ROUTES | Enables the MLE long routes extension. **Note: Enabling this feature breaks conformance to the Thread Specification.** |
| MLR | OT_MLR | Enables Multicast Listener Registration feature for Thread 1.2. |
| MTD_NETDIAG | OT_MTD_NETDIAG | Enables the TMF network diagnostics on MTDs. |
| MULTIPLE_INSTANCE | OT_MULTIPLE_INSTANCE | Enables multiple OpenThread instances. |
| NAT64_BORDER_ROUTING | OT_NAT64_BORDER_ROUTING | Enables NAT64 border routing support for Border Router. |
| NAT64_TRANSLATOR | OT_NAT64_TRANSLATOR | Enables NAT64 translator for Border Router. |
| NETDATA_PUBLISHER | OT_NETDATA_PUBLISHER | Enables support for Thread Network Data publisher. |
| PING_SENDER | OT_PING_SENDER | Enables support for ping sender. |
| OTNS | OT_OTNS | Enables support for [OpenThread Network Simulator](https://github.com/openthread/ot-ns). Enable this switch if you are building OpenThread for OpenThread Network Simulator. |
| PLATFORM_UDP | OT_PLATFORM_UDP | Enables platform UDP support. |
| REFERENCE_DEVICE | OT_REFERENCE_DEVICE | Enables support for Thread Test Harness reference device. Enable this switch on the reference device during certification. |
| SERVICE | OT_SERVICE | Enables support for injecting Service entries into the Thread Network Data. |
| SETTINGS_RAM | OT_SETTINGS_RAM | Enables volatile-only storage of settings. |
| SLAAC | OT_SLAAC | Enables support for adding auto-configured SLAAC addresses by OpenThread. This feature is enabled by default. |
| SNTP_CLIENT | OT_SNTP_CLIENT | Enables support for SNTP Client. |
| SPINEL_ENCRYPTER_LIBS | not implemented | Specifies library files (absolute paths) for implementing the NCP Spinel Encrypter. |
| SRP_CLIENT | OT_SRP_CLIENT | Enable support for SRP client. |
| SRP_SERVER | OT_SRP_SERVER | Enable support for SRP server. |
| THREAD_VERSION | OT_THREAD_VERSION | Enables the chosen Thread version (1.1 / 1.2 (default)). For example, set to `1.1` for Thread 1.1. |
| TIME_SYNC | OT_TIME_SYNC | Enables the time synchronization service feature. **Note: Enabling this feature breaks conformance to the Thread Specification.** |
| TREL | OT_TREL | Enables TREL radio link for Thread over Infrastructure feature. |
| UDP_FORWARD | OT_UDP_FORWARD | Enables support for UDP forward. Enable this switch on the Border Router device (running on the NCP design) with External Commissioning support to service Thread Commissioner packets on the NCP side. |
| UPTIME | OT_UPTIME | Enables support for tracking OpenThread instance's uptime. |
-57
View File
@@ -1,57 +0,0 @@
#
# Copyright (c) 2016, The OpenThread Authors.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# 3. Neither the name of the copyright holder nor the
# names of its contributors may be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
include $(abs_top_nlbuild_autotools_dir)/automake/pre.am
# Always package (e.g. for 'make dist') these subdirectories.
DIST_SUBDIRS = \
cli \
ncp \
$(NULL)
# Always build (e.g. for 'make all') these subdirectories.
SUBDIRS = \
$(NULL)
if OPENTHREAD_ENABLE_EXECUTABLE
if OPENTHREAD_ENABLE_CLI
SUBDIRS += cli
endif
if OPENTHREAD_ENABLE_NCP
SUBDIRS += ncp
else
if OPENTHREAD_ENABLE_RADIO_ONLY
SUBDIRS += ncp
endif
endif
endif
include $(abs_top_nlbuild_autotools_dir)/automake/post.am
-167
View File
@@ -1,167 +0,0 @@
#
# Copyright (c) 2016, The OpenThread Authors.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# 3. Neither the name of the copyright holder nor the
# names of its contributors may be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
include $(abs_top_nlbuild_autotools_dir)/automake/pre.am
include $(top_srcdir)/examples/platforms/Makefile.platform.am
bin_PROGRAMS = \
$(NULL)
CPPFLAGS_COMMON += \
-I$(top_srcdir)/include \
-I$(top_srcdir)/src \
-I$(top_srcdir)/src/core \
-I$(top_srcdir)/examples/platforms \
$(NULL)
LDADD_COMMON += \
$(top_builddir)/third_party/tcplp/libtcplp.a \
$(NULL)
LDFLAGS_COMMON += \
$(NULL)
LIBTOOLFLAGS_COMMON += \
$(NULL)
SOURCES_COMMON += \
cli_uart.cpp \
main.c \
$(NULL)
if OPENTHREAD_ENABLE_BUILTIN_MBEDTLS
LDADD_COMMON += \
$(top_builddir)/third_party/mbedtls/libmbedcrypto.a \
$(NULL)
endif # OPENTHREAD_ENABLE_BUILTIN_MBEDTLS
if OPENTHREAD_ENABLE_FTD
bin_PROGRAMS += \
ot-cli-ftd \
$(NULL)
endif
ot_cli_ftd_CPPFLAGS = \
$(CPPFLAGS_COMMON) \
$(NULL)
ot_cli_ftd_LDADD = \
$(top_builddir)/src/cli/libopenthread-cli-ftd.a \
$(top_builddir)/src/core/libopenthread-ftd.a \
$(LDADD_COMMON) \
$(top_builddir)/src/core/libopenthread-ftd.a \
$(LDADD_COMMON) \
$(NULL)
ot_cli_ftd_LDFLAGS = \
$(LDFLAGS_COMMON) \
$(NULL)
ot_cli_ftd_LIBTOOLFLAGS = \
$(LIBTOOLFLAGS_COMMON) \
$(NULL)
ot_cli_ftd_SOURCES = \
$(SOURCES_COMMON) \
$(NULL)
if OPENTHREAD_ENABLE_MTD
bin_PROGRAMS += \
ot-cli-mtd \
$(NULL)
endif
ot_cli_mtd_CPPFLAGS = \
$(CPPFLAGS_COMMON) \
$(NULL)
ot_cli_mtd_LDADD = \
$(top_builddir)/src/cli/libopenthread-cli-mtd.a \
$(top_builddir)/src/core/libopenthread-mtd.a \
$(LDADD_COMMON) \
$(top_builddir)/src/core/libopenthread-mtd.a \
$(LDADD_COMMON) \
$(NULL)
ot_cli_mtd_LDFLAGS = \
$(LDFLAGS_COMMON) \
$(NULL)
ot_cli_mtd_LIBTOOLFLAGS = \
$(LIBTOOLFLAGS_COMMON) \
$(NULL)
ot_cli_mtd_SOURCES = \
$(SOURCES_COMMON) \
$(NULL)
if OPENTHREAD_ENABLE_RADIO_CLI
bin_PROGRAMS += \
ot-cli-radio \
$(NULL)
endif
ot_cli_radio_CPPFLAGS = \
$(CPPFLAGS_COMMON) \
$(NULL)
ot_cli_radio_LDADD = \
$(top_builddir)/src/cli/libopenthread-cli-radio.a \
$(top_builddir)/src/core/libopenthread-radio-cli.a \
$(LDADD_COMMON) \
$(top_builddir)/src/core/libopenthread-radio-cli.a \
$(LDADD_COMMON) \
$(NULL)
ot_cli_radio_LDFLAGS = \
$(LDFLAGS_COMMON) \
$(NULL)
ot_cli_radio_LIBTOOLFLAGS = \
$(LIBTOOLFLAGS_COMMON) \
$(NULL)
ot_cli_radio_SOURCES = \
$(SOURCES_COMMON) \
$(NULL)
if OPENTHREAD_ENABLE_LINKER_MAP
ot_cli_ftd_LDFLAGS += -Wl,-Map=ot-cli-ftd.map
ot_cli_mtd_LDFLAGS += -Wl,-Map=ot-cli-mtd.map
ot_cli_radio_LDFLAGS += -Wl,-Map=ot-cli-radio.map
endif
if OPENTHREAD_BUILD_COVERAGE
CPPFLAGS_COMMON += \
-DOPENTHREAD_ENABLE_COVERAGE \
$(NULL)
CLEANFILES = $(wildcard *.gcda *.gcno)
endif # OPENTHREAD_BUILD_COVERAGE
include $(abs_top_nlbuild_autotools_dir)/automake/post.am
+3 -4
View File
@@ -6,8 +6,7 @@ This example application exposes OpenThread configuration and management APIs vi
```bash
$ cd <path-to-openthread>
$ ./bootstrap
$ make -f examples/Makefile-simulation
$ ./script/cmake-build simulation
```
## 2. Start node 1
@@ -15,7 +14,7 @@ $ make -f examples/Makefile-simulation
Spawn the process:
```bash
$ cd <path-to-openthread>/output/<platform>/bin
$ cd <path-to-openthread>/build/simulation/examples/apps/cli
$ ./ot-cli-ftd 1
```
@@ -78,7 +77,7 @@ Done
Spawn the process:
```bash
$ cd <path-to-openthread>/output/<platform>/bin
$ cd <path-to-openthread>/build/simulation/examples/apps/cli
$ ./ot-cli-ftd 2
```
+3 -9
View File
@@ -137,7 +137,7 @@ static void ReceiveTask(const uint8_t *aBuf, uint16_t aBufLength)
static const char sEraseString[] = {'\b', ' ', '\b'};
static const char CRNL[] = {'\r', '\n'};
static uint8_t sLastChar = '\0';
const uint8_t * end;
const uint8_t *end;
end = aBuf + aBufLength;
@@ -368,15 +368,9 @@ exit:
return rval;
}
void otPlatUartReceived(const uint8_t *aBuf, uint16_t aBufLength)
{
ReceiveTask(aBuf, aBufLength);
}
void otPlatUartReceived(const uint8_t *aBuf, uint16_t aBufLength) { ReceiveTask(aBuf, aBufLength); }
void otPlatUartSendDone(void)
{
SendDoneTask();
}
void otPlatUartSendDone(void) { SendDoneTask(); }
extern "C" void otAppCliInit(otInstance *aInstance)
{
+8
View File
@@ -48,5 +48,13 @@ target_link_libraries(ot-cli-ftd PRIVATE
ot-config
)
if(OT_LINKER_MAP)
if("${CMAKE_CXX_COMPILER_ID}" MATCHES "AppleClang")
target_link_libraries(ot-cli-ftd PRIVATE -Wl,-map,ot-cli-ftd.map)
else()
target_link_libraries(ot-cli-ftd PRIVATE -Wl,-Map=ot-cli-ftd.map)
endif()
endif()
install(TARGETS ot-cli-ftd
DESTINATION bin)
+15 -16
View File
@@ -42,7 +42,7 @@
#include "lib/platform/reset_util.h"
/**
* This function initializes the CLI app.
* Initializes the CLI app.
*
* @param[in] aInstance The OpenThread instance structure.
*
@@ -50,21 +50,12 @@
extern void otAppCliInit(otInstance *aInstance);
#if OPENTHREAD_CONFIG_HEAP_EXTERNAL_ENABLE
OT_TOOL_WEAK void *otPlatCAlloc(size_t aNum, size_t aSize)
{
return calloc(aNum, aSize);
}
OT_TOOL_WEAK void *otPlatCAlloc(size_t aNum, size_t aSize) { return calloc(aNum, aSize); }
OT_TOOL_WEAK void otPlatFree(void *aPtr)
{
free(aPtr);
}
OT_TOOL_WEAK void otPlatFree(void *aPtr) { free(aPtr); }
#endif
void otTaskletsSignalPending(otInstance *aInstance)
{
OT_UNUSED_VARIABLE(aInstance);
}
void otTaskletsSignalPending(otInstance *aInstance) { OT_UNUSED_VARIABLE(aInstance); }
#if OPENTHREAD_POSIX && !defined(FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION)
static otError ProcessExit(void *aContext, uint8_t aArgsLength, char *aArgs[])
@@ -85,9 +76,17 @@ static const otCliCommand kCommands[] = {
#if OPENTHREAD_EXAMPLES_SIMULATION
/*
* The CLI command `nodeidfilter` only works for simulation in real time.
*
* It can be used either as an allow list or a deny list. Once the filter is cleared, the first `nodeidfilter allow`
* or `nodeidfilter deny` will determine whether it is set up as an allow or deny list. Subsequent calls should
* use the same sub-command to add new node IDs, e.g., if we first call `nodeidfilter allow` (which sets the filter
* up as an allow list), a subsequent `nodeidfilter deny` will result in `InvalidState` error.
*
* The usage of the command `nodeidfilter`:
* - `nodeidfilter deny <nodeid>`: It denies the connection to a specified node.
* - `nodeidfilter clear`: It restores the filter state to default.
* - `nodeidfilter deny <nodeid>` : It denies the connection to a specified node (use as deny-list).
* - `nodeidfilter allow <nodeid> : It allows the connection to a specified node (use as allow-list).
* - `nodeidfilter clear` : It restores the filter state to default.
* - `nodeidfilter` : Outputs filter mode (allow-list or deny-list) and filtered node IDs.
*/
{"nodeidfilter", ProcessNodeIdFilter},
#endif
@@ -127,7 +126,7 @@ pseudo_reset:
otAppCliInit(instance);
#if OPENTHREAD_POSIX && !defined(FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION)
otCliSetUserCommands(kCommands, OT_ARRAY_LENGTH(kCommands), instance);
IgnoreError(otCliSetUserCommands(kCommands, OT_ARRAY_LENGTH(kCommands), instance));
#endif
while (!otSysPseudoResetWasRequested())
+8
View File
@@ -48,5 +48,13 @@ target_link_libraries(ot-cli-mtd PRIVATE
ot-config
)
if(OT_LINKER_MAP)
if("${CMAKE_CXX_COMPILER_ID}" MATCHES "AppleClang")
target_link_libraries(ot-cli-mtd PRIVATE -Wl,-map,ot-cli-mtd.map)
else()
target_link_libraries(ot-cli-mtd PRIVATE -Wl,-Map=ot-cli-mtd.map)
endif()
endif()
install(TARGETS ot-cli-mtd
DESTINATION bin)
+8
View File
@@ -52,6 +52,14 @@ target_link_libraries(ot-cli-radio PRIVATE
ot-config
)
if(OT_LINKER_MAP)
if("${CMAKE_CXX_COMPILER_ID}" MATCHES "AppleClang")
target_link_libraries(ot-cli-radio PRIVATE -Wl,-map,ot-cli-radio.map)
else()
target_link_libraries(ot-cli-radio PRIVATE -Wl,-Map=ot-cli-radio.map)
endif()
endif()
install(TARGETS ot-cli-radio
DESTINATION bin
)
-200
View File
@@ -1,200 +0,0 @@
#
# Copyright (c) 2016, The OpenThread Authors.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# 3. Neither the name of the copyright holder nor the
# names of its contributors may be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
include $(abs_top_nlbuild_autotools_dir)/automake/pre.am
include $(top_srcdir)/examples/platforms/Makefile.platform.am
bin_PROGRAMS = \
$(NULL)
CPPFLAGS_COMMON += \
-I$(top_srcdir)/include \
-I$(top_srcdir)/src \
-I$(top_srcdir)/src/core \
-I$(top_srcdir)/examples/platforms \
$(NULL)
LDADD_COMMON += \
$(top_builddir)/third_party/tcplp/libtcplp.a \
$(NULL)
LDFLAGS_COMMON += \
$(NULL)
LIBTOOLFLAGS_COMMON += \
$(NULL)
SOURCES_COMMON += \
main.c \
ncp.c \
$(NULL)
LDADD_MBEDTLS = \
$(NULL)
LDADD_MBEDTLS_RADIO = \
$(NULL)
LDADD_DIAG = \
$(NULL)
if OPENTHREAD_ENABLE_BUILTIN_MBEDTLS
LDADD_MBEDTLS += \
$(top_builddir)/third_party/mbedtls/libmbedcrypto.a \
$(NULL)
LDADD_MBEDTLS_RADIO += \
$(top_builddir)/third_party/mbedtls/libmbedcrypto-radio.a \
$(NULL)
endif # OPENTHREAD_ENABLE_BUILTIN_MBEDTLS
if OPENTHREAD_ENABLE_NCP_SPINEL_ENCRYPTER
LDADD_COMMON += \
$(OPENTHREAD_NCP_SPINEL_ENCRYPTER_LIBS) \
$(NULL)
endif # OPENTHREAD_ENABLE_NCP_SPINEL_ENCRYPTER
if OPENTHREAD_ENABLE_NCP
if OPENTHREAD_ENABLE_FTD
bin_PROGRAMS += \
ot-ncp-ftd \
$(NULL)
endif
endif
ot_ncp_ftd_CPPFLAGS = \
$(CPPFLAGS_COMMON) \
$(NULL)
ot_ncp_ftd_LDADD = \
$(top_builddir)/src/ncp/libopenthread-ncp-ftd.a \
$(top_builddir)/src/core/libopenthread-ftd.a \
$(LDADD_COMMON) \
$(LDADD_MBEDTLS) \
$(LDADD_DIAG) \
$(top_builddir)/src/core/libopenthread-ftd.a \
$(LDADD_COMMON) \
$(LDADD_MBEDTLS) \
$(LDADD_DIAG) \
$(NULL)
ot_ncp_ftd_LDFLAGS = \
$(LDFLAGS_COMMON) \
$(NULL)
ot_ncp_ftd_LIBTOOLFLAGS = \
$(LIBTOOLFLAGS_COMMON) \
$(NULL)
ot_ncp_ftd_SOURCES = \
$(SOURCES_COMMON) \
$(NULL)
if OPENTHREAD_ENABLE_NCP
if OPENTHREAD_ENABLE_MTD
bin_PROGRAMS += \
ot-ncp-mtd \
$(NULL)
endif
endif
ot_ncp_mtd_CPPFLAGS = \
$(CPPFLAGS_COMMON) \
$(NULL)
ot_ncp_mtd_LDADD = \
$(top_builddir)/src/ncp/libopenthread-ncp-mtd.a \
$(top_builddir)/src/core/libopenthread-mtd.a \
$(LDADD_COMMON) \
$(LDADD_MBEDTLS) \
$(LDADD_DIAG) \
$(top_builddir)/src/core/libopenthread-mtd.a \
$(LDADD_COMMON) \
$(LDADD_MBEDTLS) \
$(LDADD_DIAG) \
$(NULL)
ot_ncp_mtd_LDFLAGS = \
$(LDFLAGS_COMMON) \
$(NULL)
ot_ncp_mtd_LIBTOOLFLAGS = \
$(LIBTOOLFLAGS_COMMON) \
$(NULL)
ot_ncp_mtd_SOURCES = \
$(SOURCES_COMMON) \
$(NULL)
if OPENTHREAD_ENABLE_RADIO_ONLY
bin_PROGRAMS += \
ot-rcp \
$(NULL)
endif
ot_rcp_CPPFLAGS = \
$(CPPFLAGS_COMMON) \
$(NULL)
ot_rcp_LDADD = \
$(top_builddir)/src/ncp/libopenthread-rcp.a \
$(top_builddir)/src/core/libopenthread-radio.a \
$(LDADD_COMMON) \
$(LDADD_MBEDTLS_RADIO) \
$(top_builddir)/src/core/libopenthread-radio.a \
$(LDADD_COMMON) \
$(LDADD_MBEDTLS_RADIO) \
$(NULL)
ot_rcp_LDFLAGS = \
$(LDFLAGS_COMMON) \
$(NULL)
ot_rcp_LIBTOOLFLAGS = \
$(LIBTOOLFLAGS_COMMON) \
$(NULL)
ot_rcp_SOURCES = \
$(SOURCES_COMMON) \
$(NULL)
if OPENTHREAD_ENABLE_LINKER_MAP
ot_ncp_ftd_LDFLAGS += -Wl,-Map=ot-ncp-ftd.map
ot_ncp_mtd_LDFLAGS += -Wl,-Map=ot-ncp-mtd.map
ot_rcp_LDFLAGS += -Wl,-Map=ot-rcp.map
endif
if OPENTHREAD_BUILD_COVERAGE
CPPFLAGS_COMMON += \
-DOPENTHREAD_ENABLE_COVERAGE \
$(NULL)
CLEANFILES = $(wildcard *.gcda *.gcno)
endif # OPENTHREAD_BUILD_COVERAGE
include $(abs_top_nlbuild_autotools_dir)/automake/post.am
+8
View File
@@ -48,4 +48,12 @@ target_link_libraries(ot-ncp-ftd PRIVATE
ot-config
)
if(OT_LINKER_MAP)
if("${CMAKE_CXX_COMPILER_ID}" MATCHES "AppleClang")
target_link_libraries(ot-ncp-ftd PRIVATE -Wl,-map,ot-ncp-ftd.map)
else()
target_link_libraries(ot-ncp-ftd PRIVATE -Wl,-Map=ot-ncp-ftd.map)
endif()
endif()
install(TARGETS ot-ncp-ftd DESTINATION bin)
+4 -13
View File
@@ -38,7 +38,7 @@
#include "lib/platform/reset_util.h"
/**
* This function initializes the NCP app.
* Initializes the NCP app.
*
* @param[in] aInstance The OpenThread instance structure.
*
@@ -46,21 +46,12 @@
extern void otAppNcpInit(otInstance *aInstance);
#if OPENTHREAD_CONFIG_HEAP_EXTERNAL_ENABLE
OT_TOOL_WEAK void *otPlatCAlloc(size_t aNum, size_t aSize)
{
return calloc(aNum, aSize);
}
OT_TOOL_WEAK void *otPlatCAlloc(size_t aNum, size_t aSize) { return calloc(aNum, aSize); }
OT_TOOL_WEAK void otPlatFree(void *aPtr)
{
free(aPtr);
}
OT_TOOL_WEAK void otPlatFree(void *aPtr) { free(aPtr); }
#endif
void otTaskletsSignalPending(otInstance *aInstance)
{
OT_UNUSED_VARIABLE(aInstance);
}
void otTaskletsSignalPending(otInstance *aInstance) { OT_UNUSED_VARIABLE(aInstance); }
int main(int argc, char *argv[])
{
+8
View File
@@ -48,4 +48,12 @@ target_link_libraries(ot-ncp-mtd PRIVATE
ot-config
)
if(OT_LINKER_MAP)
if("${CMAKE_CXX_COMPILER_ID}" MATCHES "AppleClang")
target_link_libraries(ot-ncp-mtd PRIVATE -Wl,-map,ot-ncp-mtd.map)
else()
target_link_libraries(ot-ncp-mtd PRIVATE -Wl,-Map=ot-ncp-mtd.map)
endif()
endif()
install(TARGETS ot-ncp-mtd DESTINATION bin)
+2 -8
View File
@@ -37,15 +37,9 @@
#if !OPENTHREAD_CONFIG_NCP_SPI_ENABLE
#include "utils/uart.h"
void otPlatUartReceived(const uint8_t *aBuf, uint16_t aBufLength)
{
otNcpHdlcReceive(aBuf, aBufLength);
}
void otPlatUartReceived(const uint8_t *aBuf, uint16_t aBufLength) { otNcpHdlcReceive(aBuf, aBufLength); }
void otPlatUartSendDone(void)
{
otNcpHdlcSendDone();
}
void otPlatUartSendDone(void) { otNcpHdlcSendDone(); }
#endif
#if !OPENTHREAD_ENABLE_NCP_VENDOR_HOOK
+8
View File
@@ -47,4 +47,12 @@ target_link_libraries(ot-rcp PRIVATE
ot-config
)
if(OT_LINKER_MAP)
if("${CMAKE_CXX_COMPILER_ID}" MATCHES "AppleClang")
target_link_libraries(ot-rcp PRIVATE -Wl,-map,ot-rcp.map)
else()
target_link_libraries(ot-rcp PRIVATE -Wl,-Map=ot-rcp.map)
endif()
endif()
install(TARGETS ot-rcp DESTINATION bin)
-399
View File
@@ -1,399 +0,0 @@
#
# Copyright (c) 2016-2017, The OpenThread Authors.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# 3. Neither the name of the copyright holder nor the
# names of its contributors may be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
# OpenThread Features (Makefile default configuration).
ANYCAST_LOCATOR ?= 0
BACKBONE_ROUTER ?= 0
BIG_ENDIAN ?= 0
BORDER_AGENT ?= 0
BORDER_ROUTER ?= 0
BORDER_ROUTING ?= 0
COAP ?= 0
COAP_BLOCK ?= 0
COAP_OBSERVE ?= 0
COAPS ?= 0
COMMISSIONER ?= 0
COVERAGE ?= 0
CHANNEL_MANAGER ?= 0
CHANNEL_MONITOR ?= 0
CHILD_SUPERVISION ?= 0
DATASET_UPDATER ?= 0
DEBUG ?= 0
DHCP6_CLIENT ?= 0
DHCP6_SERVER ?= 0
DIAGNOSTIC ?= 0
DISABLE_DOC ?= 0
DISABLE_TOOLS ?= 0
DNS_CLIENT ?= 0
DNS_DSO ?= 0
DNSSD_SERVER ?= 0
DUA ?= 0
DYNAMIC_LOG_LEVEL ?= 0
ECDSA ?= 0
EXTERNAL_HEAP ?= 0
HISTORY_TRACKER ?= 0
IP6_FRAGM ?= 0
JAM_DETECTION ?= 0
JOINER ?= 0
LEGACY ?= 0
ifeq ($(REFERENCE_DEVICE),1)
LOG_OUTPUT ?= APP
endif
LINK_RAW ?= 0
MAC_FILTER ?= 0
MESSAGE_USE_HEAP ?= 0
MLE_LONG_ROUTES ?= 0
MLR ?= 0
MTD_NETDIAG ?= 0
MULTIPLE_INSTANCE ?= 0
NAT64_BORDER_ROUTING ?= 0
NAT64_TRANSLATOR ?= 0
NEIGHBOR_DISCOVERY_AGENT ?= 0
NETDATA_PUBLISHER ?= 0
OTNS ?= 0
PING_SENDER ?= 1
PLATFORM_UDP ?= 0
REFERENCE_DEVICE ?= 0
SERVICE ?= 0
SETTINGS_RAM ?= 0
# SLAAC is enabled by default
SLAAC ?= 1
SNTP_CLIENT ?= 0
SRP_CLIENT ?= 0
SRP_SERVER ?= 0
THREAD_VERSION ?= 1.3
TIME_SYNC ?= 0
TREL ?= 0
UDP_FORWARD ?= 0
UPTIME ?= 0
RCP_RESTORATION_MAX_COUNT ?= 0
ifeq ($(ANYCAST_LOCATOR),1)
COMMONCFLAGS += -DOPENTHREAD_CONFIG_TMF_ANYCAST_LOCATOR_ENABLE=1
endif
ifeq ($(BACKBONE_ROUTER),1)
COMMONCFLAGS += -DOPENTHREAD_CONFIG_BACKBONE_ROUTER_ENABLE=1
endif
ifeq ($(BIG_ENDIAN),1)
COMMONCFLAGS += -DBYTE_ORDER_BIG_ENDIAN=1
endif
ifeq ($(BORDER_AGENT),1)
COMMONCFLAGS += -DOPENTHREAD_CONFIG_BORDER_AGENT_ENABLE=1
endif
ifeq ($(BORDER_ROUTER),1)
COMMONCFLAGS += -DOPENTHREAD_CONFIG_BORDER_ROUTER_ENABLE=1
endif
ifeq ($(BORDER_ROUTING),1)
COMMONCFLAGS += -DOPENTHREAD_CONFIG_BORDER_ROUTING_ENABLE=1
endif
ifeq ($(NAT64_BORDER_ROUTING),1)
COMMONCFLAGS += -DOPENTHREAD_CONFIG_NAT64_BORDER_ROUTING_ENABLE=1
endif
ifeq ($(NAT64_TRANSLATOR),1)
COMMONCFLAGS += -DOPENTHREAD_CONFIG_NAT64_TRANSLATOR_ENABLE=1
endif
ifeq ($(COAP),1)
COMMONCFLAGS += -DOPENTHREAD_CONFIG_COAP_API_ENABLE=1
endif
ifeq ($(COAPS),1)
COMMONCFLAGS += -DOPENTHREAD_CONFIG_COAP_SECURE_API_ENABLE=1
endif
ifeq ($(COAP_BLOCK),1)
COMMONCFLAGS += -DOPENTHREAD_CONFIG_COAP_BLOCKWISE_TRANSFER_ENABLE=1
endif
ifeq ($(COAP_OBSERVE),1)
COMMONCFLAGS += -DOPENTHREAD_CONFIG_COAP_OBSERVE_API_ENABLE=1
endif
ifeq ($(COMMISSIONER),1)
COMMONCFLAGS += -DOPENTHREAD_CONFIG_COMMISSIONER_ENABLE=1
endif
ifeq ($(COVERAGE),1)
configure_OPTIONS += --enable-coverage
endif
ifeq ($(CHANNEL_MANAGER),1)
COMMONCFLAGS += -DOPENTHREAD_CONFIG_CHANNEL_MANAGER_ENABLE=1
endif
ifeq ($(CHANNEL_MONITOR),1)
COMMONCFLAGS += -DOPENTHREAD_CONFIG_CHANNEL_MONITOR_ENABLE=1
endif
ifeq ($(CHILD_SUPERVISION),1)
COMMONCFLAGS += -DOPENTHREAD_CONFIG_CHILD_SUPERVISION_ENABLE=1
endif
ifeq ($(CSL_RECEIVER),1)
COMMONCFLAGS += -DOPENTHREAD_CONFIG_MAC_CSL_RECEIVER_ENABLE=1
endif
ifeq ($(CSL_AUTO_SYNC),1)
COMMONCFLAGS += -DOPENTHREAD_CONFIG_MAC_CSL_AUTO_SYNC_ENABLE=1
else ifeq ($(CSL_AUTO_SYNC),0)
COMMONCFLAGS += -DOPENTHREAD_CONFIG_MAC_CSL_AUTO_SYNC_ENABLE=0
endif
ifeq ($(CSL_DEBUG),1)
COMMONCFLAGS += -DOPENTHREAD_CONFIG_MAC_CSL_DEBUG_ENABLE=1
endif
ifeq ($(DATASET_UPDATER),1)
COMMONCFLAGS += -DOPENTHREAD_CONFIG_DATASET_UPDATER_ENABLE=1
endif
ifeq ($(DEBUG),1)
configure_OPTIONS += --enable-debug --disable-optimization
endif
ifeq ($(DHCP6_CLIENT),1)
COMMONCFLAGS += -DOPENTHREAD_CONFIG_DHCP6_CLIENT_ENABLE=1
endif
ifeq ($(DHCP6_SERVER),1)
COMMONCFLAGS += -DOPENTHREAD_CONFIG_DHCP6_SERVER_ENABLE=1
endif
ifeq ($(DIAGNOSTIC),1)
COMMONCFLAGS += -DOPENTHREAD_CONFIG_DIAG_ENABLE=1
endif
ifeq ($(DISABLE_DOC),1)
configure_OPTIONS += --disable-docs
endif
ifeq ($(DISABLE_TOOLS),1)
configure_OPTIONS += --disable-tools
endif
ifeq ($(DNS_CLIENT),1)
COMMONCFLAGS += -DOPENTHREAD_CONFIG_DNS_CLIENT_ENABLE=1
endif
ifeq ($(DNS_DSO),1)
COMMONCFLAGS += -DOPENTHREAD_CONFIG_DNS_DSO_ENABLE=1
endif
ifeq ($(DNSSD_SERVER),1)
COMMONCFLAGS += -DOPENTHREAD_CONFIG_DNSSD_SERVER_ENABLE=1
endif
ifeq ($(DUA),1)
COMMONCFLAGS += -DOPENTHREAD_CONFIG_DUA_ENABLE=1
endif
ifeq ($(DYNAMIC_LOG_LEVEL),1)
COMMONCFLAGS += -DOPENTHREAD_CONFIG_LOG_LEVEL_DYNAMIC_ENABLE=1
endif
ifeq ($(ECDSA),1)
COMMONCFLAGS += -DOPENTHREAD_CONFIG_ECDSA_ENABLE=1
endif
ifeq ($(EXTERNAL_HEAP),1)
COMMONCFLAGS += -DOPENTHREAD_CONFIG_HEAP_EXTERNAL_ENABLE=1
endif
ifeq ($(HISTORY_TRACKER),1)
COMMONCFLAGS += -DOPENTHREAD_CONFIG_HISTORY_TRACKER_ENABLE=1
endif
ifeq ($(IP6_FRAGM),1)
COMMONCFLAGS += -DOPENTHREAD_CONFIG_IP6_FRAGMENTATION_ENABLE=1
endif
ifeq ($(JAM_DETECTION),1)
COMMONCFLAGS += -DOPENTHREAD_CONFIG_JAM_DETECTION_ENABLE=1
endif
ifeq ($(JOINER),1)
COMMONCFLAGS += -DOPENTHREAD_CONFIG_JOINER_ENABLE=1
endif
ifeq ($(LEGACY),1)
COMMONCFLAGS += -DOPENTHREAD_CONFIG_LEGACY_ENABLE=1
endif
ifeq ($(LINK_RAW),1)
COMMONCFLAGS += -DOPENTHREAD_CONFIG_LINK_RAW_ENABLE=1
endif
ifeq ($(LINK_METRICS_INITIATOR),1)
COMMONCFLAGS += -DOPENTHREAD_CONFIG_MLE_LINK_METRICS_INITIATOR_ENABLE=1
endif
ifeq ($(LINK_METRICS_SUBJECT),1)
COMMONCFLAGS += -DOPENTHREAD_CONFIG_MLE_LINK_METRICS_SUBJECT_ENABLE=1
endif
ifneq ($(LOG_OUTPUT),)
COMMONCFLAGS += -DOPENTHREAD_CONFIG_LOG_OUTPUT=OPENTHREAD_CONFIG_LOG_OUTPUT_$(LOG_OUTPUT)
endif
ifeq ($(MAC_FILTER),1)
COMMONCFLAGS += -DOPENTHREAD_CONFIG_MAC_FILTER_ENABLE=1
endif
ifeq ($(MESSAGE_USE_HEAP),1)
COMMONCFLAGS += -DOPENTHREAD_CONFIG_MESSAGE_USE_HEAP_ENABLE=1
endif
# Enable MLE long routes extension (experimental, breaks Thread conformance)
ifeq ($(MLE_LONG_ROUTES),1)
COMMONCFLAGS += -DOPENTHREAD_CONFIG_MLE_LONG_ROUTES_ENABLE=1
endif
ifeq ($(MLR),1)
COMMONCFLAGS += -DOPENTHREAD_CONFIG_MLR_ENABLE=1
endif
ifeq ($(MTD_NETDIAG),1)
COMMONCFLAGS += -DOPENTHREAD_CONFIG_TMF_NETWORK_DIAG_MTD_ENABLE=1
endif
ifeq ($(MULTIPLE_INSTANCE),1)
COMMONCFLAGS += -DOPENTHREAD_CONFIG_MULTIPLE_INSTANCE_ENABLE=1
endif
ifeq ($(NEIGHBOR_DISCOVERY_AGENT),1)
COMMONCFLAGS += -DOPENTHREAD_CONFIG_NEIGHBOR_DISCOVERY_AGENT_ENABLE=1
endif
ifeq ($(NETDATA_PUBLISHER),1)
COMMONCFLAGS += -DOPENTHREAD_CONFIG_NETDATA_PUBLISHER_ENABLE=1
endif
ifeq ($(PING_SENDER),1)
COMMONCFLAGS += -DOPENTHREAD_CONFIG_PING_SENDER_ENABLE=1
endif
ifeq ($(PLATFORM_UDP),1)
COMMONCFLAGS += -DOPENTHREAD_CONFIG_PLATFORM_UDP_ENABLE=1
endif
# Enable features only required for reference device during certification.
ifeq ($(REFERENCE_DEVICE),1)
COMMONCFLAGS += -DOPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE=1
endif
ifeq ($(SERVICE),1)
COMMONCFLAGS += -DOPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE=1
endif
ifeq ($(SLAAC),1)
COMMONCFLAGS += -DOPENTHREAD_CONFIG_IP6_SLAAC_ENABLE=1
endif
ifeq ($(SNTP_CLIENT),1)
COMMONCFLAGS += -DOPENTHREAD_CONFIG_SNTP_CLIENT_ENABLE=1
endif
ifeq ($(SRP_CLIENT),1)
COMMONCFLAGS += -DOPENTHREAD_CONFIG_SRP_CLIENT_ENABLE=1
endif
ifeq ($(SRP_SERVER),1)
COMMONCFLAGS += -DOPENTHREAD_CONFIG_SRP_SERVER_ENABLE=1
endif
ifeq ($(THREAD_VERSION),1.1)
COMMONCFLAGS += -DOPENTHREAD_CONFIG_THREAD_VERSION=2
else ifeq ($(THREAD_VERSION),1.2)
COMMONCFLAGS += -DOPENTHREAD_CONFIG_THREAD_VERSION=3
else ifeq ($(THREAD_VERSION),1.3)
COMMONCFLAGS += -DOPENTHREAD_CONFIG_THREAD_VERSION=4
endif
ifeq ($(TIME_SYNC),1)
COMMONCFLAGS += -DOPENTHREAD_CONFIG_TIME_SYNC_ENABLE=1 -DOPENTHREAD_CONFIG_MAC_HEADER_IE_SUPPORT=1
endif
ifeq ($(TREL),1)
COMMONCFLAGS += -DOPENTHREAD_CONFIG_RADIO_LINK_TREL_ENABLE=1
endif
ifeq ($(UDP_FORWARD),1)
COMMONCFLAGS += -DOPENTHREAD_CONFIG_UDP_FORWARD_ENABLE=1
endif
ifeq ($(UPTIME),1)
COMMONCFLAGS += -DOPENTHREAD_CONFIG_UPTIME_ENABLE=1
endif
ifeq ($(DISABLE_BUILTIN_MBEDTLS),1)
configure_OPTIONS += --disable-builtin-mbedtls
endif
ifneq ($(BUILTIN_MBEDTLS_MANAGEMENT),)
COMMONCFLAGS += -DOPENTHREAD_CONFIG_ENABLE_BUILTIN_MBEDTLS_MANAGEMENT=$(BUILTIN_MBEDTLS_MANAGEMENT)
endif
ifeq ($(DISABLE_EXECUTABLE),1)
configure_OPTIONS += --enable-executable=no
endif
ifeq ($(DEBUG_UART),1)
CFLAGS += -DOPENTHREAD_CONFIG_ENABLE_DEBUG_UART=1
CXXFLAGS += -DOPENTHREAD_CONFIG_ENABLE_DEBUG_UART=1
endif
ifeq ($(DEBUG_UART_LOG),1)
CFLAGS += -DOPENTHREAD_CONFIG_LOG_OUTPUT=OPENTHREAD_CONFIG_LOG_OUTPUT_DEBUG_UART
CXXFLAGS += -DOPENTHREAD_CONFIG_LOG_OUTPUT=OPENTHREAD_CONFIG_LOG_OUTPUT_DEBUG_UART
endif
ifeq ($(SETTINGS_RAM),1)
COMMONCFLAGS += -DOPENTHREAD_SETTINGS_RAM=1
endif
ifeq ($(OTNS),1)
COMMONCFLAGS += -DOPENTHREAD_CONFIG_OTNS_ENABLE=1
endif
ifneq ($(SPINEL_ENCRYPTER_LIBS),)
configure_OPTIONS += --with-ncp-spinel-encrypter-libs=$(SPINEL_ENCRYPTER_LIBS)
endif
COMMONCFLAGS += -DOPENTHREAD_SPINEL_CONFIG_RCP_RESTORATION_MAX_COUNT=${RCP_RESTORATION_MAX_COUNT}
ifeq ($(FULL_LOGS),1)
COMMONCFLAGS += -DOPENTHREAD_CONFIG_LOG_LEVEL=OT_LOG_LEVEL_DEBG -DOPENTHREAD_CONFIG_LOG_PREPEND_LEVEL=1
endif
-67
View File
@@ -1,67 +0,0 @@
#
# Copyright (c) 2017, The OpenThread Authors.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# 3. Neither the name of the copyright holder nor the
# names of its contributors may be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
include $(abs_top_nlbuild_autotools_dir)/automake/pre.am
EXTRA_DIST = \
cc1352 \
cc2538 \
cc2652 \
efr32 \
gp712 \
k32w \
kw41z \
nrf528xx \
qpg6095 \
qpg6100 \
qpg7015m \
samr21 \
$(NULL)
# Always package (e.g. for 'make dist') these subdirectories.
DIST_SUBDIRS = \
simulation \
utils \
$(NULL)
# Always build (e.g. for 'make all') these subdirectories.
SUBDIRS = \
utils \
$(NULL)
if OPENTHREAD_PLATFORM_SIMULATION
SUBDIRS += simulation
endif
noinst_HEADERS = \
openthread-system.h \
$(NULL)
include $(abs_top_nlbuild_autotools_dir)/automake/post.am
-46
View File
@@ -1,46 +0,0 @@
#
# Copyright (c) 2017, The OpenThread Authors.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# 3. Neither the name of the copyright holder nor the
# names of its contributors may be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
#
# This utility Makefile is included by the application Makefile.am as follows:
#
# include $(top_srcdir)/examples/platforms/Makefile.platform.am
#
# It will automatically set required flags and libraries to link based on
# the selected platform and feature options set via configure.
#
CPPFLAGS_COMMON = $(NULL)
LDADD_COMMON = $(NULL)
LDFLAGS_COMMON = $(NULL)
SOURCES_COMMON = $(NULL)
LIBTOOLFLAGS_COMMON = --preserve-dup-deps
if OPENTHREAD_EXAMPLES_SIMULATION
include $(top_srcdir)/examples/platforms/simulation/Makefile.platform.am
endif
-1
View File
@@ -1 +0,0 @@
The OpenThread on CC1352 example has moved to https://github.com/openthread/ot-cc13x2-cc26x2
-1
View File
@@ -1 +0,0 @@
The OpenThread on CC2538 example has moved to https://github.com/openthread/ot-cc2538
-1
View File
@@ -1 +0,0 @@
The OpenThread on CC2652 example has moved to https://github.com/openthread/ot-cc13x2-cc26x2
@@ -1 +0,0 @@
The OpenThread on EFR32 example has moved to https://github.com/openthread/ot-efr32
@@ -1 +0,0 @@
The OpenThread on EFR32 example has moved to https://github.com/openthread/ot-efr32
@@ -1 +0,0 @@
The OpenThread on EFR32 example has moved to https://github.com/openthread/ot-efr32
@@ -1 +0,0 @@
The OpenThread on EFR32 example has moved to https://github.com/openthread/ot-efr32
-1
View File
@@ -1 +0,0 @@
The OpenThread on GP712 example has moved to https://github.com/openthread/ot-qorvo
-1
View File
@@ -1 +0,0 @@
The OpenThread on K32W example has moved to https://github.com/openthread/ot-nxp
-1
View File
@@ -1 +0,0 @@
The OpenThread on JN5189 example has moved to https://github.com/openthread/ot-nxp
@@ -1 +0,0 @@
The OpenThread on K32W061 example has moved to https://github.com/openthread/ot-nxp
-1
View File
@@ -1 +0,0 @@
The OpenThread on KW41Z example has moved to https://github.com/openthread/ot-kw41z
@@ -1 +0,0 @@
The OpenThread on nRF528xx example has moved to https://github.com/openthread/ot-nrf528xx
@@ -1 +0,0 @@
The OpenThread on nRF528xx example has moved to https://github.com/openthread/ot-nrf528xx
@@ -1 +0,0 @@
The OpenThread on nRF528xx example has moved to https://github.com/openthread/ot-nrf528xx
+5 -5
View File
@@ -42,7 +42,7 @@ extern "C" {
#endif
/**
* This function performs all platform-specific initialization of OpenThread's drivers.
* Performs all platform-specific initialization of OpenThread's drivers.
*
* @note This function is not called by the OpenThread library. Instead, the system/RTOS should call this function
* when initialization of OpenThread's drivers is most appropriate.
@@ -54,7 +54,7 @@ extern "C" {
void otSysInit(int argc, char *argv[]);
/**
* This function performs all platform-specific deinitialization for OpenThread's drivers.
* Performs all platform-specific deinitialization for OpenThread's drivers.
*
* @note This function is not called by the OpenThread library. Instead, the system/RTOS should call this function
* when deinitialization of OpenThread's drivers is most appropriate.
@@ -63,7 +63,7 @@ void otSysInit(int argc, char *argv[]);
void otSysDeinit(void);
/**
* This function returns true if a pseudo-reset was requested.
* Returns true if a pseudo-reset was requested.
*
* In such a case, the main loop should shut down and re-initialize the OpenThread instance.
*
@@ -74,7 +74,7 @@ void otSysDeinit(void);
bool otSysPseudoResetWasRequested(void);
/**
* This function performs all platform-specific processing for OpenThread's example applications.
* Performs all platform-specific processing for OpenThread's example applications.
*
* @note This function is not called by the OpenThread library. Instead, the system/RTOS should call this function
* in the main loop when processing OpenThread's drivers is most appropriate.
@@ -85,7 +85,7 @@ bool otSysPseudoResetWasRequested(void);
void otSysProcessDrivers(otInstance *aInstance);
/**
* This function is called whenever platform drivers needs processing.
* Is called whenever platform drivers needs processing.
*
* @note This function is not handled by the OpenThread library. Instead, the system/RTOS should handle this function
* and schedule a call to `otSysProcessDrivers()`.
-1
View File
@@ -1 +0,0 @@
The OpenThread on QPG6095 example has moved to https://github.com/openthread/ot-qorvo
-1
View File
@@ -1 +0,0 @@
The OpenThread on QPG6100 example has moved to https://github.com/openthread/ot-qorvo
-1
View File
@@ -1 +0,0 @@
The OpenThread on QPG7015m example has moved to https://github.com/openthread/ot-qorvo
-1
View File
@@ -1 +0,0 @@
The OpenThread on SAMR21 example has moved to https://github.com/openthread/ot-samr21
-82
View File
@@ -1,82 +0,0 @@
#
# Copyright (c) 2016, The OpenThread Authors.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# 3. Neither the name of the copyright holder nor the
# names of its contributors may be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
include $(abs_top_nlbuild_autotools_dir)/automake/pre.am
include $(top_srcdir)/src/lib/common.am
lib_LIBRARIES = libopenthread-simulation.a
libopenthread_simulation_a_CPPFLAGS = \
-I$(top_srcdir)/include \
-I$(top_srcdir)/examples/platforms \
-I$(top_srcdir)/src \
-I$(top_srcdir)/src/core \
-D_GNU_SOURCE \
$(NULL)
PLATFORM_SOURCES = \
alarm.c \
crypto.c \
diag.c \
dso_transport.c \
entropy.c \
flash.c \
infra_if.c \
logging.c \
misc.c \
openthread-core-simulation-config.h \
platform-config.h \
platform-simulation.h \
radio.c \
spi-stubs.c \
system.c \
trel.c \
uart.c \
virtual_time/alarm-sim.c \
virtual_time/platform-sim.c \
$(NULL)
libopenthread_simulation_a_SOURCES = \
$(PLATFORM_SOURCES) \
$(NULL)
Dash = -
libopenthread_simulation_a_LIBADD = \
$(call ot_list_objects,$(top_builddir)/examples/platforms/utils/libopenthread-platform-utils.a) \
$(call ot_list_objects,$(top_builddir)/src/lib/platform/libopenthread-platform.a) \
$(NULL)
if OPENTHREAD_BUILD_COVERAGE
libopenthread_simulation_a_CPPFLAGS += \
-DOPENTHREAD_ENABLE_COVERAGE \
$(NULL)
CLEANFILES = $(wildcard *.gcda *.gcno)
endif # OPENTHREAD_BUILD_COVERAGE
include $(abs_top_nlbuild_autotools_dir)/automake/post.am
+1 -15
View File
@@ -4,20 +4,6 @@ This directory contains example platform drivers for simulation on POSIX.
## Build Examples
### Build using autotools
```bash
$ cd <path-to-openthread>
$ ./bootstrap
$ make -f examples/Makefile-simulation
```
After a successful build, the `elf` files are found in:
- `<path-to-openthread>/output/<platform>/bin`
### Build using cmake/ninja
```bash
$ cd <path-to-openthread>
$ mkdir build && cd build
@@ -35,7 +21,7 @@ After a successful build, the `elf` files are found in:
1. Spawn the process:
```bash
$ cd <path-to-openthread>/output/<platform>/bin
$ cd <path-to-openthread>/build/simulation/examples/apps/cli
$ ./ot-cli-ftd 1
```
+4 -16
View File
@@ -162,10 +162,7 @@ uint64_t platformGetNow(void)
}
#endif // defined(CLOCK_MONOTONIC_RAW) || defined(CLOCK_MONOTONIC)
uint32_t otPlatAlarmMilliGetNow(void)
{
return (uint32_t)(platformGetNow() / US_PER_MS);
}
uint32_t otPlatAlarmMilliGetNow(void) { return (uint32_t)(platformGetNow() / US_PER_MS); }
void otPlatAlarmMilliStartAt(otInstance *aInstance, uint32_t aT0, uint32_t aDt)
{
@@ -182,10 +179,7 @@ void otPlatAlarmMilliStop(otInstance *aInstance)
sIsMsRunning = false;
}
uint32_t otPlatAlarmMicroGetNow(void)
{
return (uint32_t)platformGetNow();
}
uint32_t otPlatAlarmMicroGetNow(void) { return (uint32_t)platformGetNow(); }
void otPlatAlarmMicroStartAt(otInstance *aInstance, uint32_t aT0, uint32_t aDt)
{
@@ -303,14 +297,8 @@ void platformAlarmProcess(otInstance *aInstance)
#endif
}
uint64_t otPlatTimeGet(void)
{
return platformGetNow();
}
uint64_t otPlatTimeGet(void) { return platformGetNow(); }
uint16_t otPlatTimeGetXtalAccuracy(void)
{
return 0;
}
uint16_t otPlatTimeGetXtalAccuracy(void) { return 0; }
#endif // OPENTHREAD_SIMULATION_VIRTUAL_TIME == 0
+2 -2
View File
@@ -38,12 +38,12 @@
// crypto key storage stubs
otError otPlatCryptoImportKey(otCryptoKeyRef * aKeyRef,
otError otPlatCryptoImportKey(otCryptoKeyRef *aKeyRef,
otCryptoKeyType aKeyType,
otCryptoKeyAlgorithm aKeyAlgorithm,
int aKeyUsage,
otCryptoKeyStorage aKeyPersistence,
const uint8_t * aKey,
const uint8_t *aKey,
size_t aKeyLen)
{
OT_UNUSED_VARIABLE(aKeyRef);
+116 -17
View File
@@ -35,8 +35,11 @@
#include <openthread/config.h>
#include <openthread/platform/alarm-milli.h>
#include <openthread/platform/diag.h>
#include <openthread/platform/radio.h>
#include "utils/code_utils.h"
#if OPENTHREAD_CONFIG_DIAG_ENABLE
/**
@@ -45,25 +48,23 @@
*/
static bool sDiagMode = false;
void otPlatDiagModeSet(bool aMode)
enum
{
sDiagMode = aMode;
}
SIM_GPIO = 0,
};
bool otPlatDiagModeGet()
{
return sDiagMode;
}
static otGpioMode sGpioMode = OT_GPIO_MODE_INPUT;
static bool sGpioValue = false;
static uint8_t sRawPowerSetting[OPENTHREAD_CONFIG_POWER_CALIBRATION_RAW_POWER_SETTING_SIZE];
static uint16_t sRawPowerSettingLength = 0;
void otPlatDiagChannelSet(uint8_t aChannel)
{
OT_UNUSED_VARIABLE(aChannel);
}
void otPlatDiagModeSet(bool aMode) { sDiagMode = aMode; }
void otPlatDiagTxPowerSet(int8_t aTxPower)
{
OT_UNUSED_VARIABLE(aTxPower);
}
bool otPlatDiagModeGet(void) { return sDiagMode; }
void otPlatDiagChannelSet(uint8_t aChannel) { OT_UNUSED_VARIABLE(aChannel); }
void otPlatDiagTxPowerSet(int8_t aTxPower) { OT_UNUSED_VARIABLE(aTxPower); }
void otPlatDiagRadioReceived(otInstance *aInstance, otRadioFrame *aFrame, otError aError)
{
@@ -72,9 +73,107 @@ void otPlatDiagRadioReceived(otInstance *aInstance, otRadioFrame *aFrame, otErro
OT_UNUSED_VARIABLE(aError);
}
void otPlatDiagAlarmCallback(otInstance *aInstance)
void otPlatDiagAlarmCallback(otInstance *aInstance) { OT_UNUSED_VARIABLE(aInstance); }
otError otPlatDiagGpioSet(uint32_t aGpio, bool aValue)
{
OT_UNUSED_VARIABLE(aInstance);
otError error = OT_ERROR_NONE;
otEXPECT_ACTION(aGpio == SIM_GPIO, error = OT_ERROR_INVALID_ARGS);
sGpioValue = aValue;
exit:
return error;
}
otError otPlatDiagGpioGet(uint32_t aGpio, bool *aValue)
{
otError error = OT_ERROR_NONE;
otEXPECT_ACTION((aGpio == SIM_GPIO) && (aValue != NULL), error = OT_ERROR_INVALID_ARGS);
*aValue = sGpioValue;
exit:
return error;
}
otError otPlatDiagGpioSetMode(uint32_t aGpio, otGpioMode aMode)
{
otError error = OT_ERROR_NONE;
otEXPECT_ACTION(aGpio == SIM_GPIO, error = OT_ERROR_INVALID_ARGS);
sGpioMode = aMode;
exit:
return error;
}
otError otPlatDiagGpioGetMode(uint32_t aGpio, otGpioMode *aMode)
{
otError error = OT_ERROR_NONE;
otEXPECT_ACTION((aGpio == SIM_GPIO) && (aMode != NULL), error = OT_ERROR_INVALID_ARGS);
*aMode = sGpioMode;
exit:
return error;
}
otError otPlatDiagRadioSetRawPowerSetting(otInstance *aInstance,
const uint8_t *aRawPowerSetting,
uint16_t aRawPowerSettingLength)
{
OT_UNUSED_VARIABLE(aInstance);
otError error = OT_ERROR_NONE;
otEXPECT_ACTION((aRawPowerSetting != NULL) && (aRawPowerSettingLength <= sizeof(sRawPowerSetting)),
error = OT_ERROR_INVALID_ARGS);
memcpy(sRawPowerSetting, aRawPowerSetting, aRawPowerSettingLength);
sRawPowerSettingLength = aRawPowerSettingLength;
exit:
return error;
}
otError otPlatDiagRadioGetRawPowerSetting(otInstance *aInstance,
uint8_t *aRawPowerSetting,
uint16_t *aRawPowerSettingLength)
{
OT_UNUSED_VARIABLE(aInstance);
otError error = OT_ERROR_NONE;
otEXPECT_ACTION((aRawPowerSetting != NULL) && (aRawPowerSettingLength != NULL), error = OT_ERROR_INVALID_ARGS);
otEXPECT_ACTION((sRawPowerSettingLength != 0), error = OT_ERROR_NOT_FOUND);
otEXPECT_ACTION((sRawPowerSettingLength <= *aRawPowerSettingLength), error = OT_ERROR_INVALID_ARGS);
memcpy(aRawPowerSetting, sRawPowerSetting, sRawPowerSettingLength);
*aRawPowerSettingLength = sRawPowerSettingLength;
exit:
return error;
}
otError otPlatDiagRadioRawPowerSettingEnable(otInstance *aInstance, bool aEnable)
{
OT_UNUSED_VARIABLE(aInstance);
OT_UNUSED_VARIABLE(aEnable);
return OT_ERROR_NONE;
}
otError otPlatDiagRadioTransmitCarrier(otInstance *aInstance, bool aEnable)
{
OT_UNUSED_VARIABLE(aInstance);
OT_UNUSED_VARIABLE(aEnable);
return OT_ERROR_NONE;
}
otError otPlatDiagRadioTransmitStream(otInstance *aInstance, bool aEnable)
{
OT_UNUSED_VARIABLE(aInstance);
OT_UNUSED_VARIABLE(aEnable);
return OT_ERROR_NONE;
}
#endif // OPENTHREAD_CONFIG_DIAG_ENABLE
+1 -1
View File
@@ -93,7 +93,7 @@ otError otPlatEntropyGet(uint8_t *aOutput, uint16_t aOutputLength)
#if __SANITIZE_ADDRESS__ == 0
FILE * file = NULL;
FILE *file = NULL;
size_t readLength;
otEXPECT_ACTION(aOutput && aOutputLength, error = OT_ERROR_INVALID_ARGS);
+3 -3
View File
@@ -41,7 +41,7 @@ bool otPlatInfraIfHasAddress(uint32_t aInfraIfIndex, const otIp6Address *aAddres
otError otPlatInfraIfSendIcmp6Nd(uint32_t aInfraIfIndex,
const otIp6Address *aDestAddress,
const uint8_t * aBuffer,
const uint8_t *aBuffer,
uint16_t aBufferLength)
{
OT_UNUSED_VARIABLE(aInfraIfIndex);
@@ -49,13 +49,13 @@ otError otPlatInfraIfSendIcmp6Nd(uint32_t aInfraIfIndex,
OT_UNUSED_VARIABLE(aBuffer);
OT_UNUSED_VARIABLE(aBufferLength);
return OT_ERROR_FAILED;
return OT_ERROR_NONE;
}
otError otPlatInfraIfDiscoverNat64Prefix(uint32_t aInfraIfIndex)
{
OT_UNUSED_VARIABLE(aInfraIfIndex);
return OT_ERROR_FAILED;
return OT_ERROR_NONE;
}
#endif
+71 -9
View File
@@ -31,6 +31,7 @@
#include <openthread/config.h>
#include <ctype.h>
#include <errno.h>
#include <inttypes.h>
#include <stdarg.h>
#include <stdint.h>
@@ -44,21 +45,82 @@
#include "utils/code_utils.h"
#if (OPENTHREAD_CONFIG_LOG_OUTPUT == OPENTHREAD_CONFIG_LOG_OUTPUT_PLATFORM_DEFINED)
OT_TOOL_WEAK void otPlatLog(otLogLevel aLogLevel, otLogRegion aLogRegion, const char *aFormat, ...)
static FILE *sLogFile = NULL;
void platformLoggingSetFileName(const char *aName)
{
if (sLogFile != NULL)
{
fclose(sLogFile);
}
sLogFile = fopen(aName, "wt");
if (sLogFile == NULL)
{
fprintf(stderr, "Failed to open log file '%s': %s\r\n", aName, strerror(errno));
exit(EXIT_FAILURE);
}
}
void platformLoggingInit(const char *aName)
{
if (sLogFile == NULL)
{
openlog(aName, LOG_PID, LOG_USER);
setlogmask(setlogmask(0) & LOG_UPTO(LOG_NOTICE));
}
else
{
fprintf(sLogFile, "OpenThread logs\r\n");
fprintf(sLogFile, "- Program: %s\r\n", aName);
fprintf(sLogFile, "- Platform: simulation\r\n");
fprintf(sLogFile, "- Node ID: %lu\r\n", (unsigned long)gNodeId);
fprintf(sLogFile, "\r\n");
}
}
void platformLoggingDeinit(void)
{
if (sLogFile != NULL)
{
fclose(sLogFile);
sLogFile = NULL;
}
}
void otPlatLog(otLogLevel aLogLevel, otLogRegion aLogRegion, const char *aFormat, ...)
{
OT_UNUSED_VARIABLE(aLogLevel);
OT_UNUSED_VARIABLE(aLogRegion);
char logString[512];
int offset;
va_list args;
offset = snprintf(logString, sizeof(logString), "[%d]", gNodeId);
va_start(args, aFormat);
vsnprintf(&logString[offset], sizeof(logString) - (uint16_t)offset, aFormat, args);
va_end(args);
syslog(LOG_CRIT, "%s", logString);
if (sLogFile == NULL)
{
char logString[512];
int offset;
offset = snprintf(logString, sizeof(logString), "[%lu]", (unsigned long)gNodeId);
vsnprintf(&logString[offset], sizeof(logString) - (uint16_t)offset, aFormat, args);
syslog(LOG_CRIT, "%s", logString);
}
else
{
vfprintf(sLogFile, aFormat, args);
fprintf(sLogFile, "\r\n");
}
va_end(args);
}
#endif
#else
void platformLoggingInit(const char *aName) { OT_UNUSED_VARIABLE(aName); }
void platformLoggingDeinit(void) {}
#endif // (OPENTHREAD_CONFIG_LOG_OUTPUT == OPENTHREAD_CONFIG_LOG_OUTPUT_PLATFORM_DEFINED)
@@ -257,7 +257,7 @@
/**
* @def OPENTHREAD_CONFIG_DETERMINISTIC_ECDSA_ENABLE
*
* Define to 1 to generate ECDSA signatures determinsitically
* Define to 1 to generate ECDSA signatures deterministically
* according to RFC 6979 instead of randomly.
*
*/
@@ -265,4 +265,35 @@
#define OPENTHREAD_CONFIG_DETERMINISTIC_ECDSA_ENABLE 1
#endif
/**
* @def OPENTHREAD_CONFIG_POWER_CALIBRATION_ENABLE
*
* Define as 1 to enable power calibration support.
*
*/
#ifndef OPENTHREAD_CONFIG_POWER_CALIBRATION_ENABLE
#define OPENTHREAD_CONFIG_POWER_CALIBRATION_ENABLE 1
#endif
/**
* @def OPENTHREAD_CONFIG_PLATFORM_POWER_CALIBRATION_ENABLE
*
* Define as 1 to enable platform power calibration support.
*
*/
#ifndef OPENTHREAD_CONFIG_PLATFORM_POWER_CALIBRATION_ENABLE
#define OPENTHREAD_CONFIG_PLATFORM_POWER_CALIBRATION_ENABLE 1
#endif
/**
* @def OPENTHREAD_CONFIG_RADIO_STATS_ENABLE
*
* Set to 1 to enable support for Radio Statistics. Note that this option only works for OPENTHREAD_FTD and
* OPENTHREAD_MTD.
*
*/
#ifndef OPENTHREAD_CONFIG_RADIO_STATS_ENABLE
#define OPENTHREAD_CONFIG_RADIO_STATS_ENABLE 1
#endif
#endif // OPENTHREAD_CORE_SIMULATION_CONFIG_H_
@@ -91,13 +91,13 @@ enum
extern uint32_t gNodeId;
/**
* This function initializes the alarm service used by OpenThread.
* Initializes the alarm service used by OpenThread.
*
*/
void platformAlarmInit(uint32_t aSpeedUpFactor);
/**
* This function retrieves the time remaining until the alarm fires.
* Retrieves the time remaining until the alarm fires.
*
* @param[out] aTimeout A pointer to the timeval struct.
*
@@ -105,7 +105,7 @@ void platformAlarmInit(uint32_t aSpeedUpFactor);
void platformAlarmUpdateTimeout(struct timeval *aTimeout);
/**
* This function performs alarm driver processing.
* Performs alarm driver processing.
*
* @param[in] aInstance The OpenThread instance structure.
*
@@ -113,7 +113,7 @@ void platformAlarmUpdateTimeout(struct timeval *aTimeout);
void platformAlarmProcess(otInstance *aInstance);
/**
* This function returns the duration to the next alarm event time (in micro seconds)
* Returns the duration to the next alarm event time (in micro seconds)
*
* @returns The duration (in micro seconds) to the next alarm event.
*
@@ -121,7 +121,7 @@ void platformAlarmProcess(otInstance *aInstance);
uint64_t platformAlarmGetNext(void);
/**
* This function returns the current alarm time.
* Returns the current alarm time.
*
* @returns The current alarm time.
*
@@ -129,7 +129,7 @@ uint64_t platformAlarmGetNext(void);
uint64_t platformAlarmGetNow(void);
/**
* This function advances the alarm time by @p aDelta.
* Advances the alarm time by @p aDelta.
*
* @param[in] aDelta The amount of time to advance.
*
@@ -137,19 +137,19 @@ uint64_t platformAlarmGetNow(void);
void platformAlarmAdvanceNow(uint64_t aDelta);
/**
* This function initializes the radio service used by OpenThread.
* Initializes the radio service used by OpenThread.
*
*/
void platformRadioInit(void);
/**
* This function shuts down the radio service used by OpenThread.
* Shuts down the radio service used by OpenThread.
*
*/
void platformRadioDeinit(void);
/**
* This function inputs a received radio frame.
* Inputs a received radio frame.
*
* @param[in] aInstance A pointer to the OpenThread instance.
* @param[in] aBuf A pointer to the received radio frame.
@@ -159,7 +159,7 @@ void platformRadioDeinit(void);
void platformRadioReceive(otInstance *aInstance, uint8_t *aBuf, uint16_t aBufLength);
/**
* This function updates the file descriptor sets with file descriptors used by the radio driver.
* Updates the file descriptor sets with file descriptors used by the radio driver.
*
* @param[in,out] aReadFdSet A pointer to the read file descriptors.
* @param[in,out] aWriteFdSet A pointer to the write file descriptors.
@@ -170,7 +170,7 @@ void platformRadioReceive(otInstance *aInstance, uint8_t *aBuf, uint16_t aBufLen
void platformRadioUpdateFdSet(fd_set *aReadFdSet, fd_set *aWriteFdSet, struct timeval *aTimeout, int *aMaxFd);
/**
* This function performs radio driver processing.
* Performs radio driver processing.
*
* @param[in] aInstance The OpenThread instance structure.
* @param[in] aReadFdSet A pointer to the read file descriptors.
@@ -180,13 +180,35 @@ void platformRadioUpdateFdSet(fd_set *aReadFdSet, fd_set *aWriteFdSet, struct ti
void platformRadioProcess(otInstance *aInstance, const fd_set *aReadFdSet, const fd_set *aWriteFdSet);
/**
* This function initializes the random number service used by OpenThread.
* Initializes the random number service used by OpenThread.
*
*/
void platformRandomInit(void);
/**
* This function updates the file descriptor sets with file descriptors used by the UART driver.
* This functions set the file name to use for logging.
*
* @param[in] aName The file name.
*
*/
void platformLoggingSetFileName(const char *aName);
/**
* Initializes the platform logging service.
*
* @param[in] aName The log module name to set with syslog.
*
*/
void platformLoggingInit(const char *aName);
/**
* Finalizes the platform logging service.
*
*/
void platformLoggingDeinit(void);
/**
* Updates the file descriptor sets with file descriptors used by the UART driver.
*
* @param[in,out] aReadFdSet A pointer to the read file descriptors.
* @param[in,out] aWriteFdSet A pointer to the write file descriptors.
@@ -196,19 +218,19 @@ void platformRandomInit(void);
void platformUartUpdateFdSet(fd_set *aReadFdSet, fd_set *aWriteFdSet, fd_set *aErrorFdSet, int *aMaxFd);
/**
* This function performs radio driver processing.
* Performs radio driver processing.
*
*/
void platformUartProcess(void);
/**
* This function restores the Uart.
* Restores the Uart.
*
*/
void platformUartRestore(void);
/**
* This function sends a simulation event.
* Sends a simulation event.
*
* @param[in] aEvent A pointer to the simulation event to send
*
@@ -216,7 +238,7 @@ void platformUartRestore(void);
void otSimSendEvent(const struct Event *aEvent);
/**
* This function sends Uart data through simulation.
* Sends Uart data through simulation.
*
* @param[in] aData A pointer to the UART data.
* @param[in] aLength Length of UART data.
@@ -225,7 +247,7 @@ void otSimSendEvent(const struct Event *aEvent);
void otSimSendUartWriteEvent(const uint8_t *aData, uint16_t aLength);
/**
* This function checks if radio transmitting is pending.
* Checks if radio transmitting is pending.
*
* @returns Whether radio transmitting is pending.
*
@@ -233,7 +255,7 @@ void otSimSendUartWriteEvent(const uint8_t *aData, uint16_t aLength);
bool platformRadioIsTransmitPending(void);
/**
* This function parses an environment variable as an unsigned 16-bit integer.
* Parses an environment variable as an unsigned 16-bit integer.
*
* If the environment variable does not exist, this function does nothing.
* If it is not a valid integer, this function will terminate the process with an error message.
@@ -247,7 +269,7 @@ void parseFromEnvAsUint16(const char *aEnvName, uint16_t *aValue);
#if OPENTHREAD_CONFIG_RADIO_LINK_TREL_ENABLE
/**
* This function initializes the TREL service.
* Initializes the TREL service.
*
* @param[in] aSpeedUpFactor The time speed-up factor.
*
@@ -255,13 +277,13 @@ void parseFromEnvAsUint16(const char *aEnvName, uint16_t *aValue);
void platformTrelInit(uint32_t aSpeedUpFactor);
/**
* This function shuts down the TREL service.
* Shuts down the TREL service.
*
*/
void platformTrelDeinit(void);
/**
* This function updates the file descriptor sets with file descriptors used by the TREL.
* Updates the file descriptor sets with file descriptors used by the TREL.
*
* @param[in,out] aReadFdSet A pointer to the read file descriptors.
* @param[in,out] aWriteFdSet A pointer to the write file descriptors.
@@ -272,7 +294,7 @@ void platformTrelDeinit(void);
void platformTrelUpdateFdSet(fd_set *aReadFdSet, fd_set *aWriteFdSet, struct timeval *aTimeout, int *aMaxFd);
/**
* This function performs TREL processing.
* Performs TREL processing.
*
* @param[in] aInstance The OpenThread instance structure.
* @param[in] aReadFdSet A pointer to the read file descriptors.
+73 -56
View File
@@ -31,6 +31,7 @@
#include <errno.h>
#include <sys/time.h>
#include <openthread/cli.h>
#include <openthread/dataset.h>
#include <openthread/link.h>
#include <openthread/random_noncrypto.h>
@@ -166,55 +167,96 @@ static otMacKeyMaterial sCurrKey;
static otMacKeyMaterial sNextKey;
static otRadioKeyType sKeyType;
enum
{
SIM_GPIO = 0,
};
static bool sGpioValue = false;
static int8_t GetRssi(uint16_t aChannel);
#if OPENTHREAD_SIMULATION_VIRTUAL_TIME == 0
static uint8_t sDeniedNodeIdsBitVector[(MAX_NETWORK_SIZE + 7) / 8];
static enum {
kFilterOff,
kFilterDenyList,
kFilterAllowList,
} sFilterMode = kFilterOff;
static uint8_t sFilterNodeIdsBitVector[(MAX_NETWORK_SIZE + 7) / 8];
static bool FilterContainsId(uint16_t aNodeId)
{
uint16_t index = aNodeId - 1;
return (sFilterNodeIdsBitVector[index / 8] & (0x80 >> (index % 8))) != 0;
}
static bool NodeIdFilterIsConnectable(uint16_t aNodeId)
{
uint16_t index = aNodeId - 1;
bool isConnectable = true;
return (sDeniedNodeIdsBitVector[index / 8] & (0x80 >> (index % 8))) == 0;
switch (sFilterMode)
{
case kFilterOff:
break;
case kFilterDenyList:
isConnectable = !FilterContainsId(aNodeId);
break;
case kFilterAllowList:
isConnectable = FilterContainsId(aNodeId);
break;
}
return isConnectable;
}
static void NodeIdFilterDeny(uint16_t aNodeId)
static void AddNodeIdToFilter(uint16_t aNodeId)
{
uint16_t index = aNodeId - 1;
sDeniedNodeIdsBitVector[index / 8] |= 0x80 >> (index % 8);
sFilterNodeIdsBitVector[index / 8] |= 0x80 >> (index % 8);
}
static void NodeIdFilterClear(void)
{
memset(sDeniedNodeIdsBitVector, 0, sizeof(sDeniedNodeIdsBitVector));
}
OT_TOOL_WEAK void otCliOutputFormat(const char *aFmt, ...) { OT_UNUSED_VARIABLE(aFmt); }
otError ProcessNodeIdFilter(void *aContext, uint8_t aArgsLength, char *aArgs[])
{
OT_UNUSED_VARIABLE(aContext);
otError error = OT_ERROR_NONE;
bool deny = false;
otEXPECT_ACTION(aArgsLength > 0, error = OT_ERROR_INVALID_COMMAND);
if (aArgsLength == 0)
{
switch (sFilterMode)
{
case kFilterOff:
otCliOutputFormat("off");
break;
case kFilterDenyList:
otCliOutputFormat("deny-list");
break;
case kFilterAllowList:
otCliOutputFormat("allow-list");
break;
}
if (!strcmp(aArgs[0], "clear"))
for (uint16_t nodeId = 0; nodeId <= MAX_NETWORK_SIZE; nodeId++)
{
if (FilterContainsId(nodeId))
{
otCliOutputFormat(" %d", nodeId);
}
}
otCliOutputFormat("\r\n");
}
else if (!strcmp(aArgs[0], "clear"))
{
otEXPECT_ACTION(aArgsLength == 1, error = OT_ERROR_INVALID_ARGS);
NodeIdFilterClear();
memset(sFilterNodeIdsBitVector, 0, sizeof(sFilterNodeIdsBitVector));
sFilterMode = kFilterOff;
}
else if (!strcmp(aArgs[0], "deny"))
else if ((deny = !strcmp(aArgs[0], "deny")) || !strcmp(aArgs[0], "allow"))
{
uint16_t nodeId;
char * endptr;
char *endptr;
otEXPECT_ACTION(aArgsLength == 2, error = OT_ERROR_INVALID_ARGS);
@@ -223,7 +265,10 @@ otError ProcessNodeIdFilter(void *aContext, uint8_t aArgsLength, char *aArgs[])
otEXPECT_ACTION(*endptr == '\0', error = OT_ERROR_INVALID_ARGS);
otEXPECT_ACTION(1 <= nodeId && nodeId <= MAX_NETWORK_SIZE, error = OT_ERROR_INVALID_ARGS);
NodeIdFilterDeny(nodeId);
otEXPECT_ACTION(sFilterMode != (deny ? kFilterAllowList : kFilterDenyList), error = OT_ERROR_INVALID_STATE);
AddNodeIdToFilter(nodeId);
sFilterMode = deny ? kFilterDenyList : kFilterAllowList;
}
else
{
@@ -244,10 +289,7 @@ otError ProcessNodeIdFilter(void *aContext, uint8_t aArgsLength, char *aArgs[])
}
#endif // OPENTHREAD_SIMULATION_VIRTUAL_TIME == 0
static bool IsTimeAfterOrEqual(uint32_t aTimeA, uint32_t aTimeB)
{
return (aTimeA - aTimeB) < (1U << 31);
}
static bool IsTimeAfterOrEqual(uint32_t aTimeA, uint32_t aTimeB) { return (aTimeA - aTimeB) < (1U << 31); }
static void ReverseExtAddress(otExtAddress *aReversed, const otExtAddress *aOrigin)
{
@@ -801,10 +843,7 @@ exit:
return;
}
bool platformRadioIsTransmitPending(void)
{
return sState == OT_RADIO_STATE_TRANSMIT && !sTxWait;
}
bool platformRadioIsTransmitPending(void) { return sState == OT_RADIO_STATE_TRANSMIT && !sTxWait; }
#if OPENTHREAD_SIMULATION_VIRTUAL_TIME
void platformRadioReceive(otInstance *aInstance, uint8_t *aBuf, uint16_t aBufLength)
@@ -1283,7 +1322,7 @@ static uint8_t generateAckIeData(uint8_t *aLinkMetricsIeData, uint8_t aLinkMetri
#endif
#if OPENTHREAD_CONFIG_MAC_CSL_RECEIVER_ENABLE
otError otPlatRadioEnableCsl(otInstance * aInstance,
otError otPlatRadioEnableCsl(otInstance *aInstance,
uint32_t aCslPeriod,
otShortAddress aShortAddr,
const otExtAddress *aExtAddr)
@@ -1314,7 +1353,7 @@ uint8_t otPlatRadioGetCslAccuracy(otInstance *aInstance)
}
#endif // OPENTHREAD_CONFIG_MAC_CSL_RECEIVER_ENABLE
void otPlatRadioSetMacKey(otInstance * aInstance,
void otPlatRadioSetMacKey(otInstance *aInstance,
uint8_t aKeyIdMode,
uint8_t aKeyId,
const otMacKeyMaterial *aPrevKey,
@@ -1358,10 +1397,10 @@ exit:
}
#if OPENTHREAD_CONFIG_MLE_LINK_METRICS_SUBJECT_ENABLE
otError otPlatRadioConfigureEnhAckProbing(otInstance * aInstance,
otError otPlatRadioConfigureEnhAckProbing(otInstance *aInstance,
otLinkMetrics aLinkMetrics,
const otShortAddress aShortAddress,
const otExtAddress * aExtAddress)
const otExtAddress *aExtAddress)
{
OT_UNUSED_VARIABLE(aInstance);
@@ -1406,25 +1445,3 @@ void parseFromEnvAsUint16(const char *aEnvName, uint16_t *aValue)
}
}
}
otError otPlatDiagGpioSet(uint32_t aGpio, bool aValue)
{
otError error = OT_ERROR_NONE;
otEXPECT_ACTION(aGpio == SIM_GPIO, error = OT_ERROR_INVALID_ARGS);
sGpioValue = aValue;
exit:
return error;
}
otError otPlatDiagGpioGet(uint32_t aGpio, bool *aValue)
{
otError error = OT_ERROR_NONE;
otEXPECT_ACTION((aGpio == SIM_GPIO) && (aValue != NULL), error = OT_ERROR_INVALID_ARGS);
*aValue = sGpioValue;
exit:
return error;
}
+3 -7
View File
@@ -40,7 +40,7 @@
otError otPlatSpiSlaveEnable(otPlatSpiSlaveTransactionCompleteCallback aCompleteCallback,
otPlatSpiSlaveTransactionProcessCallback aProcessCallback,
void * aContext)
void *aContext)
{
OT_UNUSED_VARIABLE(aCompleteCallback);
OT_UNUSED_VARIABLE(aProcessCallback);
@@ -52,9 +52,7 @@ otError otPlatSpiSlaveEnable(otPlatSpiSlaveTransactionCompleteCallback aComplete
return OT_ERROR_NOT_IMPLEMENTED;
}
void otPlatSpiSlaveDisable(void)
{
}
void otPlatSpiSlaveDisable(void) {}
otError otPlatSpiSlavePrepareTransaction(uint8_t *aOutputBuf,
uint16_t aOutputBufLen,
@@ -73,9 +71,7 @@ otError otPlatSpiSlavePrepareTransaction(uint8_t *aOutputBuf,
// Uart
void otPlatUartSendDone(void)
{
}
void otPlatUartSendDone(void) {}
void otPlatUartReceived(const uint8_t *aBuf, uint16_t aBufLength)
{
+27 -13
View File
@@ -44,7 +44,6 @@
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <syslog.h>
#include <openthread/tasklet.h>
#include <openthread/platform/alarm-milli.h>
@@ -65,7 +64,7 @@ static void handleSignal(int aSignal)
}
/**
* This enumeration defines the argument return values.
* Defines the argument return values.
*
*/
enum
@@ -74,6 +73,7 @@ enum
OT_SIM_OPT_ENABLE_ENERGY_SCAN = 'E',
OT_SIM_OPT_SLEEP_TO_TX = 't',
OT_SIM_OPT_TIME_SPEED = 's',
OT_SIM_OPT_LOG_FILE = 'l',
OT_SIM_OPT_UNKNOWN = '?',
};
@@ -86,7 +86,11 @@ static void PrintUsage(const char *aProgramName, int aExitCode)
" -h --help Display this usage information.\n"
" -E --enable-energy-scan Enable energy scan capability.\n"
" -t --sleep-to-tx Let radio support direct transition from sleep to TX with CSMA.\n"
" -s --time-speed=val Speed up the time in simulation.\n",
" -s --time-speed=val Speed up the time in simulation.\n"
#if (OPENTHREAD_CONFIG_LOG_OUTPUT == OPENTHREAD_CONFIG_LOG_OUTPUT_PLATFORM_DEFINED)
" -l --log-file=name File name to write logs.\n"
#endif
,
aProgramName);
exit(aExitCode);
@@ -94,17 +98,26 @@ static void PrintUsage(const char *aProgramName, int aExitCode)
void otSysInit(int aArgCount, char *aArgVector[])
{
char * endptr;
char *endptr;
uint32_t speedUpFactor = 1;
static const struct option long_options[] = {
{"help", no_argument, 0, OT_SIM_OPT_HELP},
{"enable-energy-scan", no_argument, 0, OT_SIM_OPT_SLEEP_TO_TX},
{"enable-energy-scan", no_argument, 0, OT_SIM_OPT_ENABLE_ENERGY_SCAN},
{"sleep-to-tx", no_argument, 0, OT_SIM_OPT_SLEEP_TO_TX},
{"time-speed", required_argument, 0, OT_SIM_OPT_TIME_SPEED},
#if (OPENTHREAD_CONFIG_LOG_OUTPUT == OPENTHREAD_CONFIG_LOG_OUTPUT_PLATFORM_DEFINED)
{"log-file", required_argument, 0, OT_SIM_OPT_LOG_FILE},
#endif
{0, 0, 0, 0},
};
#if (OPENTHREAD_CONFIG_LOG_OUTPUT == OPENTHREAD_CONFIG_LOG_OUTPUT_PLATFORM_DEFINED)
static const char options[] = "Ehts:l:";
#else
static const char options[] = "Ehts:";
#endif
if (gPlatformPseudoResetWasRequested)
{
gPlatformPseudoResetWasRequested = false;
@@ -115,7 +128,7 @@ void otSysInit(int aArgCount, char *aArgVector[])
while (true)
{
int c = getopt_long(aArgCount, aArgVector, "Ehts:", long_options, NULL);
int c = getopt_long(aArgCount, aArgVector, options, long_options, NULL);
if (c == -1)
{
@@ -144,6 +157,11 @@ void otSysInit(int aArgCount, char *aArgVector[])
exit(EXIT_FAILURE);
}
break;
#if OPENTHREAD_CONFIG_LOG_OUTPUT == OPENTHREAD_CONFIG_LOG_OUTPUT_PLATFORM_DEFINED
case OT_SIM_OPT_LOG_FILE:
platformLoggingSetFileName(optarg);
break;
#endif
default:
break;
}
@@ -162,12 +180,10 @@ void otSysInit(int aArgCount, char *aArgVector[])
exit(EXIT_FAILURE);
}
openlog(basename(aArgVector[0]), LOG_PID, LOG_USER);
setlogmask(setlogmask(0) & LOG_UPTO(LOG_NOTICE));
signal(SIGTERM, &handleSignal);
signal(SIGHUP, &handleSignal);
platformLoggingInit(basename(aArgVector[0]));
platformAlarmInit(speedUpFactor);
platformRadioInit();
#if OPENTHREAD_CONFIG_RADIO_LINK_TREL_ENABLE
@@ -176,10 +192,7 @@ void otSysInit(int aArgCount, char *aArgVector[])
platformRandomInit();
}
bool otSysPseudoResetWasRequested(void)
{
return gPlatformPseudoResetWasRequested;
}
bool otSysPseudoResetWasRequested(void) { return gPlatformPseudoResetWasRequested; }
void otSysDeinit(void)
{
@@ -187,6 +200,7 @@ void otSysDeinit(void)
#if OPENTHREAD_CONFIG_RADIO_LINK_TREL_ENABLE
platformTrelDeinit();
#endif
platformLoggingDeinit();
}
void otSysProcessDrivers(otInstance *aInstance)
+3 -6
View File
@@ -366,8 +366,8 @@ void otPlatTrelRegisterService(otInstance *aInstance, uint16_t aPort, const uint
#endif
}
void otPlatTrelSend(otInstance * aInstance,
const uint8_t * aUdpPayload,
void otPlatTrelSend(otInstance *aInstance,
const uint8_t *aUdpPayload,
uint16_t aUdpPayloadLen,
const otSockAddr *aDestSockAddr)
{
@@ -419,10 +419,7 @@ void platformTrelInit(uint32_t aSpeedUpFactor)
OT_UNUSED_VARIABLE(aSpeedUpFactor);
}
void platformTrelDeinit(void)
{
deinitFds();
}
void platformTrelDeinit(void) { deinitFds(); }
void platformTrelUpdateFdSet(fd_set *aReadFdSet, fd_set *aWriteFdSet, struct timeval *aTimeout, int *aMaxFd)
{
+4 -10
View File
@@ -54,15 +54,9 @@ static int s_out_fd;
static struct termios original_stdin_termios;
static struct termios original_stdout_termios;
static void restore_stdin_termios(void)
{
tcsetattr(s_in_fd, TCSAFLUSH, &original_stdin_termios);
}
static void restore_stdin_termios(void) { tcsetattr(s_in_fd, TCSAFLUSH, &original_stdin_termios); }
static void restore_stdout_termios(void)
{
tcsetattr(s_out_fd, TCSAFLUSH, &original_stdout_termios);
}
static void restore_stdout_termios(void) { tcsetattr(s_out_fd, TCSAFLUSH, &original_stdout_termios); }
void platformUartRestore(void)
{
@@ -241,8 +235,8 @@ void platformUartProcess(void)
ssize_t rval;
const int error_flags = POLLERR | POLLNVAL | POLLHUP;
struct pollfd pollfd[] = {
{s_in_fd, POLLIN | error_flags, 0},
{s_out_fd, POLLOUT | error_flags, 0},
{s_in_fd, POLLIN | error_flags, 0},
{s_out_fd, POLLOUT | error_flags, 0},
};
errno = 0;
@@ -55,20 +55,11 @@ void platformAlarmInit(uint32_t aSpeedUpFactor)
sNow = 0;
}
uint64_t platformAlarmGetNow(void)
{
return sNow;
}
uint64_t platformAlarmGetNow(void) { return sNow; }
void platformAlarmAdvanceNow(uint64_t aDelta)
{
sNow += aDelta;
}
void platformAlarmAdvanceNow(uint64_t aDelta) { sNow += aDelta; }
uint32_t otPlatAlarmMilliGetNow(void)
{
return (uint32_t)(sNow / US_PER_MS);
}
uint32_t otPlatAlarmMilliGetNow(void) { return (uint32_t)(sNow / US_PER_MS); }
void otPlatAlarmMilliStartAt(otInstance *aInstance, uint32_t aT0, uint32_t aDt)
{
@@ -85,10 +76,7 @@ void otPlatAlarmMilliStop(otInstance *aInstance)
sIsMsRunning = false;
}
uint32_t otPlatAlarmMicroGetNow(void)
{
return (uint32_t)sNow;
}
uint32_t otPlatAlarmMicroGetNow(void) { return (uint32_t)sNow; }
void otPlatAlarmMicroStartAt(otInstance *aInstance, uint32_t aT0, uint32_t aDt)
{
@@ -186,16 +174,10 @@ void platformAlarmProcess(otInstance *aInstance)
#endif // OPENTHREAD_CONFIG_PLATFORM_USEC_TIMER_ENABLE
}
uint64_t otPlatTimeGet(void)
{
return platformAlarmGetNow();
}
uint64_t otPlatTimeGet(void) { return platformAlarmGetNow(); }
#if OPENTHREAD_CONFIG_TIME_SYNC_ENABLE
uint16_t otPlatTimeGetXtalAccuracy(void)
{
return 0;
}
uint16_t otPlatTimeGetXtalAccuracy(void) { return 0; }
#endif
#endif // OPENTHREAD_SIMULATION_VIRTUAL_TIME
@@ -136,19 +136,11 @@ static void platformSendSleepEvent(void)
}
#if OPENTHREAD_SIMULATION_VIRTUAL_TIME_UART
void platformUartRestore(void)
{
}
void platformUartRestore(void) {}
otError otPlatUartEnable(void)
{
return OT_ERROR_NONE;
}
otError otPlatUartEnable(void) { return OT_ERROR_NONE; }
otError otPlatUartDisable(void)
{
return OT_ERROR_NONE;
}
otError otPlatUartDisable(void) { return OT_ERROR_NONE; }
otError otPlatUartSend(const uint8_t *aData, uint16_t aLength)
{
@@ -168,10 +160,7 @@ otError otPlatUartSend(const uint8_t *aData, uint16_t aLength)
return error;
}
otError otPlatUartFlush(void)
{
return OT_ERROR_NONE;
}
otError otPlatUartFlush(void) { return OT_ERROR_NONE; }
#endif // OPENTHREAD_SIMULATION_VIRTUAL_TIME_UART
static void socket_init(void)
@@ -242,15 +231,9 @@ void otSysInit(int argc, char *argv[])
signal(SIGHUP, &handleSignal);
}
bool otSysPseudoResetWasRequested(void)
{
return gPlatformPseudoResetWasRequested;
}
bool otSysPseudoResetWasRequested(void) { return gPlatformPseudoResetWasRequested; }
void otSysDeinit(void)
{
close(sSockFd);
}
void otSysDeinit(void) { close(sSockFd); }
void otSysProcessDrivers(otInstance *aInstance)
{
-74
View File
@@ -1,74 +0,0 @@
#
# Copyright (c) 2016, The OpenThread Authors.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# 3. Neither the name of the copyright holder nor the
# names of its contributors may be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
include $(abs_top_nlbuild_autotools_dir)/automake/pre.am
lib_LIBRARIES = libopenthread-platform-utils.a
noinst_LTLIBRARIES = libutils-link-metrics.la
COMMON_FLAGS = \
-I$(top_srcdir)/include \
-I$(top_srcdir)/examples/platforms \
-I$(top_srcdir)/src/core \
-I$(top_srcdir)/third_party/jlink/SEGGER_RTT_V640/RTT \
$(NULL)
libutils_link_metrics_la_CPPFLAGS = \
$(COMMON_FLAGS) \
-fno-threadsafe-statics \
$(NULL)
libutils_link_metrics_la_SOURCES = \
link_metrics.cpp \
link_metrics.h \
$(NULL)
libopenthread_platform_utils_a_CPPFLAGS = \
$(COMMON_FLAGS) \
$(NULL)
libopenthread_platform_utils_a_SOURCES = \
code_utils.h \
debug_uart.c \
logging_rtt.c \
logging_rtt.h \
mac_frame.cpp \
mac_frame.h \
otns_utils.cpp \
settings.h \
settings_ram.c \
soft_source_match_table.c \
soft_source_match_table.h \
uart.h \
$(NULL)
libopenthread_platform_utils_a_LIBADD = \
libutils-link-metrics.la \
$(NULL)
include $(abs_top_nlbuild_autotools_dir)/automake/post.am
+1 -1
View File
@@ -72,7 +72,7 @@
} while (0)
/**
* This macro calculates the number of elements in an array.
* Calculates the number of elements in an array.
*
* @param[in] aArray Name of the array variable.
*
+3 -12
View File
@@ -103,22 +103,13 @@ void otPlatDebugUart_putchar(int c)
/* provide WEAK stubs for platforms that do not implement all functions */
OT_TOOL_WEAK
void otPlatDebugUart_putchar_raw(int c)
{
OT_UNUSED_VARIABLE(c);
}
void otPlatDebugUart_putchar_raw(int c) { OT_UNUSED_VARIABLE(c); }
OT_TOOL_WEAK
int otPlatDebugUart_kbhit(void)
{
return 0; /* nothing */
}
int otPlatDebugUart_kbhit(void) { return 0; /* nothing */ }
OT_TOOL_WEAK
int otPlatDebugUart_getc(void)
{
return -1; /* nothing */
}
int otPlatDebugUart_getc(void) { return -1; /* nothing */ }
OT_TOOL_WEAK
otError otPlatDebugUart_logfile(const char *filename)
+5 -8
View File
@@ -49,7 +49,7 @@ class LinkMetricsDataInfo : public LinkedListEntry<LinkMetricsDataInfo>, public
public:
/**
* Construtor.
* Constructor.
*
*/
LinkMetricsDataInfo(void) { Clear(); };
@@ -71,7 +71,7 @@ public:
}
/**
* This method gets Link Metrics data stored in this object.
* Gets Link Metrics data stored in this object.
*
* TODO: Currently the order of Link Metircs data is fixed. Will update it to follow the order specified in TLV.
*
@@ -114,7 +114,7 @@ public:
}
/**
* This method gets the length of Link Metrics Data.
* Gets the length of Link Metrics Data.
*
* @returns The number of bytes for the data.
*
@@ -126,7 +126,7 @@ public:
}
/**
* This method gets the metrics configured for the Enhanced-ACK Based Probing.
* Gets the metrics configured for the Enhanced-ACK Based Probing.
*
* @returns The metrics configured.
*
@@ -177,10 +177,7 @@ static inline bool IsLinkMetricsClear(otLinkMetrics aLinkMetrics)
return !aLinkMetrics.mPduCount && !aLinkMetrics.mLqi && !aLinkMetrics.mLinkMargin && !aLinkMetrics.mRssi;
}
void otLinkMetricsInit(int8_t aNoiseFloor)
{
sNoiseFloor = aNoiseFloor;
}
void otLinkMetricsInit(int8_t aNoiseFloor) { sNoiseFloor = aNoiseFloor; }
otError otLinkMetricsConfigureEnhAckProbing(otShortAddress aShortAddress,
const otExtAddress *aExtAddress,
+7 -7
View File
@@ -48,7 +48,7 @@ extern "C" {
#endif
/**
* This method initializes the Link Metrics util module.
* Initializes the Link Metrics util module.
*
* @param[in] aNoiseFloor The noise floor used by Link Metrics. It should be set to the platform's
* noise floor (measured noise floor, receiver sensitivity or a constant).
@@ -57,16 +57,16 @@ extern "C" {
void otLinkMetricsInit(int8_t aNoiseFloor);
/**
* This method sets/clears Enhanced-ACK Based Probing for a specific Initiator.
* Sets/clears Enhanced-ACK Based Probing for a specific Initiator.
*
* This method can start/stop Enhanced-ACK Based Probing for a neighbor that has the address @p aShortAddress and
* Can start/stop Enhanced-ACK Based Probing for a neighbor that has the address @p aShortAddress and
* @p aExtAddress. Once the Probing is started, the device would record the Link Metrics data of link layer frames
* sent from that neighbor and include the data into header IE in Enhanced-ACK sent to that neighbor.
*
* @param[in] aShortAddress The short address of the Initiator.
* @param[in] aExtAddress A pointer to the extended address of the Initiator.
* @param[in] aLinkMetrics Flags specifying what metrics to query (Pdu Count would be omitted). When
* @p aLinkMetrics is eqaul to `0`, this method clears the Initiator.
* @p aLinkMetrics is equal to `0`, this method clears the Initiator.
*
* @retval OT_ERROR_NONE Successfully configured the Enhanced-ACK Based Probing.
* @retval OT_ERROR_INVALID_ARGS @p aExtAddress is `nullptr`.
@@ -79,10 +79,10 @@ otError otLinkMetricsConfigureEnhAckProbing(otShortAddress aShortAddress,
otLinkMetrics aLinkMetrics);
/**
* This method generates the Link Metrics data (assessed for the acknowledged frame) bytes that would be included in
* Generates the Link Metrics data (assessed for the acknowledged frame) bytes that would be included in
* Vendor-Specific IE.
*
* This method first checks what Link Metrics are specified by the Initiator indicated by @p aMacAddress. And then
* First checks what Link Metrics are specified by the Initiator indicated by @p aMacAddress. And then
* write the values to @p aData.
*
* @param[in] aMacAddress The Mac address of the Initiator.
@@ -98,7 +98,7 @@ otError otLinkMetricsConfigureEnhAckProbing(otShortAddress aShortAddress,
uint8_t otLinkMetricsEnhAckGenData(const otMacAddress *aMacAddress, uint8_t aLqi, int8_t aRssi, uint8_t *aData);
/**
* This method returns the data length of Enhanced-ACK Based Probing for a specific Initiator.
* Returns the data length of Enhanced-ACK Based Probing for a specific Initiator.
*
* @param[in] aMacAddress The Mac address of the Initiator.
*

Some files were not shown because too many files have changed in this diff Show More