Compare commits

..

786 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
Jinwon Kim c6179c24ed [netif] fix bug in print statement with no corresponding argument (#8353) 2022-11-02 00:16:53 -07:00
Abtin Keshavarzian ac11f66419 [log] add compile-time check for printf style arg check to log functions (#8339)
This commit adds compile-time check of format string to all log
functions and macros. It also updates different core modules to make
arg string formats consistent under different platforms. In particular
we use `'%lu` for `uint32_t` arguments and they are explicitly cast
to `unsigned long` using `ToUlong()`.
2022-11-01 22:45:16 -07:00
Abtin Keshavarzian f5acfb2dac [cli] update CLI Output class (#8343)
This commit updates the `Cli::Output` class and the related types. A
new type `OutputImplementer` is added which provides the basic output
functionality, i.e., method `OutputV()`. `Output` class requires a
reference to an `OutputImplementer` which it then uses to provide all
the different `Output{}()` method flavors. The new model allows all
CLI sub-modules to directly inherit `Output` class while reusing a
single and common underlying `OutputImplementer` provided by the
`Cli::Interpreter`.
2022-11-01 13:28:37 -07:00
Zhanglong Xia 11a24d111f [diag] add gpio diag command support (#8316) 2022-10-31 17:05:20 -07:00
Abtin Keshavarzian 1d1e5d16e0 [cli] enhance parsing of flags for route commands (#8340)
This commit enhances `ParseRoute()` method allowing flags to be
specified in one arg (sequence of char indicating different flags) or
potentially over different args. This commit also allows `-` to be
used in `route` or `prefix` commands to indicate empty flag.
2022-10-28 16:04:59 -07:00
Suvesh Pratapa 778e3b9ead [netif] fix bug in print statement (#8338) 2022-10-28 15:55:58 -07:00
Abtin Keshavarzian ca8799a4b8 [routing-manager] persist deprecating old prefixes in Settings (#8330)
This commit adds mechanism to save deprecating old on-link prefixes
in non-volatile `Settings`. With this, if the BR is restarted, it
will remember the old prefixes and keep deprecating them (advertising
them in emitted RA and publish them in Thread Network Data).

This commit also adds `TestSavedOnLinkPrefixes()` test case in
`test_routing_manager` to cover the behavior of the newly added
mechanism.
2022-10-27 15:12:59 -07:00
Jonathan Hui b9b9c19640 [network-data] do not process TMF messages if waiting for sync (#8332) 2022-10-27 02:08:56 -07:00
Abtin Keshavarzian 2a5a926952 [mle] log sending of "Link Accept and Request" (#8328)
This commit update `SendLinkAccept()` method so to log the message type
(whether we send "Link Accept and Request" or "Link Accept").
2022-10-27 02:08:36 -07:00
Abtin Keshavarzian d4d872c05c [test] increase wait time after ether re-enable (#8322)
This commit increases the wait time in `test_single_border_router`
after re-enabling `ether` link. It also changes the order of pings
in the test (first ping from host to Thread router and the opposite
direction).
2022-10-27 02:07:30 -07:00
Yaoxing Shan 2592e3433a [tcplp] fix call to tcplp_sys_accept_ready() (#8327)
aAddr should be the source address not the destination address.
2022-10-26 04:38:25 -07:00
Abtin Keshavarzian ed31bfefb6 [address-resolver] allow addr resolution using net data service (#8318)
This commit implements a new optimization in `AddressResolver`
allowing it to resolve on-mesh IPv6 addresses using info from Thread
Network Data DNS/SRP Service (Unicast Address) entries.

When determining EID-to-RLOC mapping in `Resolve()`, we first try to
match the EID against unicast addresses discovered from DNS/SRP
service entries. This is limited to entries where the address/port
info is encoded as part of server data. If a match is found the
associated RLOC16 of the BR which added the entry in Network Data
will be used (i.e., the `server16` field from Network data server
sub-TLV). This optimization is used on devices where MLE Mode
indicates they receive full Network Data and not the stable subset
(since stable subset will not provide RLOC16 info).

This commit adds a similar check in `UpdateSnoopedCacheEntry()` so
that the limited snoop cache entries are not unnecessarily used for
addresses which can be resolved using Network Data services.
2022-10-26 01:37:40 -07:00
Abtin Keshavarzian 53305d4762 [routing-manager] add Neighbor Solicit probe mechanism (#8090)
This commit adds a new mechanism in `RoutingManager` to periodically
check that discovered routers are still active and operational, so
that if the router providing the favored on-link prefix becomes
offline, we can detect it more quickly (instead of waiting for the
prefix lifetime to expire) and then the BR can start advertising its
own on-link prefix.

Receiving a Router or Neighbor Advertisement message from a router
indicates that it is active. After a timeout interval passes from the
last receive from a router we start sending Neighbor Solidification
(NS) probes to it. This timeout interval can be specified by newly
added build-time OT config parameter (default value is set to one
minute). If no response is received after multiple NS attempts, the
router is considered to be inactive and the discovered prefix entries
associated with the router are removed or deprecated.

This commit also updates the unit test for routing manager to validate
the behavior of the newly added mechanism.
2022-10-25 00:04:47 -07:00
Seth Rickard b7471733c5 [mac] add reserved value to source address parsing (#8326)
Fails packet parsing if the reserved value is found in the source
addressing field instead of marking the address as "none".
2022-10-24 15:07:34 -07:00
Zang MingJie e4bf2ffe34 [netif-posix] add an option to persistent interface (#8033) 2022-10-24 14:57:48 -07:00
Abtin Keshavarzian d1653a8edc [routing-manager] new mechanism for deprecating old on-link prefixes (#8315)
This commit updates how `OnLinkPrefixManager` retains and deprecates
old local on-link prefixes. Instead of remembering a single old
prefix, a list of old prefixes are remembered and the number of
entries in the list can be configured at build-time using an OT
config.

If the BR is stopped, the deprecating prefixes are still remembered
and the the expire timer keeps running. They are removed from the
list when they expire. If the BR is started again the deprecating old
prefixes are again included as PIO in the emitted RA and also
published in Network Data.

The changes in this commit also ensure we can correctly handle the
situation where the extended PAN ID is changed to a previous value
before the corresponding on-link prefix expires, i.e. when a
currently deprecating prefix becomes the current local on-link prefix
again.

This commit also updates the unit test case validating the behavior of
newly added mechanism under different situations.
2022-10-21 21:27:57 -07:00
Abtin Keshavarzian ed43da9110 [routing-manager] new mechanism for deprecating old on-link prefixes (#8315)
This commit updates how `OnLinkPrefixManager` retains and deprecates
old local on-link prefixes. Instead of remembering a single old
prefix, a list of old prefixes are remembered and the number of
entries in the list can be configured at build-time using an OT
config.

If the BR is stopped, the deprecating prefixes are still remembered
and the the expire timer keeps running. They are removed from the
list when they expire. If the BR is started again the deprecating old
prefixes are again included as PIO in the emitted RA and also
published in Network Data.

The changes in this commit also ensure we can correctly handle the
situation where the extended PAN ID is changed to a previous value
before the corresponding on-link prefix expires, i.e. when a
currently deprecating prefix becomes the current local on-link prefix
again.

This commit also updates the unit test case validating the behavior of
newly added mechanism under different situations.
2022-10-21 21:27:35 -07:00
Tobías Lifschitz 8c73c9747b [mle] add time tracking to mle roles (#8312)
A useful metric for a device is the amount of time it spends in each
mle role. This could help to identify connectivity issues on SED with
weak signal and frequent detaches by checking the time spent in
detached mode. It would also be useful to know the time spent in
leader state when having multiple FTDs frequently joining and
splitting in different partitions.

This information is not available from the role counters, since time
spent in each state is not related to the number of entries to that
state.

This commit adds mle counters to track time spent in each role, when
uptime feature is enabled (`OPENTHREAD_CONFIG_UPTIME_ENABLE=1`).
2022-10-21 21:26:41 -07:00
Abtin Keshavarzian c3bb95d5f4 [string] add compile-time check for printf style arg consistency (#8277)
This commit adds `OT_TOOL_PRINTF_STYLE_FORMAT_ARG_CHECK` macro in
`toolchain.h`. It specifies that a function or method takes `printf`
style args. It asks the compiler to check the args for consistency
with the passed-in format string.

The commit uses the new macro in `String::Append()` and its uses are
updated to ensure consistency between format string and the args.
2022-10-21 16:26:21 -07:00
Tom Rebbert acf44c45cd [mac] Bugfix: Messages without a source address handled incorrectly (#8321)
When a message is received that does not contain a source address (ex:
IEEE 802.15.4 Beacon Request) find neighbor should not be called to
attribute the message to a particular device in the network.

The bug was found in the following scenario:
* Network operating with REED devices.
* Other non-Thread IOT devices in the space periodically sending
  beacon requests.
* Note that the REED devices have unexpectedly low average RSSI values
  for their parents.

When the child processes the beacon request, it calls FindNeighbor(),
which defaults to returning the parent of the device if srcaddr is
none. The RSSI of the beacon request is then averaged into the value
for the device's parent.

Fix: Do not look up the neighbor if there is no source address in the
message, because there's no way to know who the message came from.
2022-10-21 13:27:52 -07:00
Yakun Xu ff259b845b [android] only set -std=c99 for mbedtls (#8310) 2022-10-21 13:02:18 -07:00
Tom Rebbert 488ee63b4c [coap] Bugfix: CoAP not sending 4.04 when URI handler is not found (#8297)
Update CoAP base handler to correctly detect when a handler is not
found and send a 4.04 response.

Prior to this change, the error code would be overridden in the case
where a URI handler was not found to kErrorNone. This meant that when
the exit code was reached, no 4.04 message was generated. This fixes
the logical flow to ensure the error message is sent on the link.
2022-10-20 19:24:05 -07:00
Jonathan Hui d8509e6254 [github-actions] update geekyeggo/delete-artifact to v2 (#8314) 2022-10-20 09:51:06 -07:00
Abtin Keshavarzian d805b5dd1c [routing-manager] add OnLinkPrefixManager (#8285)
This commit renames `LocalOnPreifx` class to `OnLinkPrefixManager` and
moves all the code related to managing of the on-link prefix to this
class, e.g., method `Evaluate()` to evaluate and make a decision
about on-link prefix (whether we need to advertise our local on-link
prefix or there is a favored discovered on-link prefix provided by
another router on infra link).
2022-10-19 15:49:59 -07:00
Jonathan Hui 3d5c4b41df [docs] fix build option table format (#8306) 2022-10-18 14:44:32 -07:00
Abtin Keshavarzian 68083d8a67 [srp-client] inform server on service remove even if not added yet (#8299)
This commit updates `Srp::Client` so that on `RemoveService()` we
always send an SRP Update message to server to remove the service even
if the service is not yet registered (from perspective of client).
2022-10-18 14:43:41 -07:00
Song GUO aae250af89 [nat64] add runtime switch for NAT64 prefix publisher and translator (#8194) 2022-10-18 14:42:25 -07:00
Simon Lin 77fd973a76 [multicast-forwarding] reduce warn logs (#8292) 2022-10-17 19:25:02 -07:00
Tom Rebbert 778fbfa82d [heap] move static heap construction to singleton accessor (#8242)
Move static heap construction to singleton accessor to avoid
non-trivial construction at global scope, which has an unpredictable
ordering.
2022-10-17 18:57:50 -07:00
parag-silabs c3bc9481e2 [cmake] disable OPENTHREAD_CONFIG_NCP_HDLC_ENABLE when OT_NCP_SPI is set (#8282) 2022-10-17 18:56:18 -07:00
Sarah 992f9c6374 [docs] Doxygen formatting updates (#8286)
For various reasons, we're not able to use `<` and `>` in our Doxygen
descriptions. I made some minor edits, LMKWYT. In the HTML, it renders
similar to this:

The IPv6 socket address string is formatted as [`address`]:`port`
where `address` is shown as 16 hex values separated by `:` and `port`
is the port number in decimal format, for example "[%x:%x:...:%x]:%u".
2022-10-17 11:09:10 -07:00
Sam Kumar d5333ca831 [cli-tcp] fix bug causing "accept" action for all incoming connections (#8291) 2022-10-17 09:10:47 -07:00
Sam Kumar 3d1bdf3317 [tcplp] fix bad memory access when refusing incoming TCP connection (#8291) 2022-10-17 09:10:47 -07:00
gavinmcgovern bdb9382976 [docs] resized Qorvo logo (#8279) 2022-10-14 11:07:41 -07:00
Jonathan Hui 05590e2dc8 [github-actions] migrate to actions/upload-artifact@v3 (#8278) 2022-10-14 08:47:48 -07:00
gavinmcgovern 9ebe41f16e [docs] who supports OT updates (#8263) 2022-10-13 11:38:44 -07:00
Abtin Keshavarzian f5e2a0f961 [routing-manager] adv local on-link prefix after added in net data (#8119)
This commit enhances `RoutingManager` so that when we decide to
advertise the local on-link prefix and publish it in Network Data as
an external route, we wait for it to be seen in the leader's Network
Data before including it in the emitted RA messages as PIO. If the
prefix is already present in Network Data (e.g., may have been added
by another BR on the same Thread mesh) we start advertising it
immediately. When publishing prefixes in Network Data, it may take a
short random time before the entry is registered with leader and the
updated Network Data is propagated to all Thread nodes. This change
delays the advertisement of the on-link prefix on the infra link side
till it is configured as an external route on the Thread side.
2022-10-13 09:15:17 -07:00
Jonathan Hui f92364c977 [dns-client] validate response timeout <= TimerMilli::kMaxDelay (#8275) 2022-10-13 08:37:22 -07:00
Abtin Keshavarzian f459d9e333 [core] remove OT_UNREACHABLE_CODE(break) (#8274)
This commit removes `OT_UNREACHABLE_CODE(break)` which is used
in `case` statements performing an `OT_ASSERT()` in a `switch` block.
If the `case` is the last one in the `switch` we can skip the `break`
and therefore we don't need to use `OT_UNREACHABLE_CODE()`.
2022-10-13 08:37:01 -07:00
Abtin Keshavarzian 16c927ea1c [routing-manager] enhance mechanism to publish/unpublish route prefixes (#8187)
This commit updates and enhances the mechanism in `RoutingManager`
to publish/unpublish external route prefixes in Thread Network Data.

Instead of each sub-component (e.g., `DiscoveredPrefixTable`,
`LocalOnLinkPrefix`, `Nat64PrefixManager`, ...) directly trying to
publish/unpublish its entries which can lead to conflicting requests
that then needs to be checked and handled by each component, this
commit adds a new method `EvaluatePublishingPrefix()`. This method
makes a collective decision by checking with different sub-components
to see whether or not each wants this prefix published and if so at
what preference level and flags.

This change help simplify the code and handling of conflicting
situations and edge cases (e.g., while deprecating current/old local
on-link prefix, other routers adding/removing same prefix as PIO or
RIO in their emitted RAs).
2022-10-12 15:13:16 -07:00
Sarah 23c01d7eaf [docs] CLI commands ifconfig - linkmetrics (#8253) 2022-10-12 14:34:45 -07:00
Abtin Keshavarzian 06bd4d6161 [link-metrics] update method finding neighbor to validate its version (#8271)
This commit renames and updates the `LinkMetrics::FindNeighbor()`
helper method which finds the neighbor for a given link-local address
for use in `LinkMetrics` class. This method now also validates that
the neighbor's Thread version is 1.2 or higher.
2022-10-12 14:17:24 -07:00
Yakun Xu 74cc79d7a2 [cmake-build] allow specify multiple targets (#8264)
This commit allows using OT_CMAKE_NINJA_TARGET to specify multiple
targets.
2022-10-12 13:09:04 -07:00
Jonathan Hui 3811b6529e [github-actions] migrate to actions/checkout@v3 (#8269) 2022-10-12 10:15:04 -07:00
Song GUO 43c66a3d5f [nat64] fix build issues related to NAT64 on POSIX (#8167)
The build might fail when using build systems other than cmake and
NAT64_TRANSLATOR is enabled.
- Reorder the functions in `src/posix/platform/netif.cpp`
- Define a default NAT64 CIDR
- Define `kNat64RoutePriority`
2022-10-11 22:47:50 -07:00
Abtin Keshavarzian 131e42c60f [cli] fix log filename command arg check (#8270) 2022-10-11 15:23:50 -07:00
Tom Rebbert 9c6b45c1dc [meshcop] support a zero-length network name for backwards compatibility (#8241)
Add a configuration option to support a zero-length network name
within the OT stack.
2022-10-11 15:22:57 -07:00
Abtin Keshavarzian 04feddc458 [netdata] update Publisher to reserve entries for RoutingManager (#8148)
This commit updates `NetworkData::Publisher` to reserve a set of
prefix entries for use by `RoutingManager` only. This allow us to
simplify how `RoutingManager` publishes route prefixes in Network
Data (assert on failure). In particular, this commit defines a new
enum `Requester` which specifies the requester (`kFromUser` or
`kFromRoutingManager`) associated with a published prefix. This is
used by methods `PublishExternalRoute()`/`PublishOnMeshPrefix()`.
When allocating new entries, we ensure that each requester is
limited to its maximum number of entries.
2022-10-11 12:57:33 -07:00
Abtin Keshavarzian ee83b1cb5d [backbone-router] simplify TMF URI resource handling (#8265)
This commit updates `BackboneTmfAgent` to handle TMF URI resources
(similar to the model used by `Tmf::Agent` added in #8233).
2022-10-11 09:11:20 -07:00
Jonathan Hui 76010bc9ad [docs] remove versioning note (#8266) 2022-10-11 08:31:43 -07:00
Eduardo Montoya f23eee42f8 [thci] fix setBbrDataset (#8261)
Cover the case when neither `MlrTimeout` or `ReRegDelay` are being
modified.
2022-10-11 08:31:08 -07:00
Abtin Keshavarzian 697c5e53a2 [border-agent] simplify ForwardToLeader() (#8260)
This commit updates `BorderAgent::ForwardToLeader()` to determine the
`petition` and `separate` boolean flags from the passed-in `aUri`.
2022-10-10 12:40:26 -07:00
Abtin Keshavarzian 13311256f6 [tmf] add SecureAgent and simplify URI resource processing (#8260)
This commit adds a new class `Tmf::SecureAgent` as a sub-class of
`Coap::CoapSecure`. It also simplifies the handling of TMF URI
resources by secure agent (similar model as in `Tmf::Agent` added
in #8233.
2022-10-10 12:40:26 -07:00
Jonathan Hui 09e06c6eff [dns-types] verify pointer refers to prior occurrence (#8262) 2022-10-10 11:45:39 -07:00
Abtin Keshavarzian e387505d4f [link-metrics] simplify handling of Type IDs (#8246)
This commit simplifies the handling of Type IDs in `LinkMetrics`
modules.
2022-10-10 10:54:19 -07:00
Abtin Keshavarzian 4a0d069ee8 [log] fix incorrect format strings (#8255) 2022-10-07 21:51:06 -07:00
Marek Porwisz b0266bc00e [ip6] fix packets not being forwarded outside of Thread (#8102)
Two changes made together broke fragmented packets handling: Some time
ago forwarding packets outside of thread was limited to 1280 bytes
Recently forwarding IP packet fragments was disabled.  This makes it
not forward packet fragments nor fully assembled packets.  According
to later change author this was to prevent packets from being handled
twice.

To fix this, forwarding of IP fragments was restored and instead
forwarding of reassembled frames was disabled regardless of the frame
size. This approach should save the need of fragmenting already
reassembled packets to fit into the
OPENTHREAD_CONFIG_IP6_MAX_DATAGRAM_LENGTH.

Signed-off-by: Marek Porwisz <marek.porwisz@nordicsemi.no>
2022-10-07 17:50:39 -07:00
Abtin Keshavarzian 2b726ef29f [border-agent] fix logging of RelayTx URI (#8254) 2022-10-07 14:02:51 -07:00
Abtin Keshavarzian 812c36f658 [tmf] new model for handling TMF URI resources (#8233)
This commit updates and simplifies the handling of TMF URI resources.
The new model centralizes the processing and dispatching of URI
handlers in `Tmf::Agent`. It should help reduce memory (RAM and
code) use as well.

- A new enumeration `Uri` type is defined specifying all the TMF
  URIs along with functions to map between `Uri` and the related
  URI path string.
- We use binary search in a sorted table to match a path string
  (e.g., from a received CoAP message) to its corresponding URI.
- `Coap` class is updated to allow sub-classes to register an
   optional `ResourceHandler` to handle URI resources.
- `Tmf::Agent` uses the new `ResourceHandler` to process the TMF URI
  resources and invoke the related handlers on the proper module
  (e.g., passing `kUriAddressQuery` to `AddressResolver` module,
  `kUriActiveSet` to `MeshCoP::ActiveDatasetManager`, etc).
- The TMF handlers are defined as `HandleTmf<Uri>()` template method
  specializations which are defined on the proper module.
- Most URI handlers can be processed at any time but some perform
  additional checks, e.g., `kUriAddressSolicit` is passed to
  `Mle::MleRouter` which checks that device role is leader before
  processing the request.
2022-10-06 18:32:22 -07:00
Abtin Keshavarzian c4b6206f16 [srp-client] new feature to allow lease and key lease per service (#8211)
This commit add a new feature in `Srp::Client` to allow user to
specify the lease and/or key lease intervals explicitly per service.
The lease intervals in a service can be left unspecified(set to zero)
in which case the default lease intervals will be used.

In an SRP Update message, the lease info is included in additional
section in an Update Lease Option record. Therefore the lease values
are applicable to the entire message and all its records. If we have
services with different lease intervals, they need to be registered
in separate messages. This commit updates `Srp::Client` to implement
such a mechanism. When preparing an SRP message, we first determine
the lease and key lease intervals and ensure the services using
matching intervals are included in the message.

This commit also updates and simplifies the "single service mode"
functionality to use the newly added mechanism for tracking which
services are included in the message.

This commit adds `test_srp_register_services_diff_lease` which covers
the behavior of the newly added mechanisms.
2022-10-06 18:31:25 -07:00
Eduardo Montoya a34d1176b9 [thci] remove unneeded problematic command (#8235)
Listing the table of rules results in SSH disconnection under some
circumstances. Removing the command since it doesn't add any
functionality.
2022-10-06 09:03:26 -07:00
Abtin Keshavarzian 4eb64510bf [test] update AdvanceTime() in unit tests to handle overflow (#8244) 2022-10-06 08:54:27 -07:00
Jonathan Hui 10de4c4f13 [fuzz] advance time before fuzz input enable to more services (#8243) 2022-10-06 08:54:00 -07:00
Abtin Keshavarzian 4f57b8d461 [meshcop] simplify energy scan client and server (#8230)
This commit updates `EnergyScanClient` and `EnergyScanServer`.
On server side, we prepare the report message after we parse the
request and directly append the results in the report message as
energy scans are performed. Client side is also updated to
correctly handle the case where the report message contains
greater number of results that can be supported on the client
based on its configuration.
2022-10-06 08:53:17 -07:00
Abtin Keshavarzian d3e00fbd28 [dns] allow partial read of TXT data and add config for max size in CLI (#8232)
This commit updates `Dns::Client` so that when reading service info
`otDnsServiceInfo` if the received TXT data does not fit in the given
buffer, it is read partially. A new field `mTxtDataTruncated` is added
in `otDnsServiceInfo` to indicate that TXT data was not fully read.

This commit also updates `dns` related commands in CLI so to output
the partially read TXT data and add a new config specifying the max
TXT data size used by CLI.
2022-10-05 15:10:28 -07:00
Jonathan Hui c5b4cd7bbc [doxygen] change inout to in,out (#8231) 2022-10-04 12:45:18 -07:00
Abtin Keshavarzian 61d9e72c18 [cli] update sub-modules to use Process<Cmd("cmd")> method (#8224)
This commit updates CLI `SrpServer`, `CoapSecure`, `UdpExample`, and
`TcpExample` to use the template `Process<Cmd("cmd")>` model. This
helps make them similar to other CLI modules.
2022-10-03 09:32:02 -07:00
Abtin Keshavarzian 7e8b482e3c [timer] add template TimerMilliIn to simplify handler functions (#8221)
This class adds a template sub-classes of `TimerMilli/Micro` which
allows us to directly specify an `Owner` for timer along with handler
callback as a member method of `Owner`. This helps simplify the
use of `Timer` in core module.
2022-09-30 11:32:56 -07:00
Jonathan Hui b3620ae51a [fuzz] add set -euxo pipefail to build script (#8222) 2022-09-30 11:24:20 -07:00
Suvesh Pratapa 6b712bd270 [cmake] allow configuring OPENTHREAD_CONFIG_MLE_MAX_CHILDREN with a CMake option (#8216)
This can help us configure this value during build time for OTBR
projects or other projects using CMake.
2022-09-30 09:50:12 -07:00
Abtin Keshavarzian bd8513b904 [ip6] define Ip6::NetifIdentifier mirroring otNetifIdentifier (#8219) 2022-09-30 08:36:48 -07:00
Song GUO 7954c34231 [nat64] support using IPv4 DNS server addresses in CLI (#8212)
Similar to TCP/UDP/PING commands, this command will print "Synthesized
IPv6 DNS server address:" when an IPv4 address is received.
2022-09-30 08:29:44 -07:00
Jonathan Hui f6df50cde6 [fuzz] declare otPlatLog as weak (#8220) 2022-09-29 20:59:32 -07:00
hemanth-silabs 081567fda6 [crypto] update the signature algorithm used for 3.2.0 mbedTLS (#8215)
`mbedtls_ssl_conf_sig_hashes` was deprecated in 3.2.0, and we
attempted to move over to the new recommended function. That new
function expects `MBEDTLS_TLS1_3_SIG_` type arguments.
2022-09-29 15:38:25 -07:00
Abtin Keshavarzian ba3d188db7 [srp-client] update "single service mode" to handle many removes (#8207)
This commit fixes the "single service mode" behavior to handle
if there are many simultaneous service removes. It also updates the
test to cover this situation.
2022-09-29 15:37:26 -07:00
Song GUO 06a6de24fa [nat64] add functional tests (#8161)
The test includes:
- Counters (protocol & error (4to6 no mapping, other errors are not
  expected))
- ICMP ping Connectivity
- UDP connectivity
2022-09-29 10:54:49 -07:00
Song GUO fc8949afb5 [nat64] fix typo: synthersize -> synthesize (#8213) 2022-09-29 10:51:06 -07:00
Tobías Lifschitz 12a1e618b2 [cli] print missing mac counters (#8210)
Co-authored-by: Tobias <tlifschitz@maper.com.ar>
2022-09-28 14:04:14 -07:00
Abtin Keshavarzian 32a17d8abe [test] update SRP unit test to prepare service entries in all cases (#8208) 2022-09-27 20:35:16 -07:00
Abtin Keshavarzian 02690328a8 [srp-server] lease info for a deleted service or host entry (#8206)
This commit updates the `Srp::Server` to allow lease info (in
particular the key-lease) to be retrieved for a deleted service or
host entry.
2022-09-27 09:43:20 -07:00
Abtin Keshavarzian 384dcbf631 [srp-server] update the default min/max lease/key-lease intervals (#8205)
This commit updates the default `LeaseConfig` intervals used by
`Srp::Server` to accept any requested lease time between 30 seconds
and 27 hours and any requested key lease time between 30 seconds and
189 hours.
2022-09-27 09:40:18 -07:00
Kangping ecdd5312a3 [posix] fix OT_DAEMON flag definitions (#8203)
We have to add the `OPENTHREAD_POSIX_CONFIG_DAEMON_ENABLE` definition
to `ot-config` because OpenThread core libraries will set config file
to "openthrad-core-posix-config.h" which depends on
`OPENTHREAD_POSIX_CONFIG_DAEMON_ENABLE` to correctly enable
PLATFORM_NETIF and PLATFORM_UDP features. Otherwise, OpenThread core
and posix libraries will use different feature definitions.
2022-09-27 08:58:23 -07:00
Jonathan Hui e64ba13faa [address-cache] increase default to 32 (#8204)
To reduce likelihood of cache miss and associated costs.
2022-09-26 12:58:52 -07:00
Jiachen Dong bcf9d8058e [harness-simulation] add the usage of the CLI command nodeidfilter (#8196) 2022-09-23 12:20:05 -07:00
Abtin Keshavarzian 5f7f48be9b [equatable] update Equatable to ensure CRTP-style use (#8199)
This commit updates `Equatable<Type>` to ensure CRTP-style use.
2022-09-23 09:05:32 -07:00
Abtin Keshavarzian 1942a79d75 [clearable] update Clearable to ensure CRTP-style use (#8198)
This commit updates `Clearable<Type>::Clear()` method to perform
`static_cast<Type *>(this)`. This ensures CRTP-style use and also
allows the `Clearable` to be used for types that may not be a
standard layout type (and/or more generally in cases where empty
base optimization may not be applied).
2022-09-23 09:04:24 -07:00
Abtin Keshavarzian 322671e682 [routing-manager] remove old deprecating prefix on multiple xpanid change (#8151)
This commit updates `RoutingManager` to ensure to unpublish the old
local on-link prefix being deprecated on ext PAN ID change if the ext
PAN ID happens to change again before the previous deprecating prefix
is expired. Note that the code supports retaining one old deprecating
prefix entry since back-to-back ext pan ID change is not expected as
a typical use-case. This commit also updates `test_routing_manager`
to cover and test this scenario.
2022-09-23 09:02:37 -07:00
Mason Tran cc8e4cce15 [cmake] add interface libraries ot-config-(ftd|mtd|radio) (#8190)
This allows for more granular control of any configuration which
might need to be incorporated in the core library build.
2022-09-22 23:20:35 -07:00
Abtin Keshavarzian da45d327c7 [routing-manager] allow old deprecating PIOs when checking RA is from router (#8193)
This commit updates `IsReceivedRouterAdvertFromManager()` which checks
if a received RA message was prepared by the `RoutingManager module
itself to allow deprecating PIOs in the RA message. These will handle
the case when old on-link prefix(es) (e.g., on extended PAN ID change)
are being deprecated.
2022-09-22 13:37:42 -07:00
Jiachen Dong fe655f4ef1 [thci] make OpenThreadTHCI compatible with Thread reference 20200818 (#8195) 2022-09-22 11:37:30 -07:00
Abtin Keshavarzian 8988bd84c3 [mle] add RouterTable::LogRouteTable() (#8189)
This commit updates the logging format of the route table. It adds
`LogRouteTable()` method in `RouterTable`.
2022-09-22 11:33:46 -07:00
Abtin Keshavarzian 13df0374d1 [routing-manager] fix prefix comparison in EvaluateOnLinkPrefix() (#8192)
This commit fixes `EvaluateOnLinkPrefix()` to use local on-link
prefix (instead of OMR prefix).
2022-09-21 14:11:22 -07:00
Mason Tran 32d7405174 [examples] make built-in otPlatCalloc and otPlatFree definitions weak (#8188)
This will allow platforms to define their own `otPlatCalloc` and
`otPlatFree` functions which may not map directly to `calloc()`
and `free()`
2022-09-21 11:11:37 -07:00
Abtin Keshavarzian 5a627ba0fd [test] add unit test test_srp_server (#8163)
This commit adds a unit test for `Srp::Server` (which also covers
`Srp::Client`) building a foundation for writing tests covering edge
cases of SRP server and its interaction with platform "update handler"
callback and SRP client.

For example, the test validates behavior of SRP sever, when
"update handler" accepts, rejects, or ignores (waits for timeout)
the received SRP updates. The test also validates that all heap
allocated objects (used by  SRP sever) are properly freed under
different scenarios (validating that there is no heap object leak).
2022-09-21 11:06:23 -07:00
Abtin Keshavarzian 615e951ca9 [srp-server] add AutoEnableMode to give control to BR (#8129)
This commit adds new APIs and mechanisms to support `AutoEnableMode`
in SRP server. This mode allows us to delegate the control of SRP
server (when it is enabled or disabled) to the Border Routing
Manager.

Under this mode, SRP sever is auto-enabled if/when `RoutingManager` is
done with the initial prefix and route setup, i.e., when the OMR and
on-link prefixes are determined, advertised in the emitted Router
Advert message on infrastructure side and published in the Thread
Network Data. This ensures that bi-directional connectivity is set up
before allowing service registration and discovery to start. The SRP
server is auto-disabled if/when BR is stopped, for example, when the
infrastructure network interface is brought down or when the BR gets
detached.

This commit also adds CLI commands for the new APIs and adds a
test-case in `test_routing_manager` to test and validate the newly
added mechanism.
2022-09-20 22:04:58 -07:00
Abtin Keshavarzian af1fd05f0b [gh-action] add new case to run unit test with toranj config (#8164)
This commit adds a new case under GitHub `toranj.yml` workflow to
build and run all unit test using the toranj OT configuration.
2022-09-20 18:21:13 -07:00
Abtin Keshavarzian 92f18c5c53 [cmake] add separate tcplp libraries for ftd and mtd (#8175)
This commit adds separate `tpclp-ftd` and `tcplp-mtd` libraries.
Each library is then `target_link_libraries()` with the related
`openthread-ftd/mtd`. This should help avoid situation where both
`openthread-ftd` and `openthread-mtd` are included as dependency
and linked and address linker failures under certain versions of
`clang`.
2022-09-20 15:43:19 -07:00
Abtin Keshavarzian bacf8d625f [routing-manager] add Nat64PrefixManager nested class. (#8178)
This commit adds `Nat64PrefixManager` class in `RoutingManager` which
contains the NAT64 related logic including generation of local NAT64
prefix, discovery of infra interface prefix, maintaining the
discovered prefix lifetime, and selection of the NAT64 prefix to
publish in Network Data. This class encapsulates all variables and
methods related to NAT64.
2022-09-19 11:01:44 -07:00
Jiachen Dong 6df8627135 [harness-simulation] update deviceInputFields.xml automatically (#8177)
This commit automatically updates the device fields in
deviceInputFields.xml, eliminating the need to update them manually.
2022-09-19 10:59:15 -07:00
Jiachen Dong 7b44e089a7 [harness-simulation] change config format from JSON to YAML (#8176)
This commit changes the format of the configuration file from JSON to
YAML, as YAML is designed for human interaction and better suitable
for configuration than JSON.
2022-09-19 10:58:08 -07:00
Sam Kumar 9d76424c3c [cli-tcp] use TCP Circular Send Buffer in TCP CLI tool and test (#7867) 2022-09-19 10:30:48 -07:00
Sam Kumar 19f9ba20a3 [tcp] implement TCP Circular Send Buffer (#7867) 2022-09-19 10:30:48 -07:00
Sam Kumar 5b430bf80b [tcp] suppress clang-tidy for re-declared TCPlp functions (#7867) 2022-09-19 10:30:48 -07:00
Jonathan Hui 2cab708443 [cc2538] move to openthread/ot-cc2538 (#8169) 2022-09-16 09:03:28 -07:00
Simon Lin 3a64f399bf [thci] wait for connection reset in powerDown (#8166)
This commit fixes `powerDown` to wait for connection reset after
issuing `reset` command.
2022-09-16 08:31:27 -07:00
Simon Lin 0756d1ea8f [dtls] fix DTLS connection issues (#8168)
This commit fixes two DTLS session issues on Posix:
- Fix the issue that UDP connect would cause the kernel socket to bind
  to an address that might be different from the address used by the
  Commissioner.
- Set the socket address to avoid kernel selecting an incorrect source
  address.
2022-09-15 20:55:01 -07:00
Jonathan Hui b5ea9c8106 [github-actions] use concurrency feature to cancel oustanding jobs (#8154) 2022-09-15 12:06:45 -07:00
Simon Lin b11121b7b5 [thci] fix mdns_query incorrect ip6tables rules (#8159)
This commit fixes the bug that `mdns_query` inserts `ip6tables` rules
in an incorrect order.  It also uses `ip6tables -F INPUT` to flush the
`INPUT` chain after mDNS query is done.
2022-09-15 08:52:41 -07:00
Song GUO 6973a1b067 [nat64] implement functions for NAT64 on the client side (#8126)
This commit adds the ability for accepting an IPv4 address for {ping,
tcp, udp} CLI commands.
2022-09-15 08:43:36 -07:00
Simon Lin a7e0516fb2 [thci] allow custom otbr-agent log dumping command via Param9 (#8137)
This commit allows THCI to use custom command to dump `otbr-agent`
logs via `Param9`.
2022-09-14 23:03:34 -07:00
canisLupus1313 bf2e1c39bc [cmake] add files allowing direct integration to Zephyr's west (#8143)
This commit adds CmakeLists and west config in order to be able to
directly integrate the openthread with zephyr build system.
2022-09-14 22:50:04 -07:00
Jiachen Dong a0c4ede86d [harness-simulation] add support for RF enclosure simulation (#8092)
This commit adds support for RF enclosure simulation. It can pass
Leader 9.2.9, Router 9.2.9 and Router 9.2.10 in Thread Test Harness
v56.0 now.
2022-09-14 14:31:06 -07:00
Eduardo Montoya 436bde84f5 [cli] document the ping async option (#8158) 2022-09-14 11:40:57 -07:00
Jonathan Hui 1fad9f7626 [github-actions] use external repo for arm build check (#8153)
Also remove autotools build checks.
2022-09-14 11:39:28 -07:00
Song GUO b66d521d1d [nat64] implement CLI functions for NAT64 (#8058)
This commit introduces `nat64` command and 4 new subcommands
(`configuredcidr`, `configuredprefix`, `mappings`, `counters`)

nat64 cidr -- Get the configured CIDR for NAT64 translator.
nat64 mappings -- Get the mappings of NAT64 translator.
nat64 counters -- Get the packet counters and error counters of NAT64
                  translator.

This commit also introduces related API for the above commands, and
`otIp4AddressToString` & `otIp4CidrToString` for the CLI to format the
IPv4 address and CIDR.
2022-09-13 09:39:50 -07:00
Abtin Keshavarzian 531339b65d [link-metrics] simplify preparation of MLE Data Request (#8142)
This commit simplifies the preparation of MLE Data Request message
which include a Link Metrics Query TLV and its sub-TLVs.
2022-09-13 08:44:45 -07:00
Sam Kumar dd02babfeb [tcplp] add test for contiguify functionality (#7868) 2022-09-12 21:54:33 -07:00
Abtin Keshavarzian f4c76f11fc [config] include misc.h in srp_client.h (#8146)
This ensures that `OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE` is
defined in `config/srp_client.h` and can be safely used for defining
`OPENTHREAD_CONFIG_SRP_CLIENT_BUFFERS_MAX_HOST_ADDRESSES`.
2022-09-12 21:28:35 -07:00
Jonathan Hui e9877198c4 [fuzz] enable SRP server in fuzz targets (#8145) 2022-09-12 21:23:31 -07:00
Jonathan Hui 945edf1eb6 [fuzz] bump Thread version to 1.3 (#8145) 2022-09-12 21:23:31 -07:00
Abtin Keshavarzian 2ad5515be2 [routing-manager] deprecate previous local on-link prefix on xpanid change (#8112)
This commit updates `RoutingManager` to deprecate a previously
advertised local on-link prefix when extended PAN ID gets changed.
The local on-link prefix is derived from Thread network extended PAN
ID.  On extended PAN ID change, we continue to include the the old
prefix (if it was being advertised) in the emitted RAs as PIO (with
zero preferred lifetime) and continue to publish it in Network Data
up to its lifetime. This ensures that any device on infrastructure
link side that may be using an IPv6 address based on this old prefix
can continue to communicate with the Thread mesh devices.

This commit also adds a test-case in `test_routing_manager` to
validate the behavior of the newly added mechanism when ext PAN ID
changes while the local on-link is being advertised and also while
it was being deprecated.
2022-09-12 21:23:03 -07:00
Abtin Keshavarzian 1861291a62 [routing-manager] add RsSender nested class (#8124)
This commit adds `RsSender` class in `RoutingManager` which contains
the logic related to the transmission of Router Solicitation
(RS) messages to discover other routers. This class encapsulates all
variables, constants, and methods related to the RS transmission
mechanism(number of RS messages in a cycle, time intervals, etc).
2022-09-12 13:00:48 -07:00
Eduardo Montoya 865727adc8 [tcp] extend test to cover otTcpStopListening API (#8133)
Make sure `otTcpStopListening` is verified.
2022-09-09 20:20:28 -07:00
Jiachen Dong 4311d1931a [harness-simulation] add multiple-version support (#8075)
This commit adds multiple-version support, and uses a unified
configuration file to specify all the parameters.
2022-09-09 13:32:17 -07:00
Abtin Keshavarzian 2a27a15c1a [srp-server] log the content of processed SRP update message (#8131)
This commit updates the `Srp::Server` to log the processed info in a
received SRP Update message, such as host name, lease times, host
addresses, all services (and sub-types) being added or removed. The
info is logged before invoking the "update handler" and/or committing
the info into existing data. This change can help with debugging
issues.
2022-09-09 08:42:47 -07:00
Abtin Keshavarzian ccf8ea6923 [srp-client] update document about selected preferred server (#8125)
This commit updates `otSrpClientEnableAutoStartMode` documentation
to describe how the preferred server is determined from Network Data
entries (different Network Data entry categories, their order of
preference, and how to handle when there are multiple options within
the same category).
2022-09-06 15:27:22 -07:00
Jonathan Hui 1929c7c187 [github-actions] add gcc-12 to build matrix (#8118) 2022-09-06 11:19:09 -07:00
Jonathan Hui f88f954289 [ncp] fix init order to resolve compiler warning (#8118) 2022-09-06 11:19:09 -07:00
Jonathan Hui ae4c28c5ae [core] do not use FreeMessageOnError() on nonnull pointer (#8118) 2022-09-06 11:19:09 -07:00
Abtin Keshavarzian a53715b231 [link-metrics] simplify processing of SeriesFlags (#8116)
This commit updates `SeriesFlags` definition to map to the public
`otLinkMetricsSeriesFlags` struct and adds helper methods to convert
to or set it from a `uint8_t` flags bitmask which is read or written
in the TLVs.
2022-09-06 08:50:17 -07:00
Abtin Keshavarzian f43b9f0332 [routing-manager] add ScheduleRoutingPolicyEvaluation() (#8115)
This commit adds a new method `ScheduleRoutingPolicyEvaluation()` in
`RoutingManager` which combines the logic from different related
methods. This helps simplify the code. The new method accept an enum
`SchduleMode` input which indicates the rule to use when determining
the next policy evaluation time, e.g., schedule it immediately, or
after a random delay, or after short random jitter time to reply to
a received RS, etc.
2022-09-06 08:49:27 -07:00
Abtin Keshavarzian 46c7dccfef [discover-scanner] invoke handler when scan is done from a tasklet (#8111)
This commit updates `DiscoverScanner` so when scan operation is
finished it uses a `Tasklet` to clear the state and invoke the
callback. This allows users to safely call OT APIs from the
callback.
2022-09-06 08:46:27 -07:00
Abtin Keshavarzian 5d50088da9 [routing-manager] rename published NAT64 prefix (#8113)
This commit renames the variable representing the NAT64 prefix
which is published in Network Data to `mPublishedNat64Prefix`.
2022-09-01 11:01:53 -07:00
Abtin Keshavarzian 6dca78e757 [link-metrics] add blocking CLI query command and enhance tests (#8108)
This commit updates CLI `linkmetrics query` command to allow it
to be used in blocking mode (wait for response to query). This
is then used in different tests to validate the `LinkMetrics`
module behavior. In particular, `v1_2_test_single_probe` and
`v1_2_LowPower_7_2_01_ForwardTrackingSeries` are updated to
validate that the received query report message is correctly
parsed.
2022-09-01 10:49:02 -07:00
Abtin Keshavarzian c3dd3ba8fb [mle] update DetachGracefully() to stop BR routing manager (#8105)
This commit updates `Mle::DetachGracefully()` to stop Border Router
`RoutingManager`. This ensures that BR will have the chance to send
a final Router Advertisement message desecrating/removing its
previously advertised on-link or route prefixes.
2022-09-01 08:19:57 -07:00
Simon Lin 30d65bca48 [thread-cert] import Crypto on demand (#8109)
This commit imports `Crypto` module only when it's used.

This helps thread-cert tests that do not use message factory to run
without having to install `Crypto` module.
2022-08-31 19:48:24 -07:00
Song GUO bce7c1ae1f [nat64] change BORDER_ROUTING_NAT64 to NAT64_BORDER_ROUTING (#8047)
We decided to rename BORDER_ROUTING_NAT64 to NAT64_BORDER_ROUTING so
the flag won't be confusing since we have NAT64_TRANSLATOR which does
not depends on the border routing manager.
2022-08-30 21:05:28 -07:00
rxwen 3d60038bcb [posix] make base class destructor virtual (#7220) 2022-08-30 11:04:21 -07:00
Abtin Keshavarzian d9fd256b47 [tlvs] rename method to ReadTlvValue() from ReadTlv() (#8100)
This commit renames the method from `ReadTlv()` to `ReadTlvValue()`
to emphasize that it read the TLV value only (unlike `FindTlv()` helper
methods which find and read the whole TLV).
2022-08-30 09:11:06 -07:00
Abtin Keshavarzian ba4389a44a [radio] define Radio::kInvalidRssi constant (#8097)
This commit harmonizes the constant used to indicate an "Invalid RSSI
value". It defines `Radio::kInvalidRssi` which is then used in all
core modules replacing `OT_RADIO_INVALID_RSSI` and similar constants
in `SubMac/Mac`.
2022-08-30 09:10:18 -07:00
Abtin Keshavarzian a6032491b8 [link-metrics] fix reading of Report sub-tlv from message (#8099) 2022-08-29 20:25:34 -07:00
Jonathan Hui 0988f460dc [github-actions] migrate to ubuntu 20.04 to 18.04 (#8061) 2022-08-29 10:51:35 -07:00
whd 9308db14c9 [otci] support ADB connection for OTCI (#8088) 2022-08-25 23:19:28 -07:00
Abtin Keshavarzian ba006225e0 [link-quality] helper fn to convert link margin, link quality, RSS (#8081)
This commit simplifies the helper functions that convert between
link margin, link quality and RSS (replacing the `static` methods
in `LinkQualityInfo`).
2022-08-25 14:10:29 -07:00
Abtin Keshavarzian 10c9a365f2 [link-metrics] simplify sending MLE Mgmt Request (#8073)
This commit adds `FwdProbingRegSubTlv` which is used to simplify
`SendMgmtRequestForwardTrackingSeries()` implementation. Similarly
`EnhAckConfigSubTlv` is updated and used to simplify method
`SendMgmtRequestEnhAckProbing()`.
2022-08-25 11:17:56 -07:00
Sarah cd83fc1477 [docs] CLI Dataset (#7944) 2022-08-25 11:15:37 -07:00
Abtin Keshavarzian 958eb5c5bf [srp-server] update validation of instance and service names (#8080)
This commit updates `ProcessServiceDiscoveryInstructions()` method
to use `Dns::Name::IsSubDomainOf()` to validate the relation between
service instance name and the base service name.
2022-08-25 11:11:35 -07:00
Abtin Keshavarzian d72c10eed3 [routing-manager] advert local on-link prefix if same as discovered prefix (#8079)
This commit updates the `RoutingManager` such that if we see that that
current favored discovered on-link prefix (from processed RAs from
other router) matches our local on-link prefix, we start/continue
advertising it as well. The local on-link prefix is derived from
extended PAN ID and therefore is the same for all BRs on the same
Thread mesh. Having multiple BRs advertise the same on-link prefix
adds redundancy (in case one BR goes offline).
2022-08-25 11:09:42 -07:00
Abtin Keshavarzian 989a56e96d [link-metrics] update the scaling of link margin and RSSI metrics (#8078)
This commit updates the scaling of the link margin and RSSI metrics.
The metric values are scaled when appended in the message (in a
Report sub-TLV) or when they are read back from received message. The
stored value in `MetricsValues` are changed to be always the actual
metric value (not the scaled value). This ensures that the value are
stored in proper int type (e.g., RSSI is `int8` vs the scaled value
which is `[0,255]`). Methods are added to perform the scaling which
now rounds to closest integer ensuring the reverse scaling gives back
the original value. Unit test is added to validate the scaling
methods.
2022-08-25 11:08:44 -07:00
Abtin Keshavarzian cba1bebf1f [child-table] check neighbor is in ChildTable before cast as Child (#8071)
This commit adds a check `Get<ChildTable>().Contains(Neighbor &)`
to ensure that the neighbor is from the child table before casting
the neighbor entry to `Child`. This adds safety and protection against
potential corner-case where we have a neighbor entry which is
`Parent` or `ParentCandidate` that is a REED.
2022-08-24 23:35:21 -07:00
Jonathan Hui d7cbc17961 [posix] initialize hints in InfraNetif::DiscoverNat64Prefix (#8070) 2022-08-24 22:15:07 -07:00
Jiachen Dong 0f10480ed6 [harness-simulation] fix build_docker_image.sh error (#8072) 2022-08-24 10:53:11 -07:00
Abtin Keshavarzian e51941177f [mle] add ParentCandidate class (#8069)
This commit adds `ParentCandidate` in `Mle` class (as a sub-class of
`Parent`) and moves all member properties related to parent candidate
to this new class.
2022-08-24 10:46:14 -07:00
Abtin Keshavarzian 9699d319af [takelet] add template TaskeltIn to simplify handler functions (#8064)
This class adds a template sub-class of `Tasklet` which allows
us to directly specify an `Owner` of tasklet along with handler
callback as a member method of `Owner`. This helps simplify the
use of `Tasklet` in core module.
2022-08-24 10:44:48 -07:00
Sarah 5516024905 [docs] CLI child commands (#8041) 2022-08-23 17:33:14 -07:00
Eduardo Montoya 130cfd790c [thci] remove unused methods (#7704)
`setActiveDataset` and `setCommisionerMode` have been removed from
the `iThci` abstract class in the latest harness release.
2022-08-23 16:30:10 -07:00
Abtin Keshavarzian d17bde5b2d [mle] move simple RLOC to Router ID conversion functions to mle_types.hpp (#8060)
This commit moves simple `static` member methods from `Mle` class to
`mle_types.hpp` (under `Mle` namespace).
2022-08-23 16:14:09 -07:00
Abtin Keshavarzian 2c3a10d67a [mac] add ComputeLinkMargin() (#8063)
This commit adds a helper method in `Mac` to compute link margin
from a given received signal strength (in dBm) using the radio
noise floor.
2022-08-23 14:37:21 -07:00
Abtin Keshavarzian 9d70832b85 [link-metrics] simplify HandleReport() (#8054)
This commit updates `LinkMetrics::HandleReport()` method:
- Fixes issue where `Status` sub-TLV would not be read.
- Uses `Tlv` helper method to read the sub-TLVs.
- Reads `ReportSubTlv` directly from message and uses its methods
  to get the metrics values.
- Fixes issue where we would not skip over unknown sub-TLVs
  correctly.
2022-08-23 14:34:09 -07:00
Yi 3d146f3f60 [nat64] disable discovering NAT64 AIL prefix for OpenWRT (#8065) 2022-08-23 08:32:56 -07:00
canisLupus1313 85fb24aedf [mesh-forwarder] fix random ieee frame version 2015 while attaching (#8067)
This commit fixes random 2015 frame version issue while attaching to
REED. the problem was caused by unconditionally casting Router structure
to Child structure and making out of original structure memory access.

Signed-off-by: Przemyslaw Bida <przemyslaw.bida@nordicsemi.no>
2022-08-23 07:05:04 -07:00
Jiachen Dong 0b8e9745e5 [thci] add support for OTBR simulations (#8015)
It can run all Thread 1.2 test cases with simulations now except those
requiring multiple versions support. It has been tested with the DUT
being a role of Router, Leader, Border Router, BR_1 and BR_2.
2022-08-22 21:32:45 -07:00
Abtin Keshavarzian 142b8cf58c [core] add generic three-way comparison function (#8050)
This commit adds a generic `ThreeWayCompare()` function. It also
renames header to `num_utils.hpp` from `min_max.hpp`.
2022-08-22 19:52:02 -07:00
Abtin Keshavarzian 188ec0d476 [link-metrics] define StatusSubTlv to simplify appending/parsing it (#8051)
Status sub-TLV has a single `uint8_t` status value so we can use
declare it as `UintTlvInfo<SubTlv::kStatus, uint8_t>` and then use
helper `Append<StatusSubTlv>` and `Read<StatusSubTlv>` to append
and read it.
2022-08-22 19:26:25 -07:00
Abtin Keshavarzian 570e30522f [address-resolver] simplify EntryInfo and Iterator (#8055) 2022-08-22 17:47:07 -07:00
whd 8942e7f895 [multicast-routing] block egress multicast packets from LLA (#8059)
According to the Spec, egress packets from LLA should not be
forwarded. Linux kernel doesn't automatically block such forwarding
so that we need to check this before adding the MFC entry.
2022-08-22 16:34:52 -07:00
Jonathan Hui 370d4dc0b5 [docs] update Thread version (#8053) 2022-08-22 16:30:36 -07:00
Abtin Keshavarzian b8b88d9492 [mle] track LeaderCost in Parent class (#8052) 2022-08-22 16:30:17 -07:00
Abtin Keshavarzian 96bba3659c [topology] add Router::GetTwoWayLinkQuality() method (#8049)
This commits add `GetTwoWayLinkQuality()` method to `Router` class
which returns the minimum of router's Link Quality In and Out
values. It also adds `GetLinkQualityIn()` to `Neighbor`. These
are used in `Mle` and `MeshForwarder`.
2022-08-22 16:22:31 -07:00
Abtin Keshavarzian fdd0afacc5 [link-metrics] simplify AddReport() (#8042)
This commit simplifies the `LinkMetrics::AddReport()` method so that
when preparing the MLE Link Metrics Report TLV (and its sub-TLVs) we
determine the TLV length after all sub-TLVs are appended to the
message from the number of written bytes in the message (difference
between `aMessage.GetLength()` and initial offset of the TLV). This
allows to simplify methods `AppendReportSubTlvToMessage()` and
`AppendStatusSubTlvToMessage()` as well.
2022-08-22 16:19:18 -07:00
Yi e50be395e4 [nat64] extend wait time between test cases and verify netdata stabilized (#8057)
This commit extend the wait time after disabling border routing and a
new case is added to verify that the netdata is stable again.
2022-08-22 16:14:07 -07:00
Kangping d48799dddf [border-agent] update logging for filtered messages (#8045)
Update border agent logging for filtered messages to debug level to
avoid confusion, because it's actually not a error case.
2022-08-20 08:05:59 -07:00
Abtin Keshavarzian a5eb1c9401 [link-metrics] add link_metrics_types.hpp (#8040)
This commit adds a new header files `link_metrics_types.hpp` which
includes all `LinkMetrics` related types and constants. The related
type definition are moved to this header from `link_metrics.hpp` and
`link_metrics_tlvs.hpp` (which now contains the TLV definitions only).

This commit also moves the more complex method implementations to the
`cpp` file.
2022-08-19 11:13:15 -07:00
Sam Kumar 829632e33e [tcp] implement otTcpReceiveContiguify (#7634) 2022-08-19 10:12:40 -07:00
Sam Kumar 0126c5f44b [tcp] modify cbuf to be able to use all bytes provided by the user (#7634) 2022-08-19 10:12:40 -07:00
Abtin Keshavarzian a0718d90b1 [mle] define DetachGraecfuly variables as private (#8044)
This commit changes the definitions (member variables, constants, and
methods) related to graceful detach mechanism to be `private` instead
of `protected` since they are only accessed/used by the `Mle` and not
by its sub-class `MleRouter`.
2022-08-18 23:01:26 -07:00
Abtin Keshavarzian 4dd9fd0c9e [link-metrics] fix integer conversions & use of u8 for offset (#8043)
This commit addresses integer conversion warnings in `LinkMetrics`.
In particular it updates `ReadTypeIdFlagsFromMessage()` to use
`uint16_t` as offset value (instead of `uint8_t`).
2022-08-18 23:00:51 -07:00
Abtin Keshavarzian 969d511d04 [routing-manager] allow domain prefix to be considered as OMR (#8014)
This commit updates the `RoutingManager` to allow domain prefix from
Network Data to also be considered during OMR selection. In
particular:
- `IsValidOmrPrefix(config)` now accepts prefixes with `mDp` flag.
- `OmrPrefix` now tracks whether the prefix is domain prefix.
- When appending RIO in RA message, the domain prefix is always
  excluded (independent of whether or not it is the current favored
  OMR prefix).

This commit also updates the `test_routing_manager` unit test to add
a test case checking behavior of `RoutingManager` when a domain prefix
is selected as the favored OMR.
2022-08-18 22:41:49 -07:00
Abtin Keshavarzian c2b6621d9f [ip6] add MessageOrigin to indicate origin or IPv6 message (#8036)
This commit adds a new enum `Ip6::MessageOrigin` which indicates the
origin of the message: From Thread Netif or from host. In case the
message is originating from host, it also indicates whether or not it
is allowed to pass back the message to the host.
2022-08-18 22:32:10 -07:00
Song GUO e84f05c641 [nat64] implement nat64 translator (ot::Nat64::Translator) (#7836)
This commit:

- implements the core logic for translating packets for NAT64,
  including the public APIs exposed to platform daemons.

- includes changes for POSIX platform, use `OT_POSIX_NAT64_CIDR`,
  `OPENTHREAD_POSIX_CONFIG_NAT64_CIDR` for setting the CIDR for NAT64
  during build time.

- exposes `otNat64Send(otInstance *aInstance, otMessage *aMessage)`
  and `void otNat64SetReceiveIp4Callback(otInstance *aInstance,
  otNat64ReceiveIp4Callback aCallback, void *aContext)`.
2022-08-18 22:28:26 -07:00
whd 20aee3fa70 [multicast-routing] don't add MFC entries using mesh local as the source address (#8025)
According to Thread Spec, PBBR should not forward a multicast packet
from Thread interface to Backbone interface when the source address is
Mesh-Local.
2022-08-17 22:59:50 -07:00
Abtin Keshavarzian 897a29565e [api] harmonize nullptr assert check of pointer input parameters (#8031)
This commit harmonizes and simplifies the code related to asserting
that the OT API pointer parameters are valid and not `nullptr`.
`OPENTHREAD_CONFIG_ASSERT_CHECK_API_POINTER_PARAM_FOR_NULL` is added
which when used performs assert check on all pointer inputs to APIs.
This is either done within `AsCoreType()` when the pointer is
converted to its related core type, or by a direct call to newly added
macro `AssertPointerIsNotNull()`.

Since enabling assert checks on every API parameter can increase code
size, this config is disabled by default and it is recommended to use
it during debugging only.
2022-08-17 20:22:19 -07:00
Abtin Keshavarzian cb91e43322 [mle] add Parent class (tracking CSL accuracy info) (#8029)
This commit adds `Parent` class as a sub-class of `Router` and moves
the CSL accuracy definitions in `Parent` class (from `Router`) since
we need to track CSL info only for the parent and not other entries
in the router table. This helps reduce the memory/RAM used by router
table.
2022-08-17 19:21:19 -07:00
Abtin Keshavarzian 1d10948069 [router-table] simplify Allocate() and random selection of ID (#8032)
This commit updates `RouterTable::Allocate()` to use Reservoir
sampling algorithm to randomly select a router ID while iterating
through the list of available IDs.
2022-08-17 15:36:10 -07:00
Abtin Keshavarzian 061d22ba8e [ip6] simplify Ip6::HandleDatagram() - remove netif local var (#8035)
This commit updates `Ip6::HandleDatagram()` and removes the local
`netif` variable and directly uses `ThreadNetif` instead. Note that
the input parameter `aNetif` is either `nullptr` or points to
`ThreadNetif`, and in both cases the local variable `netif` will be
set to point to `ThreadNetif`.
2022-08-17 14:32:18 -07:00
Abtin Keshavarzian 2d4896f675 [ip6] remove extra param from Ip6::HandleExtensionHeaders() (#8035)
This commit updates `Ip6::HandleExtensionHeaders()` removing
`aIsOutbound` input and instead using `(aNetif == nullptr)` to
determine this.
2022-08-17 14:32:18 -07:00
Abtin Keshavarzian 7f73cd42a4 [link-metrics] fix the endian-ness of mPduCountValue (#8039)
This commit updates `LinkMetrics::AppendReport()` to ensure
the `values.mPduCountValue` (which is a `uint32_t`) is stored in
the host MCU encoding and not in big-endian encoding.

This was originally added in #7046 as a fix (basically saving the
value in local variable in the encoding we expect to later include
in the Report TLV), however #8006 updates the `ReportSubTlv` methods
to do the encoding change in the `Get/SetMetricsValue32()` (similar
to other OT `Tlv` definitions).
2022-08-17 12:00:27 -07:00
Abtin Keshavarzian 1b5298eb76 [csl] add CslAccuracy type (#8024)
The CSL accuracy is represented as two parameters: clock accuracy in
ppm, and uncertainty in units of 10 microseconds. These two parameters
are often used together. This commit adds a new class `CslAccuracy`
encapsulating both. This new type is used in `Mac` and `Mle` methods
allowing us to pass both in one object.

This commit also adds `Mle::RxMessage::ReadCslClockAccuracyTlv()` to
read and parse the CSL Accuracy TLV value from a given received MLE
message.
2022-08-16 22:19:14 -07:00
Simon Lin f790edd5e2 [github-actions] upgrade pyshark to 0.4.6 (#8030) 2022-08-16 16:23:43 -07:00
Abtin Keshavarzian 8161a90a0c [thread] add version consts & use uint16_t for Neighbor::mVersion (#8027)
This commit adds `thread/version.hpp` which defile Thread Version
constants. It also changes the `mVersion` in `Neighbor` class to
use `uint16_t` to track the version. This help harmonize it with
the MLE Version TLV and and version in `Settings`. Due to memory
alignment of existing member variables the change (from `u8` to
`u16`) does not increase the memory requirement for child or router
table.
2022-08-16 16:22:35 -07:00
Abtin Keshavarzian bbac0e7980 [ip6] update HandlePayload() (avoid msg clone if not needed) (#8023)
This commit adds a smaller enhancement in `Ip6::HandlePayload()`. If
support for TCP `OPENTHREAD_CONFIG_TCP_ENABLE` is not enabled, we
exit early from this method before potentially creating a clone of
the message (to free later).
2022-08-16 15:55:48 -07:00
Abtin Keshavarzian 47e5277659 [mle] define ParentSearch class (#8022)
This commit adds `Mle::ParentSearch` class which encapsulates all
definitions (variables, constants, and methods) related to "Parent
Search" feature.
2022-08-16 15:55:09 -07:00
Jonathan Hui 4c8ae758fd [routing-manager] fix call to StartRoutingPolicyEvaluationJitter() (#8034) 2022-08-16 15:54:23 -07:00
Abtin Keshavarzian 51c58d9080 [slaac] only allow SLAAC for prefixes with 64-bit length (#8021)
This commit updates `Slaac` module to only allow prefixes with
64-bit length.
2022-08-16 13:21:51 -07:00
Zhangwx 7c648559da [bbr] reduce the default reregisteration delay (#7996)
After BBR restarting, in order to receive the packets from multicast
group, the devices, which have registered multicast group addresses to
that BBR, needs to re-register these groups. In current logic, the
default max reregistration delay is too large (1200 seconds).
2022-08-16 13:20:47 -07:00
Simon Lin 92a5bd5451 [routing-manager] increase routing policy evaluation jitters (#7982)
This commit increase the routing policy evaluation jitter from 1
second to 2~4 seconds to avoid adding on-link prefix when the AIL GUA
prefix is unavailable for a very short duration (usually during GUA
prefix renewing).
2022-08-16 13:19:34 -07:00
Simon Lin 1bc309452f [thci] send mdns queries without dig (#7954)
Some mDNS implementations do not respond to mDNS queries sent by
`dig`.
2022-08-16 13:18:55 -07:00
Eduardo Montoya 01dd49286e [doc] fix RCP building information for nRF52840 (#8020) 2022-08-12 16:07:08 -07:00
Abtin Keshavarzian f33a586530 [mle] new API to trigger search for better parent (#8018)
This commit adds `otThreadSearchForBetterParent()` to start the
process on a child to search for a better parent while staying
attached to its current parent. This commit also adds a related CLI
command `parent search`.
2022-08-12 16:05:53 -07:00
Abtin Keshavarzian d1d8c6fecd [mle] add method to get parent info (#8019)
This commit moves the code for getting the parent info from the
`thread_api.cpp` to `Mle` class `GetParentInfo()` method. It also
updates the `Router::Info::SetFrom()` to populate the `mVersion` and
the newly added CSL related fields. This allows us to re-use the
same code for both router or parent info.
2022-08-12 11:26:47 -07:00
Abtin Keshavarzian 3aa4060018 [routing-manager] accept any ULA/GUA with 64-bit len as OMR prefix (#8016)
This commit updates `IsValidOmrPrefix()` to accept any ULA/GUA
prefix with 64-bit length as OMR prefix.
2022-08-12 11:23:38 -07:00
Abtin Keshavarzian d06f96a50f [routing-manager] add RaInfo tracking all RA related info (#8013)
This commit adds a new struct `RaInfo` in `RoutingManager` which
tracks info about emitted RA messages: Number of RAs sent, last tx
time, header to use and whether the header is discovered from
receiving RAs from the host itself. This helps encapsulate all
related info in one data structure.
2022-08-12 11:22:46 -07:00
Abtin Keshavarzian fda4549df7 [core] add new generic Min(), Max() and Clamp() functions (#8017)
This commit adds generic helper functions:

- `Min()` to get the minimum of two values,
- `Max()` to get the maximum of two values, and
- `Clamp()` to clamp a value to a given closed range from a minimum
   up to a maximum value. It also adds functions
- `ClampToUint8()` and `ClampToUint16()` to clamp a `uint` value to
   a smaller bit-size (`uint8_t` or `uint16_t`) range.
2022-08-12 09:22:18 -07:00
Laukik Hase 82088fe24d [meshcop] update deprecated functions for Mbed TLS v3.2.1 (#7977)
- Updated the following deprecated APIs with their respective alternatives
  - `mbedtls_ssl_conf_min_version` => `mbedtls_ssl_conf_min_tls_version`
  - `mbedtls_ssl_conf_max_version` => `mbedtls_ssl_conf_min_tls_version`
  - `mbedtls_ssl_conf_sig_hashes` => `mbedtls_ssl_conf_sig_algs`
- Updated the parameter data-type for `mbedtls_ssl_conf_sig_algs`
  (list of allowed signature algorithms) from `int` to `uint16_t`
- Added macros for backward compatibility
2022-08-12 09:15:04 -07:00
Yi 80565c58a9 [nat64] fetch NAT64 prefix from infrastructure interface and advertise it to netdata (#7619)
This commit fetches the NAT64 prefix on infrastructure interface and
advertise it to Network Data at medium preference.

- Use `getaddrinfo_a()` function to asynchronously lookup the ipv6
  address of the special domain `ipv4only.arpa`. The infrastructure
  NAT64 prefix is extracted from the domain answer.

- `mInfraIfNat64PrefixStaleTimer` is scheduled to monitor the presence
  and change of infrastructure NAT64 prefix.

- `EvaluateNat64Prefix` evaluates whether to advertise the
  infrastructure prefix or the local ULA prefix or neither. When there
  is a new infrastructure prefix, it will withdraw the legacy one and
  add the new one. When the infrastructure prefix no longer exists, it
  will withdraw the legacy one and add the local ULA prefix. When the
  infrastructure prefix presents again, it will add the infrastructure
  prefix and withdraw the local ULA prefix.

New tests are added to test the scenarios when infrastructure NAT64
prefix exists.  `DNS64` on OTBR is turned on to enable `bind9` with
NAT64 prefix on infrastructure interface for these tests. `bind9` is
explicitly turned off when testing local ULA prefix.  Since bind9 is
conflict with other components like dnssd, all nat64 tests are moved
under /nat64 directory and configured separately.

The case that two or more BRs have same infrastructure NAT64 prefix is
not covered by this commit and will be followed up later.
2022-08-12 07:37:05 -07:00
Abtin Keshavarzian 034fc826f3 [routing-manager] use Ip6::Prefix::IsUniqeLocal() to check OMR prefix (#8012)
This commit updates `IsValidOmrPrefix()` to use `IsUniqeLocal()`
method of `Ip6::Prefix`. This relaxes the check to allow any ULA
prefix and not necessarily with 64 bits prefix length.
2022-08-11 11:16:46 -07:00
Abtin Keshavarzian a1e2698401 [ip6-address] move more complex Prefix methods to cpp file (#8011)
This commit moves more complex methods of `Ip6::Prefix` class to the
`cpp` file. It also simplifies the `IsLinkLocal()` implementation. It
also updates unit test `test_ip_address` to validate `IsLinkLocal()`,
`IsMulticast()`, and `IsUniqueLocal()` methods.
2022-08-11 11:15:11 -07:00
Abtin Keshavarzian ea1b2292be [mle] add TlvList to track list of TLV types (#8008)
This commit adds `Mle::TlvList` type which represents a list of MLE
TLV types. It provides helper methods to `Add()` TLVs to the list
ensuring that any TLV type is included only once. The `TlvList` is
used when parsing "TLV Request TLV" or preparing which TLVs to
include in an MLE message.
2022-08-11 11:14:09 -07:00
Simon Lin 3120efb486 [thci] restore BBR config for 1.2 BR_1/BR_2 roles (#7997)
BBR related configurations was previously removed for Thread 1.3 BRs.
However, when running 1.2 test case for a Thread 1.3 BR, these
configurations are still necessary.

This commit restores BBR dataset configurations for 1.2 BR_1/BR_2
roles.
2022-08-11 11:08:48 -07:00
Simon Lin f4d93d8fcf [thci] enhance mdns_query to use ip6tables to filter mDNS responses (#8000) 2022-08-11 10:24:52 -07:00
whd df2c11a6cb [tests] add test for Advertising Proxy to publish zero or multiple host addrs (#8003) 2022-08-10 21:24:44 -07:00
Sarah c336a1899f [docs] CLI bbr (#7986) 2022-08-10 17:12:05 -07:00
Abtin Keshavarzian 82ce9dd4c4 [csl] update CSL Channel TLV process to allow for unspecified case (#8005)
This commit updates how unspecified CSL channel is conveyed in MLE
messages. Special value of zero in CSL Channel TLV is used to
indicate that the CSL channel is unspecified. The exclusion of the
TLV keeps the CSL channel as before (no change to the previously
set CSL channel).
2022-08-10 15:00:48 -07:00
Abtin Keshavarzian 967d89cd1a [link-metrics] fix u32 endian-ness in ReportSubTlv (#8006) 2022-08-10 12:11:39 -07:00
Abtin Keshavarzian 9f451a2b32 [mle] fix processing of CSL TLVs (#8004)
This commit contains fixes and enhancements related to processing
of CSL Channel TLV and CSL Clock Accuracy TLV in MLE messages:

- Updates/adds `IsValid()` method to check if TLV is well-formed.
  In particular, we check the TLV length to be at least the
  expecte length (but can be larger) to allow for future changes
  to the TLV format (adding new fields while remaining backward
  compatible).

- Ensure to verify that the read TLV is valid before using its
  content.

 - Fix processing of Accuracy TLV in `HandleChildUpdateResponse()`
   (where we could use incorrect values if TLV was not present).
2022-08-10 10:28:32 -07:00
Abtin Keshavarzian 3a31a5f368 [mle] add array bound check to avoid overflow in HandleDataRequest() (#8002) 2022-08-10 10:26:41 -07:00
Abtin Keshavarzian 3c38af22b4 [mle] helper method appending TLV Request TLV (#8001)
This commit contains smaller enhancements in MLE:

- We use `static const` to define array of TLVs to request.
- Rename the const arrays to `kTlvs`.
- Adds template `AppendTlvRequestTlv()`.
- Adds template `SendDataRequest()`.
2022-08-10 10:22:51 -07:00
Jiachen Dong ba14836b68 [thci] enhance SSH connection (#7981)
Now It connects to OpenThread FTD simulations via SSH without PTY and
runs in non-blocking mode.
2022-08-09 09:21:52 -07:00
Simon Lin 919157d0a6 [thci] generate more logs (#7975) 2022-08-09 09:19:20 -07:00
Jiachen Dong 0a41196540 [thci] add SSH keepalive (#7999)
Add SSH keepalive to avoid disconnection after idle for a long time.
2022-08-08 18:18:21 -07:00
Eduardo Montoya 4ce6a4708d [api] allow CSL receiver to gather parent CSL capabilities (#7991)
This commit extends the Thread API to allow a CSL Receiver application
to adjust its CSL parameters depending on the parent capabilities.

Specifically, it might decide to switch to polling operation instead
of CSL synchronization when the attached parent does not support CSL
Transmitter role (Thread Version 2) or it advertises poor CSL accuracy
or uncertainty.
2022-08-08 11:42:39 -07:00
Eduardo Montoya 5700f90590 [message] document buffer size needs (#7998)
With changes in #7554 the `Metadata` stuct size in `Message` increased,
leading to unsufficient message buffer size when the maximum number
of children is configured, due to the variable size of `ChildMask`.

Furthermore, enabling CoAP Blockwise option also extends the message
buffer size requirements.

This commit documents those cases and makes it clearer
for users how to overcome the possible building issues.
2022-08-08 11:06:59 -07:00
Steven Cooreman 0b41ae0a30 [crypto] allow selecting randomized ECDSA instead of deterministic (#7894)
There is no hard dependency in the Thread specification which requires
the use of deterministic signatures. On the contrary, looking at the
tinycrypt implementation, that one issues randomized ECDSA signatures
and seems to be quite happy with that.

This change does not change the default behaviour, which is to use
deterministic ECDSA when using the default MbedTLS backend. It does
however make it possible for platforms which have qualified hardware
entropy to select 'plain' ECDSA instead, which gives both a performance
and code size improvement on those platforms.
2022-08-08 10:27:12 -07:00
Abtin Keshavarzian cbbed06931 [mesh-forwarder] add Mac::Addresses (src and dst address) (#7990)
This commit adds a new struct `Mac::Addresses` which represents two
MAC addresses corresponding to source and destination. This type
is then used in `MeshForwarder` and `Lowpan` methods allowing us
to pass both source and destination addresses as one parameter.
2022-08-08 09:26:16 -07:00
Abtin Keshavarzian c28496dbd8 [routing-manager] add LocalOnLinkPrefix class (#7989)
This commit simplifies `RoutingManager` by adding a nested class
`LocalOnLinkPrefix` which encapsulates the local on-link prefix
related info and functionality. It tracks the state of the prefix,
i.e. whether we are advertising, deprecating or not including it. It
provides a method to append it as a PIO in an RA message and uses a
timer to keep track of the prefix's lifetime (since the last time it
was advertised in an RA message).

This commit also updated the `test_routing_manager` unit test to add
`TestLocalOnLinkPrefixDeprecation()` checking the deprecation and
expiration of local on-link prefix.
2022-08-08 09:24:10 -07:00
Jiachen Dong 62fcf85106 [thci] change implementation of sniffer simulation from SSH to gRPC (#7983)
The sniffer simulation now supports node filter functionality
(equivalent to RF enclosure in the real world).
2022-08-08 09:19:07 -07:00
whd 24fd146e10 [otci] wait for 2 seconds before retrying a command (#7995)
After a factoryreset the `ot-ctl` may fail to connect to the socket
for ~10 seconds. In such a situation, if OTCI sends a new command,
`execute_command` will receive an exception and will retry the same
command for several times. Such retries will immediately fail because
`ot-ctl` connection is still down and there's no time gap between two
retries.  Hence we should add some wait time before retrying so that
it gives `ot-ctl` some time to recover the connection.
2022-08-08 09:14:33 -07:00
Abtin Keshavarzian b2f8c4adba [cmake] enhance OT CMake config options (allow on/off/unspecified) (#7979)
This commit enhances OT CMake config options allowing them to use 3
values of "on", "off", and unspecified (empty string).

With this change is an `OT_{FEATURE}` option is set to "off", it is
explicitly disabled (`-DOPENTHREAD_CONFIG_{FEATURE}=0` is added which
defines the corresponding OT config as zero). This changes the CMake OT
option behavior from before where "off" was treated as unspecified.

If `OT_{FEATURE}` is left unspecified (or set to empty string), then
the related OT config is not defined by CMake build allowing it to be
to be determined by other means, e.g., a project specific config
header or default config specified in `src/core/config` header files).

This commit adds a CMake macro `ot_option()` to help simplify defining
CMake OT config options. This macro also help emit status messages
indicating the value of each OT config.
2022-08-05 19:56:53 -07:00
Simon Lin 2615d10db8 [border-agent] refine meshcop service state bitmap checks (#7950) 2022-08-04 21:18:19 -07:00
Abtin Keshavarzian cc72e29c88 [lowpan] update ComputeIid() and simplify CompressIid() (#7973)
This commit contains smaller enhancements and fixes in `Lowpan`
related to IID calculation and compression:

- It updates `ComputeIid()` to return `Iid` only.
- `ComputeIid()` now uses the newly added `ApplyPrefix()` which
  ensures the prefix bits are set in IID (if prefix len > 64).
- `CompressIid()` methods are simplified to use `IsLocator()`
   method to determine if the IID matches the locator pattern.
2022-08-04 20:19:56 -07:00
Abtin Keshavarzian 21c5bf7025 [ip6] add ApplyPrefix() to Ip6::InterfaceIdentifier (#7973)
This commit adds a new method `InterfaceIdentifier::ApplyPrefix()`
which applies a given prefix to an IID. This is applicable only when
the prefix length is longer than 64 bit. In this case, only the bits
in the IID up the prefix length are changed to match the prefix and
the remaining bits are left unchanged. This commit also updates the
unit test to validate the behavior of the new method.
2022-08-04 20:19:56 -07:00
Abtin Keshavarzian 3b0738542c [lowpan] update Context and add FindContext() methods (#7971)
This commit contains smaller enhancements in `Lowpan` related to
`Context`. It adds a new member variable `mIsValid` to this struct
which indicates whether we have a valid context. It also adds new
methods `FindContextForId()` and `FindContextToCompressAddress()`.
These methods will either retrieve a related context or `Clear()`
it (to indicate that there is no valid context and also set it ID
to zero which is the default used in lowpan compression).
2022-08-04 07:29:12 -07:00
Abtin Keshavarzian 4116b30c58 [config] add border_routing.h and border_agent.h (#7968)
This commit adds `border_routing.h` and `border_agent.h` header
files for OT configuration related to Border Routing Manager and
Border Agent (removing the definitions from `border_router.h`).
2022-08-04 07:27:10 -07:00
Sarah 9a104a814c [docs] CLI channel (#7957) 2022-08-02 12:54:10 -07:00
Abtin Keshavarzian c096c0e9ca [mesh-forwarder] use FrameBuidler in PrepareDataFrame() (#7964)
This commit updates `MeshForwarder::PrepareDataFrame()` to use
`FrameBuilder` to prepare the frame. It also updates `Lowpan`
fragment header definitions and adds `FirstFrag` and `NextFrag`
nested types. The unit test `test_lowpan` is also updated to
use the new types.
2022-08-02 12:43:51 -07:00
Abtin Keshavarzian e3f157402c [frame-builder] add Insert(), Remove() and other helper methods (#7964)
This commit adds `Insert()` and `Remove()` methods in `FrameBuilder`.
`Insert` can be used to insert new content in the frame at a given
offset moving any previously written content forward. `Remove()` can
be used to remove previously appended content from the frame moving
any content after the removed bytes backward. This commit also adds
`GetRemainingLength()` to get the remaining length (number of bytes
that can be appended) in the frame buffer, and `SetMaxLength()`. Unit
test `test_frame_builder` is also updated to validate all the newly
added methods.
2022-08-02 12:43:51 -07:00
Jonathan Hui 7af484f49f [docker] upgrade pip before installing cmake (#7970) 2022-08-01 21:48:36 -07:00
Jonathan Hui 184aef663a [github-actions] remove clang-6,7,8 from build check (#7969) 2022-08-01 18:48:08 -07:00
Abtin Keshavarzian 600ae09994 [test] update RoutingManager unit test to check default-route (#7940)
This commit updates `test_routing_manager` unit test to validate the
behavior of `RoutingMangaer` related to default route prefix (when AIL
routers advertise default route in RA header or as `::/0` prefix in an
RIO).
2022-08-01 10:44:32 -07:00
Abtin Keshavarzian 4e8eeccfe8 [test] update RoutingManager unit test adding new helper methods (#7951)
This commit updates `test_routing_manager` unit test and adds a new
set of helper methods to simplify the implementation of test-case:

- `VerifyOmrPrefixInNetData()` to check OMR prefix in Network Data.
- `VerifyExternalRoutesInNetData()` to check external route prefixes
   in Network Data.
- `VerifyPrefixTable()` to check the on-link and route prefixes in
  discovered prefix table.
- Different flavors of `SendRouterAdvert()` to send RA with different
  PIOs, RIOs, and default route info (in header).

This commit also breaks the test-cases into multiple functions each
covering specific aspect.
2022-07-28 17:26:49 -07:00
Abtin Keshavarzian 747a0a8069 [mle] fix incorrect StatusTlv when processing Child Update Response (#7956)
This commit fixes `MleRouter::HandleChildUpdateResponse()` to use the
MLE `StatusTlv` instead of `ThreadStatusTlv` when parsing a received
MLE Child Update Response (from a child).
2022-07-28 16:46:54 -07:00
Jonathan Hui 0b1e922a1d [mle] send Link Request immediately if router id was previously allocated (#7947)
After upgrading to a router, the device will wait until it receives a
Route TLV from a neighboring node indicating that the new Router ID
has been allocated. In normal cases, this is not an issue since the
Leader will disseminate a new Router ID Sequence after allocating a
new Router ID. However, in some scenarios, a device may request the
same Router ID that was previously allocated and significantly delay
establishing links with neighboring routers. With this commit, a
device will immediately send a Link Request if the Router ID was
previously allocated.
2022-07-28 07:27:57 -07:00
Abtin Keshavarzian b6ac79f61a [test] fix test_mle_msg_key_seq_jump (#7952)
This commit updates `test_mle_msg_key_seq_jump` to increase the wait
time after key index change for MLE advertisement transmissions. The
MLE advertisement uses trickle timer with max interval of 32 seconds.
Based on this the max interval between two consecutive advertisement
transmissions can be 1.5 times the trickle timer max interval or 48
seconds. The test uses 52 sec as wait time which includes a 4 sec
additional guard time to account for any action and/or message
exchanges after rx of an advertisement. This change should help
address the occasional failures of this test.
2022-07-27 18:58:47 -07:00
Abtin Keshavarzian 1c9373bb0c [mesh-forwarder] allow limiting max num of frames in direct tx queue (#7908)
This commit adds a new feature in `MeshForwarder` to specify a max
limit for the number of frames in tx queue marked for direct
transmission. `OPENTHREAD_CONFIG_MAX_FRAMES_IN_DIRECT_TX_QUEUE`
specifies the maximum number. If set to zero then this behavior is
disabled, i.e., no check is performed on tx queue length.

This commit also adds a new message action log "Dropping (dir queue
full)" which indicates when a message is being dropped due to the
newly added check.
2022-07-27 13:39:51 -07:00
Abtin Keshavarzian c96bf599b7 [toranj] relax test-017-parent-reset-child-recovery pass condition (#7939)
This commit relaxes the pass condition for `test-017` which checks
that after a parent is reset it uses "MLE Child Update Request" to
recover its previous children. This is indirectly validated by
monitoring number of state/role changes on the children. With the
recent change which increases the number of MLE Parent Requests, the
window of time where parent is detached is increased and if during
this time a child tries to send to the parent it can detect that
parent is reset and detach itself causing the test to fail. This
commit relaxes the pass condition to at least one child recovering
using "Child Update" mechanism.
2022-07-27 07:21:44 -07:00
Abtin Keshavarzian 925b12cc08 [routing-manager] rename DiscoveredPrefixTable::Entry method to SetFrom() (#7949)
This commit renames the `DiscoveredPrefixTable::Entry` method to
`SetFrom()` from `InitFrom()` to make it clear that this method can
be used on an existing entry to update it.
2022-07-26 20:53:31 -07:00
Abtin Keshavarzian 12d35f3dfa [routing-manager] ensure to clear the prefix for default route (#7948)
This commit fixes the method setting the prefix table entry from
RA header as a default route by clearing `mPrefix` variable so
to set it as `::/0`.
2022-07-26 20:52:53 -07:00
Jonathan Hui 32ac6ddfad [bootstrap] apply shfmt diffs (#7946) 2022-07-26 14:51:14 -07:00
Abtin Keshavarzian 209716aa19 [routing-manager] enhance selection of prefixes to advertise as RIO (#7936)
This commit updated how `RoutingManager` selects the set of prefixes
to advertise as RIO in emitted RA messages from the BR.  The related
code is now moved to `SendRouterAdvertisement()` method (instead of
previously being in `EvaluateOmrPrefix()`). Since the array for
storing the advertised prefixes has a limited size (configurable
through an OT build-time setting), we add more important prefixes
first in the array to ensure that they are advertised in the RA
message. The following order is used: (1) Local OMR prefix (if
added in Network Data), (2) currently favored OMR prefix, (3) any
other OMR prefixes from Network Data, (4) any other on-mesh prefix
(excluding Domain Prefix) from Network Data.
2022-07-26 12:41:07 -07:00
Abtin Keshavarzian 5755797937 [routing-manager] fix DiscoveredPrefixTable::Entry leak (#7945)
This commit fixes an issue with the potential overwriting of `mNext`
when existing entry in the list is updated (avoid calling `Clear()`).
It also updates `test_routing_manager` to check such a situation
and ensure that the fix is addressing the issue.
2022-07-26 12:24:35 -07:00
Thomas 47b42bb8d9 [ncp] fixes -Werror=missing-field-initializers (#7942)
The uninitialized fields cause compile errors on some systems, this
commit fixes this.
2022-07-26 11:17:36 -07:00
Abtin Keshavarzian a282aa9f9b [core] adding FrameBuilder for constructing frames (#7935)
This commit adds a new class `FrameBuilder` which helps with
construction of frames in a given buffer. It provides helper methods
to append different items to the frame, e.g., bytes from a buffer or
`Message`, a `uint8`, `uint16` or `uint32` value assuming big or
little endian encoding, or a given object. It also provides methods
to overwrite previously appended content in the frame at a given
offset. This class is used in `Lowpan` (replacing `BufferWriter`)
which helps simplify the code. This commit also updates `Appender` to
use the `FrameBuilder` and adds a new unit test for `FrameBuidler`.
2022-07-25 19:59:55 -07:00
Abtin Keshavarzian 5bc71b2a4f [message] allow msg pool using external heap (#7933)
This commit updates the code to allow the config combination of
`OPENTHREAD_CONFIG_MESSAGE_USE_HEAP_ENABLE` along using external heap
`OPENTHREAD_CONFIG_HEAP_EXTERNAL_ENABLE`. This commit updates `Message`
`GetFreeBufferCount()` and `GetTotalBufferCount()` methods to return
special value `0xffff` under this config combo indicating the numbers
cannot be estimated.

This commit also updates `check-simulation-build-autotools` to add
such a build config so to be covered as part OT CI tests.
2022-07-22 15:43:48 -07:00
Abtin Keshavarzian 390efb4c38 [srp-client] add random short delay before sending update message (#7863)
This commit updates the `Srp::Client` to add a randomly chosen short
delay before delay wait time before sending an update message. This
replaces the current model which was adding a fixed short delay.
Selecting the delay randomly helps in situations where some common
event triggers multiple SRP clients on Thread mesh to send an SRP
update(e.g., new OMR prefix causing new addresses, or a server entry
change on Thread Network Data).
2022-07-22 11:16:46 -07:00
Luis Ubieda 1f2a315acf [cmake] update option to enable CoAP Observe through CMake (#7932)
Change the definition of OPENTHREAD_CONFIG_COAP_OBSERVE_API_ENABLE
through target_compile_detinifions().

Signed-off-by: Luis Ubieda <luisubiedas@gmail.com>
2022-07-21 22:25:08 -07:00
Jiachen Dong 12933d3f86 [harness] add functionality to discover and control simulations (#7901)
It can run all the Thread 1.1 test cases with simulations as a role of
Router now except those requiring RF enclosure.
2022-07-21 21:49:34 -07:00
Abtin Keshavarzian 19ca3a0a3c [test] add unit test test_routing_manager (#7927)
This commit adds a unit test for `RoutingManager` which builds a
foundation for writing test cases covering different behaviors of
`RoutingManager`, e.g., validating emitted router advertisements,
sending custom RA messages from different routers on AIL, adding or
removing entries in Network Data while monitoring the behavior of
`RoutingManager`.
2022-07-21 21:43:11 -07:00
Abtin Keshavarzian 96819f934a [routing-manager] new API to get currently favored OMR prefix (#7913)
This commit updates `RoutingManager` to remember the currently favored
OMR prefix (which can be an OMR prefix discovered from Network Data
or device's local OMR prefix). It adds a new public API to retrieve
this prefix and adds a related CLI sub-command.
2022-07-21 21:32:52 -07:00
Abtin Keshavarzian 19181047fd [routing-manager] advertise all on-mesh prefixes as RIOs in emitted RAs (#7900)
This commit changes `RoutingManager` so to include all on-mesh
prefixes from Thread Network Data excluding domain prefix as Route
Info Option in the emitted Router Advertisement messages.
2022-07-21 14:26:21 -07:00
Jonathan Hui 6809b33f31 [github-actions] update to macos-12 (#7930)
macos-10.15 is deprecated.
2022-07-21 13:08:26 -07:00
Yi bec3a5edb0 [nat64] fix build options for NAT64 tests (#7929)
This commit fixes the build options for NAT64 tests. A new option was
added in ot-br-posix recently.
2022-07-21 07:22:27 -07:00
Eduardo Montoya 424005f695 [csl] test resync after parent is down for a long period (#7915)
Add test steps to verify that a CSL Receiver is able to re-establish
CSL synchronization after its peer has been absent for a long period.
2022-07-20 15:11:34 -07:00
Abtin Keshavarzian 7b60716713 [csl] ensure SubMacis informed when CSL support changes (#7918)
This commit changes `Mac::UpdateCsl()` to ensure we inform `SubMac`
and disable CSL when CSL support changes (e.g., device gets
detached). This ensures that `SubMac` internal variables (CSL period,
channel) are updated on a detach and if the device later attaches
again, we detect the change in CSL configuration and trigger the tx
of MLE Child Update Request.
2022-07-20 15:11:34 -07:00
Paweł Wańczyk ed0334f626 [routing-table] do not reset LastHeard timestamp when removing router link (#7879) 2022-07-20 15:09:28 -07:00
Abtin Keshavarzian f98f89adfe [core] replace uses of OT_ERROR_{} with kError{} in core modules (#7919) 2022-07-19 21:45:55 -07:00
Robert Quattlebaum 8095a086d7 [bootstrap] Explicitly use arm-none-eabi-gcc from armmbed (#7917)
The bootstrap script taps `armmbed/formulae`, and then tries
to install `arm-none-eabi-gcc` from that tap. However, if the
user has already tapped a different tap that offers
`arm-none-eabi-gcc`, then the install will fail.

This change removes the ambiguity of the install by specifying
the tap to use.
2022-07-19 14:35:19 -07:00
Sarah c73db3ff2f [docs] add NAT64 to Doxygen (#7916)
I added the group definition under IPv6 Networking.
2022-07-19 13:21:20 -07:00
Simon Lin e538aad095 [thci] find border agents with non link-local addresses (#7853)
Thread BR may advertise IPv6 GUA rather than LLA. For example, Avahi
stops publishing LLA when any GUA is found on the network interface.

This commit enhances mdns_query to find border agents with
non-link-local addresses.
2022-07-19 09:12:17 -07:00
Simon Lin 6242a1e68e [thci] allow to specify custom commands (#7912)
This commit uses `Param9` to specify custom commands for Thread BR
THCI to control `otbr-agent`.
2022-07-19 08:51:20 -07:00
Yi 095f530bd7 [nat64] run nat64 ci tests as an independent job (#7885)
This commit changes the NAT64 CI tests to be ran as an independent
job. A new /nat64 folder is added and it would make it easier to
configure new NAT64 tests in the future.
2022-07-18 14:15:00 -07:00
Eduardo Montoya a68cd059cc [csl] update CSL information in radio when parent changes (#7911)
Cover the case of parent change while the CSL child is still attached.
2022-07-18 14:12:20 -07:00
Abtin Keshavarzian ec96609070 [test] fix "unused result warning" in newly updated unit tests (#7905) 2022-07-18 14:10:54 -07:00
Sarah 78f8437c3b [docs] update CLI comments (#7902) 2022-07-16 18:41:13 -07:00
Yakun Xu 793483da0d [size-report] fix markdown viewer (#7906) 2022-07-16 08:19:14 -07:00
Song GUO 03c9b9389d [nat64] add functions for processing IPv4 packets (#7824)
With NAT64, we need to handle the IPv4 packets inside the border
router functions in OpenThread core.

This commit introduces a few new classes for NAT64:
- Add `Ip4::Cidr` (for specifying CIDR block of translated packets)
- Updated Ip4 address format -- use a union of (m8[4], m16[2], m32)
  instead of 4 bytes.
- Extend `Checksum` for supporting ICMP in Ip4 (and TCP4 / UDP4) and
  IPv4 header.
2022-07-15 10:54:20 -07:00
Abtin Keshavarzian 13416b15fb [core] adding FrameData class for parsing frames (#7892)
This commit adds a new class `FrameData` which is a sub-class of
`Data` (acts as a wrapper over a buffer pointer and a length). It is
used in `MeshForwarder` and `Lowpan` to simplify the method calls
(can pass `FrameData` instance instead of pointer and length). It
also provides helper methods for parsing the frame content (e.g.,
reading `uint16/32` value assuming big or little endian encoding).
When read successfully, the `FrameData` is updated to skip over the
read content. These methods help simplify `Lowpan` parsing and
decompression code. In particular the `Lowpan` methods now directly
update the passed-in `FrameData` to skip over the parsed header
portion (instead of returning the parsed header length).
2022-07-14 17:04:47 -07:00
Zhanglong Xia 366786dbed [posix] add a vendor interface for the radio spinel layer (#7884)
This commit adds a vendor interface for developers to implement
the bus interface by themselves.
2022-07-14 13:10:51 -07:00
Abtin Keshavarzian 0ec9612379 [docs] add plat-infra-if and api-border-routing doxygen groups (#7898) 2022-07-13 19:59:47 -07:00
Eduardo Montoya 648770a8ad [cli] fix endif comment (#7896) 2022-07-13 08:11:27 -07:00
Abtin Keshavarzian 78e3b28127 [routing-manager] fix typos in method/variable names (#7895) 2022-07-12 10:51:12 -07:00
Abtin Keshavarzian 158e59f267 [tmf] update IsTmfMessage() method (#7875)
This commit updates `Tmf::IsTmfMessage()` method to check source and
destination addresses. This change helps make this method more
generic(allow it to be used for both rx/tx messages). This commit
also simplifies the implementation (avoid using complex expression
containing multiple `&&` and `||`).
2022-07-12 10:15:34 -07:00
Abtin Keshavarzian eca7a63adc [toranj] make test-017 more robust (#7888)
This commit updates `test-017-parent-reset-child-recovery.py` to make
it more robust by increasing the wait time for children to be
recovered after parent/leader reset. This is related to the increase
in data poll period of sleepy children to 10 sec which was done
previously to accommodate for the increased start-up time of leader
(due to change in number of MLE Parent Requests).
2022-07-11 11:59:34 -07:00
Abtin Keshavarzian 6e0eb8addf [mesh-forwarder] simplify CheckReachability() and Icmp::SendError() (#7887)
A new flavor of `Icmp::SendError()` is added which allows the caller
to provide the parsed `Ip6::Headers` of the error-causing message
instead the full `Message` instance. Note that the implementation of
`SendError()` only includes the IPv6 header of the error-causing
message in the payload of the ICMPv6 error message.

`MeshForwarder::CheckReachability()` method is updated to use the
recently added `Ip6::Headers` to parse the IPv6 headers from the
received frame. With the changes in this commit, we no longer need to
allocate a temporary `Message` which was used for reading the
decompressed IPv6 header and also to pass to `Icmp::SendError()` in
case of "destination unreachable" error.
2022-07-11 11:59:06 -07:00
Abtin Keshavarzian 5876ff79ae [routing-manager] add public API to get discovered prefix table (#7877)
This commit adds new public OT APIs to iterate over the Border Router
discovered prefix table from received Router Advertisement messages.
It also adds new CLI command to output the prefix table. The new APIs
are primary intended for testing.
2022-07-11 11:58:27 -07:00
Abtin Keshavarzian 75ecf8d260 [api] add border_routing.h header for otBorderRouting APIs (#7877)
This commit adds `<openthread/border_routing.h`> header and moves
all the `otBorderRouting` APIs (which are related to Border Routing
Manager) into this header. It also adds a note that these APIs are
available when `OPENTHREAD_CONFIG_BORDER_ROUTING_ENABLE` is enabled.
It also adds `border_routing_api.cpp` source file for the API
implementation.
2022-07-11 11:58:27 -07:00
1243 changed files with 82395 additions and 64339 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
+176 -52
View File
@@ -28,28 +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:
cancel-previous-runs:
runs-on: ubuntu-20.04
steps:
- uses: rokroskar/workflow-run-cleanup-action@master
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
if: "github.ref != 'refs/heads/main'"
pretty:
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@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: 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
@@ -59,23 +69,58 @@ jobs:
markdown-lint-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- 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-18.04
spell-check:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@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: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
with:
submodules: true
- name: Bootstrap
run: |
sudo pip3 install --system -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
@@ -97,7 +142,12 @@ jobs:
CC: ${{ matrix.compiler_c }}
CXX: ${{ matrix.compiler_cpp }}
steps:
- uses: actions/checkout@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: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
with:
submodules: true
- name: Bootstrap
@@ -109,33 +159,43 @@ jobs:
script/test package
scan-build:
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@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: 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
mbedtls3-build:
runs-on: ubuntu-18.04
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@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: 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@v2
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
with:
repository: ARMmbed/mbedtls
ref: v3.1.0
ref: v3.2.1
path: third_party/mbedtls/repo
- name: Build
run: |
@@ -143,7 +203,7 @@ jobs:
arm-gcc:
name: arm-gcc-${{ matrix.gcc_ver }}
runs-on: ubuntu-18.04
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
@@ -163,37 +223,63 @@ 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@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: 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 --system -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:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
run: |
export PATH=/tmp/${{ matrix.gcc_extract_dir }}/bin:$PATH
script/check-arm-build
gcc:
name: gcc-${{ matrix.gcc_ver }}
runs-on: ubuntu-18.04
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
gcc_ver: [5, 6, 7, 8, 9, 10, 11]
gcc_ver: [9, 10, 11, 12]
env:
CC: gcc-${{ matrix.gcc_ver }}
CXX: g++-${{ matrix.gcc_ver }}
steps:
- uses: actions/checkout@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: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
with:
submodules: true
- name: Bootstrap
@@ -216,12 +302,17 @@ jobs:
strategy:
fail-fast: false
matrix:
clang_ver: ["6.0", "7", "8", "9", "10", "11", "12", "13"]
clang_ver: ["9", "10", "11", "12", "13"]
env:
CC: clang-${{ matrix.clang_ver }}
CXX: clang++-${{ matrix.clang_ver }}
steps:
- uses: actions/checkout@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: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
with:
submodules: true
- name: Bootstrap
@@ -246,7 +337,7 @@ jobs:
strategy:
fail-fast: false
matrix:
clang_ver: ["6.0", "7", "8", "9", "10", "11", "12", "13"]
clang_ver: ["9", "10", "11", "12", "13"]
env:
CC: clang-${{ matrix.clang_ver }}
CXX: clang++-${{ matrix.clang_ver }}
@@ -254,7 +345,12 @@ jobs:
CXXFLAGS: -m32 -Wconversion
LDFLAGS: -m32
steps:
- uses: actions/checkout@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: 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@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: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
with:
submodules: true
- name: Bootstrap
@@ -303,32 +404,55 @@ jobs:
CXX: clang++
- CC: gcc
CXX: g++
runs-on: macos-10.15
runs-on: macos-12
env:
CC: ${{ matrix.CC }}
CXX: ${{ matrix.CXX }}
steps:
- uses: actions/checkout@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: 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@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: 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}}"
+26 -16
View File
@@ -28,18 +28,23 @@
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:
cancel-previous-runs:
runs-on: ubuntu-20.04
steps:
- uses: rokroskar/workflow-run-cleanup-action@master
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
if: "github.ref != 'refs/heads/main'"
buildx:
name: buildx-${{ matrix.docker_name }}
runs-on: ubuntu-20.04
@@ -49,7 +54,12 @@ jobs:
include:
- docker_name: environment
steps:
- uses: actions/checkout@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: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
with:
submodules: true
@@ -63,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: |
@@ -81,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 }}
+21 -4
View File
@@ -27,24 +27,41 @@
#
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
+20 -10
View File
@@ -28,21 +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:
cancel-previous-runs:
runs-on: ubuntu-20.04
steps:
- uses: rokroskar/workflow-run-cleanup-action@master
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
if: "github.ref != 'refs/heads/main'"
makefile-check:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@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: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
with:
submodules: true
- name: Check
+39 -21
View File
@@ -28,18 +28,23 @@
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:
cancel-previous-runs:
runs-on: ubuntu-20.04
steps:
- uses: rokroskar/workflow-run-cleanup-action@master
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
if: "github.ref != 'refs/heads/main'"
backbone-router:
runs-on: ubuntu-20.04
env:
@@ -57,7 +62,7 @@ jobs:
# of OMR prefix and Domain prefix is not deterministic.
BORDER_ROUTING: 0
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
with:
submodules: true
- name: Build OTBR Docker
@@ -81,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@v2
- uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
with:
name: cov-thread-1-3-backbone-docker
path: /tmp/coverage/
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
if: ${{ failure() }}
with:
name: thread-1-3-backbone-results
@@ -98,7 +103,7 @@ jobs:
- name: Generate Coverage
run: |
./script/test generate_coverage gcc
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
with:
name: cov-thread-1-3-backbone
path: tmp/coverage.info
@@ -113,31 +118,43 @@ jobs:
otbr_trel: 0
cert_scripts: ./tests/scripts/thread-cert/border_router/*.py
packet_verification: 1
nat64: 0
description: ""
- otbr_mdns: "mDNSResponder"
otbr_trel: 1
cert_scripts: ./tests/scripts/thread-cert/border_router/*.py
packet_verification: 2
nat64: 0
description: ""
- otbr_mdns: "mDNSResponder"
otbr_trel: 0
cert_scripts: ./tests/scripts/thread-cert/border_router/MATN/*.py
packet_verification: 1
nat64: 0
description: "MATN"
- otbr_mdns: "mDNSResponder"
otbr_trel: 0
cert_scripts: ./tests/scripts/thread-cert/border_router/LowPower/*.py
packet_verification: 1
nat64: 0
description: "LowPower"
- otbr_mdns: "mDNSResponder"
otbr_trel: 0
cert_scripts: ./tests/scripts/thread-cert/border_router/nat64/*.py
packet_verification: 1
nat64: 1
description: "nat64 openthread"
- otbr_mdns: "avahi"
otbr_trel: 0
cert_scripts: ./tests/scripts/thread-cert/border_router/*.py
packet_verification: 1
nat64: 0
description: ""
- otbr_mdns: "avahi"
otbr_trel: 1
cert_scripts: ./tests/scripts/thread-cert/border_router/*.py
packet_verification: 2
nat64: 0
description: ""
name: BR ${{ matrix.description }} (${{ matrix.otbr_mdns }}, TREL=${{matrix.otbr_trel}})
env:
@@ -152,9 +169,10 @@ jobs:
PYTHONUNBUFFERED: 1
VERBOSE: 1
BORDER_ROUTING: 1
NAT64: ${{ matrix.nat64 }}
MAX_JOBS: 3
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
- name: Build OTBR Docker
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
@@ -177,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@v2
- uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
with:
name: cov-thread-border-router-docker
path: /tmp/coverage/
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
if: ${{ failure() }}
with:
name: thread-border-router-results
@@ -194,7 +212,7 @@ jobs:
- name: Generate Coverage
run: |
./script/test generate_coverage gcc
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
with:
name: cov-thread-border-router
path: tmp/coverage.info
@@ -205,13 +223,13 @@ jobs:
- thread-border-router
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- 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
@@ -220,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
@@ -229,7 +247,7 @@ jobs:
needs: upload-coverage
runs-on: ubuntu-20.04
steps:
- uses: geekyeggo/delete-artifact@1-glob-support
- uses: geekyeggo/delete-artifact@54ab544f12cdb7b71613a16a2b5a37a9ade990af # v2.0.0
with:
name: cov-*
useGlob: true
+29 -16
View File
@@ -28,18 +28,23 @@
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:
cancel-previous-runs:
runs-on: ubuntu-20.04
steps:
- uses: rokroskar/workflow-run-cleanup-action@master
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
if: "github.ref != 'refs/heads/main'"
cli-sim:
name: cli-sim VIRTUAL_TIME=${{ matrix.virtual_time }}
runs-on: ubuntu-20.04
@@ -48,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@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: 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
+59 -42
View File
@@ -28,7 +28,17 @@
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 }}
cancel-in-progress: true
env:
COVERAGE: 1
@@ -38,33 +48,32 @@ env:
MAX_NETWORK_SIZE: 999
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
jobs:
permissions: # added using https://github.com/step-security/secure-workflows
contents: read
cancel-previous-runs:
runs-on: ubuntu-20.04
steps:
- uses: rokroskar/workflow-run-cleanup-action@master
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
if: "github.ref != 'refs/heads/main'"
jobs:
unittests:
name: Unittests
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2
- 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
@@ -73,7 +82,7 @@ jobs:
cd /tmp/otns
./script/test py-unittests
)
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
if: ${{ failure() }}
with:
name: unittests-pcaps
@@ -83,28 +92,27 @@ jobs:
- name: Generate Coverage
run: |
./script/test generate_coverage gcc
- uses: actions/upload-artifact@v2
- 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@v2
- 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
@@ -113,7 +121,7 @@ jobs:
cd /tmp/otns
./script/test py-examples
)
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
if: ${{ failure() }}
with:
name: examples-pcaps
@@ -123,14 +131,14 @@ jobs:
- name: Generate Coverage
run: |
./script/test generate_coverage gcc
- uses: actions/upload-artifact@v2
- 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:
@@ -150,19 +158,23 @@ jobs:
env:
STRESS_LEVEL: ${{ matrix.stress_level }}
steps:
- uses: actions/checkout@v2
- 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
@@ -171,7 +183,7 @@ jobs:
cd /tmp/otns
./script/test stress-tests ${{ matrix.suite }}
)
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
if: ${{ failure() }}
with:
name: stress-tests-${{ matrix.suite }}-pcaps
@@ -181,7 +193,7 @@ jobs:
- name: Generate Coverage
run: |
./script/test generate_coverage gcc
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
with:
name: cov-otns-stress-tests-${{ matrix.suite }}
path: tmp/coverage.info
@@ -191,13 +203,18 @@ jobs:
- unittests
- examples
- stress-tests
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@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: 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
+92 -72
View File
@@ -28,25 +28,35 @@
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:
cancel-previous-runs:
runs-on: ubuntu-20.04
steps:
- uses: rokroskar/workflow-run-cleanup-action@master
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
if: "github.ref != 'refs/heads/main'"
expects-linux:
runs-on: ubuntu-18.04
runs-on: ubuntu-20.04
env:
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@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: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
- name: Bootstrap
run: |
sudo apt-get --no-install-recommends install -y expect ninja-build lcov socat
@@ -55,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@v2
- uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
if: ${{ failure() && env.CRASHED_RCP == '1' }}
with:
name: core-expect-rcp
@@ -70,19 +84,19 @@ jobs:
- name: Generate Coverage
run: |
./script/test generate_coverage gcc
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
with:
name: cov-expects-linux-1
path: tmp/coverage.info
- name: Run TUN Mode
run: |
sudo rm /etc/apt/sources.list.d/* && sudo apt-get update
sudo apt-get install --no-install-recommends -y dnsmasq bind9-host ntp
sudo systemctl start dnsmasq ntp
host ipv6.google.com 127.0.0.1
echo 'listen-address=::1' | sudo tee /etc/dnsmasq.conf
echo 0 | sudo tee /proc/sys/net/ipv6/conf/all/disable_ipv6
sudo systemctl restart dnsmasq
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
./script/test prepare_coredump_upload
@@ -93,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@v2
- 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@v2
- uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
if: ${{ failure() }}
with:
name: syslog-expect-linux
@@ -107,7 +121,7 @@ jobs:
- name: Generate Coverage
run: |
./script/test generate_coverage gcc
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
with:
name: cov-expects-linux-2
path: tmp/coverage.info
@@ -117,68 +131,41 @@ jobs:
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@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: 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@v2
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@v2
- 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@v2
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@v2
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
@@ -191,7 +178,12 @@ jobs:
OT_DAEMON: ${{ matrix.OT_DAEMON }}
OT_READLINE: 'readline'
steps:
- uses: actions/checkout@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: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
- name: Bootstrap
run: |
sudo rm /etc/apt/sources.list.d/* && sudo apt-get update
@@ -219,14 +211,14 @@ jobs:
- name: Generate Coverage
run: |
./script/test generate_coverage gcc
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
with:
name: cov-pty-linux-${{ matrix.DAEMON }}
path: tmp/coverage.info
pty-macos:
name: pty-macos OT_DAEMON=${{ matrix.OT_DAEMON }}
runs-on: macos-10.15
runs-on: macos-12
strategy:
fail-fast: false
matrix:
@@ -235,10 +227,24 @@ jobs:
OT_DAEMON: ${{ matrix.OT_DAEMON }}
OT_READLINE: 'off'
steps:
- uses: actions/checkout@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: 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
@@ -251,7 +257,12 @@ jobs:
rcp-stack-reset:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@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: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
- name: Bootstrap
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
@@ -267,7 +278,7 @@ jobs:
- name: Generate Coverage
run: |
./script/test generate_coverage gcc
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
with:
name: cov-rcp-stack-reset
path: tmp/coverage.info
@@ -275,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@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: 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
@@ -302,7 +317,12 @@ jobs:
needs: upload-coverage
runs-on: ubuntu-20.04
steps:
- uses: geekyeggo/delete-artifact@1-glob-support
- 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
+101 -84
View File
@@ -28,44 +28,23 @@
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
permissions:
contents: read
jobs:
cancel-previous-runs:
runs-on: ubuntu-20.04
steps:
- uses: rokroskar/workflow-run-cleanup-action@master
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
if: "github.ref != 'refs/heads/main'"
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@v2
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
packet-verification:
runs-on: ubuntu-20.04
env:
@@ -75,7 +54,12 @@ jobs:
VIRTUAL_TIME: 1
MULTIPLY: 3
steps:
- uses: actions/checkout@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: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
with:
submodules: true
- name: Bootstrap
@@ -92,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@v2
- uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
if: ${{ failure() }}
with:
name: packet-verification-pcaps
@@ -102,7 +86,7 @@ jobs:
- name: Generate Coverage
run: |
./script/test generate_coverage gcc
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
with:
name: cov-packet-verification
path: tmp/coverage.info
@@ -118,30 +102,34 @@ jobs:
THREAD_VERSION: 1.1
VIRTUAL_TIME: 1
steps:
- uses: actions/checkout@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: 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@v2
./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@v2
- uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
with:
name: cov-cli-ftd
path: tmp/coverage.info
@@ -164,30 +152,34 @@ jobs:
VIRTUAL_TIME: 1
MESSAGE_USE_HEAP: ${{ matrix.message_use_heap }}
steps:
- uses: actions/checkout@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: 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@v2
./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@v2
- uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
with:
name: cov-cli-mtd-${{ matrix.message_use_heap }}
path: tmp/coverage.info
@@ -201,45 +193,53 @@ jobs:
COVERAGE: 1
REFERENCE_DEVICE: 1
THREAD_VERSION: 1.1
TIME_SYNC: 1
VIRTUAL_TIME: 1
steps:
- uses: actions/checkout@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: 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@v2
./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@v2
- uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
with:
name: cov-cli-time-sync
path: tmp/coverage.info
expects:
runs-on: ubuntu-18.04
runs-on: ubuntu-20.04
env:
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
THREAD_VERSION: 1.1
steps:
- uses: actions/checkout@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: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
- name: Bootstrap
run: |
sudo apt-get --no-install-recommends install -y expect ninja-build lcov socat
@@ -254,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@v2
- uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
if: ${{ failure() && env.CRASHED_CLI == '1' }}
with:
name: core-expect-cli
@@ -263,17 +263,22 @@ jobs:
- name: Generate Coverage
run: |
./script/test generate_coverage gcc
- uses: actions/upload-artifact@v2
- 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@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: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
with:
submodules: true
- name: Bootstrap
@@ -306,7 +311,7 @@ jobs:
- name: Generate Coverage
run: |
./script/test generate_coverage gcc
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
with:
name: cov-ot-commissioner
path: tmp/coverage.info
@@ -315,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@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: 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@v2
./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@v2
- uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
with:
name: cov-multiple-instance
path: tmp/coverage.info
@@ -359,20 +366,25 @@ jobs:
- multiple-instance
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@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: 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
@@ -381,7 +393,12 @@ jobs:
needs: upload-coverage
runs-on: ubuntu-20.04
steps:
- uses: geekyeggo/delete-artifact@1-glob-support
- 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
+73 -31
View File
@@ -28,18 +28,23 @@
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:
cancel-previous-runs:
runs-on: ubuntu-20.04
steps:
- uses: rokroskar/workflow-run-cleanup-action@master
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
if: "github.ref != 'refs/heads/main'"
thread-1-3:
name: thread-1-3-${{ matrix.compiler.c }}-${{ matrix.arch }}
runs-on: ubuntu-20.04
@@ -51,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:
@@ -59,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@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: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
with:
submodules: true
- name: Bootstrap
@@ -84,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@v2
- 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@v2
- uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
if: ${{ failure() && env.CRASHED == '1' }}
with:
name: core-packet-verification-thread-1-3
@@ -98,7 +109,7 @@ jobs:
- name: Generate Coverage
run: |
./script/test generate_coverage "${{ matrix.compiler.gcov }}"
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
with:
name: cov-thread-1-3-${{ matrix.compiler.c }}-${{ matrix.arch }}
path: tmp/coverage.info
@@ -115,7 +126,12 @@ jobs:
INTER_OP: 1
INTER_OP_BBR: 0
steps:
- uses: actions/checkout@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: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
with:
submodules: true
- name: Bootstrap
@@ -143,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@v2
- uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
if: ${{ failure() }}
with:
name: packet-verification-low-power-pcaps
path: |
*.pcap
*.json
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
if: ${{ failure() && env.CRASHED == '1' }}
with:
name: core-packet-verification-low-power
@@ -159,7 +175,7 @@ jobs:
- name: Generate Coverage
run: |
./script/test generate_coverage gcc
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
with:
name: cov-packet-verification-low-power
path: tmp/coverage.info
@@ -171,9 +187,15 @@ jobs:
VIRTUAL_TIME: 1
PACKET_VERIFICATION: 1
THREAD_VERSION: 1.3
INTER_OP_BBR: 1
MULTIPLY: 3
steps:
- uses: actions/checkout@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: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
with:
submodules: true
- name: Bootstrap
@@ -190,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@v2
- uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
if: ${{ failure() }}
with:
name: packet-verification-1.1-on-1.3-pcaps
@@ -200,7 +222,7 @@ jobs:
- name: Generate Coverage
run: |
./script/test generate_coverage gcc
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
with:
name: cov-packet-verification-1-1-on-1-3
path: tmp/coverage.info
@@ -212,7 +234,12 @@ jobs:
THREAD_VERSION: 1.3
VIRTUAL_TIME: 0
steps:
- uses: actions/checkout@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: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
with:
submodules: true
- name: Bootstrap
@@ -229,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@v2
- uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
if: ${{ failure() && env.CRASHED == '1' }}
with:
name: core-expect-1-3
@@ -238,7 +265,7 @@ jobs:
- name: Generate Coverage
run: |
./script/test generate_coverage gcc
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
with:
name: cov-expects
path: tmp/coverage.info
@@ -255,7 +282,12 @@ jobs:
VIRTUAL_TIME: 1
INTER_OP: 1
steps:
- uses: actions/checkout@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: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
with:
submodules: true
- name: Bootstrap
@@ -282,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@v2
- uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
if: ${{ failure() }}
with:
name: thread-1-3-posix-pcaps
path: "*.pcap"
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
if: ${{ failure() && env.CRASHED == '1' }}
with:
name: core-thread-1-3-posix
@@ -296,7 +328,7 @@ jobs:
- name: Generate Coverage
run: |
./script/test generate_coverage gcc
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
with:
name: cov-thread-1-3-posix
path: tmp/coverage.info
@@ -310,20 +342,25 @@ jobs:
- thread-1-3-posix
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@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: 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
@@ -332,7 +369,12 @@ jobs:
needs: upload-coverage
runs-on: ubuntu-20.04
steps:
- uses: geekyeggo/delete-artifact@1-glob-support
- 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
+21 -11
View File
@@ -28,27 +28,37 @@
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:
cancel-previous-runs:
runs-on: ubuntu-20.04
steps:
- uses: rokroskar/workflow-run-cleanup-action@master
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
if: "github.ref != 'refs/heads/main'"
size-report:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@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: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
- name: Bootstrap
if: "github.event_name == 'push'"
run: |
python3 -m pip install --upgrade setuptools wheel
python3 -m pip install mdv
python3 -m pip install git+https://github.com/axiros/terminal_markdown_viewer.git
- name: Run
env:
OT_BASE_BRANCH: "${{ github.base_ref }}"
+104 -65
View File
@@ -28,76 +28,42 @@
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:
cancel-previous-runs:
runs-on: ubuntu-20.04
steps:
- uses: rokroskar/workflow-run-cleanup-action@master
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
if: "github.ref != 'refs/heads/main'"
toranj-ncp:
name: toranj-ncp-${{ matrix.TORANJ_RADIO }}
runs-on: ubuntu-18.04
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
TORANJ_RADIO: ['15.4', 'trel', 'multi']
env:
COVERAGE: 1
TORANJ_RADIO : ${{ matrix.TORANJ_RADIO }}
steps:
- uses: actions/checkout@v2
with:
submodules: true
- name: Bootstrap
env:
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 bsdtar
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 libboost-dev libboost-signals-dev
sudo apt-get --no-install-recommends install -y lcov
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
- 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@v2
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-18.04
strategy:
matrix:
TORANJ_RADIO: ['15.4']
env:
COVERAGE: 1
TORANJ_RADIO : ${{ matrix.TORANJ_RADIO }}
TORANJ_CLI: 1
TORANJ_NCP : 1
TORANJ_EVENT_NAME: ${{ github.event_name }}
steps:
- uses: actions/checkout@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: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
with:
submodules: true
- name: Bootstrap
@@ -105,7 +71,38 @@ 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: |
top_builddir=$(pwd)/build/toranj ./tests/toranj/start.sh
toranj-cli:
name: toranj-cli-${{ matrix.TORANJ_RADIO }}
runs-on: ubuntu-20.04
strategy:
matrix:
TORANJ_RADIO: ['15.4', 'trel', 'multi']
env:
COVERAGE: 1
TORANJ_RADIO : ${{ matrix.TORANJ_RADIO }}
TORANJ_CLI: 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
env:
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 ninja-build lcov
python3 -m pip install -r tests/scripts/thread-cert/requirements.txt
- name: Build & Run
run: |
@@ -114,32 +111,69 @@ jobs:
if: "matrix.TORANJ_RADIO != 'multi'"
run: |
./script/test generate_coverage gcc
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
if: "matrix.TORANJ_RADIO != 'multi'"
with:
name: cov-toranj-cli-${{ matrix.TORANJ_RADIO }}
path: tmp/coverage.info
toranj-unittest:
name: toranj-unittest
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
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
run: |
sudo dpkg --add-architecture i386
sudo apt-get update
sudo apt-get --no-install-recommends install -y clang-10 clang++-10 ninja-build python3-setuptools python3-wheel llvm lcov
sudo apt-get --no-install-recommends install -y g++-multilib libreadline-dev:i386 libncurses-dev:i386
python3 -m pip install -r tests/scripts/thread-cert/requirements.txt
- name: Build & Run
run: |
./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-18.04
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@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: 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
@@ -148,7 +182,12 @@ jobs:
needs: upload-coverage
runs-on: ubuntu-20.04
steps:
- uses: geekyeggo/delete-artifact@1-glob-support
- 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
+17 -10
View File
@@ -28,21 +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:
cancel-previous-runs:
runs-on: ubuntu-20.04
steps:
- uses: rokroskar/workflow-run-cleanup-action@master
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
if: "github.ref != 'refs/heads/main'"
api-version:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@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: 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
-630
View File
@@ -1,630 +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/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/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/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/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_address.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/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/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_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/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 \
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-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 := \
-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
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)
+16 -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)
@@ -40,6 +41,9 @@ set(OT_EXTERNAL_MBEDTLS "" CACHE STRING "Specify external mbedtls library")
option(OT_MBEDTLS_THREADING "enable mbedtls threading" OFF)
add_library(ot-config INTERFACE)
add_library(ot-config-ftd INTERFACE)
add_library(ot-config-mtd INTERFACE)
add_library(ot-config-radio INTERFACE)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_C_STANDARD 99)
@@ -103,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()
@@ -169,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
@@ -201,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
+4 -4
View File
@@ -1,5 +1,5 @@
OpenThread is an open source implementation of the Thread 1.2.0 Final Specification.
The Thread 1.2.0 Final Specification is promulgated by the Thread Group. The Thread
OpenThread is an open source implementation of the Thread 1.3.0 Final Specification.
The Thread 1.3.0 Final Specification is promulgated by the Thread Group. The Thread
Group is a non-profit organization formed for the purposes of defining one or
more specifications, best practices, reference architectures, implementation
guidelines and certification programs to promote the availability of compliant
@@ -7,10 +7,10 @@ implementations of the Thread protocol. Information on becoming a Member, includ
information about the benefits thereof, can be found at http://threadgroup.org.
OpenThread is not affiliated with or endorsed by the Thread Group. Implementation
of this OpenThread code does not assure compliance with the Thread 1.2.0 Final
of this OpenThread code does not assure compliance with the Thread 1.3.0 Final
Specification and does not convey the right to identify any final product as Thread
certified. Members of the Thread Group may hold patents and other intellectual
property rights relating to the Thread 1.2.0 Final Specification, ownership and
property rights relating to the Thread 1.3.0 Final Specification, ownership and
licenses of which are subject to the Thread Groups IP Policies, and not this license.
The included copyright to the OpenThread code is subject to the license in the
+3 -9
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]
---
@@ -10,7 +10,7 @@ OpenThread released by Google is... <a href="https://www.threadgroup.org/What-is
**...OS and platform agnostic**, with a narrow platform abstraction layer and a small memory footprint, making it highly portable. It supports both system-on-chip (SoC) and network co-processor (NCP) designs.
**...a Thread Certified Component**, implementing all features defined in the [Thread 1.2 specification](https://www.threadgroup.org/support#specifications), including all Thread networking layers (IPv6, 6LoWPAN, IEEE 802.15.4 with MAC security, Mesh Link Establishment, Mesh Routing) and device roles, as well as [Border Router](https://github.com/openthread/ot-br-posix) support.
**...a Thread Certified Component**, implementing all features defined in the [Thread 1.3.0 specification](https://www.threadgroup.org/support#specifications), including all Thread networking layers (IPv6, 6LoWPAN, IEEE 802.15.4 with MAC security, Mesh Link Establishment, Mesh Routing) and device roles, as well as [Border Router](https://github.com/openthread/ot-br-posix) support.
More information about Thread can be found at [threadgroup.org](http://threadgroup.org/). Thread is a registered trademark of the Thread Group, Inc.
@@ -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.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.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="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
@@ -54,10 +52,6 @@ We would love for you to contribute to OpenThread and help make it even better t
Contributors are required to abide by our [Code of Conduct](https://github.com/openthread/openthread/blob/main/CODE_OF_CONDUCT.md) and [Coding Conventions and Style Guide](https://github.com/openthread/openthread/blob/main/STYLE_GUIDE.md).
# Versioning
OpenThread follows the [Semantic Versioning guidelines](http://semver.org/) for release cycle transparency and to maintain backwards compatibility. OpenThread's versioning is independent of the Thread protocol specification version but will clearly indicate which version of the specification it currently supports.
# License
OpenThread is released under the [BSD 3-Clause license](https://github.com/openthread/openthread/blob/main/LICENSE). See the [`LICENSE`](https://github.com/openthread/openthread/blob/main/LICENSE) file for more information.
+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
-45
View File
@@ -1,45 +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)
-1107
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: 9.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 58 KiB

After

Width:  |  Height:  |  Size: 5.5 KiB

+8 -1
View File
@@ -53,10 +53,11 @@
* @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
* @defgroup api-nat64 NAT64
* @defgroup api-srp SRP
* @defgroup api-ping-sender Ping Sender
*
@@ -102,11 +103,13 @@
* @defgroup api-backbone-router Backbone Router
* @defgroup api-border-agent Border Agent
* @defgroup api-border-router Border Router
* @defgroup api-border-routing Border Routing Manager
* @defgroup api-commissioner Commissioner
* @defgroup api-thread-general General
* @brief This module includes functions for all Thread roles.
* @defgroup api-joiner Joiner
* @defgroup api-operational-dataset Operational Dataset
* @brief Includes functions for the Operational Dataset API.
* @defgroup api-thread-router Router/Leader
* @brief This module includes functions for Thread Routers and Leaders.
* @defgroup api-server Server
@@ -136,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
*
* @{
@@ -164,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
@@ -177,6 +183,7 @@
* @defgroup plat-time Time Service
* @defgroup plat-toolchain Toolchain
* @defgroup plat-trel TREL - Platform
* @defgroup plat-infra-if Infrastructure Interface
*
* @}
*
+187 -333
View File
@@ -34,57 +34,197 @@ option(OT_FTD "enable FTD" ON)
option(OT_MTD "enable MTD" ON)
option(OT_RCP "enable RCP" ON)
option(OT_ANYCAST_LOCATOR "enable anycast locator support")
if(OT_ANYCAST_LOCATOR)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_TMF_ANYCAST_LOCATOR_ENABLE=1")
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"
"OFF"
)
macro(ot_option name ot_config description)
# Declare an OT cmake config with `name` mapping to OPENTHREAD_CONFIG
# `ot_config`. Parameter `description` provides the help string for this
# OT cmake config. There is an optional last parameter which if provided
# determines the default value for the cmake config. If not provided
# empty string is used which will be treated as "not specified". In this
# case, the variable `name` would still be false but the related
# OPENTHREAD_CONFIG is not added in `ot-config`.
if (${ARGC} GREATER 3)
set(${name} ${ARGN} CACHE STRING "enable ${description}")
else()
set(${name} "" CACHE STRING "enable ${description}")
endif()
set_property(CACHE ${name} PROPERTY STRINGS ${OT_CONFIG_VALUES})
string(COMPARE EQUAL "${${name}}" "" is_empty)
if (is_empty)
message(STATUS "${name}=\"\"")
elseif (${name})
message(STATUS "${name}=ON --> ${ot_config}=1")
target_compile_definitions(ot-config INTERFACE "${ot_config}=1")
else()
message(STATUS "${name}=OFF --> ${ot_config}=0")
target_compile_definitions(ot-config INTERFACE "${ot_config}=0")
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_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)")
ot_option(OT_COAPS OPENTHREAD_CONFIG_COAP_SECURE_API_ENABLE "secure coap")
ot_option(OT_COMMISSIONER OPENTHREAD_CONFIG_COMMISSIONER_ENABLE "commissioner")
ot_option(OT_CSL_AUTO_SYNC OPENTHREAD_CONFIG_MAC_CSL_AUTO_SYNC_ENABLE "data polling based on csl")
ot_option(OT_CSL_DEBUG OPENTHREAD_CONFIG_MAC_CSL_DEBUG_ENABLE "csl debug")
ot_option(OT_CSL_RECEIVER OPENTHREAD_CONFIG_MAC_CSL_RECEIVER_ENABLE "csl receiver")
ot_option(OT_DATASET_UPDATER OPENTHREAD_CONFIG_DATASET_UPDATER_ENABLE "dataset updater")
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")
ot_option(OT_EXTERNAL_HEAP OPENTHREAD_CONFIG_HEAP_EXTERNAL_ENABLE "external heap")
ot_option(OT_FIREWALL OPENTHREAD_POSIX_CONFIG_FIREWALL_ENABLE "firewall")
ot_option(OT_HISTORY_TRACKER OPENTHREAD_CONFIG_HISTORY_TRACKER_ENABLE "history tracker")
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_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_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")
ot_option(OT_PLATFORM_UDP OPENTHREAD_CONFIG_PLATFORM_UDP_ENABLE "platform UDP")
ot_option(OT_REFERENCE_DEVICE OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE "test harness reference device")
ot_option(OT_SERVICE OPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE "Network Data service")
ot_option(OT_SETTINGS_RAM OPENTHREAD_SETTINGS_RAM "volatile-only storage of settings")
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")
ot_option(OT_UDP_FORWARD OPENTHREAD_CONFIG_UDP_FORWARD_ENABLE "UDP forward")
ot_option(OT_UPTIME OPENTHREAD_CONFIG_UPTIME_ENABLE "uptime")
option(OT_DOC "Build OpenThread documentation")
option(OT_FULL_LOGS "enable full logs")
if(OT_FULL_LOGS)
if(NOT OT_LOG_LEVEL)
message(STATUS "OT_FULL_LOGS=ON --> Setting LOG_LEVEL to DEBG")
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_LOG_LEVEL=OT_LOG_LEVEL_DEBG")
endif()
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_LOG_PREPEND_LEVEL=1")
endif()
option(OT_ASSERT "enable assert function OT_ASSERT()" ON)
if(OT_ASSERT)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_ASSERT_ENABLE=1")
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()
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_ASSERT_ENABLE=0")
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()
option(OT_BACKBONE_ROUTER "enable backbone router functionality")
if(OT_BACKBONE_ROUTER)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_BACKBONE_ROUTER_ENABLE=1")
set(OT_BACKBONE_ROUTER_DUA_NDPROXYING ON CACHE BOOL "Enable DUA NDProxying by default")
set(OT_BACKBONE_ROUTER_MULTICAST_ROUTING ON CACHE BOOL "Enable Multicast Routing by default")
endif()
option(OT_BACKBONE_ROUTER_DUA_NDPROXYING "enable Backbone Router DUA ND Proxying functionality" OFF)
if(OT_BACKBONE_ROUTER_DUA_NDPROXYING)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_BACKBONE_ROUTER_DUA_NDPROXYING_ENABLE=1")
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()
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_BACKBONE_ROUTER_DUA_NDPROXYING_ENABLE=0")
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()
option(OT_BACKBONE_ROUTER_MULTICAST_ROUTING "enable Backbone Router Multicast Routing functionality" OFF)
if(OT_BACKBONE_ROUTER_MULTICAST_ROUTING)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_BACKBONE_ROUTER_MULTICAST_ROUTING_ENABLE=1")
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()
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_BACKBONE_ROUTER_MULTICAST_ROUTING_ENABLE=0")
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()
option(OT_BORDER_AGENT "enable border agent support")
if(OT_BORDER_AGENT)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_BORDER_AGENT_ENABLE=1")
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()
option(OT_BORDER_ROUTER "enable border router support")
if(OT_BORDER_ROUTER)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_BORDER_ROUTER_ENABLE=1")
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}")
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_MLE_MAX_CHILDREN=${OT_MLE_MAX_CHILDREN}")
elseif(NOT OT_MLE_MAX_CHILDREN STREQUAL "")
message(FATAL_ERROR "Invalid maximum number of children: ${OT_MLE_MAX_CHILDREN}")
endif()
option(OT_BORDER_ROUTING "enable border routing support")
if(OT_BORDER_ROUTING)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_BORDER_ROUTING_ENABLE=1")
endif()
option(OT_BORDER_ROUTING_NAT64 "enable border routing NAT64 support")
if(OT_BORDER_ROUTING_NAT64)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_BORDER_ROUTING_NAT64_ENABLE=1")
set(OT_RCP_RESTORATION_MAX_COUNT "0" CACHE STRING "set max RCP restoration count")
if(OT_RCP_RESTORATION_MAX_COUNT MATCHES "^[0-9]+$")
message(STATUS "OT_RCP_RESTORATION_MAX_COUNT=${OT_RCP_RESTORATION_MAX_COUNT}")
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_SPINEL_CONFIG_RCP_RESTORATION_MAX_COUNT=${OT_RCP_RESTORATION_MAX_COUNT}")
else()
message(FATAL_ERROR "Invalid max RCP restoration count: ${OT_RCP_RESTORATION_MAX_COUNT}")
endif()
if(NOT OT_EXTERNAL_MBEDTLS)
@@ -102,307 +242,21 @@ else()
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_ENABLE_BUILTIN_MBEDTLS_MANAGEMENT=0")
endif()
option(OT_CHANNEL_MANAGER "enable channel manager support")
if(OT_CHANNEL_MANAGER)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_CHANNEL_MANAGER_ENABLE=1")
endif()
option(OT_CHANNEL_MONITOR "enable channel monitor support")
if(OT_CHANNEL_MONITOR)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_CHANNEL_MONITOR_ENABLE=1")
endif()
option(OT_CHILD_SUPERVISION "enable child supervision support")
if(OT_CHILD_SUPERVISION)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_CHILD_SUPERVISION_ENABLE=1")
endif()
option(OT_COAP "enable coap api support")
if(OT_COAP)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_COAP_API_ENABLE=1")
endif()
option(OT_COAPS "enable secure coap api support")
if(OT_COAPS)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_COAP_SECURE_API_ENABLE=1")
endif()
option(OT_COAP_BLOCK "enable coap block-wise transfer (RFC7959) api support")
if(OT_COAP_BLOCK)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_COAP_BLOCKWISE_TRANSFER_ENABLE=1")
endif()
option(OT_COAP_OBSERVE "enable coap observe (RFC7641) api support")
if(OT_COAP_OBSERVE)
list(APPEND OT_PRIVATE_DEFINES "OPENTHREAD_CONFIG_COAP_OBSERVE_API_ENABLE=1")
endif()
option(OT_COMMISSIONER "enable commissioner support")
if(OT_COMMISSIONER)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_COMMISSIONER_ENABLE=1")
endif()
option(OT_CSL_RECEIVER "enable csl receiver")
if(OT_CSL_RECEIVER)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_MAC_CSL_RECEIVER_ENABLE=1")
endif()
option(OT_CSL_AUTO_SYNC "enable data polling based on csl config" ${OT_CSL_RECEIVER})
if(OT_CSL_AUTO_SYNC)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_MAC_CSL_AUTO_SYNC_ENABLE=1")
else()
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_MAC_CSL_AUTO_SYNC_ENABLE=0")
endif()
option(OT_CSL_DEBUG "enable csl debug")
if(OT_CSL_DEBUG)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_MAC_CSL_DEBUG_ENABLE=1")
endif()
option(OT_DATASET_UPDATER "enable dataset updater support")
if(OT_DATASET_UPDATER)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_DATASET_UPDATER_ENABLE=1")
endif()
option(OT_DHCP6_CLIENT "enable DHCP6 client support")
if(OT_DHCP6_CLIENT)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_DHCP6_CLIENT_ENABLE=1")
endif()
option(OT_DHCP6_SERVER "enable DHCP6 server support")
if(OT_DHCP6_SERVER)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_DHCP6_SERVER_ENABLE=1")
endif()
option(OT_DIAGNOSTIC "enable diagnostic support")
if(OT_DIAGNOSTIC)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_DIAG_ENABLE=1")
endif()
option(OT_DNS_CLIENT "enable DNS client support")
if(OT_DNS_CLIENT)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_DNS_CLIENT_ENABLE=1")
endif()
option(OT_DNS_DSO "enable DNS Stateful Operations (DSO) support")
if(OT_DNS_DSO)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_DNS_DSO_ENABLE=1")
endif()
option(OT_DNSSD_SERVER "enable DNS-SD server support")
if(OT_DNSSD_SERVER)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_DNSSD_SERVER_ENABLE=1")
endif()
option(OT_DOC "Build OpenThread documentation")
option(OT_ECDSA "enable ECDSA support")
if(OT_ECDSA)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_ECDSA_ENABLE=1")
endif()
option(OT_SRP_CLIENT "enable SRP client support")
if (OT_SRP_CLIENT)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_SRP_CLIENT_ENABLE=1")
endif()
option(OT_DUA "enable Domain Unicast Address feature for Thread 1.2")
if(OT_DUA)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_DUA_ENABLE=1")
endif()
option(OT_MESSAGE_USE_HEAP "enable heap allocator for message buffers")
if(OT_MESSAGE_USE_HEAP)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_MESSAGE_USE_HEAP_ENABLE=1")
endif()
option(OT_MLR "enable Multicast Listener Registration feature for Thread 1.2")
if(OT_MLR)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_MLR_ENABLE=1")
endif()
option(OT_EXTERNAL_HEAP "enable external heap support")
if(OT_EXTERNAL_HEAP)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_HEAP_EXTERNAL_ENABLE=1")
endif()
option(OT_HISTORY_TRACKER "enable history tracker support")
if(OT_HISTORY_TRACKER)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_HISTORY_TRACKER_ENABLE=1")
endif()
option(OT_IP6_FRAGM "enable ipv6 fragmentation support")
if(OT_IP6_FRAGM)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_IP6_FRAGMENTATION_ENABLE=1")
endif()
option(OT_JAM_DETECTION "enable jam detection support")
if(OT_JAM_DETECTION)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_JAM_DETECTION_ENABLE=1")
endif()
option(OT_JOINER "enable joiner support")
if(OT_JOINER)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_JOINER_ENABLE=1")
endif()
option(OT_LEGACY "enable legacy network support")
if(OT_LEGACY)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_LEGACY_ENABLE=1")
endif()
option(OT_LINK_RAW "enable link raw service")
if(OT_LINK_RAW)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_LINK_RAW_ENABLE=1")
endif()
option(OT_LINK_METRICS_INITIATOR "enable link metrics initiator")
if (OT_LINK_METRICS_INITIATOR)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_MLE_LINK_METRICS_INITIATOR_ENABLE=1")
endif()
option(OT_LINK_METRICS_SUBJECT "enable link metrics subject")
if (OT_LINK_METRICS_SUBJECT)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_MLE_LINK_METRICS_SUBJECT_ENABLE=1")
endif()
option(OT_LOG_LEVEL_DYNAMIC "enable dynamic log level control")
if(OT_LOG_LEVEL_DYNAMIC)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_LOG_LEVEL_DYNAMIC_ENABLE=1")
endif()
option(OT_MAC_FILTER "enable mac filter support")
if(OT_MAC_FILTER)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_MAC_FILTER_ENABLE=1")
endif()
option(OT_MLE_LONG_ROUTES "enable MLE long routes extension (experimental, breaks Thread conformance)")
if(OT_MLE_LONG_ROUTES)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_MLE_LONG_ROUTES_ENABLE=1")
endif()
option(OT_MTD_NETDIAG "enable TMF network diagnostics on MTDs")
if(OT_MTD_NETDIAG)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_TMF_NETWORK_DIAG_MTD_ENABLE=1")
endif()
option(OT_MULTIPLE_INSTANCE "enable multiple instances")
if(OT_MULTIPLE_INSTANCE)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_MULTIPLE_INSTANCE_ENABLE=1")
endif()
option(OT_NEIGHBOR_DISCOVERY_AGENT "enable neighbor discovery agent support")
if(OT_NEIGHBOR_DISCOVERY_AGENT)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_NEIGHBOR_DISCOVERY_AGENT_ENABLE=1")
endif()
option(OT_NETDATA_PUBLISHER "enable Thread Network Data publisher")
if(OT_NETDATA_PUBLISHER)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_NETDATA_PUBLISHER_ENABLE=1")
endif()
option(OT_PING_SENDER "enable ping sender support" ${OT_APP_CLI})
if(OT_PING_SENDER)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_PING_SENDER_ENABLE=1")
endif()
option(OT_PLATFORM_NETIF "enable platform netif support")
if(OT_PLATFORM_NETIF)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_PLATFORM_NETIF_ENABLE=1")
endif()
option(OT_PLATFORM_UDP "enable platform UDP support")
if(OT_PLATFORM_UDP)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_PLATFORM_UDP_ENABLE=1")
endif()
if(OT_POSIX_SETTINGS_PATH)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_POSIX_SETTINGS_PATH=${OT_POSIX_SETTINGS_PATH}")
endif()
option(OT_REFERENCE_DEVICE "enable Thread Test Harness reference device support")
if(OT_REFERENCE_DEVICE)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE=1")
endif()
#-----------------------------------------------------------------------------------------------------------------------
# Check removed/replaced options
option(OT_SERVICE "enable support for injecting Service entries into the Thread Network Data")
if(OT_SERVICE)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE=1")
endif()
option(OT_SETTINGS_RAM "enable volatile-only storage of settings")
if(OT_SETTINGS_RAM)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_SETTINGS_RAM=1")
endif()
option(OT_SLAAC "enable support for adding of auto-configured SLAAC addresses by OpenThread")
if(OT_SLAAC)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_IP6_SLAAC_ENABLE=1")
endif()
option(OT_SNTP_CLIENT "enable SNTP Client support")
if(OT_SNTP_CLIENT)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_SNTP_CLIENT_ENABLE=1")
endif()
option(OT_SRP_SERVER "enable SRP server")
if (OT_SRP_SERVER)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_SRP_SERVER_ENABLE=1")
endif()
option(OT_TIME_SYNC "enable the time synchronization service feature")
if(OT_TIME_SYNC)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_TIME_SYNC_ENABLE=1")
endif()
option(OT_TREL "enable TREL radio link for Thread over Infrastructure feature")
if (OT_TREL)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_RADIO_LINK_TREL_ENABLE=1")
endif()
option(OT_TX_BEACON_PAYLOAD "enable Thread beacon payload in outgoing beacons")
if (OT_TX_BEACON_PAYLOAD)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_MAC_OUTGOING_BEACON_PAYLOAD_ENABLE=1")
endif()
option(OT_UDP_FORWARD "enable UDP forward support")
if(OT_UDP_FORWARD)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_UDP_FORWARD_ENABLE=1")
endif()
option(OT_UPTIME "enable support for tracking OpenThread instance's uptime")
if(OT_UPTIME)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_UPTIME_ENABLE=1")
endif()
option(OT_FIREWALL "enable firewall")
if (OT_FIREWALL)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_POSIX_CONFIG_FIREWALL_ENABLE=1")
endif()
option(OT_FULL_LOGS "enable full logs")
if(OT_FULL_LOGS)
if(NOT OT_LOG_LEVEL)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_LOG_LEVEL=OT_LOG_LEVEL_DEBG")
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()
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_LOG_PREPEND_LEVEL=1")
endif()
endmacro()
option(OT_OTNS "enable OTNS support")
if(OT_OTNS)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_OTNS_ENABLE=1")
endif()
set(OT_RCP_RESTORATION_MAX_COUNT "0" CACHE STRING "set max RCP restoration count")
if(OT_RCP_RESTORATION_MAX_COUNT MATCHES "^[0-9]+$")
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_SPINEL_CONFIG_RCP_RESTORATION_MAX_COUNT=${OT_RCP_RESTORATION_MAX_COUNT}")
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")
# Checks
if(OT_PLATFORM_UDP AND OT_UDP_FORWARD)
message(FATAL_ERROR "OT_PLATFORM_UDP and OT_UDP_FORWARD are exclusive")
endif()
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)
+3 -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 \
@@ -20,6 +21,7 @@ RUN set -x \
inetutils-ping \
ca-certificates \
&& update-ca-certificates \
&& python3 -m pip install -U pip \
&& python3 -m pip install -U cmake \
&& python3 -m pip install wheel
+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
-309
View File
@@ -1,309 +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.
#
.NOTPARALLEL:
AR = arm-none-eabi-ar
CCAS = arm-none-eabi-as
CPP = arm-none-eabi-cpp
CC = arm-none-eabi-gcc
CXX = arm-none-eabi-g++
LD = arm-none-eabi-ld
STRIP = arm-none-eabi-strip
NM = arm-none-eabi-nm
RANLIB = arm-none-eabi-ranlib
OBJCOPY = arm-none-eabi-objcopy
BuildJobs ?= 10
configure_OPTIONS = \
--enable-cli \
--enable-ftd \
--enable-mtd \
--enable-ncp \
--enable-radio-only \
--enable-linker-map \
--with-examples=cc2538 \
$(NULL)
TopSourceDir := $(dir $(shell readlink $(firstword $(MAKEFILE_LIST))))..
AbsTopSourceDir := $(dir $(realpath $(firstword $(MAKEFILE_LIST))))..
CC2538_CONFIG_FILE_CPPFLAGS = -DOPENTHREAD_PROJECT_CORE_CONFIG_FILE='\"openthread-core-cc2538-config.h\"'
CC2538_CONFIG_FILE_CPPFLAGS += -DOPENTHREAD_CORE_CONFIG_PLATFORM_CHECK_FILE='\"openthread-core-cc2538-config-check.h\"'
CC2538_CONFIG_FILE_CPPFLAGS += -I$(AbsTopSourceDir)/examples/platforms/cc2538/
COMMONCFLAGS := \
-fdata-sections \
-ffunction-sections \
-Os \
-g \
$(CC2538_CONFIG_FILE_CPPFLAGS) \
$(NULL)
include $(dir $(abspath $(lastword $(MAKEFILE_LIST))))/common-switches.mk
# Optional CC2592 options, first and foremost, whether to enable support for it
# at all.
ifeq ($(CC2592),1)
COMMONCFLAGS += -DOPENTHREAD_CONFIG_CC2538_WITH_CC2592=1
# If the PA_EN is on another port C pin, specify it with CC2592_PA_PIN.
ifneq ($(CC2592_PA_EN),)
COMMONCFLAGS += -DOPENTHREAD_CONFIG_CC2592_PA_EN_PIN=$(CC2592_PA_EN)
endif
# If the LNA_EN is on another port C pin, specify it with CC2592_LNA_PIN.
ifneq ($(CC2592_LNA_EN),)
COMMONCFLAGS += -DOPENTHREAD_CONFIG_CC2592_LNA_EN_PIN=$(CC2592_LNA_EN)
endif
# If we're not using HGM, set CC2538_USE_HGM to 0.
ifeq ($(CC2592_USE_HGM),0)
COMMONCFLAGS += -DOPENTHREAD_CONFIG_CC2592_USE_HGM=0
else # CC2592_USE_HGM=1
# HGM in use, if not on port D, specify the port here (A, B or C) with CC2592_HGM_PORT.
ifneq ($(CC2592_HGM_PORT),)
COMMONCFLAGS += -DOPENTHREAD_CONFIG_CC2592_HGM_PORT=GPIO_$(CC2592_HGM_PORT)_BASE
endif
# If HGM is not at pin 2, specify which pin here with CC2592_HGM_PIN.
ifneq ($(CC2592_HGM_PIN),)
COMMONCFLAGS += -DOPENTHREAD_CONFIG_CC2592_HGM_PIN=$(CC2592_HGM_PIN)
endif
# If we want it off by default, specify CC2592_HGM_DEFAULT_STATE=0
ifeq ($(CC2592_HGM_DEFAULT_STATE),0)
COMMONCFLAGS += -DOPENTHREAD_CONFIG_CC2592_HGM_DEFAULT_STATE=false
endif
endif # CC2592_USE_HGM
endif # CC2592
ifneq ($(CC2538_RECEIVE_SENSITIVITY),)
COMMONCFLAGS += -DOPENTHREAD_CONFIG_CC2538_RECEIVE_SENSITIVITY=$(CC2538_RECEIVE_SENSITIVITY)
endif
ifneq ($(CC2538_RSSI_OFFSET),)
COMMONCFLAGS += -DOPENTHREAD_CONFIG_CC2538_RSSI_OFFSET=$(CC2538_RSSI_OFFSET)
endif
CPPFLAGS += \
$(COMMONCFLAGS) \
$(target_CPPFLAGS) \
$(NULL)
CFLAGS += \
$(COMMONCFLAGS) \
$(target_CFLAGS) \
$(NULL)
CXXFLAGS += \
$(COMMONCFLAGS) \
$(target_CXXFLAGS) \
-fno-exceptions \
-fno-rtti \
$(NULL)
LDFLAGS += \
$(COMMONCFLAGS) \
$(target_LDFLAGS) \
-nostartfiles \
-specs=nano.specs \
-specs=nosys.specs \
-Wl,--gc-sections \
$(NULL)
ECHO := @echo
MAKE := make
MKDIR_P := mkdir -p
LN_S := ln -s
RM_F := rm -f
INSTALL := /usr/bin/install
INSTALLFLAGS := -p
BuildPath = build
TopBuildDir = $(BuildPath)
AbsTopBuildDir = $(PWD)/$(TopBuildDir)
ResultPath = output
TopResultDir = $(ResultPath)
AbsTopResultDir = $(PWD)/$(TopResultDir)
TargetTuple = cc2538
ARCHS = cortex-m3
TopTargetLibDir = $(TopResultDir)/$(TargetTuple)/lib
ifndef BuildJobs
BuildJobs := $(shell getconf _NPROCESSORS_ONLN)
endif
JOBSFLAG := -j$(BuildJobs)
#
# configure-arch <arch>
#
# Configure OpenThread for the specified architecture.
#
# arch - The architecture to configure.
#
define configure-arch
$(ECHO) " CONFIG $(TargetTuple)..."
(cd $(BuildPath)/$(TargetTuple) && $(AbsTopSourceDir)/configure \
INSTALL="$(INSTALL) $(INSTALLFLAGS)" \
CPP="$(CPP)" CC="$(CC)" CXX="$(CXX)" OBJC="$(OBJC)" OBJCXX="$(OBJCXX)" AR="$(AR)" RANLIB="$(RANLIB)" NM="$(NM)" STRIP="$(STRIP)" CPPFLAGS="$(CPPFLAGS)" CFLAGS="$(CFLAGS)" CXXFLAGS="$(CXXFLAGS)" LDFLAGS="$(LDFLAGS)" \
--host=arm-none-eabi \
--prefix=/ \
--exec-prefix=/$(TargetTuple) \
$(configure_OPTIONS))
endef # configure-arch
#
# build-arch <arch>
#
# Build the OpenThread intermediate build products for the specified
# architecture.
#
# arch - The architecture to build.
#
define build-arch
$(ECHO) " BUILD $(TargetTuple)"
$(MAKE) $(JOBSFLAG) -C $(BuildPath)/$(TargetTuple) --no-print-directory \
all
endef # build-arch
#
# stage-arch <arch>
#
# Stage (install) the OpenThread final build products for the specified
# architecture.
#
# arch - The architecture to stage.
#
define stage-arch
$(ECHO) " STAGE $(TargetTuple)"
$(MAKE) $(JOBSFLAG) -C $(BuildPath)/$(TargetTuple) --no-print-directory \
DESTDIR=$(AbsTopResultDir) \
install
endef # stage-arch
#
# ARCH_template <arch>
#
# Define macros, targets and rules to configure, build, and stage the
# OpenThread for a single architecture.
#
# arch - The architecture to instantiate the template for.
#
define ARCH_template
CONFIGURE_TARGETS += configure-$(1)
BUILD_TARGETS += do-build-$(1)
STAGE_TARGETS += stage-$(1)
BUILD_DIRS += $(BuildPath)/$(TargetTuple)
DIRECTORIES += $(BuildPath)/$(TargetTuple)
configure-$(1): target_CPPFLAGS=$($(1)_target_CPPFLAGS)
configure-$(1): target_CFLAGS=$($(1)_target_CFLAGS)
configure-$(1): target_CXXFLAGS=$($(1)_target_CXXFLAGS)
configure-$(1): target_LDFLAGS=$($(1)_target_LDFLAGS)
configure-$(1): $(BuildPath)/$(TargetTuple)/config.status
$(BuildPath)/$(TargetTuple)/config.status: | $(BuildPath)/$(TargetTuple)
$$(call configure-arch,$(1))
do-build-$(1): configure-$(1)
do-build-$(1):
+$$(call build-arch,$(1))
stage-$(1): do-build-$(1)
stage-$(1): | $(TopResultDir)
$$(call stage-arch,$(1))
$(1): stage-$(1)
endef # ARCH_template
.DEFAULT_GOAL := all
all: stage
#
# cortex-m3
#
cortex-m3_target_ABI = cortex-m3
cortex-m3_target_CPPFLAGS = -mcpu=cortex-m3 -mfloat-abi=soft -mthumb
cortex-m3_target_CFLAGS = -mcpu=cortex-m3 -mfloat-abi=soft -mthumb
cortex-m3_target_CXXFLAGS = -mcpu=cortex-m3 -mfloat-abi=soft -mthumb
cortex-m3_target_LDFLAGS = -mcpu=cortex-m3 -mfloat-abi=soft -mthumb
# Instantiate an architecture-specific build template for each target
# architecture.
$(foreach arch,$(ARCHS),$(eval $(call ARCH_template,$(arch))))
#
# Common / Finalization
#
configure: $(CONFIGURE_TARGETS)
build: $(BUILD_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) "architectures: "
$(ECHO) ""
$(ECHO) " $(ARCHS)"
$(ECHO) ""
$(ECHO) "To build only a particular architecture, specify: "
$(ECHO) ""
$(ECHO) " make -f $(firstword $(MAKEFILE_LIST)) <architecture>"
$(ECHO) ""
-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
-73
View File
@@ -1,73 +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. |
| BORDER_ROUTING_NAT64 | OT_BORDER_ROUTING_NAT64 | Enables NAT64 border routing support 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. |
| 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)
{
+9
View File
@@ -44,8 +44,17 @@ target_link_libraries(ot-cli-ftd PRIVATE
${OT_PLATFORM_LIB_FTD}
openthread-cli-ftd
${OT_MBEDTLS}
ot-config-ftd
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)
+31 -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,24 +50,15 @@
extern void otAppCliInit(otInstance *aInstance);
#if OPENTHREAD_CONFIG_HEAP_EXTERNAL_ENABLE
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); }
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 void ProcessExit(void *aContext, uint8_t aArgsLength, char *aArgs[])
static otError ProcessExit(void *aContext, uint8_t aArgsLength, char *aArgs[])
{
OT_UNUSED_VARIABLE(aContext);
OT_UNUSED_VARIABLE(aArgsLength);
@@ -75,9 +66,33 @@ static void ProcessExit(void *aContext, uint8_t aArgsLength, char *aArgs[])
exit(EXIT_SUCCESS);
}
static const otCliCommand kCommands[] = {{"exit", ProcessExit}};
#if OPENTHREAD_EXAMPLES_SIMULATION
extern otError ProcessNodeIdFilter(void *aContext, uint8_t aArgsLength, char *aArgs[]);
#endif
static const otCliCommand kCommands[] = {
{"exit", ProcessExit},
#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 (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
};
#endif // OPENTHREAD_POSIX && !defined(FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION)
int main(int argc, char *argv[])
{
otInstance *instance;
@@ -111,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())
+9
View File
@@ -44,8 +44,17 @@ target_link_libraries(ot-cli-mtd PRIVATE
${OT_PLATFORM_LIB_MTD}
openthread-cli-mtd
${OT_MBEDTLS}
ot-config-mtd
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)
+9
View File
@@ -48,9 +48,18 @@ target_link_libraries(ot-cli-radio PRIVATE
${OT_PLATFORM_LIB_RCP}
openthread-cli-radio
${OT_MBEDTLS_RCP}
ot-config-radio
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
+9
View File
@@ -44,7 +44,16 @@ target_link_libraries(ot-ncp-ftd PRIVATE
${OT_PLATFORM_LIB_FTD}
openthread-ncp-ftd
${OT_MBEDTLS}
ot-config-ftd
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
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); }
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[])
{
+9
View File
@@ -44,7 +44,16 @@ target_link_libraries(ot-ncp-mtd PRIVATE
${OT_PLATFORM_LIB_MTD}
openthread-ncp-mtd
${OT_MBEDTLS}
ot-config-mtd
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
+9
View File
@@ -43,7 +43,16 @@ target_link_libraries(ot-rcp PRIVATE
openthread-radio
${OT_PLATFORM_LIB_RCP}
openthread-rcp
ot-config-radio
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)
-394
View File
@@ -1,394 +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
BORDER_ROUTING_NAT64 ?= 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
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 ($(BORDER_ROUTING_NAT64),1)
COMMONCFLAGS += -DOPENTHREAD_CONFIG_BORDER_ROUTING_NAT64_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
-71
View File
@@ -1,71 +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 \
cc2652 \
efr32 \
gp712 \
k32w \
kw41z \
nrf528xx \
qpg6095 \
qpg6100 \
qpg7015m \
samr21 \
$(NULL)
# Always package (e.g. for 'make dist') these subdirectories.
DIST_SUBDIRS = \
cc2538 \
simulation \
utils \
$(NULL)
# Always build (e.g. for 'make all') these subdirectories.
SUBDIRS = \
utils \
$(NULL)
if OPENTHREAD_PLATFORM_CC2538
SUBDIRS += cc2538
endif
if OPENTHREAD_PLATFORM_SIMULATION
SUBDIRS += simulation
endif
noinst_HEADERS = \
openthread-system.h \
$(NULL)
include $(abs_top_nlbuild_autotools_dir)/automake/post.am
-50
View File
@@ -1,50 +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_CC2538
include $(top_srcdir)/examples/platforms/cc2538/Makefile.platform.am
endif
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
-69
View File
@@ -1,69 +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
# Do not enable -Wcast-align for this platform
override CFLAGS := $(filter-out -Wcast-align,$(CFLAGS))
override CXXFLAGS := $(filter-out -Wcast-align,$(CXXFLAGS))
lib_LIBRARIES = libopenthread-cc2538.a
libopenthread_cc2538_a_CPPFLAGS = \
-I$(top_srcdir)/include \
-I$(top_srcdir)/examples/platforms \
-I$(top_srcdir)/src/core \
$(NULL)
PLATFORM_SOURCES = \
alarm.c \
cc2538-reg.h \
diag.c \
entropy.c \
flash.c \
misc.c \
openthread-core-cc2538-config.h \
openthread-core-cc2538-config-check.h \
platform-cc2538.h \
radio.c \
rom-utility.h \
startup-gcc.c \
system.c \
logging.c \
uart.c \
$(NULL)
libopenthread_cc2538_a_SOURCES = \
$(PLATFORM_SOURCES) \
$(NULL)
Dash = -
libopenthread_cc2538_a_LIBADD = \
$(shell find $(top_builddir)/examples/platforms/utils $(Dash)type f $(Dash)name "*.o")
include $(abs_top_nlbuild_autotools_dir)/automake/post.am
-112
View File
@@ -1,112 +0,0 @@
# OpenThread on CC2538 Example
This directory contains example platform drivers for the [Texas Instruments CC2538][cc2538].
[cc2538]: http://www.ti.com/product/CC2538
The example platform drivers are intended to present the minimal code necessary to support OpenThread. As a result, the example platform drivers do not necessarily highlight the platform's full capabilities.
## Toolchain
Download and install the [GNU toolchain for ARM Cortex-M][gnu-toolchain].
[gnu-toolchain]: https://developer.arm.com/tools-and-software/open-source-software/developer-tools/gnu-toolchain/gnu-rm
In a Bash terminal, follow these instructions to install the GNU toolchain and other dependencies.
```bash
$ cd <path-to-openthread>
$ ./script/bootstrap
```
## Building
In a Bash terminal, follow these instructions to build the cc2538 examples.
```bash
$ cd <path-to-openthread>
$ ./bootstrap
$ make -f examples/Makefile-cc2538
```
### CC2592 support
If your board has a CC2592 range extender front-end IC connected to the CC2538 (e.g. the CC2538-CC2592 EM reference design), you need to initialise this part before reception of radio traffic will work.
Support is enabled in OpenThread by building with `CC2592=1`:
```bash
$ make -f examples/Makefile-cc2538 CC2592=1
```
The default settings should work for any design following the integration advice given in TI's application report ["AN130 - Using CC2592 Front End With CC2538"](http://www.ti.com/lit/pdf/swra447).
Additional settings can be customised:
- `CC2592_PA_EN`: This specifies which pin (on port C of the CC2538) connects to the CC2592's `PA_EN` pin. The default is `3` (PC3).
- `CC2592_LNA_EN`: This specifies which pin (on port C of the CC2538) connects to the CC2592's `LNA_EN` pin. The default is `2` (PC2).
- `CC2592_USE_HGM`: This defines whether the HGM pin of the CC2592 is under GPIO control or not. If not, it is assumed that the HGM pin is tied to a power rail.
- `CC2592_HGM_PORT`: The HGM pin can be connected to any free GPIO. TI recommend using PD2, however if you've used a pin on another GPIO port, you may specify that port (`A`, `B` or `C`) here.
- `CC2592_HGM_PORT`: The HGM pin can be connected to any free GPIO. TI recommend using PD2, however if you've used a pin on another GPIO port, you may specify that port (`A`, `B` or `C`) here. Default is `D`.
- `CC2592_HGM_PIN`: The HGM pin can be connected to any free GPIO. TI recommend using PD2, however if you've used a pin on another GPIO pin, you can specify the pin here. Default is `2`.
- `CC2592_HGM_DEFAULT_STATE`: By default, HGM is enabled at power-on, but you may want to have it default to off, specify `CC2592_HGM_DEFAULT_STATE=0` to do so.
- `CC2538_RECEIVE_SENSITIVITY`: If you have tied the HGM pin to a power rail, this allows you to calibrate the RSSI values according to the new receive sensitivity. This has no effect if `CC2592_USE_HGM=1` (the default).
- `CC2538_RSSI_OFFSET`: If you have tied the HGM pin to a power rail, this allows you to calibrate the RSSI values according to the new RSSI offset. This has no effect if `CC2592_USE_HGM=1` (the default).
## Flash Binaries
If the build completed successfully, the `elf` files may be found in `<path-to-openthread>/output/cc2538/bin`.
To flash the images with [Flash Programmer 2][ti-flash-programmer-2], the files must have the `*.elf` extension.
```bash
$ cd <path-to-openthread>/output/cc2538/bin
$ cp ot-cli ot-cli.elf
```
To load the images with the [serial bootloader][ti-cc2538-bootloader], the images must be converted to `bin`. This is done using `arm-none-eabi-objcopy`
```bash
$ cd <path-to-openthread>/output/cc2538/bin
$ arm-none-eabi-objcopy -O binary ot-cli ot-cli.bin
```
The [cc2538-bsl.py script][cc2538-bsl-tool] provides a convenient method for flashing a CC2538 via the UART. To enter the bootloader backdoor for flashing, hold down SELECT for CC2538DK (corresponds to logic '0') while you press the Reset button.
[ti-flash-programmer-2]: http://www.ti.com/tool/flash-programmer
[ti-cc2538-bootloader]: http://www.ti.com/lit/an/swra466a/swra466a.pdf
[cc2538-bsl-tool]: https://github.com/JelmerT/cc2538-bsl
## Interact
1. Open terminal to `/dev/ttyUSB1` (serial port settings: 115200 8-N-1).
2. Type `help` for list of commands.
```bash
> help
help
channel
childtimeout
contextreusedelay
extaddr
extpanid
ipaddr
keysequence
leaderweight
mode
netdata register
networkidtimeout
networkkey
networkname
panid
ping
prefix
releaserouterid
rloc16
route
routerupgradethreshold
scan
start
state
stop
```
-148
View File
@@ -1,148 +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.
*/
/**
* @file
* This file implements the OpenThread platform abstraction for the alarm.
*
*/
#include <stdbool.h>
#include <stdint.h>
#include <openthread/config.h>
#include <openthread/platform/alarm-milli.h>
#include <openthread/platform/diag.h>
#include "platform-cc2538.h"
enum
{
kSystemClock = 32000000, ///< MHz
kTicksPerSec = 1000, ///< Ticks per second
};
static uint32_t sCounter = 0;
static uint32_t sAlarmT0 = 0;
static uint32_t sAlarmDt = 0;
static bool sIsRunning = false;
static uint8_t sTimersIsRunning = 0;
static uint32_t sTimersExpireAt[OT_CC2538_TIMERS_COUNT];
extern void cc2538EnergyScanTimerHandler(void);
void cc2538SetTimer(otCC2538Timer aTimer, uint32_t aDelay)
{
sTimersIsRunning |= (1 << aTimer);
sTimersExpireAt[aTimer] = sCounter + aDelay;
}
void cc2538AlarmInit(void)
{
HWREG(NVIC_ST_RELOAD) = kSystemClock / kTicksPerSec;
HWREG(NVIC_ST_CTRL) = NVIC_ST_CTRL_CLK_SRC | NVIC_ST_CTRL_INTEN | NVIC_ST_CTRL_ENABLE;
}
uint32_t otPlatAlarmMilliGetNow(void)
{
return sCounter;
}
void otPlatAlarmMilliStartAt(otInstance *aInstance, uint32_t t0, uint32_t dt)
{
OT_UNUSED_VARIABLE(aInstance);
sAlarmT0 = t0;
sAlarmDt = dt;
sIsRunning = true;
}
void otPlatAlarmMilliStop(otInstance *aInstance)
{
OT_UNUSED_VARIABLE(aInstance);
sIsRunning = false;
}
void cc2538AlarmProcess(otInstance *aInstance)
{
uint32_t expires;
bool fire = false;
if (sTimersIsRunning)
{
if ((int32_t)(sTimersExpireAt[OT_CC2538_TIMER_ENERGY_SCAN] - sCounter) < 0)
{
sTimersIsRunning &= ~(1 << OT_CC2538_TIMER_ENERGY_SCAN);
cc2538EnergyScanTimerHandler();
}
}
if (sIsRunning)
{
expires = sAlarmT0 + sAlarmDt;
if (sAlarmT0 <= sCounter)
{
if (expires >= sAlarmT0 && expires <= sCounter)
{
fire = true;
}
}
else
{
if (expires >= sAlarmT0 || expires <= sCounter)
{
fire = true;
}
}
if (fire)
{
sIsRunning = false;
#if OPENTHREAD_CONFIG_DIAG_ENABLE
if (otPlatDiagModeGet())
{
otPlatDiagAlarmFired(aInstance);
}
else
#endif
{
otPlatAlarmMilliFired(aInstance);
}
}
}
}
void SysTick_Handler()
{
sCounter++;
}
@@ -1,42 +0,0 @@
#
# Copyright (c) 2019, 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.
#
set(CMAKE_SYSTEM_NAME Generic)
set(CMAKE_SYSTEM_PROCESSOR ARM)
set(CMAKE_C_COMPILER arm-none-eabi-gcc)
set(CMAKE_CXX_COMPILER arm-none-eabi-g++)
set(CMAKE_ASM_COMPILER arm-none-eabi-as)
set(CMAKE_RANLIB arm-none-eabi-ranlib)
set(COMMON_C_FLAGS "-mthumb -fno-builtin -Wall -fdata-sections -ffunction-sections -mabi=aapcs -mcpu=cortex-m3 -mfloat-abi=soft")
set(CMAKE_C_FLAGS_INIT "${COMMON_C_FLAGS} -std=gnu99")
set(CMAKE_CXX_FLAGS_INIT "${COMMON_C_FLAGS} -fno-exceptions -fno-rtti")
set(CMAKE_ASM_FLAGS_INIT "${COMMON_C_FLAGS}")
set(CMAKE_EXE_LINKER_FLAGS_INIT "${COMMON_C_FLAGS} -specs=nano.specs -specs=nosys.specs -nostartfiles")
-326
View File
@@ -1,326 +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.
*/
/**
* @file
* This file includes CC2538 register definitions.
*
*/
#ifndef CC2538_REG_H_
#define CC2538_REG_H_
#include <stdint.h>
// clang-format off
#define HWREG(x) (*((volatile uint32_t *)(x)))
/*!
* For registers that are arrays of 32-bit integers.
*
* @param reg Register address
* @param idx Register array index
*/
#define HWREG_ARR(reg, idx) HWREG((reg) + ((idx) << 2))
#define NVIC_ST_CTRL 0xE000E010 // SysTick Control and Status
#define NVIC_ST_RELOAD 0xE000E014 // SysTick Reload Value Register
#define NVIC_EN0 0xE000E100 // Interrupt 0-31 Set Enable
#define NVIC_ST_CTRL_COUNT 0x00010000 // Count Flag
#define NVIC_ST_CTRL_CLK_SRC 0x00000004 // Clock Source
#define NVIC_ST_CTRL_INTEN 0x00000002 // Interrupt Enable
#define NVIC_ST_CTRL_ENABLE 0x00000001 // Enable
#define RFCORE_XREG_SRCMATCH_EN 0x00000001 // SRCMATCH.SRC_MATCH_EN(1)
#define RFCORE_XREG_SRCMATCH_AUTOPEND 0x00000002 // SRCMATCH.AUTOPEND(1)
#define RFCORE_XREG_SRCMATCH_PEND_DATAREQ_ONLY 0x00000004 // SRCMATCH.PEND_DATAREQ_ONLY(1)
#define RFCORE_XREG_SRCMATCH_ENABLE_STATUS_SIZE 3 // Num of register for source match enable status
#define RFCORE_XREG_SRCMATCH_SHORT_ENTRIES 24 // 24 short address entries in maximum
#define RFCORE_XREG_SRCMATCH_EXT_ENTRIES 12 // 12 extended address entries in maximum
#define RFCORE_XREG_SRCMATCH_SHORT_ENTRY_OFFSET 4 // address offset for one short address entry
#define RFCORE_XREG_SRCMATCH_EXT_ENTRY_OFFSET 8 // address offset for one extended address entry
#define INT_UART0 21 // UART0 Rx and Tx
#define IEEE_EUI64 0x00280028 // Address of IEEE EUI-64 address
#define RFCORE_FFSM_SRCADDRESS_TABLE 0x40088400 // Source Address Table
#define RFCORE_FFSM_SRCEXTPENDEN0 0x40088590 // Enable/Disable automatic pending per extended address
#define RFCORE_FFSM_SRCSHORTPENDEN0 0x4008859C // Enable/Disable automatic pending per short address
#define RFCORE_FFSM_EXT_ADDR0 0x400885A8 // Local address information
#define RFCORE_FFSM_PAN_ID0 0x400885C8 // Local address information
#define RFCORE_FFSM_PAN_ID1 0x400885CC // Local address information
#define RFCORE_FFSM_SHORT_ADDR0 0x400885D0 // Local address information
#define RFCORE_FFSM_SHORT_ADDR1 0x400885D4 // Local address information
#define RFCORE_XREG_FRMFILT0 0x40088600 // The frame filtering function
#define RFCORE_XREG_SRCMATCH 0x40088608 // Source address matching and pending bits
#define RFCORE_XREG_SRCSHORTEN0 0x4008860C // Short address matching
#define RFCORE_XREG_SRCEXTEN0 0x40088618 // Extended address matching
#define RFCORE_XREG_FRMCTRL0 0x40088624 // Frame handling
#define RFCORE_XREG_FRMCTRL1 0x40088628 // Frame handling
#define RFCORE_XREG_RXENABLE 0x4008862C // RX enabling
#define RFCORE_XREG_FREQCTRL 0x4008863C // Controls the RF frequency
#define RFCORE_XREG_TXPOWER 0x40088640 // Controls the output power
#define RFCORE_XREG_FSMSTAT0 0x40088648 // Radio finite state machine status
#define RFCORE_XREG_FSMSTAT1 0x4008864C // Radio status register
#define RFCORE_XREG_FIFOPCTRL 0x40088650 // FIFOP threshold
#define RFCORE_XREG_CCACTRL0 0x40088658 // CCA threshold
#define RFCORE_XREG_RSSI 0x40088660 // RSSI status register
#define RFCORE_XREG_RSSISTAT 0x40088664 // RSSI valid status register
#define RFCORE_XREG_AGCCTRL1 0x400886C8 // AGC reference level
#define RFCORE_XREG_RFC_OBS_CTRL 0x400887AC // RF Core observable output
#define RFCORE_XREG_TXFILTCFG 0x400887E8 // TX filter configuration
#define RFCORE_XREG_RFRND 0x4008869C // Random data
#define RFCORE_SFR_RFDATA 0x40088828 // The TX FIFO and RX FIFO
#define RFCORE_SFR_RFERRF 0x4008882C // RF error interrupt flags
#define RFCORE_SFR_RFIRQF0 0x40088834 // RF interrupt flags
#define RFCORE_SFR_RFST 0x40088838 // RF CSMA-CA/strobe processor
#define CCTEST_OBSSEL 0x44010014 // CCTEST observable output route
#define RFCORE_XREG_FRMFILT0_FRAME_FILTER_EN 0x00000001 // Enables frame filtering
#define RFCORE_XREG_FRMCTRL0_AUTOACK 0x00000020
#define RFCORE_XREG_FRMCTRL0_ENERGY_SCAN 0x00000010
#define RFCORE_XREG_FRMCTRL0_AUTOCRC 0x00000040
#define RFCORE_XREG_FRMCTRL0_INFINITY_RX 0x00000008
#define RFCORE_XREG_FRMCTRL1_PENDING_OR 0x00000004
#define RFCORE_XREG_RFRND_IRND 0x00000001
#define RFCORE_XREG_FSMSTAT0_STATE_MASK 0x0000003F
#define RFCORE_XREG_FSMSTAT0_CAL_DONE 0x00000080
#define RFCORE_XREG_FSMSTAT0_CAL_RUN 0x00000040
#define RFCORE_XREG_FSMSTAT0_STATE_IDLE 0x00000000
#define RFCORE_XREG_FSMSTAT0_STATE_RX_CAL 0x00000002
#define RFCORE_XREG_FSMSTAT0_STATE_SFD_WAIT0 0x00000003
#define RFCORE_XREG_FSMSTAT0_STATE_SFD_WAIT1 0x00000004
#define RFCORE_XREG_FSMSTAT0_STATE_SFD_WAIT2 0x00000005
#define RFCORE_XREG_FSMSTAT0_STATE_SFD_WAIT3 0x00000006
#define RFCORE_XREG_FSMSTAT0_STATE_RX0 0x00000007
#define RFCORE_XREG_FSMSTAT0_STATE_RX1 0x00000008
#define RFCORE_XREG_FSMSTAT0_STATE_RX2 0x00000009
#define RFCORE_XREG_FSMSTAT0_STATE_RX3 0x0000000A
#define RFCORE_XREG_FSMSTAT0_STATE_RX4 0x0000000B
#define RFCORE_XREG_FSMSTAT0_STATE_RX5 0x0000000C
#define RFCORE_XREG_FSMSTAT0_STATE_RX6 0x0000000D
#define RFCORE_XREG_FSMSTAT0_STATE_RX_WAIT 0x0000000E
#define RFCORE_XREG_FSMSTAT0_STATE_RX_FRST 0x00000010
#define RFCORE_XREG_FSMSTAT0_STATE_RX_OVER 0x00000011
#define RFCORE_XREG_FSMSTAT0_STATE_TX_CAL 0x00000020
#define RFCORE_XREG_FSMSTAT0_STATE_TX0 0x00000022
#define RFCORE_XREG_FSMSTAT0_STATE_TX1 0x00000023
#define RFCORE_XREG_FSMSTAT0_STATE_TX2 0x00000024
#define RFCORE_XREG_FSMSTAT0_STATE_TX3 0x00000025
#define RFCORE_XREG_FSMSTAT0_STATE_TX4 0x00000026
#define RFCORE_XREG_FSMSTAT0_STATE_TX_FINAL 0x00000027
#define RFCORE_XREG_FSMSTAT0_STATE_RXTX_TRANS 0x00000028
#define RFCORE_XREG_FSMSTAT0_STATE_ACK_CAL 0x00000030
#define RFCORE_XREG_FSMSTAT0_STATE_ACK0 0x00000031
#define RFCORE_XREG_FSMSTAT0_STATE_ACK1 0x00000032
#define RFCORE_XREG_FSMSTAT0_STATE_ACK2 0x00000033
#define RFCORE_XREG_FSMSTAT0_STATE_ACK3 0x00000034
#define RFCORE_XREG_FSMSTAT0_STATE_ACK4 0x00000035
#define RFCORE_XREG_FSMSTAT0_STATE_ACK5 0x00000036
#define RFCORE_XREG_FSMSTAT0_STATE_ACK_DELAY 0x00000037
#define RFCORE_XREG_FSMSTAT0_STATE_TX_UNDER 0x00000038
#define RFCORE_XREG_FSMSTAT0_STATE_TX_DOWN0 0x0000001A
#define RFCORE_XREG_FSMSTAT0_STATE_TX_DOWN1 0x0000003A
#define RFCORE_XREG_FSMSTAT1_RX_ACTIVE 0x00000001
#define RFCORE_XREG_FSMSTAT1_TX_ACTIVE 0x00000002
#define RFCORE_XREG_FSMSTAT1_LOCK_STATUS 0x00000004
#define RFCORE_XREG_FSMSTAT1_SAMPLED_CCA 0x00000008
#define RFCORE_XREG_FSMSTAT1_CCA 0x00000010 // Clear channel assessment
#define RFCORE_XREG_FSMSTAT1_SFD 0x00000020
#define RFCORE_XREG_FSMSTAT1_FIFOP 0x00000040
#define RFCORE_XREG_FSMSTAT1_FIFO 0x00000080
#define RFCORE_XREG_RSSISTAT_RSSI_VALID 0x00000001 // RSSI value is valid.
#define RFCORE_XREG_RFC_OBS_POL_INV 0x00000040 // Invert polarity of OBS signal
#define RFCORE_XREG_RFC_OBS_MUX_ZERO 0x00000000 // Observable = constant zero
#define RFCORE_XREG_RFC_OBS_MUX_ONE 0x00000001 // Observable = constant one
#define RFCORE_XREG_RFC_OBS_MUX_SNIFF_DATA 0x00000008 // RFC sniff data
#define RFCORE_XREG_RFC_OBS_MUX_SNIFF_CLK 0x00000009 // RFC sniff clock
#define RFCORE_XREG_RFC_OBS_MUX_RSSI_VALID 0x0000000c // RSSI valid
#define RFCORE_XREG_RFC_OBS_MUX_DEMOD_CCA 0x0000000d // Clear channel assessment
#define RFCORE_XREG_RFC_OBS_MUX_SAMPLED_CCA 0x0000000e // Sampled CCA signal
#define RFCORE_XREG_RFC_OBS_MUX_SFD_SYNC 0x0000000f // SFD received or transmitted
#define RFCORE_XREG_RFC_OBS_MUX_TX_ACTIVE 0x00000010 // Transmitter is active
#define RFCORE_XREG_RFC_OBS_MUX_RX_ACTIVE 0x00000011 // Receiver is active
#define RFCORE_XREG_RFC_OBS_MUX_FFCTRL_FIFO 0x00000012 // One or more bytes in FIFO
#define RFCORE_XREG_RFC_OBS_MUX_FFCTRL_FIFOP 0x00000013 // One or more frames in FIFO
#define RFCORE_XREG_RFC_OBS_MUX_PACKET_DONE 0x00000014 // Packet received
#define RFCORE_XREG_RFC_OBS_MUX_RFC_XOR_RAND_IQ 0x00000016 // RAND I ^ RAND Q
#define RFCORE_XREG_RFC_OBS_MUX_RFC_RAND_Q 0x00000017 // Random data from Q channel
#define RFCORE_XREG_RFC_OBS_MUX_RFC_RAND_I 0x00000018 // Random data from I channel
#define RFCORE_XREG_RFC_OBS_MUX_LOCK_STATUS 0x00000019 // PLL is in lock
#define RFCORE_XREG_RFC_OBS_MUX_PA_PD 0x00000028 // Power amp power down
#define RFCORE_XREG_RFC_OBS_MUX_LNA_PD 0x0000002a // LNA power down
#define RFCORE_SFR_RFERRF_NLOCK 0x00000001 // Failed to achieve PLL lock.
#define RFCORE_SFR_RFERRF_RXABO 0x00000002 // RX Aborted.
#define RFCORE_SFR_RFERRF_RXOVERF 0x00000004 // RX FIFO overflowed.
#define RFCORE_SFR_RFERRF_RXUNDERF 0x00000008 // RX FIFO underflowed.
#define RFCORE_SFR_RFERRF_TXOVERF 0x00000010 // TX FIFO overflowed.
#define RFCORE_SFR_RFERRF_TXUNDERF 0x00000020 // TX FIFO underflowed.
#define RFCORE_SFR_RFERRF_STROBEERR 0x00000040 // Command Strobe Error.
#define RFCORE_SFR_RFST_INSTR_RXON 0xE3 // Instruction set RX on
#define RFCORE_SFR_RFST_INSTR_TXON 0xE9 // Instruction set TX on
#define RFCORE_SFR_RFST_INSTR_RFOFF 0xEF // Instruction set RF off
#define RFCORE_SFR_RFST_INSTR_FLUSHRX 0xED // Instruction set flush rx buffer
#define RFCORE_SFR_RFST_INSTR_FLUSHTX 0xEE // Instruction set flush tx buffer
#define CCTEST_OBSSEL_EN 0x00000080 // Enable the OBS output on this pin
#define CCTEST_OBSSEL_SEL_OBS0 0x00000000 // Route OBS0 to pin
#define CCTEST_OBSSEL_SEL_OBS1 0x00000001 // Route OBS1 to pin
#define CCTEST_OBSSEL_SEL_OBS2 0x00000002 // Route OBS2 to pin
#define ANA_REGS_BASE 0x400D6000 // ANA_REGS
#define ANA_REGS_O_IVCTRL 0x00000004 // Analog control register
#define SYS_CTRL_CLOCK_CTRL 0x400D2000 // The clock control register
#define SYS_CTRL_SYSDIV_32MHZ 0x00000000 // Sys_div for sysclk 32MHz
#define SYS_CTRL_CLOCK_CTRL_AMP_DET 0x00200000
#define SYS_CTRL_PWRDBG 0x400D2074
#define SYS_CTRL_PWRDBG_FORCE_WARM_RESET 0x00000008
#define SYS_CTRL_RCGCUART 0x400D2028
#define SYS_CTRL_SCGCUART 0x400D202C
#define SYS_CTRL_DCGCUART 0x400D2030
#define SYS_CTRL_I_MAP 0x400D2098
#define SYS_CTRL_RCGCRFC 0x400D20A8
#define SYS_CTRL_SCGCRFC 0x400D20AC
#define SYS_CTRL_DCGCRFC 0x400D20B0
#define SYS_CTRL_EMUOVR 0x400D20B4
#define SYS_CTRL_RCGCRFC_RFC0 0x00000001
#define SYS_CTRL_SCGCRFC_RFC0 0x00000001
#define SYS_CTRL_DCGCRFC_RFC0 0x00000001
#define SYS_CTRL_I_MAP_ALTMAP 0x00000001
#define SYS_CTRL_RCGCUART_UART0 0x00000001
#define SYS_CTRL_SCGCUART_UART0 0x00000001
#define SYS_CTRL_DCGCUART_UART0 0x00000001
#define SYS_CTRL_RCGCUART_UART1 0x00000002
#define SYS_CTRL_SCGCUART_UART1 0x00000002
#define SYS_CTRL_DCGCUART_UART1 0x00000002
#define IOC_PA0_SEL 0x400D4000 // Peripheral select control
#define IOC_PA1_SEL 0x400D4004 // Peripheral select control
#define IOC_PA2_SEL 0x400D4008
#define IOC_PA3_SEL 0x400D400C
#define IOC_UARTRXD_UART0 0x400D4100
#define IOC_UARTRXD_UART1 0x400D4108
#define IOC_PA0_OVER 0x400D4080
#define IOC_PA1_OVER 0x400D4084
#define IOC_PA2_OVER 0x400D4088
#define IOC_PA3_OVER 0x400D408C
#define IOC_MUX_OUT_SEL_UART0_TXD 0x00000000
#define IOC_MUX_OUT_SEL_UART1_TXD 0x00000002
#define IOC_OVERRIDE_OE 0x00000008 // PAD Config Override Output Enable
#define IOC_OVERRIDE_DIS 0x00000000 // PAD Config Override Disabled
#define IOC_PAD_IN_SEL_PA0 0x00000000 // PA0
#define IOC_PAD_IN_SEL_PA1 0x00000001 // PA1
#define IOC_PAD_IN_SEL_PA2 0x00000002 // PA2
#define IOC_PAD_IN_SEL_PA3 0x00000003 // PA3
#define UART0_BASE 0x4000C000
#define UART1_BASE 0x4000D000
#define GPIO_A_BASE 0x400D9000 // GPIO A
#define GPIO_B_BASE 0x400DA000 // GPIO B
#define GPIO_C_BASE 0x400DB000 // GPIO C
#define GPIO_D_BASE 0x400DC000 // GPIO D
#define GPIO_O_DIR 0x00000400
#define GPIO_O_AFSEL 0x00000420
#define GPIO_PIN(x) (1UL << x) // Arbitrary GPIO pin
#define GPIO_PIN_0 0x00000001 // GPIO pin 0
#define GPIO_PIN_1 0x00000002 // GPIO pin 1
#define GPIO_PIN_2 0x00000004 // GPIO pin 2
#define GPIO_PIN_3 0x00000008 // GPIO pin 3
#define GPIO_PIN_4 0x00000010 // GPIO pin 4
#define GPIO_PIN_5 0x00000020 // GPIO pin 5
#define GPIO_PIN_6 0x00000040 // GPIO pin 6
#define GPIO_PIN_7 0x00000080 // GPIO pin 7
#define UART_O_DR 0x00000000 // UART data
#define UART_O_FR 0x00000018 // UART flag
#define UART_O_IBRD 0x00000024
#define UART_O_FBRD 0x00000028
#define UART_O_LCRH 0x0000002C
#define UART_O_CTL 0x00000030 // UART control
#define UART_O_IM 0x00000038 // UART interrupt mask
#define UART_O_MIS 0x00000040 // UART masked interrupt status
#define UART_O_ICR 0x00000044 // UART interrupt clear
#define UART_O_CC 0x00000FC8 // UART clock configuration
#define UART_FR_RXFE 0x00000010 // UART receive FIFO empty
#define UART_FR_TXFF 0x00000020 // UART transmit FIFO full
#define UART_FR_RXFF 0x00000040 // UART receive FIFO full
#define UART_CONFIG_WLEN_8 0x00000060 // 8 bit data
#define UART_CONFIG_STOP_ONE 0x00000000 // One stop bit
#define UART_CONFIG_PAR_NONE 0x00000000 // No parity
#define UART_CTL_UARTEN 0x00000001 // UART enable
#define UART_CTL_TXE 0x00000100 // UART transmit enable
#define UART_CTL_RXE 0x00000200 // UART receive enable
#define UART_IM_RXIM 0x00000010 // UART receive interrupt mask
#define UART_IM_RTIM 0x00000040 // UART receive time-out interrupt
#define SOC_ADC_ADCCON1 0x400D7000 // ADC Control
#define SOC_ADC_RNDL 0x400D7014 // RNG low data
#define SOC_ADC_RNDH 0x400D7018 // RNG high data
#define SOC_ADC_ADCCON1_RCTRL0 0x00000004 // ADCCON1 RCTRL bit 0
#define SOC_ADC_ADCCON1_RCTRL1 0x00000008 // ADCCON1 RCTRL bit 1
#define FLASH_CTRL_FCTL 0x400D3008 // Flash control
#define FLASH_CTRL_DIECFG0 0x400D3014 // Flash information
// clang-format on
#endif
-138
View File
@@ -1,138 +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.
*/
/**
* @file
* GCC linker script for CC2538.
*/
_512k_bytes = (512*1024);
_256k_bytes = (256*1024);
_128k_bytes = (128*1024);
_FLASH_page_size = 2048;
/*
* Change for your chip, default is 512k chips
*/
_FLASH_size_bytes = _512k_bytes;
_FLASH_n_pages = (_FLASH_size_bytes / _FLASH_page_size);
/* reduce the usable size by: the CCA + settings Page A & B, total 3 pages */
_FLASH_usable_size = (_FLASH_size_bytes - (3 * _FLASH_page_size));
_FLASH_start = 0x00200000;
_FLASH_end = (_FLASH_start + _FLASH_size_bytes);
/*
* The CCA (Customer Configuration Area) is always the last page.
* See: http://www.ti.com/lit/ug/swru319c/swru319c.pdf
* table 8-2 for more details.
*/
_FLASH_cca_page = (_FLASH_end - (1 * _FLASH_page_size));
/*
* OpenThread NV storage goes in the settings page.
* OpenThread requires at least 2 adjacent pages, call them A and B.
*/
_FLASH_settings_pageB = (_FLASH_end - (2 * _FLASH_page_size));
_FLASH_settings_pageA = (_FLASH_end - (3 * _FLASH_page_size));
MEMORY
{
/* would like to use SYMBOLS (from above)here but we cannot
* GCC version 4.9 does not support symbolic expressions here.
* But later versions do support the feature.
*/
FLASH (rx) : ORIGIN = 0x00200000, LENGTH = 0x0007c000
FLASH_CCA (rx) : ORIGIN = 0x0027FFD4, LENGTH = 0x2c
SRAM (rwx) : ORIGIN = 0x20000000, LENGTH = 32K
}
/*
* To safty check what would have been the SYMBOL values
* we use these ASSERTS to verify things are still good.
*/
ASSERT( _FLASH_start == 0x00200000, "invalid flash start address for cc2538")
ASSERT( _FLASH_cca_page == 0x0027f800, "invalid cca start address for cc2538")
ASSERT( _FLASH_usable_size == 0x0007e800, "Invalid usable size for this config")
ENTRY(flash_cca_lock_page)
SECTIONS
{
.text : ALIGN(4)
{
_text = .;
*(.vectors)
*(.text*)
*(.rodata*)
KEEP(*(.init))
KEEP(*(.fini))
_etext = .;
} > FLASH= 0
.init_array :
{
_init_array = .;
KEEP(*(SORT(.init_array.*)))
KEEP(*(.init_array*))
_einit_array = .;
} > FLASH
.ARM.exidx : ALIGN(4)
{
*(.ARM.exidx*)
} > FLASH
.data : ALIGN(4)
{
_data = .;
*(.data*)
_edata = .;
} > SRAM AT > FLASH
_ldata = LOADADDR(.data);
.bss : ALIGN(4)
{
_bss = .;
*(.bss*)
*(COMMON)
_ebss = .;
} > SRAM
_heap = .;
end = .;
.stack : ALIGN(4)
{
*(.stack)
} > SRAM
.flashcca :
{
KEEP(*(.flash_cca))
} > FLASH_CCA
}
-112
View File
@@ -1,112 +0,0 @@
/*
* Copyright (c) 2019, 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.
*/
/**
* @file
* This file implements an entropy source based on ADC.
*
*/
#include <openthread/platform/entropy.h>
#include <openthread/platform/radio.h>
#include "platform-cc2538.h"
#include "utils/code_utils.h"
static void generateRandom(uint8_t *aOutput, uint16_t aOutputLength)
{
uint32_t frmctrl0;
HWREG(SOC_ADC_ADCCON1) &= ~(SOC_ADC_ADCCON1_RCTRL1 | SOC_ADC_ADCCON1_RCTRL0);
HWREG(SYS_CTRL_RCGCRFC) = SYS_CTRL_RCGCRFC_RFC0;
while (HWREG(SYS_CTRL_RCGCRFC) != SYS_CTRL_RCGCRFC_RFC0)
;
frmctrl0 = HWREG(RFCORE_XREG_FRMCTRL0);
HWREG(RFCORE_XREG_FRMCTRL0) = RFCORE_XREG_FRMCTRL0_INFINITY_RX;
HWREG(RFCORE_SFR_RFST) = RFCORE_SFR_RFST_INSTR_RXON;
while (!HWREG(RFCORE_XREG_RSSISTAT) & RFCORE_XREG_RSSISTAT_RSSI_VALID)
;
for (uint16_t index = 0; index < aOutputLength; index++)
{
aOutput[index] = 0;
for (uint8_t offset = 0; offset < 8 * sizeof(uint8_t); offset++)
{
aOutput[index] <<= 1;
aOutput[index] |= (HWREG(RFCORE_XREG_RFRND) & RFCORE_XREG_RFRND_IRND);
}
}
HWREG(RFCORE_SFR_RFST) = RFCORE_SFR_RFST_INSTR_RFOFF;
HWREG(RFCORE_XREG_FRMCTRL0) = frmctrl0;
}
void cc2538RandomInit(void)
{
uint16_t seed = 0;
while (seed == 0x0000 || seed == 0x8003)
{
generateRandom((uint8_t *)&seed, sizeof(seed));
}
HWREG(SOC_ADC_RNDL) = (seed >> 8) & 0xff;
HWREG(SOC_ADC_RNDL) = seed & 0xff;
}
otError otPlatEntropyGet(uint8_t *aOutput, uint16_t aOutputLength)
{
otError error = OT_ERROR_NONE;
uint8_t channel = 0;
otEXPECT_ACTION(aOutput, error = OT_ERROR_INVALID_ARGS);
if (sInstance && otPlatRadioIsEnabled(sInstance))
{
channel = 11 + (HWREG(RFCORE_XREG_FREQCTRL) - 11) / 5;
otPlatRadioSleep(sInstance);
otPlatRadioDisable(sInstance);
}
generateRandom(aOutput, aOutputLength);
if (channel)
{
cc2538RadioInit();
otPlatRadioEnable(sInstance);
otPlatRadioReceive(sInstance, channel);
}
exit:
return error;
}
-101
View File
@@ -1,101 +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 <assert.h>
#include <stdint.h>
#include <string.h>
#include "platform-cc2538.h"
#include "rom-utility.h"
#define FLASH_CTRL_FCTL_BUSY 0x00000080
#define FLASH_PAGE_SIZE 2048
#define FLASH_PAGE_NUM 2
#define FLASH_SWAP_SIZE (FLASH_PAGE_SIZE * (FLASH_PAGE_NUM / 2))
/* The linker script creates this external symbol */
extern uint8_t _FLASH_settings_pageA[];
/* Convert a settings offset to the physical address within the flash settings pages */
static uint32_t flashPhysAddr(uint8_t aSwapIndex, uint32_t aOffset)
{
uint32_t address = (uint32_t)(&_FLASH_settings_pageA[0]) + aOffset;
if (aSwapIndex)
{
address += FLASH_SWAP_SIZE;
}
return address;
}
void otPlatFlashInit(otInstance *aInstance)
{
OT_UNUSED_VARIABLE(aInstance);
}
uint32_t otPlatFlashGetSwapSize(otInstance *aInstance)
{
OT_UNUSED_VARIABLE(aInstance);
return FLASH_SWAP_SIZE;
}
void otPlatFlashErase(otInstance *aInstance, uint8_t aSwapIndex)
{
OT_UNUSED_VARIABLE(aInstance);
ROM_PageErase(flashPhysAddr(aSwapIndex, 0), FLASH_PAGE_SIZE);
while (HWREG(FLASH_CTRL_FCTL) & FLASH_CTRL_FCTL_BUSY)
{
}
}
void otPlatFlashWrite(otInstance *aInstance, uint8_t aSwapIndex, uint32_t aOffset, const void *aData, uint32_t aSize)
{
OT_UNUSED_VARIABLE(aInstance);
uint32_t *data = (uint32_t *)(aData);
for (uint32_t size = 0; size < aSize; size += sizeof(uint32_t), aOffset += sizeof(uint32_t), data++)
{
ROM_ProgramFlash(data, flashPhysAddr(aSwapIndex, aOffset), sizeof(uint32_t));
while (HWREG(FLASH_CTRL_FCTL) & FLASH_CTRL_FCTL_BUSY)
{
}
}
}
void otPlatFlashRead(otInstance *aInstance, uint8_t aSwapIndex, uint32_t aOffset, uint8_t *aData, uint32_t aSize)
{
OT_UNUSED_VARIABLE(aInstance);
memcpy(aData, (void *)flashPhysAddr(aSwapIndex, aOffset), aSize);
}
@@ -1,255 +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.
*/
/**
* @file
* This file includes cc2538 compile-time configuration constants for OpenThread.
*/
#ifndef OPENTHREAD_CORE_CC2538_CONFIG_H_
#define OPENTHREAD_CORE_CC2538_CONFIG_H_
/**
* @def OPENTHREAD_CONFIG_PLATFORM_INFO
*
* The platform-specific string to insert into the OpenThread version string.
*
*/
#define OPENTHREAD_CONFIG_PLATFORM_INFO "CC2538"
/**
* @def OPENTHREAD_CONFIG_MAC_SOFTWARE_ACK_TIMEOUT_ENABLE
*
* Define to 1 if you want to enable software ACK timeout logic.
*
*/
#define OPENTHREAD_CONFIG_MAC_SOFTWARE_ACK_TIMEOUT_ENABLE 1
/**
* @def OPENTHREAD_CONFIG_MAC_SOFTWARE_RETRANSMIT_ENABLE
*
* Define to 1 if you want to enable software retransmission logic.
*
*/
#define OPENTHREAD_CONFIG_MAC_SOFTWARE_RETRANSMIT_ENABLE 1
/**
* @def OPENTHREAD_CONFIG_MAC_SOFTWARE_CSMA_BACKOFF_ENABLE
*
* Define to 1 if you want to enable software CSMA-CA backoff logic.
*
*/
#define OPENTHREAD_CONFIG_MAC_SOFTWARE_CSMA_BACKOFF_ENABLE 1
/**
* @def OPENTHREAD_CONFIG_MAC_SOFTWARE_TX_SECURITY_ENABLE
*
* Define to 1 if you want to enable software transmission security logic.
*
*/
#define OPENTHREAD_CONFIG_MAC_SOFTWARE_TX_SECURITY_ENABLE 0
/**
* @def OPENTHREAD_CONFIG_MAC_SOFTWARE_ENERGY_SCAN_ENABLE
*
* Define to 1 if you want to enable software energy scanning logic.
*
*/
#define OPENTHREAD_CONFIG_MAC_SOFTWARE_ENERGY_SCAN_ENABLE 1
/**
* @def OPENTHREAD_CONFIG_NCP_HDLC_ENABLE
*
* Define to 1 to enable NCP HDLC support.
*
*/
#define OPENTHREAD_CONFIG_NCP_HDLC_ENABLE 1
/**
* @def OPENTHREAD_CONFIG_CC2538_USE_RADIO_RX_INTERRUPT
*
* Enable support for using interrupt-driven radio reception. This allows
* for a single frame to be received whilst the CPU is busy processing some
* other code.
*
* To disable interrupts and just rely on polling, set this to 0.
*
*/
#ifndef OPENTHREAD_CONFIG_CC2538_USE_RADIO_RX_INTERRUPT
#define OPENTHREAD_CONFIG_CC2538_USE_RADIO_RX_INTERRUPT 1
#endif
/**
* @def OPENTHREAD_CONFIG_CC2538_WITH_CC2592
*
* Enable support for the CC2592 range-extender front-end.
*
* This is a feature of the CC2538-CC2592 EM and other peripherals which
* extends the range of the bare CC2538 to over a kilometre line-of-sight.
* The CC2592 needs to be wired up to the RF port on the CC2538 in accordance
* with application note 130 ("Using CC2592 Front End With CC2538", TI doc
* SWRA447).
*
* If you have such a board, change this to 1.
*
*/
#ifndef OPENTHREAD_CONFIG_CC2538_WITH_CC2592
#define OPENTHREAD_CONFIG_CC2538_WITH_CC2592 0
#endif
/**
* @def OPENTHREAD_CONFIG_CC2592_PA_EN_PIN
*
* Define the pin (on port C) that connects to the CC2592 PA_EN pin.
*
* One of the 3 observable channels on the CC2538 radio module will be
* configured to take the "PA power down" signal from the radio module itself,
* invert it, and emit it on this GPIO pin. Due to hardware constraints, it
* may only be connected to a pin on GPIO port C.
*
* The default (PC3) is as per TI recommendations in AN130.
*
*/
#ifndef OPENTHREAD_CONFIG_CC2592_PA_EN_PIN
#define OPENTHREAD_CONFIG_CC2592_PA_EN_PIN 3
#endif
/**
* @def OPENTHREAD_CONFIG_CC2592_LNA_EN_PIN
*
* Define the pin (on port C) that connects to the CC2592 LNA_EN pin.
*
* One of the 3 observable channels on the CC2538 radio module will be
* configured to take the "LNA power down" signal from the radio module itself,
* invert it, and emit it on this GPIO pin. Due to hardware constraints, it
* may only be connected to a pin on GPIO port C.
*
* The default (PC2) is as per TI recommendations in AN130.
*
*/
#ifndef OPENTHREAD_CONFIG_CC2592_LNA_EN_PIN
#define OPENTHREAD_CONFIG_CC2592_LNA_EN_PIN 2
#endif
/**
* @def OPENTHREAD_CONFIG_CC2592_USE_HGM
*
* Enable control of the high-gain mode signal.
*
* High-gain mode is enabled through the `HGM` pin on the CC2592, which may be
* connected to any free GPIO pin for software control, or may be linked to
* VDD or 0V to hard-wire it to a given state.
*
* Set this to 0 if you have wired this pin to a power rail, or have a
* non-standard way of controlling it.
*
*/
#ifndef OPENTHREAD_CONFIG_CC2592_USE_HGM
#define OPENTHREAD_CONFIG_CC2592_USE_HGM 1
#endif
/**
* @def OPENTHREAD_CONFIG_CC2538_RECEIVE_SENSITIVITY
*
* Set the CC2538 receive sensitivity.
*
* A bare CC2538 has a receive sensitivity of -88dBm. The CC2592 changes this
* to -85 or -81 depending on whether the HGM pin is high or low. If
* `OPENTHREAD_CONFIG_CC2592_USE_HGM` is 0, then this sets the receive
* sensitivity.
*
*/
#ifndef OPENTHREAD_CONFIG_CC2538_RECEIVE_SENSITIVITY
#define OPENTHREAD_CONFIG_CC2538_RECEIVE_SENSITIVITY -88
#endif
/**
* @def OPENTHREAD_CONFIG_CC2538_RSSI_OFFSET
*
* Set the CC2538 RSSI offset. This calibrates the RSSI readings received from
* the CC2538 radio module to give a reading in dBm.
*
* For a standard CC2538 (no front-end), the RSSI offset is 73.
*
* For a CC2592 hard-wired in high-gain mode, an offset of 85 should be used;
* or for low-gain mode, 81. If `OPENTHREAD_CONFIG_CC2592_USE_HGM` is 0, then
* this calibrates the RSSI value accordingly.
*/
#ifndef OPENTHREAD_CONFIG_CC2538_RSSI_OFFSET
#define OPENTHREAD_CONFIG_CC2538_RSSI_OFFSET 73
#endif
/**
* @def OPENTHREAD_CONFIG_CC2592_HGM_PORT
*
* Define the GPIO port that the HGM pin is connected to. It may be
* connected to any available GPIO pin.
*
* The default (GPIO port D) is as per TI recommendations.
*
*/
#ifndef OPENTHREAD_CONFIG_CC2592_HGM_PORT
#define OPENTHREAD_CONFIG_CC2592_HGM_PORT GPIO_D_BASE
#endif
/**
* @def OPENTHREAD_CONFIG_CC2592_HGM_PIN
*
* Define the pin on the GPIO port that the HGM pin is connected to. It
* may be connected to any available GPIO pin.
*
* The default (PD2) is as per TI recommendations.
*
*/
#ifndef OPENTHREAD_CONFIG_CC2592_HGM_PIN
#define OPENTHREAD_CONFIG_CC2592_HGM_PIN 2
#endif
/**
* @def OPENTHREAD_CONFIG_CC2592_HGM_DEFAULT_STATE
*
* Define the default state of the CC2592's HGM pin.
*
* The default is to turn high-gain mode on.
*
*/
#ifndef OPENTHREAD_CONFIG_CC2592_HGM_DEFAULT_STATE
#define OPENTHREAD_CONFIG_CC2592_HGM_DEFAULT_STATE true
#endif
/**
* @def OPENTHREAD_CONFIG_PLATFORM_FLASH_API_ENABLE
*
* Define to 1 to enable otPlatFlash* APIs to support non-volatile storage.
*
* When defined to 1, the platform MUST implement the otPlatFlash* APIs instead of the otPlatSettings* APIs.
*
*/
#define OPENTHREAD_CONFIG_PLATFORM_FLASH_API_ENABLE 1
#endif // OPENTHREAD_CORE_CC2538_CONFIG_H_
-122
View File
@@ -1,122 +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.
*/
/**
* @file
* This file includes the platform-specific initializers.
*
*/
#ifndef PLATFORM_CC2538_H_
#define PLATFORM_CC2538_H_
#include <openthread-core-config.h>
#include <stdint.h>
#include <openthread/config.h>
#include <openthread/instance.h>
#include "cc2538-reg.h"
// Global OpenThread instance structure
extern otInstance *sInstance;
/**
* Initialize the debug uart
*/
void cc2538DebugUartInit(void);
/**
* This function initializes the alarm service used by OpenThread.
*
*/
void cc2538AlarmInit(void);
/**
* This function performs alarm driver processing.
*
* @param[in] aInstance The OpenThread instance structure.
*
*/
void cc2538AlarmProcess(otInstance *aInstance);
/**
* This function initializes the radio service used by OpenThread.
*
*/
void cc2538RadioInit(void);
/**
* This function performs radio driver processing.
*
* @param[in] aInstance The OpenThread instance structure.
*
*/
void cc2538RadioProcess(otInstance *aInstance);
/**
* This function initializes the random number service used by OpenThread.
*
*/
void cc2538RandomInit(void);
/**
* This function performs UART driver processing.
*
*/
void cc2538UartProcess(void);
#if OPENTHREAD_CONFIG_CC2538_WITH_CC2592 && OPENTHREAD_CONFIG_CC2592_USE_HGM
/**
* Change the state of the CC2592 HGM pin.
*
* @param aState Whether or not to enable HGM
*/
void cc2538RadioSetHgm(bool aState);
/**
* Retrieve the state of the CC2592 HGM pin.
*/
bool cc2538RadioGetHgm(void);
#endif // OPENTHREAD_CONFIG_CC2538_WITH_CC2592 && OPENTHREAD_CONFIG_CC2592_USE_HGM
typedef enum
{
OT_CC2538_TIMER_ENERGY_SCAN, ///< Internal timer for energy scan
OT_CC2538_TIMERS_COUNT, ///< Number of internal timers
} otCC2538Timer;
/**
* This function sets the internal timer.
*
* @param[in] aTimer The timer identifier.
* @param[in] aDelay The delay to trigger the timer, and must be no more than `INT32_MAX`.
*
*/
void cc2538SetTimer(otCC2538Timer aTimer, uint32_t aDelay);
#endif // PLATFORM_CC2538_H_
File diff suppressed because it is too large Load Diff
-76
View File
@@ -1,76 +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.
*/
#ifndef ROM_UTILITY_H_
#define ROM_UTILITY_H_
#define ROM_API_TABLE_ADDR 0x00000048
typedef uint32_t (*volatile FPTR_CRC32_T)(uint8_t * /*pData*/, uint32_t /*byteCount*/);
typedef uint32_t (*volatile FPTR_GETFLSIZE_T)(void);
typedef uint32_t (*volatile FPTR_GETCHIPID_T)(void);
typedef int32_t (*volatile FPTR_PAGEERASE_T)(uint32_t /*FlashAddr*/, uint32_t /*Size*/);
typedef int32_t (*volatile FPTR_PROGFLASH_T)(uint32_t * /*pRamData*/, uint32_t /*FlashAdr*/, uint32_t /*ByteCount*/);
typedef void (*volatile FPTR_RESETDEV_T)(void);
typedef void *(*volatile FPTR_MEMSET_T)(void * /*s*/, int32_t /*c*/, uint32_t /*n*/);
typedef void *(*volatile FPTR_MEMCPY_T)(void * /*s1*/, const void * /*s2*/, uint32_t /*n*/);
typedef int32_t (*volatile FPTR_MEMCMP_T)(const void * /*s1*/, const void * /*s2*/, uint32_t /*n*/);
typedef void *(*volatile FPTR_MEMMOVE_T)(void * /*s1*/, const void * /*s2*/, uint32_t /*n*/);
typedef struct
{
FPTR_CRC32_T Crc32;
FPTR_GETFLSIZE_T GetFlashSize;
FPTR_GETCHIPID_T GetChipId;
FPTR_PAGEERASE_T PageErase;
FPTR_PROGFLASH_T ProgramFlash;
FPTR_RESETDEV_T ResetDevice;
FPTR_MEMSET_T memset;
FPTR_MEMCPY_T memcpy;
FPTR_MEMCMP_T memcmp;
FPTR_MEMMOVE_T memmove;
} ROM_API_T;
// clang-format off
#define P_ROM_API ((ROM_API_T*)ROM_API_TABLE_ADDR)
#define ROM_Crc32(a,b) P_ROM_API->Crc32(a,b)
#define ROM_GetFlashSize() P_ROM_API->GetFlashSize()
#define ROM_GetChipId() P_ROM_API->GetChipId()
#define ROM_PageErase(a,b) P_ROM_API->PageErase(a,b)
#define ROM_ProgramFlash(a,b,c) P_ROM_API->ProgramFlash(a,b,c)
#define ROM_ResetDevice() P_ROM_API->ResetDevice()
#define ROM_Memset(a,b,c) P_ROM_API->memset(a,b,c)
#define ROM_Memcpy(a,b,c) P_ROM_API->memcpy(a,b,c)
#define ROM_Memcmp(a,b,c) P_ROM_API->memcmp(a,b,c)
#define ROM_Memmove(a,b,c) P_ROM_API->memmove(a,b,c)
// clang-format on
#endif // ROM_UTILITY_H_
-215
View File
@@ -1,215 +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.
*/
/**
* @file
* This file implements gcc-specific startup code for the cc2538.
*/
#include <stdint.h>
#include <string.h>
#include "cc2538-reg.h"
extern uint8_t _ldata;
extern uint8_t _data;
extern uint8_t _edata;
extern uint8_t _bss;
extern uint8_t _ebss;
extern uint8_t _init_array;
extern uint8_t _einit_array;
__extension__ typedef int __guard __attribute__((mode(__DI__)));
int __cxa_guard_acquire(__guard *g)
{
return !*(char *)(g);
}
void __cxa_guard_release(__guard *g)
{
*(char *)g = 1;
}
void __cxa_guard_abort(__guard *g)
{
(void)g;
}
void __cxa_pure_virtual(void)
{
while (1)
;
}
void IntDefaultHandler(void);
void ResetHandler(void);
extern void SysTick_Handler(void);
extern void UART0IntHandler(void);
extern void RFCoreRxTxIntHandler(void);
extern void RFCoreErrIntHandler(void);
extern void main(void);
static uint64_t stack[640] __attribute__((section(".stack")));
__attribute__((section(".vectors"), used)) void (*const vectors[])(void) = {
(void (*)(void))((unsigned long)stack + sizeof(stack)), // Initial Stack Pointer
ResetHandler, // 1 The reset handler
ResetHandler, // 2 The NMI handler
IntDefaultHandler, // 3 The hard fault handler
IntDefaultHandler, // 4 The MPU fault handler
IntDefaultHandler, // 5 The bus fault handler
IntDefaultHandler, // 6 The usage fault handler
0, // 7 Reserved
0, // 8 Reserved
0, // 9 Reserved
0, // 10 Reserved
IntDefaultHandler, // 11 SVCall handler
IntDefaultHandler, // 12 Debug monitor handler
0, // 13 Reserved
IntDefaultHandler, // 14 The PendSV handler
SysTick_Handler, // 15 The SysTick handler
IntDefaultHandler, // 16 GPIO Port A
IntDefaultHandler, // 17 GPIO Port B
IntDefaultHandler, // 18 GPIO Port C
IntDefaultHandler, // 19 GPIO Port D
0, // 20 none
UART0IntHandler, // 21 UART0 Rx and Tx
IntDefaultHandler, // 22 UART1 Rx and Tx
IntDefaultHandler, // 23 SSI0 Rx and Tx
IntDefaultHandler, // 24 I2C Master and Slave
0, // 25 Reserved
0, // 26 Reserved
0, // 27 Reserved
0, // 28 Reserved
0, // 29 Reserved
IntDefaultHandler, // 30 ADC Sequence 0
0, // 31 Reserved
0, // 32 Reserved
0, // 33 Reserved
IntDefaultHandler, // 34 Watchdog timer, timer 0
IntDefaultHandler, // 35 Timer 0 subtimer A
IntDefaultHandler, // 36 Timer 0 subtimer B
IntDefaultHandler, // 37 Timer 1 subtimer A
IntDefaultHandler, // 38 Timer 1 subtimer B
IntDefaultHandler, // 39 Timer 2 subtimer A
IntDefaultHandler, // 40 Timer 2 subtimer B
IntDefaultHandler, // 41 Analog Comparator 0
RFCoreRxTxIntHandler, // 42 RFCore Rx/Tx
RFCoreErrIntHandler, // 43 RFCore Error
IntDefaultHandler, // 44 IcePick
IntDefaultHandler, // 45 FLASH Control
IntDefaultHandler, // 46 AES
IntDefaultHandler, // 47 PKA
IntDefaultHandler, // 48 Sleep Timer
IntDefaultHandler, // 49 MacTimer
IntDefaultHandler, // 50 SSI1 Rx and Tx
IntDefaultHandler, // 51 Timer 3 subtimer A
IntDefaultHandler, // 52 Timer 3 subtimer B
0, // 53 Reserved
0, // 54 Reserved
0, // 55 Reserved
0, // 56 Reserved
0, // 57 Reserved
0, // 58 Reserved
0, // 59 Reserved
IntDefaultHandler, // 60 USB 2538
0, // 61 Reserved
IntDefaultHandler, // 62 uDMA
IntDefaultHandler, // 63 uDMA Error
};
void IntDefaultHandler(void)
{
while (1)
;
}
// clang-format off
#define FLASH_CCA_BOOTLDR_CFG_DISABLE 0xEFFFFFFF ///< Disable backdoor function
#define FLASH_CCA_BOOTLDR_CFG_ENABLE 0xF0FFFFFF ///< Enable backdoor function
#define FLASH_CCA_BOOTLDR_CFG_ACTIVE_HIGH 0x08000000 ///< Selected pin on pad A active high
#define FLASH_CCA_BOOTLDR_CFG_PORT_A_PIN_M 0x07000000 ///< Selected pin on pad A mask
#define FLASH_CCA_BOOTLDR_CFG_PORT_A_PIN_S 24 ///< Selected pin on pad A shift
#define FLASH_CCA_IMAGE_VALID 0x00000000 ///< Indicates valid image in flash
#define FLASH_CCA_CONF_BOOTLDR_BACKDOOR_PORT_A_PIN 3 ///< Select Button on SmartRF06 Eval Board
// clang-format on
typedef struct
{
uint32_t ui32BootldrCfg;
uint32_t ui32ImageValid;
uint32_t ui32ImageVectorAddr;
uint8_t ui8lock[32];
} flash_cca_lock_page_t;
__attribute__((__section__(".flashcca"), used)) const flash_cca_lock_page_t flash_cca_lock_page = {
FLASH_CCA_BOOTLDR_CFG_ENABLE | (FLASH_CCA_CONF_BOOTLDR_BACKDOOR_PORT_A_PIN << FLASH_CCA_BOOTLDR_CFG_PORT_A_PIN_S),
FLASH_CCA_IMAGE_VALID,
(uint32_t)&vectors,
{0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}};
typedef void (*init_fn_t)(void);
void ResetHandler(void)
{
HWREG(SYS_CTRL_EMUOVR) = 0xFF;
// configure clocks
HWREG(SYS_CTRL_CLOCK_CTRL) |= SYS_CTRL_CLOCK_CTRL_AMP_DET;
HWREG(SYS_CTRL_CLOCK_CTRL) = SYS_CTRL_SYSDIV_32MHZ;
// alternate map
HWREG(SYS_CTRL_I_MAP) |= SYS_CTRL_I_MAP_ALTMAP;
// copy the data segment initializers from flash to SRAM
memcpy(&_data, &_ldata, &_edata - &_data);
// zero-fill the bss segment
memset(&_bss, 0, &_ebss - &_bss);
// C++ runtime initialization (BSS, Data, relocation, etc.)
init_fn_t *fp;
for (fp = (init_fn_t *)&_init_array; fp < (init_fn_t *)&_einit_array; fp++)
{
(*fp)();
}
// call the application's entry point
main();
// end here if main() returns
while (1)
;
}
-318
View File
@@ -1,318 +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.
*/
/**
* @file
* This file implements the OpenThread platform abstraction for UART communication.
*
*/
#include <openthread-core-config.h>
#include <openthread/config.h>
#include <stdarg.h>
#include <stddef.h>
#include <stdio.h>
#include <openthread/platform/debug_uart.h>
#include <openthread/platform/logging.h>
#include "platform-cc2538.h"
#include "utils/code_utils.h"
#include "utils/uart.h"
enum
{
kPlatformClock = 32000000,
kBaudRate = 115200,
kReceiveBufferSize = 128,
};
extern void UART0IntHandler(void);
static void processReceive(void);
static void processTransmit(void);
static const uint8_t *sTransmitBuffer = NULL;
static uint16_t sTransmitLength = 0;
typedef struct RecvBuffer
{
// The data buffer
uint8_t mBuffer[kReceiveBufferSize];
// The offset of the first item written to the list.
uint16_t mHead;
// The offset of the next item to be written to the list.
uint16_t mTail;
} RecvBuffer;
static RecvBuffer sReceive;
static void enable_uart_clocks(void)
{
static int uart_clocks_done = 0;
if (uart_clocks_done)
{
return;
}
uart_clocks_done = 1;
#if OPENTHREAD_CONFIG_ENABLE_DEBUG_UART
HWREG(SYS_CTRL_RCGCUART) = (SYS_CTRL_RCGCUART_UART0 | SYS_CTRL_RCGCUART_UART1);
HWREG(SYS_CTRL_SCGCUART) = (SYS_CTRL_SCGCUART_UART0 | SYS_CTRL_SCGCUART_UART1);
HWREG(SYS_CTRL_DCGCUART) = (SYS_CTRL_DCGCUART_UART0 | SYS_CTRL_DCGCUART_UART1);
#else
HWREG(SYS_CTRL_RCGCUART) = SYS_CTRL_RCGCUART_UART0;
HWREG(SYS_CTRL_SCGCUART) = SYS_CTRL_SCGCUART_UART0;
HWREG(SYS_CTRL_DCGCUART) = SYS_CTRL_DCGCUART_UART0;
#endif
}
otError otPlatUartEnable(void)
{
uint32_t div;
sReceive.mHead = 0;
sReceive.mTail = 0;
// clock
enable_uart_clocks();
HWREG(UART0_BASE + UART_O_CC) = 0;
// tx pin
HWREG(IOC_PA1_SEL) = IOC_MUX_OUT_SEL_UART0_TXD;
HWREG(IOC_PA1_OVER) = IOC_OVERRIDE_OE;
HWREG(GPIO_A_BASE + GPIO_O_AFSEL) |= GPIO_PIN_1;
// rx pin
HWREG(IOC_UARTRXD_UART0) = IOC_PAD_IN_SEL_PA0;
HWREG(IOC_PA0_OVER) = IOC_OVERRIDE_DIS;
HWREG(GPIO_A_BASE + GPIO_O_AFSEL) |= GPIO_PIN_0;
HWREG(UART0_BASE + UART_O_CTL) = 0;
// baud rate
div = (((kPlatformClock * 8) / kBaudRate) + 1) / 2;
HWREG(UART0_BASE + UART_O_IBRD) = div / 64;
HWREG(UART0_BASE + UART_O_FBRD) = div % 64;
HWREG(UART0_BASE + UART_O_LCRH) = UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE | UART_CONFIG_PAR_NONE;
// configure interrupts
HWREG(UART0_BASE + UART_O_IM) |= UART_IM_RXIM | UART_IM_RTIM;
// enable
HWREG(UART0_BASE + UART_O_CTL) = UART_CTL_UARTEN | UART_CTL_TXE | UART_CTL_RXE;
// enable interrupts
HWREG(NVIC_EN0) = 1 << ((INT_UART0 - 16) & 31);
return OT_ERROR_NONE;
}
otError otPlatUartDisable(void)
{
return OT_ERROR_NONE;
}
otError otPlatUartSend(const uint8_t *aBuf, uint16_t aBufLength)
{
otError error = OT_ERROR_NONE;
otEXPECT_ACTION(sTransmitBuffer == NULL, error = OT_ERROR_BUSY);
sTransmitBuffer = aBuf;
sTransmitLength = aBufLength;
exit:
return error;
}
void processReceive(void)
{
// Copy tail to prevent multiple reads
uint16_t tail = sReceive.mTail;
// If the data wraps around, process the first part
if (sReceive.mHead > tail)
{
otPlatUartReceived(sReceive.mBuffer + sReceive.mHead, kReceiveBufferSize - sReceive.mHead);
// Reset the buffer mHead back to zero.
sReceive.mHead = 0;
}
// For any data remaining, process it
if (sReceive.mHead != tail)
{
otPlatUartReceived(sReceive.mBuffer + sReceive.mHead, tail - sReceive.mHead);
// Set mHead to the local tail we have cached
sReceive.mHead = tail;
}
}
otError otPlatUartFlush(void)
{
otEXPECT(sTransmitBuffer != NULL);
for (; sTransmitLength > 0; sTransmitLength--)
{
while (HWREG(UART0_BASE + UART_O_FR) & UART_FR_TXFF)
;
HWREG(UART0_BASE + UART_O_DR) = *sTransmitBuffer++;
}
sTransmitBuffer = NULL;
return OT_ERROR_NONE;
exit:
return OT_ERROR_INVALID_STATE;
}
void processTransmit(void)
{
otPlatUartFlush();
otPlatUartSendDone();
}
void cc2538UartProcess(void)
{
processReceive();
processTransmit();
}
void UART0IntHandler(void)
{
uint32_t mis;
uint8_t byte;
mis = HWREG(UART0_BASE + UART_O_MIS);
HWREG(UART0_BASE + UART_O_ICR) = mis;
if (mis & (UART_IM_RXIM | UART_IM_RTIM))
{
while (!(HWREG(UART0_BASE + UART_O_FR) & UART_FR_RXFE))
{
byte = HWREG(UART0_BASE + UART_O_DR);
// We can only write if incrementing mTail doesn't equal mHead
if (sReceive.mHead != (sReceive.mTail + 1) % kReceiveBufferSize)
{
sReceive.mBuffer[sReceive.mTail] = byte;
sReceive.mTail = (sReceive.mTail + 1) % kReceiveBufferSize;
}
}
}
}
#if OPENTHREAD_CONFIG_ENABLE_DEBUG_UART
int otPlatDebugUart_kbhit(void)
{
uint32_t v;
/* get flags */
v = HWREG(UART1_BASE + UART_O_FR);
/* if FIFO empty we have no data */
return !(v & UART_FR_RXFE);
}
int otPlatDebugUart_getc(void)
{
int v = 1;
/* if nothing in fifo */
if (!otPlatDebugUart_kbhit())
{
return -1;
}
/* fetch */
v = (int)HWREG(UART0_BASE + UART_O_DR);
v = (v & 0x0ff);
return v;
}
void otPlatDebugUart_putchar_raw(int b)
{
/* wait till not busy */
while (HWREG(UART1_BASE + UART_O_FR) & UART_FR_TXFF)
;
/* write byte */
HWREG(UART1_BASE + UART_O_DR) = ((uint32_t)(b & 0x0ff));
}
void cc2538DebugUartInit(void)
{
int32_t a, b;
// clocks
enable_uart_clocks();
HWREG(UART1_BASE + UART_O_CC) = 0;
// UART1 - tx pin
// Using an RF06 Evaluation board
// http://www.ti.com/tool/cc2538dk
// PA3 => is jumper position RF1.14
// To use these, you will require a "flying-lead" UART adapter
HWREG(IOC_PA3_SEL) = IOC_MUX_OUT_SEL_UART1_TXD;
HWREG(IOC_PA3_OVER) = IOC_OVERRIDE_OE;
HWREG(GPIO_A_BASE + GPIO_O_AFSEL) |= GPIO_PIN_3;
// UART1 - rx pin we don't really use but we setup anyway
// PA2 => is jumper position RF1.16
HWREG(IOC_UARTRXD_UART1) = IOC_PAD_IN_SEL_PA2;
HWREG(IOC_PA2_OVER) = IOC_OVERRIDE_DIS;
HWREG(GPIO_A_BASE + GPIO_O_AFSEL) |= GPIO_PIN_2;
HWREG(UART1_BASE + UART_O_CC) = 0;
// baud rate
b = (((kPlatformClock * 8) / kBaudRate) + 1) / 2;
a = b / 64;
b = b % 64;
HWREG(UART1_BASE + UART_O_IBRD) = a;
HWREG(UART1_BASE + UART_O_FBRD) = b;
HWREG(UART1_BASE + UART_O_LCRH) = UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE | UART_CONFIG_PAR_NONE;
/* NOTE:
* uart1 is not using IRQs it is tx only
* and we block when writing bytes
*/
HWREG(UART1_BASE + UART_O_CTL) = UART_CTL_UARTEN | UART_CTL_TXE | UART_CTL_RXE;
}
#endif
-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
```

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