Compare commits

..

1804 Commits

Author SHA1 Message Date
Abtin Keshavarzian 2ce3d3bf02 [mesh-forwarder] add delay-aware queue management (#7568)
This commit implements delay-aware queue management. When enabled the
device will monitor time-in-queue of messages in the direct tx queue
and if it is lager than specified thresholds it updates ECN flag
(if message indicates it is ECN-capable) and/or drop the message. This
mechanism is applied to IPv6 messages on the first device that sends
the message into Thread mesh and also on intermediate routers that are
forwarding the message (e.g., as a "mesh lowpan fragment" frame). On an
intermediate router when forwarding the fragments of a message, if any
fragment is dropped by the queue management policy, all subsequent
fragments will also be dropped.

In particular, this commit contains the following:

- Adds `DecompressEcn()` and `MarkCompressedEcn()` in `Lowpan` class
  to decompress or update the ECN field in a compressed IPHC header
  (unit test `test_lowpan` is also updated to test the new methods).
- Adds `UpdateEcnOrDrop()` which implements the main queue management
 logic. This method is used when preparing next direct tx message. It
 decides whether to keep the message as is, update ECN on it or drop
 it.
- Updates `EvictMessage()` to first apply the queue management rule
  to see if any message can be dropped before using the eviction
  logic based on message priority.
- Updates and reuses the `FragmentPriorityList` to track whether
  queue management dropped any of the fragments of same message so
  to also drop any subsequent ones.
- Updates `LogMessage()` to log when a message is dropped by
  queue-management or when ECN is marked on a message.
2022-07-08 13:02:53 -07:00
Abtin Keshavarzian 8aca0655e7 [srp-client] exclude sub-type PTR when service is being removed (#7883)
This commit updates the SRP client to not include sub-types PTR
records when the base service is being removed.
2022-07-08 12:13:04 -07:00
Bob MacDonald 742b4e8cc3 [gcov] use __gcov_dump() instead for clang 12/13 (#7880)
Use gcov_dump when using clang on MacOS and the version is 13 or above
or when using clang on a non MacOS system and the version is 12 or
above.
2022-07-07 21:28:29 -07:00
Abtin Keshavarzian 5d09e9ca4f [mle] update number parent requests in an attach cycle (#7538)
This commit updates the MLE attach process so that in the first attach
cycle device tries a total of six MLE Parent Requests, the first two
to routers only followed by four to routers and REEDs. For example,
the six Parent Request message will be used before device can decide
to act the leader. An MTD in the next attach attempt (if cannot find a
parent in first attempt cycle), will go to the model of two Parent
Requests (first to routers, then to routers/REEDs).

This change impacts the time it takes for a device to start as leader
(due to increased number of Parent Request and wait time). This commit
updates different test scripts to address the change in the wait
time. It adds a new `config.LEADER_STARTUP_DELAY` constants which is
used for wait time for leader to start.
2022-07-07 16:50:21 -07:00
Abtin Keshavarzian b71c1590c1 [routing-manager] adding LocalOmrPrefix class (#7871)
This commit contain smaller enhancements related to managing the
local OMR prefix:

- It adds a new class to encapsulate all the related data and
  methods.
- We directly track whether or not the prefix is added to the local
  Network Data (using a boolean)
- The methods are renamed to use the terms "add/remove" instead of
  "publish/unpublish" since the Network data publisher is not used
  for OMR prefix and it is directly added or removed.
2022-07-07 10:11:10 -07:00
Abtin Keshavarzian 31f1992dbd [ip6] Headers class to parse IPv6 and UDP/TCP/ICMPv6 headers from message (#7851)
This commit adds `Ip6::Headers` class which represents IPv6 header
along with related transport layer header (UDP, TCP or ICMP6). It
provides helper methods to parse all headers from an IPv6 message or
decompress and read them from a lowpan frame.

This helps simplify the code and allows us to remove multiple similar
methods in `MeshForwarder` performing decompression/parsing.
2022-07-07 10:08:23 -07:00
Abtin Keshavarzian 12dfedb28f [csl] update CSL on role change to router or leader (#7874)
This commit adds a call to `Get<Mac::Mac>().UpdateCsl()` when there
is role change from `SetStateLeader()` or `SetStateRouter()`. This
ensures to disable CSL at `SubMac` and radio platform.
2022-07-07 08:54:14 -07:00
Zhanglong Xia eb3ca48042 [platform] add RCP interface metrics (#7860) 2022-07-07 08:47:58 -07:00
Zhanglong Xia 7e7da0e211 [spinel] add an API to get the radio spinel metrics (#7859)
When the RCP is not stable, it causes the Thread stack to crash.  To
better know the stability of the RCP, this commit adds an API to
return the radio spinel metrics.
2022-07-06 20:30:23 -07:00
canisLupus1313 dd631b2a19 [spinel] fix dua log region (#7865)
This commit sets dua log region to correct value 20.
2022-07-06 11:33:03 -07:00
Eduardo Montoya 289bbebb9c [csl] simplify states and scheduling (#7783)
After enabling the scheduling of delayed reception slots in #7677
they would be configured even when the device switched to MED mode.

This commit introduces some simplifications around the CSL states
and scheduling:
- Maintain the CSL timer stopped if not in CSL Receiver mode.
- Keep the CSL Period and Channel values in the MAC in order to use
  them as an indication of CSL Receiver mode in the Sub-Mac.
- Simplify CSL states with `mIsCslSampling` variable.
- Use a simplified interaction between MAC and SubMac:
  - `SubMac::UpdateCsl` for CSL config or stopping CSL sampling.
  - `SubMac::CslSample` for start/maintain CSL sampling.
2022-07-06 10:58:01 -07:00
Abtin Keshavarzian 2057ca8846 [cli] add helper method ParsePreference() (#7858)
This commit adds a helper method `ParsePreference()` to parse a given
CLI argument string as a route preference comparing it against "high",
"med", or "low". This commit also moves the `PreferenceToString()`
method from `Cli::NetworkData` to `Cli::Interpreter` class.
2022-06-30 15:05:56 -07:00
Abtin Keshavarzian a8924f65f7 [routing-manager] get/set preference for RIOs in emitted RA messages (#7849)
This commit adds new mechanism in `RoutingManager` to allow user to
get or set the preference level to use when advertising Rout Info
Options (e.g., for discovered OMR prefixes) in RA messages sent on
infra netif. By default 'medium' preference is used. As an example,
user can choose to set the preference to 'low' when the device is
acting as a temporary BR (a mobile or battery-powered BR) to indicate
that other BRs should be preferred over this BR on the infra link.

This commit also adds CLI sub-commands for newly added APIs and
updates the documentation.
2022-06-30 12:49:49 -07:00
Abtin Keshavarzian ec8ff8f3b4 [instance] move definition of all OT core objects in Instance (#7842)
This commit moves all the OT core member variable definitions into
`Instance` class (from `ThreadNetif`).
2022-06-30 12:35:28 -07:00
Abtin Keshavarzian f2f98c565f [routing-manager] skip self-prepared RA when learning host RA header (#7846)
This commit updates how `RoutingManager` learns the RA header from
host daemons. It adds a new method to determine whether a received RA
message is prepared by the `RoutingManager` itself by checking the
options (PIO and RIO) from the RA message. When learning/updating the
host RA header, we check and skip over such self-prepared RA
messages.
2022-06-30 12:18:31 -07:00
Abtin Keshavarzian 0132362815 [netdata] wait for sync before accepting new data on leader restart (#7838)
This commit adds a new mechanism related to Network Data recovery on
leader after restart. We determine whether device is starting normally
as leader or restoring its role as leader after restart. In the
latter case, we do not allow the device to accept any new Network Data
registrations until it has successfully recovered the Network Data
(received MLE Data Response).

This change help address situation where Network Data entries
registered with leader before it syncs and restores the Network Data
can be removed and then take a while to be re-registered.
2022-06-30 09:49:27 -07:00
Yakun Xu 3b0a876b24 [cli] use snprintf instead (#7848)
To address a warning on some platforms.
2022-06-29 22:33:27 -07:00
Simon Lin 86e642379c [thci] configure backbone netif (#7804)
The backbone netif is always set to `eth0` in the original THCI. This
commit allows to configure backbone netif via THC parameter `Param8`.
2022-06-29 13:32:00 -07:00
Eduardo Montoya b058ea4e17 [dua] allow MTD to handle ADDR_ERR.ntf messages (#7844)
An MTD interface should be able to handle Address Error Notifications
as per Thread Specification section 5.6.4.
2022-06-29 11:11:46 -07:00
Mason Tran 902f295b31 [cmake] add option for RCP specfific mbedtls library (#7847) 2022-06-29 11:09:51 -07:00
Sarah 4747a9c776 [docs] add Doxygen support for CLI comments (#7749) 2022-06-28 16:44:39 -07:00
Abtin Keshavarzian f561b44586 [routing-manager] discover and publish default route (#7839)
This commit updates `RoutingManager` to discover and publish default
route entries. It updates `DiscoveredPrefixTable` to track which
routers provide default route when processing the received RA
messages. A router can indicate that it provides default route in the
RA message header and it can also include an RIO for "::/0". When
processing the RA message, the preference and lifetime values in a
"::/0" RIO override the preference and lifetime values in the RA
header.

While `DiscoveredPrefixTable` will always track default routes, only
if we see an OMR prefix with default route flag in the Network Data,
we allow it to publish the discovered default route (as "::/0"
external route) in the Network Data. Finding such an OMR prefix
indicates that this prefix is routable beyond the infra link and
therefore default routes can be published and used within Thread
mesh.
2022-06-28 11:36:35 -07:00
JaneFromSilabs 7576306553 [thci] support 1.3 border router configurations (#7826)
Adding support for 1.3 style border router configurations which are
different from the 1.2 style border router configurations.  The
'device capabilities' is used to differentiate between these 2 device
types to assign them their needed configuration parameters.

Also moving restartAgentService to the proper class.
2022-06-28 09:32:39 -07:00
Abtin Keshavarzian ba7d5f1b94 [ip6] use Array in Ip6::Filter (#7843)
This commit updates `Ip6::Filter` to use `Array` to track the
unsecure ports.
2022-06-28 08:42:49 -07:00
Abtin Keshavarzian 827006b2e2 [routing-manager] track discovered entries per router in prefix table (#7830)
This commit updates the data model used by `DiscoveredPrefixTable` in
`RoutingManager` to track the router which added each prefix entry.
This change ensures correct behavior when multiple routers on the
infra link advertise the same set of prefixes. The routers can
potentially advertise the same prefixes (in RIOs) with different
preference levels and/or stop/start advertising the prefixes
independently of each other. We publish the prefixes in Network Data
with highest seen preference. The published entries in Network Data
are also updated as the table entries changes.
2022-06-28 08:37:19 -07:00
Eduardo Montoya dbcebd2ed4 [mle] reuse ScheduleChildUpdateRequest where possible (#7841) 2022-06-27 20:14:53 -07:00
Abtin Keshavarzian 733750b3de [mle] handle rx key seq update based on MLE message class (#7672)
This commit implements new mechanism in `Mle` related to key sequence
update when an MLE message is received with a larger key sequence
compared to the one being used by `KeyManager`. The MLE messages are
categorized into classes of Authoritative, or Peer depending on the
MLE command type and included TLVs. The class determines different
actions: Authoritative indicates sender is confident that its key seq
is in sync, so receiver will adopt the larger key seq. Peer class is
used when both sender and receiver think they are in sync. In this
case, if the MLE message is from a known neighbor, receiver will
adopt the larger key seq if the difference is one, otherwise it will
try to re-establish link with the neighbor using Authoritative
message exchanges (e.g. sending Link Request or Child Update
Request).
2022-06-24 12:21:04 -07:00
Abtin Keshavarzian f4c2233527 [thread-tlvs] define min/max num of addrs under Ip6AddressesTlv (#7834)
This commit moves the definitions of constants related to min/max
number of IPv6 addresses that can be included in an IP6 Addresses TLV
to `Ip6AddressesTlv` class. It also adds a public OT constant in
`ip6.h` related to this for MLR feature which is then used in `cli`
and `ncp` modules so to avoid the use of OT core internal constant
from CLI/NCP.
2022-06-24 08:37:58 -07:00
Abtin Keshavarzian 747e20cc54 [script] fix multiple LOG_OUTPUT definitions (#7833)
This commit updates `check-simulation-build-autotools` to use the
`LOG_OUTPUT` switch directly. This addresses an issue where
we could end up with multiple `OPENTHREAD_CONFIG_LOG_OUTPUT`
definitions in the `CPPFLAGS`.
2022-06-23 21:22:41 -07:00
Abtin Keshavarzian 0bf370c22a [owning-list] fix typos (#7831) 2022-06-23 17:52:25 -07:00
Abtin Keshavarzian dff9111d0c [array] add RemoveAllMatching() (#7829)
This commit adds a new method in `Array` to remove all elements
in the array matching a given indicator.

This commit also updates `test_array.cpp` unit test to validate
the behavior of the newly added method.
2022-06-23 07:35:28 -07:00
Abtin Keshavarzian 5cfbcfcbf4 [netdata] update Publisher to allow change to previous entries (#7827)
This commit updates `NetworkData::Publisher` so that a call to
`PublishOnMeshPrefix()` or `PublishExternalRoute()` replaces a
previous request for the same prefix. In particular, if the new call
only changes the flags (e.g., preference level) and the prefix is
already added in the Network Data, the change to flags is immediately
reflected in the Network Data. This ensures that existing entries in
the Network Data are not abruptly removed. Note that a change in the
preference level can potentially later cause the entry to be removed
from the Network Data after determining there are other nodes that
are publishing the same prefix with the same or higher preference.

This commit also updates `test_netdata_publisher.py` to test the newly
added behavior.
2022-06-22 14:17:28 -07:00
Abtin Keshavarzian 64e837861f [netdata] add feature for BR to request router role upgrade (#7597)
This commit adds a new mechanism to allow border routers to request
router role upgrade.

A border router which provides IP connectivity (either adding an
external route prefix or an on-mesh prefix with default route flag)
and is acting as a REED is eligible to request a router role upgrade
by sending an "Address Solicit" request to leader with status reason
`BorderRouterRequest`. This reason is used when the number of active
routers in the Thread mesh is above the threshold, and only if the
number of existing eligible BRs (determined from the network data)
that are acting as router is less than two. This mechanism  allows up
to two eligible border routers to request router role upgrade when
the number of routers is already above the threshold.

This commit also adds a new test-case `test_br_upgrade_router_role`
which validates the behavior of the new mechanism.
2022-06-22 11:45:30 -07:00
Dong Jiachen 4164a5029d [posix] remove used variables (#7828) 2022-06-22 11:27:26 -07:00
Abtin Keshavarzian 7e4d4d5cc1 [routing-manager] add DiscoveredPrefixTable (#7821)
This commit introduces `DiscoveredPrefixTable` class as a nested type
in `RoutingManager`. This class maintains the on-link and route
prefixes which are discovered by processing the received Router
Advertisement messages. It manages the lifetime of the discovered
prefixes (running a timer and removing entries when they expire). It
also handles publishing and unpublishing the prefixes in the Thread
Network Data as they are added and removed.

When there is any change in the table (an entry is added, removed,
or modified), it signals this through a callback to `RoutingManager`
which can then take action and decide whether or not to re-evaluate
the routing policy. A `Tasklet` is used for signalling which ensures
that if there are multiple changes within the same flow of execution,
the callback is invoked after all the changes are processed.

The change in this commit simplifies the overall `RoutingManager`
code by abstracting away the prefix table management into its own
class and allows us to hide the internal data model used for storing
the discovered prefixes.
2022-06-21 15:53:28 -07:00
Abtin Keshavarzian 2bc87ce157 [netdata] simplify Publisher to use HandleServerDataUpdated() (#7823)
This commit simplifies `NetworkData::Publisher` to rely and use the
new `HandleServerDataUpdated()` behavior which uses a `Tasklet` to
start the registration with leader. With this, we can directly call
`HandleServerDataUpdated()` whenever there is a change and even
multiple times during processing from `Publisher` while ensuring that
all changes are still registered together.
2022-06-21 09:55:20 -07:00
Abtin Keshavarzian ea611dc1f1 [netdata] perform SynchronizeServerData() from a Tasklet (#7823)
This commit adds a `Taskelt` in `NetworkData::Notifier` to perform
`SynchronizeServerData()` and post this tasklet when there is a
change and `HandleServerDataUpdated()` is called. This ensures that
if there are multiple changes triggered within the same flow of
execution, they are all synchronized together and included in the
same message to register with leader.
2022-06-21 09:55:20 -07:00
Abtin Keshavarzian 481a064f03 [ip6] update Ip6::Prefix comparison (#7813)
This commit updates `Ip6::Prefix` comparison (overload of `<`
operator). If the two prefixes have same length N, then the bytes are
compared directly (as two big-endian N-bit numbers). If the two
prefix have different lengths, the shorter prefix is padded by `0`
bit up to the longer prefix length N before the bytes are compared
(as big-endian N-bit numbers). If all bytes are equal, the prefix
with shorter length is considered smaller.

This commit also updates `test_ip_address` unit test to validate
the new comparison behavior.
2022-06-16 21:28:08 -07:00
Abtin Keshavarzian 16ddb157d0 [dns-dso] use Array::RemoveMatching() (#7817) 2022-06-16 21:26:03 -07:00
Abtin Keshavarzian aad14e9f2f [array] add Remove() and RemoveMatching() (#7817)
This commit adds `Remove/RemoveMatching()` in `Array` class which
remove a given or a matched element from the array. To remove the
element, it is replaced by the last element from array, so the order
of items in the array can change after call to these method.

This commit also updated unit test `test_array` to verify the behavior
of newly added methods.
2022-06-16 21:26:03 -07:00
Abtin Keshavarzian a5d39c3ec3 [routing-manager] fix calculation if an entry's stale time is in past (#7818)
This commit updates the calculation of the next stale time in
`ResetDiscoveredPrefixStaleTimer()` in (unlikely) cases where the
stale time of a discovered prefix or RA header happens to be in past
(compared to `GetNow()`). In such a case, we use `now` as the stale
time of the entry. This then ensures that the we can correctly
compare the stale time with `now.GetDistantFuture()`.
2022-06-16 21:22:02 -07:00
Simon Lin c055c10a9a [routing-manager] self-generated OMR prefix to use P_preference=Low (#7802) 2022-06-16 19:42:10 -07:00
Abtin Keshavarzian d5926a2445 [mle] refactor Tx/RxMessage method definitions (#7812)
This commit is a cosmetic change and contains no change in the code
logic. It is a follow-up from #7689 which added `Mle::Tx/RxMessage`
types. This commit moves all `TxMessage` and `RxMessage` method
definitions close to one another (at the end of `mle.cpp`).
2022-06-15 13:35:40 -07:00
Abtin Keshavarzian 49b9846632 [routing-manager] simplify RA message parsing and preparation (#7789)
This commit adds a new class `RouterAdvertMessage` representing an RA
message. It provides methods to append options (PIO or RIO) to the RA
message or parse and iterate over the options in the RA message
(using newly added `Option::Iterator` which allows use of range-based
`for` loop). These method are used by `RoutingManager` and help
simplify the code.
2022-06-14 21:58:35 -07:00
Simon Lin b7c2c52d5c [thci] wait for netdata to stabilize if BORDER_ROUTING is enabled (#7798)
A BR with `BORDER_ROUTING` feature may add OMR prefix and external
routes to the network data when Thread is started.  The network data
changes may incur additional Thread communications that may interfere
with certification traffic.

This commit enhances THCI to wait for the network data to stabilize
after the BR is started.
2022-06-14 20:11:27 -07:00
Abtin Keshavarzian ac62f7819c [border-router] use Ip6::Nd namespace for IPv6 Neighbor Discovery (#7780)
This commit uses `Ip6::Nd` namespace for IPv6 Neighbor Discovery
definitions (used for border router). It also renames and moves
the source files to `net/nd6.*`.
2022-06-14 12:26:18 -07:00
Abtin Keshavarzian 19f8033b78 [srp-server] validate sub-types and treat as atomic (#7795)
This commit updates `Srp::Server` to treat the update instructions in
a received SRP message for a service and all its sub-types as atomic.
It adds a new method `ValidateServiceSubTypes()` which performs two
checks. First, it verifies that there is a matching base service for
all sub-type services in a received SRP Update message. Second, it
treats the sub-types in the message as atomic, i.e., whatever
information appears in the message is considered the entirety of
information about the service and its sub-types. In particular, any
previously registered service sub-type that does not appear in a new
SRP Update is removed (marked as deleted).

This commit updates `test_srp_sub_type.py` test-case to validate the
behavior of newly added mechanism (i.e. removal of older sub-types
when not present in the new SRP update message).
2022-06-13 10:56:42 -07:00
JaneFromSilabs d0a7147165 [thci] add support for Thread Version 4 (1.3) (#7806) 2022-06-13 10:36:54 -07:00
Jonathan Hui abad2f2cc1 [docs] remove linkquality from src/cli/README.md (#7810) 2022-06-13 10:35:18 -07:00
Simon Lin edbb07d95f [tests] verify a Router can establish links quickly via multicast Link Request (#7807)
This commit adds a test to make sure delay sending multicast Link
Request (#7745) works as intended.
2022-06-13 09:54:57 -07:00
Jonathan Hui b2132a9031 [tests] add 1.3.0 as valid version in test_publish_meshcop_service.py (#7801) 2022-06-08 15:22:36 -07:00
Jonathan Hui 0c48ade2ff [tests] change 1.2 builds to 1.3 (#7756) 2022-06-08 11:44:23 -07:00
Abtin Keshavarzian 9e887eb77a [srp-client] message MTU check and single service mode (#7776)
This commit adds a new mechanism in `Srp::Client`: When preparing an
update message, client will check whether the prepared message fits
in an IPv6 MTU (1280 bytes). If it does not, the SRP client would
temporarily enable "single service mode" which ensures only a single
service (along with its sub-types) to be appended in the SRP update
message. After the message is sent SRP client would switch back to
normal behavior and disables the single service mode.

This change addresses situation where user may register many services
(with multiple sub-types and long TXT data) which then may not fit
in a single UDP message payload.

This commit also adds `test_srp_many_services_mtu_check` test which
verifies the newly added behavior.
2022-06-07 11:13:20 -07:00
Jonathan Hui 171fbd82cf [tests] relax MLE Adv delay check in Cert_5_3_06_RouterIdMask (#7788)
Time delay between MLE Advertisements after reset can be up to 3.5
seconds. For example:

- 0.0s: Reset Interval, reset interval to 1 seconds, random interval
        at 0.5 second
- 0.5s: Transmit MLE Advertisement
- 1.0s: Set interval to 2 seconds, random interval at 2 seconds
- 3.0s: Receive MLE Advertisement, reset interval to 1 second, random
        interval at 1.0 second
- 4.0s: Transmit MLE Advertisement
2022-06-06 10:52:15 -07:00
Jonathan Hui 4384a3100b [mle] fix handling of MLE Orphan Announce messages (#7786)
MLE Orphan Announce messages include a timestamp value that has both
seconds and ticks set to zero, but authoritative bit set. However, the
default Active Timestamp value is all zeros. As a result, an MLE
Orphan Announce timestamp can appear to be greater than the default
Active Timestamp value and cause a device to detach.

This commit adds a special case to check for the Orphan Announce
timestamp.
2022-06-06 10:51:47 -07:00
Kangping 5daca7c684 [dataset] use full Timestamp TLV value in otOperationalDataset (#7739)
The `otOperationalDataset#mActiveTimestamp` should represent the full
Active Timestamp TLV value but not only the seconds. The same for
`otOperationalDataset#mPendingTimestamp`.
2022-06-03 10:59:16 -07:00
Mason Tran c8556dfd66 [cmake] add option for RCP specific mbedtls library (#7781)
This commit enables a different mbedtls library to be used for RCP
builds. This will make it possible to use a PSA Crypto mbedtls library
for FTD/MTD images while using a non-PSA crypto library on RCPs.
2022-06-02 19:26:29 -07:00
gabekassel 1811ac763f [cmake] add build option to configure outgoing beacon payload (#7782) 2022-06-02 19:08:08 -07:00
Abtin Keshavarzian c0babfe319 [routing-manager] add OmrPrefix class, include OMR preference in RIO (#7778)
This commit updates `RoutingManager` to track the preference of the
discovered OMR prefixes from Thread Network Data and advertise the
OMR prefixes with the same preference in Route Info Options in the
emitted Router Advertisements.

This commit adds `OmrPrefix` class (which tracks an OMR prefix along
with its preference) and provides helpers method (e.g., method to
compare two OMR prefixes to determine which one is favored, `ToString
()` method). The `EvaluateOmrPrefix()` is updated to use the new
`OmrPrefix` class.
2022-06-02 15:33:12 -07:00
Abtin Keshavarzian 24d633d99d [srp-client] add auto host address mode (#7655)
This commit adds a "auto host address mode" in SRP client. When
enabled, host IPv6 addresses are automatically set by SRP client
using all the unicast addresses on Thread netif excluding the
link-local and mesh-local addresses. If there is no valid address,
then Mesh Local EID address is added. The SRP client will
automatically re-register when/if addresses on Thread netif are
updated (e.g., new addresses are added or existing addresses are
removed).

This commit updates CLI to add support for new SRP client APIs related
to the new feature. It also adds `test_srp_auto_host_address` test to
cover the behavior of this feature.
2022-06-02 15:32:08 -07:00
Zhanglong Xia e83ecab395 [log] add log to record the RCP restoration state (#7743) 2022-06-02 13:58:36 -07:00
jinran-google 9bb09e74e2 [mle] add API to detach gracefully (#7666)
This commit adds an API `otThreadDetachGracefully` to notify other
nodes in the network (if any) and then stop Thread protocol
operation. It sends an Address Release if it's a router, or sets its
child timeout to 0 if it's a child.
2022-06-02 09:04:14 -07:00
hemanth-silabs 8f92d2dc81 [mac] enable Beacon Payload in outgoing beacons (#7767)
This commit enables beacon payloads on outgoing beacons to prevent
backward compatibility issues with existing devices in the market.
2022-06-01 16:50:01 -07:00
Łukasz Duda ed665e95a7 [platform] update documentation of otPlatSettings API (#7774)
Signed-off-by: Lukasz Duda <lukasz.duda@nordicsemi.no>
2022-06-01 13:47:13 -07:00
Jonathan Hui 33cc75ed3b [srp-server] implement TTL processing (#7738) 2022-05-31 22:01:27 -07:00
Abtin Keshavarzian 11eb753484 [settings] remove unused/deprecated definitions (#7762)
This commit removes deprecated `Settings` definitions in particular
the OMR prefix, on-link prefix and NAT64 prefix.
2022-05-31 20:09:07 -07:00
Yakun Xu 2870c1c4dc [border-agent] log the listening port (#7768) 2022-05-31 17:30:41 -07:00
Abtin Keshavarzian 40484c9468 [routing-manager] directly remove on-link prefix from discovered list on advert start (#7764)
This commit changes `EvaluteOnLinkPrefix()` so that when we decide to
start advertising the local on-link prefix, we go through the list of
discovered prefixes to check if the local prefix was previously discovered
and included in the list, and remove it from the list (without
unpublishing it from Thread Network Data). This change allows us to
simplify `InvalidateDiscoveredPrefixes()` which was earlier called and
was in charge of removing the local prefix.

This helps align the logic that when we are advertising the on-link
prefix, we do not allow it to be added in the discovered prefix list
from `UpdateDiscoveredOnLinkPrefix()`.
2022-05-30 22:06:00 -07:00
Jonathan Hui bfb60204fc [ndproxy] fix typo Attampts -> Attempts (#7752) 2022-05-27 13:16:23 -07:00
Jonathan Hui 81a948b4d8 [mle] evaluate neighbor links before upgrade to router (#7765)
OpenThread only etablishes links when the link margin is above a
certain threshold, to help ensure that links in the routing topology
are stable. However, if a device has no existing links to neighboring
routers above threshold, then upgrading to a router is useless and
disruptive.

This commit adds a check to ensure there is at least one neighbor
above the link margin threshold before upgrading to a router.
2022-05-27 13:15:58 -07:00
Jonathan Hui 62f5a3907c [mle-router] fix uninitialized pointer in SendLinkRequest() (#7770) 2022-05-27 13:13:14 -07:00
Jonathan Hui 1b4a866fea [tests] disable some checks in Cert_9_2_09 (#7771)
Disable steps 32, 33, and 34 until a solution is found. Depending on
timing, there may be one MLE Data Request/Response exchange for both
Active and Pending Operational Datasets or individual MLE Data
Request/Response exchange for each Active and Pending Operational
Dataset separately.
2022-05-27 10:46:35 -07:00
hemanth-silabs e8b9b874f5 [mac] re-add API to receive Thread-specific Beacon payload (#7736)
Some of the current implementations of thread stack use active scans
to find out the joining network name and extended panids. These
details are then used as part of commissioning process.

So at the very minimum we will need processing the incoming beacons to
extract these information.
2022-05-26 14:02:07 -07:00
Abtin Keshavarzian 3c4caed8a4 [routing-manager] remove invalidated prefixes from array in place (#7751)
This commit updates `InvalidateDiscoveredPrefixes()` to remove
invalidated entries from the array directly. This is done by
replacing the invalidated prefix entry in array with the last entry
in list and popping the last entry. This helps simplify the code and
avoid the need to create a separate copy of the list.

This commit also makes other smaller enhancements in this method:
Tracking the `nextExpireTime` to avoid multiple calls to
`FireAtIfEarlier()` from the same method (avoid re-arranging the full
timer linked-list). Also using a boolean `containsOnLinkPrefix` to
track whether we have seen any on-link prefix in the discovered
prefix list (instead of keeping track of the number of such
entries).
2022-05-26 09:21:13 -07:00
Jonathan Hui f75d03f6cb [mle] delay sending multicast Link Request (#7745)
A device sends a multicast Link Request message after becoming a
router to quickly and efficiently establish links with neighboring
routers. However, sending a Link Request too quickly can fail in cases
where the neighboring router(s) have not yet received the updated
Router ID set from the Leader.

This commit delays sending the Link Request to allow time for
neighboring routers to receive the updated Router ID from the Leader.
2022-05-26 09:16:49 -07:00
Jonathan Hui cbb51b01ce [neighbor] change IsThreadVersion1p2() to include higher versions (#7755) 2022-05-26 09:07:41 -07:00
Simon Lin d266f90fbf [tests] mcast6.py to receive UDP messages without JOIN_GROUP (#7757)
`mcast6.py` is used by GitHub Actions CI to send or receive UDP
messages in multicast groups.

This commit adds a `-u` argument to allow `mcast6.py` to receive UDP
messages without joining a multicast group.
2022-05-26 08:57:42 -07:00
Abtin Keshavarzian 61ecd90531 [routing-manager] simplify invalidation of specific prefix (#7747)
This commit simplifies the mechanism to invalidate/remove a specific
prefix entry in `mDiscoveredPrefixes` list. Instead of passing the
prefix to invalidate as an input to `InvalidateDiscoveredPrefixes()`
method, we directly set the valid lifetime to zero on the entry in
the list before calling the `InvalidateDiscoveredPrefixes()` to then
remove all expired entries.

This change addresses an issue in `HandleRouterSolicitTimer()` where
while iterating over the `mDiscoveredPrefixes` list we could call
`InvalidateDiscoveredPrefixes()` which then removed an entry from the
list (thus changing the list).
2022-05-25 11:23:09 -07:00
Eduardo Montoya 57bfa92d46 [srp-client] prefer the numerically lowest server address (#7737) 2022-05-25 11:15:59 -07:00
whd 8210a02400 [dnssd-server] add otDnssdGetCounters for telemetry (#7708)
This commit implements `otDnssdGetCounters` to report the statistics
of the DNS-SD server.
2022-05-24 21:14:58 -07:00
Zhanglong Xia 67c2c04f0e [log] add region code log (#7740)
This commit adds log to record the region code to help developers know
which region code is currently in use from log.
2022-05-24 10:47:30 -07:00
Abtin Keshavarzian 349041bc61 [routing-manager] simplify EvaluateOnLinkPrefix() and sending RA (#7726)
This commit changes `EvaluateOnLinkPrefix()` to directly update
`mIsAdvertisingLocalOnLinkPrefix`. The `SendRouterAdvertisement()` is
also simplified to directly use this boolean variable (instead of
a pointer to prefix being passed as input parameter) to determine
whether or not to include a PIO with the local on-link prefix.
2022-05-23 16:53:54 -07:00
Abtin Keshavarzian 5f2437939d [routing-manager] simplify ExternalPrefix (#7723)
This commit contains smaller enhancement in `RoutingManager` related
to `ExternalPrefix` class (which represents a prefix discovered from
processing Router Advertisements from infrastructure netif). This
commit also uses `Array::Find()` methods when searching in the
`mDiscoveredPrefixes` array.
2022-05-23 14:52:16 -07:00
Abtin Keshavarzian 58f56bbec2 [srp-server] check allocated UpdateMetadata is not nullptr (#7717) 2022-05-23 13:37:51 -07:00
Jonathan Hui 56db0d3eff [routing-manager] remove vicarious router discovery feature (#7727)
The vicarious router discovery feature depends on the ability to
receive Router Advertisement messages sent in response to Router
Solicitation messages from other hosts. However, this does not work
since Router Advertisement messages are often sent unicast in
response.
2022-05-23 13:26:04 -07:00
Simon Lin 65c6f39300 [routing-manager] handle deprecated OMR prefix (#7703)
This commit enhances routing-manager to avoid using deprecated
(i.e. P_preferred=false) OMR prefixes as the winning OMR prefix, but
still sends RA RIO for the deprecating OMR prefixes.
2022-05-23 11:07:40 -07:00
Simon Lin c319046599 [routing-manager] fix BR incorrectly removing route for local on-link prefix (#7724)
This commit fixes a bug that BR could incorrectly remove the route of
the local on-link prefix in Network Data when it's still advertising
the local on-link prefix.

This is a short-term fix because in the long term we want to refactor
how `RoutingManager` manages external routes and the default route.
2022-05-23 11:04:28 -07:00
Jonathan Hui fcbc4bef9b [srp-client] add API to specify TTL (#7735) 2022-05-20 15:34:50 -07:00
Jonathan Hui 0f4531b22f [data-poll-sender] return kErrorNone when Data Request is already enqueued (#7725)
There are no use cases where `kErrorAlready` is useful.
2022-05-20 13:02:37 -07:00
Abtin Keshavarzian bffbebc646 [router-advert] RouterAdvMessage to provide default router prf (#7720)
This commit updates and simplifies `RouterAdvMessage`:
- Adds new method to get and set the "default router preference"
- Removes custom overloads of operator `=` and `==` (which
  excluded the checksum field). Instead when we save a received RA
  in `RoutingManager` we directly set the checksum to zero so the
  normal (byte by byte) comparison would properly check all fields.
2022-05-20 11:16:04 -07:00
Yakun Xu 36b2a173f9 [simulation] simulate energy scan (#7393)
This commit implements energy scan in simulation platform.

Verified locally
```bash
> ifconfig up
Done
> scan energy 100
| Ch | RSSI |
+----+------+
| 11 |  -98 |
| 12 |  -98 |
| 13 |  -98 |
| 14 |  -98 |
| 15 |  -30 |
| 16 |  -30 |
| 17 |  -98 |
| 18 |  -98 |
| 19 |  -30 |
| 20 |  -98 |
| 21 |  -98 |
| 22 |  -98 |
| 23 |  -30 |
| 24 |  -30 |
| 25 |  -30 |
| 26 |  -98 |
Done
```
2022-05-20 11:00:44 -07:00
Jonathan Hui 5fbf1bec88 [tests] use common definition for border router startup delay (#7721) 2022-05-20 08:53:34 -07:00
Abtin Keshavarzian 33bd1f425b [border-router] adding InfraIf class (#7700)
This commit adds `InfraIf` class which represents an infrastructure
network interface on a border router providing methods & definitions
mirroring the platform APIs `otPlatInfraIf{}`. This commit also
updates the `RoutingManager` to to use the `InfraIf` class.
2022-05-20 08:51:38 -07:00
Abtin Keshavarzian 39ac118a03 [tcp6] Endpoint and Listener to act as GetProvider (#7722)
This commit updates `Tcp::Endpoint` and `Tcp::Listener` types to
inherit from `GetProvider` (which provides `Get<Type>()` methods
allowing them to directly access different components in an
OpenThread `Instance`).
2022-05-19 10:51:47 -07:00
Jonathan Hui dbb8a5801f [codecov] migrate to v2 uploader (#7718) 2022-05-19 10:32:31 -07:00
Jonathan Hui 5107ee6238 [thread-cert] update Cert_5_5_05_SplitMergeREED to expect 16 routers (#7719)
Cert_5_5_05_SplitMergeREED.py was intermittently failing to find an
MLE Advertisement that had a Route TLV with 15 entries. However, the
test topology has 16 routers in steady state. Update packet filter to
look for 16 routers.
2022-05-19 09:15:54 -07:00
Abtin Keshavarzian ab57ca2f44 [ip6] simplify Ip6::ShouldForwardToThread() (#7706) 2022-05-18 15:35:05 -07:00
Rongli Sun a51a6311e9 [tests] add wait time in test_border_router_as_fed.py (#7714)
This commit adds some wait time before connectivity
validation to mitigate the impact of #7660 which
introduces some random delay before publishing
external route into network data.
2022-05-18 14:08:14 -07:00
Abtin Keshavarzian d3a6268149 [routing-manager] PublishExternalRoute() to return success on kErrorAlready (#7715)
This commit changes `RoutingManager::PublishExternalRoute()` method
to return `kErrorAlready` as `kErrorNone` (i.e., if the prefix to be
published was previously published). This commit keeps the logging
the same (i.e. we still log on `Already` error so we can see when/if
this happens).
2022-05-18 11:45:23 -07:00
Jonathan Hui 0fdbfbe613 [routing-manager] fix build and test failures (#7707)
`RemoveExternalRoute` -> `UnpublishExternalRoute`
2022-05-18 11:45:23 -07:00
Abtin Keshavarzian 8440b5f85d [test] relax wait time in test_nat64_multi_border_routers.py (#7660)
This commit increases the wait time in `nat64_multi_border_routers`
test to accommodate for the fact that prefixes are added and removed
using  `NetworkData::Publisher` which can add additional initial
random wait time (before adding the prefix into network data).
2022-05-17 15:43:44 -07:00
Abtin Keshavarzian d53bcde890 [routing-manager] use NetData::Publisher to publish external routes (#7660)
This commit updates `RoutingManager` to use `NetData::Publisher` for
external routes. This ensures to limit the number of similar entries
added in Network Data if there are many BRs within Thread mesh
discovering same set of prefixes and adding them to Thread Network
Data (avoid overflow of Thread Network Data).
2022-05-17 15:43:44 -07:00
Abtin Keshavarzian 25c610a0ed [routing-manager] prepare route/prefix info options in place (#7699)
This commit contains smaller enhancements in `RoutingManager `
and `Prefix/RouteInfoOption`.

This commit changes how the options are added in a message so that we
directly construct the option in the message buffer (instead of
creating it separately and then copying the bytes).

It also changes `RouteInfoOption::IsValid()` to validate that the
option length can fit the specified prefix length.
2022-05-17 15:39:15 -07:00
Abtin Keshavarzian cb41668c0c [mle] add Tx/RxMessage providing Append/Read{Tlv} methods (#7689)
This commit adds new `Mle::TxMessage` and `Mle::RxMessage` classes
(as sub-classes of `Message`). `TxMessage` represents an MLE message
to be sent out providing `Append{Some}Tlv()` methods and `RxMessage`
represent a received MLE message providing helper methods `Read
{Some}Tlv()`.
2022-05-17 11:25:41 -07:00
Sarah 3f47516ce8 [docs] add Doxygen group for new TCP Abstractions API (#7647) 2022-05-17 10:29:16 -07:00
whd 50862769b9 [srp-server] add SRP server APIs for telemetry (#7680) 2022-05-17 10:24:17 -07:00
Jonathan Hui 282b85fa9c [routing-manager] derive on-link prefix from Extended PAN ID (#7695)
To align with latest Thread Specification.
2022-05-16 22:12:08 -07:00
Simon Lin 8330e708d1 [routing-manager] prefer OMR prefix with higher Pref (#7688)
This commit fixes the issue that the OMR prefix with higher Pref is not preferred.
2022-05-16 22:09:13 -07:00
Jonathan Hui 512d072889 [tests] set routereligible to False for FED (#7694) 2022-05-13 12:59:24 -07:00
rretanubun 0f8dc59f57 [routing-manager] use sizeof explicit type Ip6::Icmp::Header (#7693)
While using sizeof(*icmp6Header) before it is initialized to something
is not wrong, it is possible this will be flagged by some code checker
tools. Lets check using direct type.
2022-05-13 12:57:32 -07:00
Abtin Keshavarzian 658491a1aa [config] introduce OT_THREAD_VERSION_1_3 (#7692)
This commit adds `OT_THREAD_VERSION_1_3` constant (equal to `4`)
and change=s the `OPENTHREAD_CONFIG_THREAD_VERSION` default value
to be the 1.3 version number.

It also updates the build switch option (Cmake and autoconf)
to support 1.3 and use 1.3 as default version value (when not
explicitly specified).
2022-05-13 12:56:16 -07:00
Eduardo Montoya 130afd9bb6 [csl] rename to CslUncertainty (#7690) 2022-05-12 15:49:52 -07:00
Jonathan Hui edd65d5cf0 [tests] use common definition for router startup delay (#7685) 2022-05-12 10:20:16 -07:00
Abtin Keshavarzian f6f3a932fc [owned-ptr] add method PassOwnership() (#7684) 2022-05-12 10:14:07 -07:00
Simon Lin 6a6a1e2b25 [thread-cert] run LowPower cert tests for OTBR Posix (#7683)
This commit runs LowPower cert test cases for OTBR Posix (Docker).

Tests include:
- v1_2_LowPower_5_3_01_SSEDAttachment.py
- v1_2_LowPower_7_1_01_SingleProbeLinkMetricsWithEnhancedAcks.py
- v1_2_LowPower_7_2_01_ForwardTrackingSeries.py

Note: OTBR Posix plays FTD DUT roles .
2022-05-12 10:13:11 -07:00
Abtin Keshavarzian 8085f0a4ac [locator] add GetProvider base to provide Get<Type>() on Message (#7679)
This commit introduces a base class `GetProvider` which provides
`Get<Type>()` methods using `GetInstance()` (which is expected to be
provided by the derived class in a CRTP style inheritance). The class
`GetProvider` is used as base class of `InstanceLocator`.

This model allows us to provide `Get<Type>()` methods on types that
may not be directly an `InstanceLocator`. For example, this commit
uses this model on `Message` class. `Message` always retains the
`MessagePool` which can be used to get to the `Instance` that owns
the `Message`. Note that it is not straight-forward to to have
`Message` directly inherit from `InstanceLocator` (due to way
`Message` is built from `Buffer` and uses `Metadata` header and that
`InstanceLocator` behaves differently under single vs multi instance
configs).
2022-05-12 09:59:14 -07:00
Jonathan Hui c2dd7eb66d [mesh-local-prefix] remove coupling to Extended PAN ID (#7686)
Deriving the Mesh Local Prefix from the Extended PAN ID was carried
forward from legacy implementations. Removing this coupling to conform
to the existing Thread Specification.
2022-05-11 18:21:09 -07:00
Simon Lin fcf40d7087 [routing-manager] BR not to use P_on_mesh=0 or P_stable=0 prefixes as OMR prefixes (#7676)
This commit fixes the bug that BRs would recognize `P_on_mesh=0` or
`P_stable=0` prefixes as OMR prefixes.
2022-05-11 16:00:02 -07:00
Eduardo Montoya b8f305b825 [spinel] add CSL Accuracy and CSL Uncertainty properties (#7638)
Allow the host to get CSL Accuracy and CSL Uncertainty from the RCP.
2022-05-11 15:57:55 -07:00
Abtin Keshavarzian adea4c4b2a [toranj] update test-018-child-supervision to make it more robust (#7687)
This commit adds a small wait time between steps in the toranj
`test-018-child-supervision` to help make the test more robust. The
test adds some extra time for child to finish the "child update
request/response" exchange with the parent before enabling MAC
filter.
2022-05-10 21:21:59 -07:00
Eduardo Montoya 645fbcd400 [csl] allow scheduling delayed reception in any radio state (#7677)
When radio supports receive timing it makes no sense to restrict
scheduling future reception slots while the radio state is for
instance transmitting or receiving, as long as CSL parameters are
properly configured.
2022-05-10 09:11:27 -07:00
Simon Lin d9dd34ea6f [posix] install high priority kernel routes for OMR prefixes (#7636) 2022-05-09 22:30:18 -07:00
Jonathan Hui d068df82a6 [github-actions] do not delete artifacts if coverage upload fails (#7678)
Coverage upload can fail intermittently for various reasons. Do not
delete coverage artifacts if upload fails to avoid needing to re-run
the entire workflow.
2022-05-09 21:31:19 -07:00
Eduardo Montoya 7cd73f30a4 [thci] version string depending on capabilities (#7665)
Return different output of `ValidateDeviceFirmware` depending on the
device's capabilities. This allows to have a single THCI file for the
same vendor for different device's versions.
2022-05-09 20:57:00 -07:00
Abtin Keshavarzian 08e5168bdd [routing-manager] add new config for MAX_DISCOVERED_PREFIXES (#7656) 2022-05-09 20:26:57 -07:00
Yakun Xu 5b1a3189ce [rcp] add enable-coex switch (#7675)
This commit adds a new option of radio url to enable/disable RCP coex
feature on boot without changing the RCP firmware.
2022-05-09 14:56:49 -07:00
Abtin Keshavarzian 8714ec10bb [link-quality] define LinkQuality enumeration (#7673)
This commit adds `LinkQuality` enumeration which represents the
2-bit [0-3] link quality value
2022-05-09 14:17:33 -07:00
Eduardo Montoya b76e524f7f [crypto] make sure MAC keys are exportable (#7669)
If MAC keys are not exportable their reference can't be used by the
platform's radio implementation to retrieve the actual keys.
2022-05-09 10:17:22 -07:00
Jonathan Hui 85382902ac [tests] initialize mesh-local prefix instead of extended pan id (#7668) 2022-05-09 09:15:11 -07:00
Abtin Keshavarzian 8907cb8495 [mle] enhance ProcessRouteTlv() to update neighbor pointer (#7667)
This commit updates `MleRouter::ProcessRouteTlv()` to not only read
and process Route TLV from a received MLE message but also to update
the `mNeighbor` pointer (in `RxInfo`) which indicates the neighbor
from which the MLE message was received.

During processing of Route TLV, the entries in the router table may
shuffle. If the `mNeighbor` was pointing to an entry in `RouterTable`
it may be invalid afterwards. The new implementation ensures that
`mNeighbor` is correctly updated to point the same entry.

This change addresses a scenario where in `Mle::HandleAdvertisement()`
a potentially invalid (or set to null) `mNeighbor` may be checked
after Route TLV is processed from `MleRouter::HandleAdvertisement()`
call.
2022-05-06 13:36:30 -07:00
Abtin Keshavarzian cc003b3a42 [coap] add new helper to allocate and init CoAP message (#7631)
This commit adds new helper methods in `Coap` to allocate a new
message and initialize it as a confirmable or non-confirmable post to
a given URI path. It also adds a new helper method to allocate a CoAP
response message for a given request. These methods help simplify the
preparation of CoAP and TMF messages.
2022-05-06 10:27:55 -07:00
Jonathan Hui 3a125c66d2 [cli] add command to set mesh-local prefix (#7663)
Also add an expect test for getting/setting mesh-local prefix.
2022-05-05 21:42:58 -07:00
Diego Ismirlian fa939be97b [commissioner] add command line option to specify commissioner ID (#7520) 2022-05-05 16:23:06 -07:00
Eduardo Montoya 43be7f41f8 [thci] logging cleanup (#7654)
Remove excesive logging redundancy:
- `API` decorator is enough to show test script calls with arguments
- `__executeCommand` already prints all OT commands and arguments
- Command timestamp is irrelevant in most cases
- Some extra detail logging lines are left commented in case they
  are needed for some debugging

As a result test logs are much easier to follow and resulting files
are much smaller.
2022-05-05 14:03:25 -07:00
Jonathan Hui 68e06bda4e [netdata] remove duplicate prefixes in lcoal network data (#7653)
The current implementation attempts to remove existing on-mesh prefix
entry when adding an on-mesh prefix entry with the same prefix. The
same logic exists for external routes. However, the existing code does
not work properly when both on-mesh prefixes and external routes exist
with the same prefix.

This commit simply updates the logic to always remove existing entries
with the same prefix, regardless of whether they are on-mesh prefix or
external route. This is in contrast to trying to keep both on-mesh
prefix and external route with the same prefix simultaneously. There
is no obvious use case for having both the on-mesh prefix and external
route exist at the same time.
2022-05-05 09:44:29 -07:00
Jonathan Hui d144202e2c [github-actions] remove pyspinel tests (#7662) 2022-05-04 20:33:40 -07:00
Abtin Keshavarzian f3774e3368 [netdata] always check IsConsistent() before netdata registration (#7643)
This commit removes the `#if OPENTHREAD_CONFIG_BORDER_ROUTER_ENABLE`
around the call to `IsConsistent()` which checks whether there is any
difference between local network entries and ones from leader network
data and decide to send a "Server Data Notification" message to
leader. This change ensures that services are updated correctly under
the uncommon config combination where `TMF_NETDATA_SERVICE_ENABLE` is
enabled without `BORDER_ROUTER_ENABLE`.
2022-05-02 16:57:29 -07:00
Eduardo Montoya d2f18d5ebc [thci] remove support for legacy Harness tool (#7651)
Currently the official Thread Harness has support for device
capabilities even for Thread 1.1 tests.
2022-05-02 09:42:15 -07:00
Simon Lin 961baa53d9 [github-actions] remove caching OTBR test results (#7637)
Caching OTBR test results to avoid re-running all tests is no longer
necessary now that GitHub Actions supports it natively.
2022-05-02 09:37:52 -07:00
Abtin Keshavarzian c5fbc45573 [mle] enhance NewMleMessage() to prepare the MLE header (#7633)
This commit updates `NewMleMessage()` to allocate and also
initialize an MLE message adding MLE header and setting the
`Message::SubType`.
2022-05-02 09:34:17 -07:00
Abtin Keshavarzian 0347022854 [mle] add common ProcessMessageSecurity() (#7625)
This commit adds `Mle::ProcessMessageSecurity()`. Based on the `aMode`
input, it can be used to encrypt and append tag to a message (which
will be sent) or to decrypt and validate the tag in a received
message. The common method handles the generation of nonce and
preparation of AES-CCM header.
2022-05-02 09:31:28 -07:00
jinran-google 2d977b0edd [simulation] fix build with RAM settings (#7648)
This commit fixes the build error when `OPENTHREAD_SETTINGS_RAM` is
enabled. Also adds a check to prevent this error in the future.
2022-05-01 19:20:47 -07:00
Simon Lin 972ed8d793 [posix-trel] allow using fixed TREL UDP port (#7646)
This commit adds the configuration
`OPENTHREAD_CONFIG_POSIX_TREL_UDP_PORT` to allow TREL to use a fixed
UDP port number on POSIX platform.
2022-05-01 19:18:34 -07:00
whd b0e532b138 [tests] verify meshcop service after a factoryreset (#7592) 2022-05-01 19:17:36 -07:00
Yakun Xu 9a2d84a4b7 [meshcop] rename dataset managers (#7630)
This commit renames dataset managers ActiveDataset and PendingDataset
to ActiveDatasetManager and PendingDatasetManager for readability.
2022-04-25 12:49:08 -07:00
Abtin Keshavarzian 092be22333 [mle] add RxInfo struct and pass in Handle{MleMsg}() methods (#7627)
This commit adds a new struct `RxInfo` which includes a received
MLE `Message` along with additional info about it such as the
`Ip6::MessageInfo` and key sequence from security header and
pointer to `Neighbor` from which the message was received.
The `RxInfo` is used as the input parameter in different MLE
`Handle{MleMsg}`()` methods.
2022-04-25 06:37:25 -07:00
Simon Lin 4365f505f3 [posix-netif] remove IFA_RT_PRIORITY definition (#7635)
`IFA_RT_PRIORITY` not defined basically means that the feature is not
present. Defining it to 9 does not make it effective.

This commit removes the `IFA_RT_PRIORITY` definition so that it would
not compile on platforms that do not support `IFA_RT_PRIORITY`.
2022-04-25 06:27:51 -07:00
Yakun Xu 013ab41291 [gcov] use __gcov_dump() instead for gcc 11 (#7629)
__gcov_flush is removed from gcc 11. This commit moves reset setup to a
single header file.
2022-04-25 06:23:00 -07:00
Jonathan Hui 79757a69f6 [meshcop] remove unnecessary MeshCoP:: qualifier (#7628) 2022-04-25 06:19:38 -07:00
Abtin Keshavarzian 8069b958d9 [mle] simplify security header processing (#7615)
This commit simplifies the MLE header processing. It defines
the `SecurityHeader` to represent the aux security header used
by MLE messages (when security suite is set to `k154Security`).
With this change the initial `SecuitySuite` and the MLE `Command`
fields are parsed and appended separately.
2022-04-22 14:14:47 -07:00
Abtin Keshavarzian f9e8b266f7 [mle] perform in-place AES-CCM encryption/decryption (#7614)
This commit adds a new method in `AesCcm` to encrypt/decrypt the
payload content in place within a given `Message`. This is then used
in `Mle` for processing MLE messages. This commit also updates unit
test `test_aes.cpp` to validate the new method.
2022-04-22 10:18:02 -07:00
Jonathan Hui 7284b3f183 [mle-router] fix HasOneNeighborWithComparableConnectivity() (#7617)
The `routerCount` value was being reset to zero with each iteration
over the router table. As a result, the comparisons were only
happening on the first entry in the received Route64 TLV.
2022-04-22 10:13:35 -07:00
Jonathan Hui 9b6ac4b5ac [meshcop] separate Network Name from Mac (#7609) (#7616)
With the removal of Thread payload from IEEE 802.15.4 Beacons, the MAC
layer no longer needs to maintain the Network Name.
2022-04-22 10:13:17 -07:00
Sam Kumar 7d04ff0a63 [tcp] add TCP circular send buffer API (#7584)
This commit introduces an API for the circular buffer library. While
we ultimately converged on the linked-buffer-based API that has been
merged into OpenThread, it was also discussed that we should provide a
circular buffer library that is implemented on top of the linked
buffer API, to support applications that find a circular-buffer-based
interface easier to use.
2022-04-22 10:02:01 -07:00
Sam Kumar d79468bb18 [tcp] add support for otTcpForwardProgress callback (#7583)
This commit adds support for the remaining TCP callback, which was not
yet supported.

Originally, the unimplemented callback was otTcpSendReady, which would
indicate to the application when new data added to the TCP send buffer
would be sent out immediately. There was also discussion of adding an
otTcpBytesAcked callback, which, together with the
otTcpSendByExtension() call, would allow a circular buffer to be
implemented efficiently on top of the otLinkedBuffer API.

Ultimately, it seemed best to generalize the otTcpSendReady callback
to include both cases where bytes are acked by the connection peer,
and where the send buffer drains, allowing new data to be sent
immediately. The reasoning behind this decision is that both the
otTcpSendReady and otTcpBytesAcked callbacks are triggered by the same
event --- an ACK received from the connection peer --- and that it may
require the application to have to "coordinate state" across
callbacks. Having a single callback function to indicate both
conditions seemed like it could simplify applications significantly.

The new, combined, callback is otTcpForwardProgress. This commit
implements support and documentation for this callback function.
2022-04-22 09:12:12 -07:00
Bob MacDonald 4bd7ab4b79 [cli] update dataset securitypolicy README (#7623)
Remove `b` option from documentation.
2022-04-21 10:25:46 -07:00
Simon Lin b5a347a3f9 [simulation] use 128 max children for simulation (#7620) 2022-04-21 09:28:58 -07:00
Jonathan Hui 515c3d3d80 [meshcop] separate Extended PAN ID from Mac (#7609)
With the removal of Thread payload from IEEE 802.15.4 Beacons, the MAC
layer no longer needs to maintain the Extended PAN ID.
2022-04-20 12:20:50 -07:00
Kangping 81f0c13b69 [posix] fix binding to interface for macOS (#7611) 2022-04-20 11:37:22 -07:00
Abtin Keshavarzian 5c8a9cb5bc [mesh-forwarder] collision avoidance delay mechanism (#7512)
This commit adds a new feature in `MeshForwarder` to add wait delay
after a successful frame tx to a neighbor which is expected to
forward the frame. This wait time applies before the next direct tx
to any neighbor on an FTD. This mechanism is intended to help prevent
self-interference when messages are sent to a destination that is
at least 2-hops away. This commit adds new OT build configs to
enable/disable this behavior and specify the wait interval
(default is set to 8 msec).
2022-04-19 11:05:24 -07:00
Simon Lin 1e9f6ebd95 [posix-netif] configure metric for prefix routes (#7605)
This commit allows configuring route metric for the prefix routes of
IPv6 addresses added to the Thread network interface.

This commit also simplifies `UpdateUnicastLinux` by using `AddRtAttr`.
2022-04-19 10:28:20 -07:00
Abtin Keshavarzian 82f5ab298b [message] update and simplify otBufferInfo (#7596)
This commit updates the `otMessageGetBufferInfo()` and its related
types. In particular, this commit adds `otMessageQueueInfo` to
indicate number of messages, number of data buffers, and total
message length (number of bytes) for all messages in the queue.
2022-04-18 19:53:43 -07:00
Abtin Keshavarzian 082aefc270 [random] move Random::Manager in ranadom.hpp (#7603)
This commit moves and renames the `Random::Manager` class to
the `random.hpp` header file (deleting the `random_manager.hpp`).
It also moves the implementation of some the `Random` functions
e.g. `GetUint8InRange()` or `FillBuffer()` (which are more complex)
to the `cpp` file (instead of defined as `inline`)
2022-04-18 15:37:46 -07:00
Abtin Keshavarzian a820a55294 [settings] update Dataset related methods to use Dataset::Type (#7602) 2022-04-18 15:33:47 -07:00
Abtin Keshavarzian 4b864f78a1 [tmf] use priority message for ServerData and AddressRelease (#7601)
This commit changes to use Thread control traffic priority level
for "Server Data" and "Address Release" TMF messages.
2022-04-18 15:32:37 -07:00
Abtin Keshavarzian 767e9fd627 [mle] reject ChildIdResponse if included dataset TLV is ill-formed (#7599)
This commit contains the following changes:

- The `Dataset` method which reads the dataset TLVs from a message
  is renamed to `ReadFromMessage()` and after reading the TLVs, it
  also checks that the TLVs in the Dataset are valid (well-formed).
- The `Active/PendingDataset::Save()` methods are updated to return
  error in the case the parsed dataset is not well-formed.
- The `Mle::HandleChildIdRequest()` rejects the response if the
  included dataset is not well-formed. This ensures that device
  stays detached if it cannot accept and save the dataset it gets
  from the parent candidate.
2022-04-18 15:32:15 -07:00
Abtin Keshavarzian 758f342a29 [netdata] update srp/dns anycast entry seq num selection (#7488)
This commit enhances the selection algorithm for the preferred entry
when there are multiple "DNS/SRP Service Anycast" entries in the
Thread Network Data. The sequence number (which is `uint8_t`) is used
for selecting the preferred entry and the larger value is preferred.
The seq numbers are compared using "serial number arithmetic"
(RFC-1982) but if we have 3 or more entries the notion of a largest
seq number may not be well-defined under the "serial number
arithmetic" comparison (e.g., for `{10, 130, 250}` there is no
largest seq number since `130 > 10`, `250 > 130` and `10 > 250`). In
such a case the algorithm selects the entry with largest seq number
in normal sense.

This commit updates `FindPreferredDnsSrpAnycastInfo()` to implement
the new algorithm. It also updates `test_network_data` unit test to
add many test cases related to the selection algorithm.
2022-04-15 10:08:42 -07:00
Abtin Keshavarzian a08e627419 [srp-client] update how auto-start mode prefers netdata entries (#7503)
This commit updates the auto-start behavior in `Srp::Client` which
monitors the Thread Network Data entries to discover and select SRP
sever to register with. There are three types of entries in Network
Data and are selected in the order below:

1) Preferred unicast entries with address in service data,
2) Anycast entries (each having a seq number,
3) Unicast entries with address info included in server data.

This commit also defines `AutoStart` class which includes all the
state and data variables related to auto-start feature. It also
updates `test_srp_auto_start_mode` test to cover the newly added
behaviors.
2022-04-15 10:01:52 -07:00
Abtin Keshavarzian 90cd43ac1f [net-diags] set the sock addr based on dest in GetQuery response (#7593)
This commit updates how the `MessageInfo` for a "GetQuery" response
is prepared so that we use link-local source if the destination of
response is also using link-local.
2022-04-15 08:49:01 -07:00
Abtin Keshavarzian 73f28712b2 [mle-router] leader to handle "BR request" in an Address Solicit (#7578)
This commit adds support for new Status TLV values and updates
the processing of Address Solicit request messages on leader.

The new status `kBorderRouterRequest` can be used by a BR to request to
upgrade to router role. If there are fewer routers than "router
upgrade threshold" leader will accept the request. If the number of
routers is more than the threshold but less than max, the leader will
accept the BR request only if the number of current Border Routers
(as indicated by Network Data) that are acting as router is less than
two (thus allowing up to two BRs to use this status reason to become
router when already above the threshold).

The other change in this PR, is that when processing Address Solicit
request if the included status value is not known or invalid, a
response with `kUnrecognizedStatus` status is sent.
2022-04-14 09:57:39 -07:00
Abtin Keshavarzian ba5ebc7296 [tmf] add Tmf::MessageInfo (#7589)
This commit adds `Tmf::MessageInfo` which is a sub-class of the
`Ip6::MessageInfo` class intended for use when sending TMF messages.
The peer port number is by default set to the TMF port from the
constructor. This class also provides helper methods for commonly
used patterns, e.g., source or `SockAddr` set to device's RLOC
address and/or the destination or `PeerAddr` set to leader ALOC or
RLOC, or a given address.
2022-04-14 09:26:43 -07:00
Zhanglong Xia 5e9f6f1e67 [diag] add diag rcp echo command (#7585)
There is no command that can generate different sizes of Spinel frames
for testing the SPI/UART interface. This commit adds a diag command
`diag rcp echo` to RCP for testing SPI/UART interface.
2022-04-14 09:06:49 -07:00
Abtin Keshavarzian d51eb07c62 [netdata] get the list or count of RLOC16s of border routers (#7543)
This commit adds a new method in `NetworkData` to find the list of
RLOC16 of all border routers providing external IP connectivity. A
border router is considered to provide external IP connectivity if it
has added at least one external route entry, or an on-mesh prefix
with default-route and on-mesh flags set. It also adds a method to
count the number of border routers. The methods allow filtering based
on the border router device role, including devices in any role, or
in router role only, or in child role only. This commit also updates
`test_network_data` unit test to validate the behavior of the newly
added methods.
2022-04-12 12:36:22 -07:00
Simon Lin 0c754bb09d [logging] add log level platform handler (#7545)
Adds a log level platform handler that allow platform code to handle
OT log level changes.
2022-04-12 12:36:00 -07:00
Gatien Chapon 1c1a583d78 [spinel] map kMaxSpinelFrame to SPINEL_FRAME_MAX_SIZE (#7580)
The current implementation does not differentiate the max spinel frame
size that is used to pack a spinel command and the radio spinel RX
frame buffer size which could contain multiple frames.  In
radio_spinel_impl.hpp, only one spinel frame can be written when
calling function `SendCommand` or `SendReset`.

Therefore the aim of this commit is to allocate, in such a context,
only a buffer of one frame instead of a buffer that could contain
multiple frames.

Signed-off-by: Gatien Chapon <gatien.chapon@nxp.com>
2022-04-12 11:56:23 -07:00
hemanth-silabs 9a93a33a12 [crypto] update emplace method to expect read failure during key export (#7559)
EmplaceSecurelyStoredKeys tries to read the network key and PSKc from
secure storage to update the TLVs and asserts if the read fails. But
if the device was previously running a non-PSA application, it won't
have the keys in secure storage, and the device asserts.

This commit provides a way to move the the keys to secure storage, if
the ExportKey fails. Once it is moved to secure storage, literal key
stored in the settings is cleared.
2022-04-12 11:54:41 -07:00
Abtin Keshavarzian fbba1e4ede [test] update SRP name conflict test to cover more cases (#7588)
This commit updates `test_srp_name_conflicts.py` to cover the
situation where different clients try to register services with the
same service instance label but under different services.
2022-04-12 09:24:27 -07:00
Abtin Keshavarzian a2106646bc [mesh-forwarder] keep msgs during address resolution in mSendQueue (#7577)
This commit updates how the messages waiting for address query
resolution are processed and queued. It adds a boolean flag in
`Message` metadata to indicate whether or not a message is waiting
for an address query resolution. Messages that require address query are
marked and kept in `mSendQueue` instead of being placed in a
different queue `mResolvingQueue`. When the address is resolved the
messages are updated accordingly. This ensures that the order of
messages in `mSendQueue` are preserved.
2022-04-12 09:22:23 -07:00
Simon Lin cbd1d50995 [otci] support filter new log formats (#7586) 2022-04-11 14:08:39 -07:00
Kangping a0f00424b3 [srp-server] add more error tracing logs (#7582)
This commit add more error tracing logs to help identify where a
SRP service registration fails. The log format is also updated to
capitalize the first char to align with rest of the codebase.
2022-04-11 13:32:46 -07:00
Abtin Keshavarzian e71dc7bfc1 [test] update Cert_9_2_17_Orphan to make it more robust (#7581)
This commit updates `Cert_9_2_17_Orphan` packet verification to check
that the two leaders are sending MLE advertisement before checking
for child attach (Child ID response). The current test checked this
after the child attach but leader 1 is turned off 5 seconds after
the child is attached which may not be enough time to ensure rx
of an advertisement (which every 30 seconds on average).
2022-04-11 11:08:19 -07:00
Abtin Keshavarzian f538240cd2 [instance] move otMessageGetBufferInfo() impl to Instance (#7573)
This commit moves the implementation of `otMessageGetBufferInfo()`
from the `message_api.cpp` file to  `Instance` class.
2022-04-08 13:46:21 -07:00
Zhanglong Xia efedbe9784 [cli] allow to run factoryreset under the diag mode (#7566)
Before starting a test case, our test script calls the `factoryreset`
to make the device enters a known state . But the previous test case
may fail to call the `diag stop` before exiting. This case the next
test case failed to call the `factoryreset `.

This commit allows the users to call `factoryreset` under the diag
mode.
2022-04-07 15:03:16 -07:00
Jonathan Donald a9b4e637f9 [docs] community discussion change (#7507)
Replace link to openthread-users Google Group with link to GitHub
OpenThread Discussions, clarify issue reporting links.
2022-04-07 13:29:08 -07:00
Abtin Keshavarzian fe0258cbec [mesh-forwarder] update LogMessage() to include ECN from IPv6 header (#7562)
This commit adds a helper `Ip6::EncToString()` and updates logging of
messages in `MeshForwarder` to include the ECN field from IPv6
header.
2022-04-07 13:09:05 -07:00
Eduardo Montoya 5eb0537cf0 [thci] increase BBR Sequence Number when dataset changes (#7558)
Make sure BBR Sequence Number is increased when Re-registration
Delay or MLR Timeout changes.
2022-04-07 11:46:06 -07:00
Sam Kumar cda71d1b25 [tcp] remove extraneous #define and restrict inclusion of TCPlp headers (#7570)
* remove extraneous #define
* restrict inclusion of `third_party/tcplp/tcplp.h`
2022-04-07 10:42:17 -07:00
jinran-google 97a7910172 [posix] stop setting up and de-initializing uninitialized modules when dry run (#7550)
Initialization of these modules is not called when dry run, so setup
and de-initialization should not be called either.
2022-04-07 10:37:48 -07:00
Jonathan Hui 9be687a1d0 [mbedtls] move mbedtls to 2.28.0 LTS version (#7539)
- Squashed 'third_party/mbedtls/repo/' content from commit 23e9e0bd2

git-subtree-dir: third_party/mbedtls/repo
git-subtree-split: 23e9e0bd2c7d1b5496773356d5a2c0c56d722d93

- update Makefiles
- update `check-android-build`
2022-04-07 10:35:51 -07:00
Abtin Keshavarzian fdf3c3034f [ip6] new methods in Header and add unit test (#7561)
This commit adds new methods in `Ip6::Header` to get and set Traffic
Class, Flow fields. It also updates and renames some of the existing
methods. This commit also adds a unit test `test_ip6_header` to
validate the IPv6 header parsing and preparation.
2022-04-06 13:47:48 -07:00
Eduardo Montoya 47fd27be3e [mac] remove beacons payload (#7472)
Thread Specification v1.2.1 removes support for Thread Beacons payload.
2022-04-06 12:18:22 -07:00
whd a8b4fbb189 [tests] disable check in test_firewall.py (#7569)
The test failed when verifying that HOST sends a ping packet to BR
while the destination is a link local address. That requires adding a
route on HOST before the ping. In this specific step, HOST added a
route to link local prefix going to BR. However, HOST failed to send
the echo request to BR using this newly added route. Since the impact
of disabling this step is small, I'll skip this step as for now and
look for a long term fix in the future.
2022-04-05 21:22:19 -07:00
Abtin Keshavarzian 5290a2aed0 [message] static assert Meatdata::mPriority is of proper bit size (#7563) 2022-04-04 22:11:53 -07:00
Abtin Keshavarzian bb533e34d3 [message] add timestamp field in Message metadata (#7554)
This commit adds a `TimeMilli mTimestamp` field in `Message` metadata.
This replaces the `mTimeout` which was used during lowpan and/or IPv6
fragment reassembly to drop the message if the next fragment is not
received within a time window.
2022-04-03 18:13:24 -07:00
Eduardo Montoya 01ff8952ab [thci] do not set P_slaac flag for Domain prefix (#7557)
According to the Thread Specification the `P_slaac` flag should be
set to false for the Domain prefix.
2022-04-03 18:11:38 -07:00
Abtin Keshavarzian 7dfde1f129 [mesh-forwarder] fix and enhance LogMessage() (#7556)
This commit updates `LogMessage()` in `MeshForwarder`:
- Fixes `MessageActionToString()` so when there is a passed-in error
  it correctly returns the related action string (and only when
  `aAction == kMessageTransmit` it returned "Failed to send").
- Changes the order of parameters in `LogMessage()` and uses default
  value for parameters to simplify its use.
2022-03-31 22:03:52 -07:00
Łukasz Maciejończyk c6a767579f [sub-mac] fix semiWindow overflow in GetCslWindowEdges() (#7549)
Prevent possible overflow in semiWindow calculation by converting
it to uint64_t accuracy.
2022-03-31 21:34:17 -07:00
Abtin Keshavarzian 309073109f [ip6] set priority on fragments when fragmenting an IPv6 datagram (#7555)
This commit updates `Ip6::FragmentDatagram()` to set the priority on
every fragment message to match the original IPv6 message. This
ensures that as fragments are enqueued in the priority queue they
follow the same priority as the original IPv6 message.
2022-03-31 21:32:43 -07:00
Abtin Keshavarzian 42eb77807d [ip6] copy the parsed ECN value from IPv6 msg in MessageInfo (#7548)
This commit changes `Ip6::HandleDatagram()` so to copy the ECN value
parsed from IPv6 header of the message in the accompanying
`MessageInfo` data structure.
2022-03-31 21:28:10 -07:00
Abtin Keshavarzian 03876128a9 [ip6] add header ip6_types.hpp for common types and constants (#7547)
This commit adds new header file `ip6_types.hpp` which include
common IPv6 related types (enumerations) and constants. It also
moves the `Ecn` constants and define them as an `enum`.
2022-03-31 21:27:42 -07:00
Abtin Keshavarzian 35a568eee5 [mle] simplify sending/processing of address solicit/response (#7544)
This commit contains smaller enhancements in `MleRouter` related to
preparation and handling address solicit request/response:

- Simplify router id allocation logic (if RLOC16 is requested
  in the address solicit message).
- Simplify `SendAddressSolicitResponse()` (remove `error`).
- Update logs.
- Remove simple comments.
2022-03-31 21:21:55 -07:00
alexandru-porosanu-nxp 5eb973ce00 [build] enable coexistence parameter build (#7540)
This commit enables defining
OPENTHREAD_CONFIG_PLATFORM_RADIO_COEX_ENABLE, which can be used by
external build system (i.e. Matter) to override the platform
defaults. This is useful for platforms having transceivers that also
support coexistence between multiple protocols (WiFi/BLE etc.)`
2022-03-30 22:13:39 -07:00
Eduardo Montoya f9f316314b [bbr] revert add bbr skipseqnuminc command for reference device (#7534)
This reverts commit c9066b6506 (#7283).
2022-03-29 22:16:53 -07:00
Yi 1091b947dc [routing-manager] update legacy comments in routing manager (#7533)
This commit updates some legacy comments when evaluating routing
policy, especially about the legacy Router Advertisement timer.
2022-03-29 22:15:59 -07:00
Diego Ismirlian 4f2013f647 [commissioner] add cli command to print joiner list (#7521) 2022-03-29 22:14:28 -07:00
Eduardo Montoya b489c35769 [mle] avoid setting mode D flag on MTD builds (#7519)
When building with `OPENTHREAD_MTD` make sure that the device is not
configured as Full Thread Device, whether by the API or by the stored
settings.
2022-03-29 22:13:07 -07:00
jinran-google 7e4ada6f16 [settings] reserve settings keys for vendor use (#7532) 2022-03-29 00:10:27 -07:00
Abtin Keshavarzian 2b2534cc76 [mle] change Restore() to return void (#7537) 2022-03-28 21:07:34 -07:00
Eduardo Montoya 3be955b28b [logging] fix log level for LogCacheEntryChange (#7535)
Fix not matching macro.
2022-03-28 12:58:02 -07:00
Kangping ac311759d2 [net-diag] fix kChildIdMask value (#7531) 2022-03-28 12:36:03 -07:00
Abtin Keshavarzian 8d3d19d1db [cli] add link to tcp command README_TCP.md in the main doc (#7528) 2022-03-28 12:34:29 -07:00
Jonathan Donald 3350f598f6 [docs] add Infineon to list of contributors (#7523) 2022-03-25 15:18:00 -07:00
Abtin Keshavarzian f95bddcef4 [mle] add kBetterParent in AttachMode enum (#7524)
This commit adds a new enumerator `kBetterParent` in `AttachMode`
enumeration. This new value is used by periodic parent search
feature only when searching for a better parent to help make
it explicit that attach process is started for this purpose.
2022-03-25 15:17:01 -07:00
Abtin Keshavarzian 018f54f71b [mle] renames and smaller changes (#7515)
This commit contains small changes in `Mle`:

- Renames `mParentRequestMode` to `mAttachMode` (to match its type).
- Shortens `ParentRequestType` enumerator names.
- Changes `SendParentRequest()` to return `void`.
- Adds a protected method `Mle::Attach()` (which replaces
  the `BecomeChild()`).
- Moves `AttachMode` enum as a protected definition in `Mle`
  class itself and renames the `AttachMode` constants.
2022-03-25 12:10:06 -07:00
jinran-google 91344f31b7 [posix] expose platform settings interfaces (#7495)
This commit adds the `src/posix/platform/settings.hpp` file to make
other components able to access the POSIX data file, so that secure
settings implementation can use the same file as platform settings.
2022-03-25 09:44:07 -07:00
jinran-google c9f23ccdda [settings] set sensitive keys in platform settings initialization (#7496)
This commit makes the core pass the sensitive keys to the platform
settings initialization, so that the platform settings implementation
can know which keys are sensitive keys during the initializing and do
the migration when needed.
2022-03-24 21:22:32 -07:00
jinran-google 11e2df8efc [cmake] add option to enable secure settings API (#7517)
This commit adds an option to the POSIX platform CMake module to turn
on/off the secure settings API.
2022-03-24 15:37:46 -07:00
Abtin Keshavarzian eca7675acb [radio-spinel] fix GetNextTid() (#7516)
This commit updates `GetNextTid()` in `RadioSpinel` so that it
searches for the next unused TID. The current implementation only
checked the `mCmdNextTid` and assumed that if it was in-use, then all
other TIDs were also in-use. This may not be valid since a TID may be
in-use for a pending radio tx in `mTxRadioTid` while TIDs after that
are still available.

This should help address the situation where while waiting for a
pending radio tx (holding on to `mTxRadioTid`) 15 other radio API
calls happen (each consuming a TID) causing the `mCmdNextTid` to wrap
around back to `mTxRadioTid`.
2022-03-23 23:08:20 -07:00
Abtin Keshavarzian 35ff12215f [mac] log AddressFiltered rx errors at debug level (#7514)
This commit changes the log level used by `Mac` to log frame rx error
when error is `kErrorAddressFiltered` (from "info" to "debug" log
level). This error is used when the frame is filtered `Mac::Filter`.
This helps reduce the logs during simulation/testing when allow-list
or deny-list are used to form specific network topology.
2022-03-23 20:51:58 -07:00
Abtin Keshavarzian 119df62cbd [netdata] update Service::DnsSrpUnicast to include Origin (#7498)
This commit updates `NetworkData::Service::DnsSrpUnicast` to indicate
`Origin` of the entry, whether the server IPv6 address and port
number is included as part of service data or server data. This will
be used by clients to prefer entries with the info in service data
(which coveys the infra-structure provided (authoritative) server)
over the ones in server data (which are used by Thread BRs).

This commit also updates the unit test `test_network_data` to validate
the new behavior.
2022-03-23 13:17:53 -07:00
Jonathan Hui a53893a334 [message] change GetDirectTransmission() to IsDirectTransmission() (#7510) 2022-03-23 13:17:14 -07:00
Jonathan Hui 8f459133c6 [mle-router] fix uninitialized message in SendChildUpdaateRequest() (#7509) 2022-03-23 13:16:58 -07:00
Abtin Keshavarzian 0402bc8183 [mesh-forwarder] rename method to PrepareNextDirectTransmission() (#7508)
This commit renames the method `MeshForwarder::GetDirectTransmission`
to `PrepareNextDirectTransmission()`. This is to help make this method
different from `Message::GetDirectTransmission()` (which indicate if a
`Message` is marked for direct tx).
2022-03-22 21:37:33 -07:00
Eduardo Montoya 95aaae9fdb [thci] fix RA configuration for eth0 in the host device (#7506)
`accept_ra` was not being set properly for host reference device.

Some cleanup is added for simplification.
2022-03-22 21:25:25 -07:00
Abtin Keshavarzian 6992c0177b [mesh-forwarder] remove assert in HandleFrameRequest()` (#7502) 2022-03-22 14:36:17 -07:00
Abtin Keshavarzian 255a326b10 [toranj] add support for CLI based test-cases (#7258)
This commit updates `toranj` test framework to add support for writing
CLI based test-cases (in addition to existing model which uses OT NCP
build along with `wpantund`/`wpanctl`).
2022-03-22 14:28:08 -07:00
Kangping bc6ce12f03 [routing-manager] resend failed RS messages in 4 seconds (#7504)
Current `Routing Manager` implementation will try to send the failed
RS messages in 60 seconds.  RS failures happen often when the infra
interface is re-enabled which is the case of rebooting, and it could
not be acceptable for the border router to take 1 minute to recover
the IPv6 connectivity after reboot.

To resolve this issue, this commit changes the delay to
`kRtrSolicitationInterval` (4 seconds) which is the interval between
two successful RS messages.
2022-03-22 14:26:12 -07:00
Abtin Keshavarzian 237c91b939 [message] add range-based for loop for message/priority queue (#7481)
This commit adds support for range-based `for` loop iteration over
`MessageQueue` and `PriorityQueue`. It adds `ConstIterator` and
`Iterator` in `Message` class. The non-const `for` loop iteration
(which uses `Message::Iterator`) works properly and is safe to use
even when the entry is removed from the queue during iteration. This
commit updates other core modules to use the new `for` loop iteration
model which helps simplify the code. It also updates the unit tests
to validate the behavior of the newly added iteration mechanisms.
2022-03-21 09:28:12 -07:00
Eduardo Montoya c24e5dd6c4 [thci] selectively configure Domain Prefix advertisement on the host (#7491)
Implement changes in `setupHost` method to be able to selectively
configure the RA for the Domain Prefix.
2022-03-21 09:27:02 -07:00
andrei-menzopol 687e04f6d4 [ecdsa] integrate TinyCrypt ECC operations (#7454) 2022-03-18 12:10:20 -07:00
sarveshkumarv3 5ee837efbb [crypto] compilation fix for clang10 -Wdeprecated-copy (#7487)
Deleting a copy constructor without specifying an explicit assignment
operator causes an error in clang10 (-Wdeprecated-copy). Since
explicit assignment operator defined in
OPENTHREAD_CONFIG_PLATFORM_KEY_REFERENCES_ENABLE case, added the copy
constructor deletion also under the same. If the macro is not enabled,
implicit copy constructor and assignment operator would take effect.
2022-03-17 22:18:30 -07:00
Simon Lin fba6bc90e6 [github-actions] set fail-fast: false for matrix (#7490)
This commit sets `fail-fast: false` for matrix in GitHub Actions so
that tests in a matrix do not fail all at once. It's more convenient
now that we can re-run failed tests.
2022-03-17 21:36:46 -07:00
Simon Lin 0bc886a468 [routing-manager] fix BR can't send RA in the first 3 seconds (#7489) 2022-03-17 21:35:03 -07:00
Abtin Keshavarzian 9f30e04981 [dataset] use AsCoreType() in Generate() (#7483) 2022-03-16 18:02:10 -07:00
Jonathan Hui 289d137640 [doxygen] fix inconsistencies (#7480) 2022-03-15 12:54:35 -07:00
Simon Lin 549b02e11c [routing-manager] add minimal delay between RAs (#7473)
This commit adds minimal delay (3 seconds) between consecutive Router
Advertisements according to `6.2.6.  Processing Router Solicitations,
RFC4861`.
2022-03-15 12:47:26 -07:00
Abtin Keshavarzian dd4ce786a8 [mle] add HasAcceptableParentCandidate() and refactor code (#7470)
This commit adds `Mle::HasAcceptableParentCandidate()` method
which is used to during attach process after sending an MLE Parent
Request message and waiting for the proper delay (i.e., when attach
timer fires) to determine whether or not we have found an acceptable
parent candidate.

This is a refactor of the existing code with no change in behavior
with goal of making the code easier to read (all the conditions that
are checked when deciding to accept a parent candidate).
2022-03-14 14:39:47 -07:00
Abtin Keshavarzian 4dddcb673c [tcp6] use range-based for when iterating over lists (#7479) 2022-03-14 12:19:04 -07:00
Eduardo Montoya 15a9c4c0bd [thci] unify IPv6 prefix representation (#7477)
Switch to IPv6 dotted-quad format in all uses.
2022-03-14 11:25:07 -07:00
Abtin Keshavarzian ea28a1913b [mle] add RemoveDelayedMessage() helper method (#7476)
This commit adds `Mle::RemoveDelayedMessage()` helper method which
removes messages with a given sub-type and an optional destination
IPv6 address from the `mDelayedResponses` message queue.
2022-03-14 10:52:54 -07:00
Abtin Keshavarzian fc523bc0d9 [mle] add SendDelayedResponse() method (#7475) 2022-03-14 10:50:07 -07:00
Jonathan Hui 0a74d66fed [doxygen] change inout to in,out (#7461) 2022-03-10 14:34:20 -08:00
Eduardo Montoya c16abe00e6 [csl] adjust polling closer to the CSL Timeout end (#7463)
Thread Certification Harness makes use of CSL Timeout configurations
as low as 10 seconds, with the expectation that the SSED will try to
autosync very near to the end of the CSL Timeout.

However, the default configuration is to send a Data Request 4 secs
before, which makes several certification tests to fail due to
unexpected polling.

This commit sets the default `pollAhead` to 1 second, aligning better
with the certification testing expectations.

For the on field deployments it shouldn't be an issue that the Data
Request does not reach the parent exactly before the CSL Timeout
expiration since it will resynchronize anyway once one of the
retransmissions reaches the parent.
2022-03-10 14:00:33 -08:00
Yi b34f2a3fd3 [tests] replace ifconfig command with ip command in node.py (#7471)
This commit replaces `ifconfig` command with `ip` command in node.py
for testing. `ifconfig` is not available on BR when bind9 is disabled.
2022-03-10 06:54:50 -08:00
Abtin Keshavarzian 15d25eed7f [multi-radio] add mechanism to timeout last received frag tag (#6522)
This commit adds a new mechanism in `Neighbor` to timeout the last
received fragment tag being tracked per neighbor. The fragment tag is
used when `MULTI_RADIO` is enabled to suppress duplicate received
frames (over different radios).
2022-03-09 19:33:06 -08:00
Yi 304caab7ba [nat64] allocate NAT64 prefix and OMR prefix from the same /48 BR ULA prefix (#7436)
This commit updates the local NAT64 prefix and OMR prefix to be
allocated from the same /48 BR ULA prefix. The /48 prefix is generated
randomly and is saved in Settings for recovery. The subnet id of
prefixes are statically assigned to avoid conflict with each other in
a simple way.
2022-03-09 14:33:44 -08:00
Abtin Keshavarzian 9021935bcc [log] add OT_SHOULD_LOG_AT(aLevel) (#7456)
This commit adds new helper macro `OT_SHOULD_LOG_AT(aLevel)` which
indicates whether logging is enabled at a given log level. This helps
simplify the code and makes sure the the condition used for enabling
logging related functions/methods is consistent across all the core
modules.

With this change, when `OPENTHREAD_CONFIG_LOG_OUTPUT` is set to
`LOG_OUTPUT_NONE` (which practically disables all logging), all the
related code/methods that are used to prepare the log line
(e.g. `Mac::OperationToString()`) are excluded from the build
(become empty functions/methods). This way, under `LOG_OUTPUT = NONE`
instead of preparing the log line and then passing it to an empty
`otPlatLog()` implementation to be dropped, the code is optimized to
not prepare the log line in first place.
2022-03-09 10:38:50 -08:00
Eduardo Montoya 73eba74fc8 [thci] avoid further delay after ping command (#7457)
Test L5.3.5 is failing sometimes because there are unwanted data
requests during the second ping round. This can be mitigated by
finishing earlier with this round so there is no need for children
to synchronize CSL.
2022-03-09 08:45:38 -08:00
Abtin Keshavarzian b6cc940634 [mac] feature to add delay on no-ack error before tx retry (#7346)
This commit adds a new feature in `SubMac` to add random delay before
frame retransmissions. The delay is added only if the previous tx
resulted in `kErrorNoAck`. A backoff algorithm similar to one used
for CSMA is used to determine the random delay, i.e., starting with a
min backoff exponent (BE) which is incremented each time delay is
added up to a max backoff exponent. The backoff interval is derived by
selecting a random value from `[0, 2^BE]` range multiplied by
`kUnitBackoffPeriod=20` times radio symbol time (20x16=320 usec).
The `OPENTHREAD_CONFIG_MAC_ADD_DELAY_ON_NO_ACK_ERROR_BEFORE_RETRY`
is added to enable this behavior (which is enabled by default).
This commit also adds other configs for this feature including
minimum and maximum backoff exponents (the values are from Thread
1.3 spec recommendations).
2022-03-08 17:58:30 -08:00
Abtin Keshavarzian 9475bce07a [srp-server] allow any number of host addresses (use Heap::Array) (#7420)
This commit changes the `Srp::Server` definition to use `Heap::Array`
to store the list of IPv6 addresses associated with a given `Host`.
This makes the array length dynamic and removes the need for
specifying a hard limit on the number of addresses and allow us to
remove `OPENTHREAD_CONFIG_SRP_SERVER_MAX_ADDRESSES_NUM` config.
2022-03-08 17:55:02 -08:00
Abtin Keshavarzian 4b31f57014 [common] adding Heap::Array<Type> a heap allocated flexible-length array (#7420)
This commit adds `Heap::Array<Type>` class which allocates the
buffer to store array elements from the heap. The `Array`
implementation automatically grows the buffer when new entries
are added. It also provides optional method `ReserveCapacity()`
to allow user to allocate and reserve a certain capacity
(number of elements user expects to add).

The `Array` can safely be used with element `Type`s that are
themselves heap allocated (manage allocated items). The `Array`
implementation uses the move constructor and destructor of the
`Type` class to ensure that copying the entries when growing the
array is performed efficiently and that the removed entries are
properly deleted.

The `Array` implementation also provides helper methods to search
in the array, e.g., `Find()`, `FindMatching()`, `Contains()`, and
`ContainsMatching()`. It also supports range-based `for` loop
iteration.

This commit also adds a detailed unit test `test_heap_array` which
covers behavior of `Array` with a simple `uint16_t` entry type and
a more complex entry type (validating the constructors and destructor
of entry are properly invoked by `Array` implementation).
2022-03-08 17:55:02 -08:00
Eduardo Montoya 465518ec64 [thci] find IPv6 border agents only (#7452)
Without this fix some Border Agents will not send mDNS responses
with AAAA record for IPv6 link local address.
2022-03-08 17:25:35 -08:00
Abtin Keshavarzian a83d90702f [test] address uninitialized reference use warning (#7459)
This commit addresses "uninitialized reference use" warning in
`test_data`.
2022-03-08 17:22:02 -08:00
Abtin Keshavarzian 05d8e81988 [dns-client] add support address resolution query for IPv4 directly (#7441)
This commit adds a new mechanism in `Dns::Client` along with a new
public OT API `otDnsClientResolveIp4Address()` and its related CLI
sub-command to allow a user to request an address resolution DNS
query specifically for A records or IPv4 addresses for a given host
name.

This API requires `OPENTHREAD_CONFIG_DNS_CLIENT_NAT64_ENABLE` to be
enabled. Upon receiving a successful query response the addresses are
reported to user (in callback) as NAT64 IPv6 translated version of
the IPv4 addresses from the received query response.

The new API is added in addition to the existing behavior where address
resolution query from `otDnsClientResolveAddress()` first queries for
IPv6 addresses and only if no IPv6 address is found and NAT64 is
enabled and allowed by the query config, `Dns::Client` implementation
tries to perform an IPv4 query. The new API directly starts with IPv4
query and can be useful in situations where Thread devices are
connected through BRs to a network without global IPv6 connectivity.
2022-03-08 17:18:44 -08:00
Łukasz Maciejończyk 2612fbc927 [ip6] forward IPv6 fragments only if reassebling is disabled (#7449)
IPv6 fragments are unconditionally forwarded to the host even if the
option: OT_IP6_FRAGM for internal reassembling is enabled. It results
with e.g. for RCP echo request are handled twice, by the OpenThread
and by the host.

This commit changes it in this way that when OT_IP6_FRAGM is enabled
IPv6 fragments are not forwarded to the host any more but handled
internally only. When OT_IP6_FRAGM is disabled the IPv6 fragments are
always forwarded to the host. This case is especially important for
NCP architecture with spinel maximum frame size limitation (1500B).

Now the option: OT_IP6_FRAGM should be disabled for NCP to allow
forwarding IPv6 fragments to the host.
2022-03-08 09:21:39 -08:00
whd dbf475f066 [tests] add a multi-BR DNS-SD server test case (#7453)
I just found that we don't have a test case covers the scenario of
DNS-SD when there are multiple BRs. Specially, one of the BRs starts
with no mDNS cache.

There was a time that our mDNS publisher answered the queries
correctly, even when there was a bug in mDNS publisher that it
cancelled resolving/browsing too early (was fixed in
https://github.com/openthread/ot-br-posix/pull/1120). That bug was
hidden because mDNS cache already contained the needed information.
2022-03-07 22:07:00 -08:00
Eduardo Montoya db0833f73c [thci] fix setBbrDataset (#7455) 2022-03-07 10:17:25 -08:00
Simon Lin 6bb9631e80 [doxygen] add missing @def OPENTHREAD_CONFIG_TMF_PROXY_MLR_ENABLE (#7450) 2022-03-02 22:30:09 -08:00
Simon Lin 417b5645be [thci] support ssh connection with root user (#7399) 2022-03-01 23:46:46 -08:00
Simon Lin fa79f38c02 [routing-manager] fix small OMR prefix election issue (#7405)
This commit fixes two small issues regarding OMR prefix election:
- This commit handles the case where `mLocalOmrPrefix` is already in
  Leader's Network Data, but not locally added. It is possible when
  the BR restores the Network Data from Leader. In such case the BR
  should re-add `mLocalOmrPrefix` to local Network Data so that it
  keeps advertising OMR Prefix. Otherwise, the OMR Prefix will be
  removed from Leader's Network Data because of Network Data
  inconsistentency, and then all BRs start to re-elect OMR Prefix. So,
  the change will make the OMR Prefix more stable in some corner
  cases.
- The change here checks if `mLocalOmrPrefix` was added to the Local
  Network Data, instead of checking if `mLocalOmrPrefix` is added to
  the Leader's Network Data. Here the BR has already decided that it
  should not be advertising `mLocalOmrPrefix`. Whether or not
  `mLocalOmrPrefix` is in Leader's Network Data is relevant. The BR
  only needs to remove `mLocalOmrPrefix` from Local Network Data and
  eventually Local Network Data will synchronize with Leader's Network
  Data. The original code also has a potential issue that the BR may
  send `NET_DATA.ntf` to Leader indefinitely when these conditions are
  met:
  - `mLocalOmrPrefix` was added to Local Network Data
  - `mLocalOmrPrefix` is not added to Leader' Network Data because
    there is no more space in Leader's Network Data
2022-02-28 15:55:35 -08:00
Abtin Keshavarzian 56873fe492 [test] fix test_ecdsa to use array of char as message string (#7446)
This commit updates `kMessage` in `test_ecdsa.cpp` function which
verifies the signature generation to be an array of char instead of a
`char *`. This ensures that the use of `sizeof(kMessage)` correctly
gives the length of the message string (which is used during hash
calculation).
2022-02-28 15:50:53 -08:00
Kangping 4275b26935 [tests] add advertising test case of removing a host (#7440) 2022-02-28 12:47:14 -08:00
Simon Lin a17d8800e9 [build] disable Commissioner by default in Android.mk (#7443) 2022-02-28 08:34:00 -08:00
Abtin Keshavarzian 41409d4b60 [dns-client] allow empty question section in response with error code (#7438)
This commit updates `Dns::Client` such that when parsing a query
response we allow and accept a message with empty question section if
the response code in header indicates an error. This ensures that the
`Dns::Client` can work with DNS name resolvers that may not echo back
the question section in case of an error response.
2022-02-27 22:12:20 -08:00
Simon Lin 13af8ad0a5 [otci] add srp_client_clear_service (#7442) 2022-02-27 22:10:48 -08:00
Simon Lin d79d0a99ac [logging] refine NOTE and WARN logs (#7369)
This commit refines `NOTE` and `WARN` logs:
- Certain `INFO` and `WARN` logs are changed to `INFO` since they are
  normal situations.
2022-02-25 21:28:00 -08:00
hemanth-silabs 0563240a2d [crypto] changes to dtls code to match mbedtls 3.1.0 (#7425)
Some of the private fields are changed to public again in MbedTLS 3.1,
update dtls to match these changes.
2022-02-24 19:39:56 -08:00
Abtin Keshavarzian 92ddd38777 [cli] use template Process<Cmd("command")> to simplify handlers (#7412)
This commit updates how the CLI command handlers are defined. A
template `Process<CommandId>()` method is now used to process a CLI
command where the `CommandId` is a `uint64` hash ID derived from
the command string itself.

This model helps simplify the CLI modules. With this change, there is
no need to declare different process methods for every CLI command in
the header files. It also makes the association between a CLI command
and its command string explicit and simple (e.g., `"state"` command
with `Process<Cmd("state")>` method).
2022-02-23 19:58:59 -08:00
Yakun Xu bdec466cee [build] remove unnecessary config files (#7414)
This commit removes unnecessary OPENTHREAD_CONFIG_FILE by only
including it when it's defined.
2022-02-22 12:44:06 -08:00
Abtin Keshavarzian ec02abc47c [spi-interface] send pending frame from WaitForFrame() (#7431)
This commit updates the `SpiInterface` implementation to send any
pending tx SPI frame from `WaitForFrame()` while waiting for a
response frame from RCP. This should help address rare RCP response
timeout which can potentially happen if RCP is not yet ready to
accept a frame in a first SPI transaction from a `SendFrame()` call
followed by a call to `WaitForFrame()`.

This commit updates the `WaitForFrame()` to reuse `UpdateFdset()` and
`Process()` methods which in turn handle the situation that central
is being rate-limited by the peripheral.
2022-02-21 22:18:05 -08:00
Jonathan Hui 2feb5c45ca [mle] drop Child ID Response if Router IDs do not match (#7430)
The Child ID Response message contains the RLOC16 that the Parent
assigns to the Child. Add a check to ensure that Parent's and Child's
Router IDs match. If the Router IDs do not match, drop the Child ID
Response message.
2022-02-21 17:42:39 -08:00
AdityaHPatwardhan ff848e7a20 [meshcop] update the DEPRECATED function mbedtls_ssl_conf_curves (#7415)
The commit updates the `mbedtls_ssl_conf_curves` with the new
alternative - `mbedtls_ssl_conf_groups`. The API has been deprecated
in `mbedtls-3.1` and will be removed in a future release. The code is
also kept backward compatible to support older versions.
2022-02-18 16:12:12 -08:00
Abtin Keshavarzian 52777e8f8d [mle] check router ID match when sending Child Id Response (#7428)
This commit updates the `SendChildIdResponse()` to check in the case
that the child already has a previously assigned RLOC16 that it
matches the current router ID of the parent and if not we assign a
new RLOC16 to it in the "Child ID response".
2022-02-18 13:51:44 -08:00
Abtin Keshavarzian 564982c818 [log] implement new logging model with module name support (#7385)
This commit implements new logging model in OpenThread. Each core
module can specify its own module name using `RegisterLogModule()`.
The registered log module name is then included in the all the log
messages emitted from the specific file. This model replaces and
enhances the log region model.
2022-02-17 15:50:45 -08:00
Eduardo Montoya f759d163dc [link-metrics] support at least one series per child (#7416)
Thread Conformance document requires a Link Metrics Subject to
support at least one Link Metrics series (forward or enhanced ACK)
per connected SED.

Make sure this is the default configuration.
2022-02-17 09:10:08 -08:00
canisLupus1313 91e1d9cfa3 [ip6] fix static code analysis errors (#7422)
This commit fixes issues found during static code analysis.
2022-02-16 10:57:37 -08:00
Abtin Keshavarzian 2e03d4dfa1 [ip6] rename aFromNcpHost to aFromHost (#7380) 2022-02-16 10:43:26 -08:00
Eduardo Montoya a727275259 [thci] move zeroconf execution to the commissioner device (#7419)
So far zeroconf was running on the Windows Harness server and there
was no control on which Ethernet interface to scan.
2022-02-16 10:24:13 -08:00
Abtin Keshavarzian 65d01a1b5d [config] rename config header file (#7402) 2022-02-15 21:26:32 -08:00
whd 6b6edf53f3 [tests] add a test case of mDNS service restarting (#7363) 2022-02-15 13:41:10 -08:00
Abtin Keshavarzian 7ec658e47a [common] add GetArrayLength() and GetArrayEnd() (#7413)
This commit adds two inline template functions to get the length of an
array and a pointer to the end of the array. These functions replace
similar macros that were used with OT core modules. The template
functions are safer to use since they would perform type checking at
compile time. The functions validate that the input variable is
indeed an array and unlike the macros they will not work with a
pointer variable.
2022-02-14 14:03:23 -08:00
Abtin Keshavarzian 49918c7f8e [mle] remove unnecessary usages of OT_UNUSED_VARIABLE() (#7411) 2022-02-14 13:55:40 -08:00
Yi a201e9d5d0 [tests] add tests for NAT64 prefix advertisement (#7361)
This commit adds tests for NAT64 prefix
advertisement. BORDER_ROUTING_NAT64 is set to 1 to enable the feature
in tests.

It also adjusted some util functions for prefixes and routes in
netdata.

Testing outbound connectivity to IPv4 hosts is not covered yet. It
will be added after we update OTBR.
2022-02-11 00:08:10 -08:00
Zhanglong Xia 5117c39f97 [posix] exit the program when creating a folder fails (#7407) 2022-02-10 12:35:59 -08:00
Simon Lin 9fcdbed9c5 [tests] make sure BRs not sending disallowed ICMPv6 in Thread traffic (#7357) 2022-02-09 20:21:16 -08:00
Li Cao af2082e122 [version] fix OPENTHREAD_BUILD_DATETIME in version string (#7398)
If `OPENTHREAD_BUILD_DATETIME` is defined by the build system, the
version string would be something like:

OPENTHREAD/20191113-03303-gbdeacdc55-dirty; NRF52840DK-engFeb 08 2022 13:05:38
                                                         ^^

We shouldn't put the separator in the macro, but put it in the version
string instead.
2022-02-09 17:23:09 -08:00
Abtin Keshavarzian adf4e84caf [trel] change TXT data format to use binary value (#7401)
This commit changes the TXT record data format to use binary value
for extended address and extended PAN ID entries.
2022-02-08 22:37:17 -08:00
Simon Lin 4fb966e3eb [otci] address small reliability issues (#7372)
This commit addresses several small reliability issues revealed during
testing.
2022-02-08 21:51:06 -08:00
Jonathan Hui b9ee08d87b [docs] update Thread version to 1.2 (#7404) 2022-02-08 15:17:14 -08:00
Jonathan Hui 9fb6b1b1d0 [docs] update Thread version in NOTICE (#7400) 2022-02-08 11:26:49 -08:00
Jonathan Donald afc55a384b [docker] remove codelab_otsim Dockerfile (#7396)
* Delete obsolete codelab_otsim Dockerfile
* Remove codelab_otsim from git Docker Action
2022-02-07 21:55:41 -08:00
Yakun Xu ad2bc74c12 [mle] fix comparing PAN ID to skip logging (#7390)
This commit adds a flag in Thread link info to indicate whether
destination PAN ID is broadcast.

Verified by running two simulation nodes (modified announce sender
interval) of different Thread networks and make sure there are no
logs of `[WARN]-MLE-----: Failed to process UDP: Security` when
receiving MLE Announce messages.
2022-02-07 21:41:15 -08:00
Yakun Xu bef3f6e024 [android] disable legacy support (#7391)
This commit disables the legacy network support.

Tested by GitHub workflow.
2022-02-07 10:51:31 -08:00
Jonathan Hui 74f5ab5c9f [docs] fix typos FLASE -> FALSE (#7389) 2022-02-03 20:17:17 -08:00
Sarah 3b79cb0d08 [docs] trel doxygen updates (#7386) 2022-02-01 17:21:06 -08:00
Jonathan Donald 297a880324 [docker] fix ot-daemon build in environment Dockerfile (#7378) 2022-01-31 20:39:07 -08:00
Sam Kumar 404093d9fe [tcp] add basic CLI-based test (#7336) 2022-01-31 20:33:06 -08:00
Jonathan Hui 074814be87 [github-actions] fix branch filter in OTNS workflow (#7382)
Also pin ubuntu image to 20.04.
2022-01-31 20:30:52 -08:00
Jonathan Hui dbcd04ef86 [crypto] add feature flag around kEntropyMinThreshold (#7381)
To avoid "unused variable" compiler warning.
2022-01-31 14:33:04 -08:00
Sam Kumar 216b40e4bf [tcp] improve logging in TCPlp (#7379)
* Avoid printf, and omit newline at end of tcplp_sys_log calls
* Add new tcplp_sys_panic call to use for assertion failures
* Fix code in "#ifdef INSTRUMENT_TCP" so that it can be used
2022-01-31 14:32:36 -08:00
JaneFromSilabs 9e0bf6a263 [thci] prefix fix for TH 1.1 border router 7.x.x cases (#7367) 2022-01-31 10:25:09 -08:00
Simon Lin ce77ab3c1d [github-actions] add OTNS stress tests (#5308)
This commit runs OTNS stress tests in OpenThread CI.
2022-01-29 10:32:14 -08:00
Simon Lin 40b5fd3749 [trel] small updates and adding trel test (#7205)
- Adds platform API `trelDnssdInitialize` to initialize TREL
  DNS-SD module.
- Adds `test_trel_connectivity.py` test.
- Fixed `Border Router` TREL test to really use TREL.
2022-01-28 12:07:42 -08:00
Abtin Keshavarzian 69ad96675f [trel] implement new TREL model using DNS-SD (#7125)
This commit implements the new TREL model which uses DNS-SD to
discover TREL peers on the network. This implementation replaces the
previous model which relied on link-local multicast.

This commit adds a new set of `otPlatTrel` APIs and callbacks that are
then used by an updated `Trel::Interface` implementation. The
`Trel::Interface` maintains a TREL peer table which is populated from
DNS-SD discovered services. A device supporting TREL registers a new
service to be advertised using DNS-SD with the service name
`_trel._udp`. It also initiates an ongoing DNS-SD browse for the same
service name within the local browsing domain to discover other
devices supporting TREL. `Trel::Interface` encapsulates and send
unicast frames as a unicast UDP message between TREL peers. Broadcast
frames are sent as a group of UDP unicast transmission to a sub-set
of TREL peers.

This commit also adds a new set of public APIs for TREL along with
support for them in CLI:
- APIs for enabling/disabling of TREL operation at run-time.
- Filter mode API which when enabled temporarily drops all the traffic
  on the TREL interface (is mainly intended for testing).
- APIs to get the TREL peer table entries.

This commit adds an implementation of the new `otPlatTrel` APIs under
`simulation` platform. This is used for testing. This implementation
emulates a simplified version of DNS-SD mechanism.

A basic implementation  of the `otPlatTrel` is also provided under
`posix` platform. However certain functions are tied to mDNS or
DNS-SD library being used on a device and need to be implemented per
project/platform. A set of weak empty functions `trelDnssd{}` are
defined (along with a description of the their expected behavior)
which can be overridden during project/platform integration.
2022-01-28 12:07:42 -08:00
Eduardo Montoya 1c6062c610 [thci] fix implementation of setKeepAliveTimeOut (#7373)
Thread 1.2 harness uses this method to set the child timeout in
DUA-TC-10, DUA-TC-21 and DUA-TC-22.
2022-01-28 12:00:53 -08:00
Łukasz Duda 925d9b657c [crypto] allow platform to define its own CSPRNG (#7355)
This commit provides the following changes:

 * Introduce a new `otPlatCryptoRandom*` API
 * Move usage of `mbedtls_entropy_*` and `mbedtls_ctr_drbg_*` out of
   ARM PSA enabled platforms
 * Stop exposing internal mbedtls contextes for entropy and CTR DRBG
   in OpenThread API

Signed-off-by: Lukasz Duda <lukasz.duda@nordicsemi.no>
2022-01-28 09:06:21 -08:00
Karthick 9f70bafd67 [thci] update registerMulticast to align with #7253 (#7364)
Enabling registration to multiple mcast addresses on the same command
line in THCI.
2022-01-28 08:21:03 -08:00
Simon Lin 9e17e471ad [thci] print traceback and re-raise exceptions (#7356)
THCI used to catch Exceptions and print errors using
`ModuleHelper.WriteIntoDebugLogger`. However, in most of time it just
help hide the actual issue and make it harder to debug.

Re-raising the exceptions should be a better approach:
- @API decorator will print the full exception Traceback via
  `ModuleHelper.WriteIntoDebugLogger` and then re-raise.
2022-01-28 08:14:59 -08:00
Abtin Keshavarzian c2773c3d8d [ip6] remove UNSECURE_TRAFFIC_MANAGED_BY_STACK_ENABLE config (#7358) 2022-01-27 22:05:58 -08:00
Jonathan Donald 7339a68684 [docker] modified environment Dockerfile to support Docker OT simulation (#7368)
* added inetutils-ping (provides ping6)

* modified Dockerfile to add binaries required by Docker OT simulation codelab
2022-01-27 22:04:04 -08:00
Sam Kumar 876aa82164 [tcp] add rewrite of TCPlp's interface code to support OpenThread's TCP API (#7190) 2022-01-27 21:48:52 -08:00
Sam Kumar a7b6eac41d [tcp] minor changes to FreeBSD-derived code for integration into OpenThread (#7190)
* update TCPlp #include guards to be TCPlp-specific

* do not use sys/queue.h in tcp_var.h, to avoid polluting global namespace

* avoid bitfields in TCP header structure

* use int32_t instead of int in tcpcb and reorder fields to eliminate padding
2022-01-27 21:48:52 -08:00
Sam Kumar 097ab86369 [tcp] update Android build to include TCPlp (#7190) 2022-01-27 21:48:52 -08:00
Yakun Xu 44d0c3c12a [spi] dump garbage in debug level (#7370) 2022-01-27 21:33:51 -08:00
Yakun Xu 5cd4392b6b [mle] no failing logs for broadcast security check (#7362)
This commit eliminates logging of broadcast security check failures
because it can be common to receive such messages from ajacent Thread
networks.
2022-01-27 13:15:16 -08:00
Yakun Xu 019e5ab4fa [cli] do not update aError which is not read (#7365)
This commit avoid setting aError which is not read.
2022-01-27 10:35:08 -08:00
Abtin Keshavarzian d71742049f [logging] remove otLogResult and move to module (#7360)
This commit removes the `otLogResult{Bbr/Platform}()` macros from
`logging.hpp` and instead have each module implement `LogError()`
method. The main goal behind this change to simplify the logging
module and reduce number of macros/definitions in it (to prepare for
new logging model to be introduced).
2022-01-27 10:29:09 -08:00
wohdo 69ed42f491 [coap] add 'otCoapMessageSetCode' (#7339) (#7351)
Provide a setter for the message code to change it after
initialization of the message.

This complements the existing getter function `otCoapMessageGetCode`.
2022-01-26 21:28:18 -08:00
Yi 5896eefc21 [nat64] withdraw greater NAT64 prefix in network data (#7337)
This commit enables BR to withdraw its local NAT64 prefix if a smaller
one is found in network data.

It might happen when two BRs join the Thread network at merely the
same time and thus both advertise its local NAT64 prefix. The BR with
numerically greater prefix will withdraw its NAT64 prefix.
2022-01-26 21:27:08 -08:00
Abtin Keshavarzian 137c40136c [commissioner] add Dataset and ResignMode (#7352)
This commit adds `Commissioner::Dataset` class which mirrors the
public `otCommissioningDataset`. It also adds `ResignMode` enum
which is used as input to `Stop()` method to indicate whether or
not to resign from being the commissioner.
2022-01-25 18:26:42 -08:00
Eduardo Montoya d4e041096f [bbr] implement new Sequence Number increase rules (#7342)
"BBR Sequence Number Updating" section in Thread Specification
requires special wraps when increasing BBR Dataset Sequence Number.
2022-01-25 18:20:36 -08:00
Abtin Keshavarzian 3ef867602e [address-resolver] add LookUp() method to check cache entries (#7350)
This commit adds `AddressResolver::LookUp()` method which resolves
an EID to an RLOC17 by checking if an existing entry already exists
in the address cache table.
2022-01-25 10:55:55 -08:00
Jiacheng Guo b943b250ab [ip6] always enable ICMP6 filtering when forwarding to Thread (#7343)
This will prevent unexpected multicast packets on the Thread network.
2022-01-24 22:13:07 -08:00
Abtin Keshavarzian 3243897cd1 [cli] add helper method to output a otMacFilterEntry (#7348)
This commit also adds `MacFilterAddressModeToString()`.
2022-01-24 10:13:17 -08:00
Abtin Keshavarzian 3e214bd17a [cli] inline simple sub-command process methods (#7347) 2022-01-24 10:10:58 -08:00
Abtin Keshavarzian ca3dd08f26 [mac] smaller style changes (#7341)
This commit contain smaller style changes in `Mac` and `SubMac`
2022-01-24 10:07:19 -08:00
Eduardo Montoya 9c6dc87ab7 [bbr] fix bbr skipseqnuminc command response (#7354)
`bbr skipseqnuminc` should complete without error.
2022-01-24 09:55:24 -08:00
JaneFromSilabs 4af585400e [thci] reset and multicast changes (#7340)
- THCI changes for bbr reset procedure to make a better effort to
  reset and to also make sure to restart the otbr-agent prior to
  attempting a factoryreset to cover the case where the agent cannot
  currently communicate to the rcp.

- THCI change to move from sudo service restart otbr-agent to sudo
  systemctl restart otbr-agent, which is more comprehensive.

- THCI changes for multicast to use ipmaddr in both soc and bbr cases.
2022-01-24 09:49:59 -08:00
Simon Lin 22bb1346fa [github-actions] add BR --radio-version test (#7345) 2022-01-24 09:48:40 -08:00
Zhanglong Xia 9a9083f20e [posix] add break to case statement (#7349) 2022-01-24 09:47:46 -08:00
Yakun Xu 215c459846 [script] support cmake-build in different dir (#7344)
This commit allows calling this cmake-build script from a different
directory. Currently it only supports root of OpenThread source.
2022-01-23 22:12:53 -08:00
Yakun Xu f113eb4b71 [script] support cmake-build in different dir (#7344)
This commit allows calling this cmake-build script from a different
directory. Currently it only supports root of OpenThread source.
2022-01-23 22:12:22 -08:00
Simon Lin aa1cf21bcf [github-actions] set fail-fast=false for border router tests (#7332) 2022-01-21 09:55:25 -08:00
Abtin Keshavarzian e04c8e3307 [common] add SerialNumber::Is{Greater/Less}>() (#7334)
This commit adds `SerialNumber` class which provides `static` methods
`IsGeater<UintType>()` and `IsLess<UintType()` to compare two serial
numbers, taking into account the wrapping of serial number values
(similar to RFC-1982). This is then used in `MleRouter` and other
modules. This helps us avoid casting of `uint` to `int` for the
comparison (such a casting is undefined behavior in C++11 though
toolchains often implement it as expected). This commit also adds a
unit test `test_serial_number` to validate the new methods.
2022-01-20 16:54:46 -08:00
Abtin Keshavarzian 72676c542e [netdata] add NetworkData::Type enum for full or stable subset (#7328)
This commit adds `NetworkData::Type` enumeration to indicate full set
or stable subset. It also adds helper method `GetNetworkDataType()`
in `Neighbor` and `Mle` to indicate what type of Network Data device
requests.
2022-01-20 11:50:18 -08:00
Simon Lin 0dccf05473 [otci] fix read error after close (#7331)
This commit fixes OTCI that CLI connection via serial may fail when
closing.
2022-01-20 08:56:47 -08:00
Sam Kumar 3fdaaab07c [tcp] fix minor bugs (#7335)
This commit fixes minor bugs in TCP.

1. The first change fixes a bug where the TCP CLI prints out an
incorrect message when a connection is terminated. This appears to
have been introduced in #7279.

2. The second change fixes a null pointer dereference when accepting a
TCP connection. This issue is purely theoretical at the moment,
because in the case where the dereferenced pointer is NULL, the
dereferenced value is not used, and so the compiler optimizes out the
memory access (so it seems). As a result, TCP actually runs without
issues. But I've fixed it anyway, to avoid depending on that behavior.
2022-01-19 19:56:13 -08:00
Abtin Keshavarzian 314e945bb6 [history-tracker] support tracking netdata prefix and route entries (#7324)
This commit adds a mechanism in `HistoryTracker` to track changes in
Thread Network Data maintaining a history of on-mesh prefix and
external route entries as they are added or removed by different
nodes in Network Data. This commit also adds new `cli history`
commands to retrieve the Network Data prefix/route history list and
updates the documentation in `cli/README_HISTORY.md`.
2022-01-19 16:35:40 -08:00
canisLupus1313 556cee64d3 [thci] add implementation of setVrCheckSkip in THCI (#7329) 2022-01-19 14:03:01 -08:00
Yi 37f9d171c0 [routing-manager] generate random nat64 prefix and add it to netdata (#7232)
This commit generates a random NAT64 prefix and adds the prefix to
NetworkData if none exits. The prefix will be saved in Settings for
recovery.

It also adds a new CLI command `br nat64prefix` to show the local
nat64 prefix.

A new config OPENTHREAD_CONFIG_BORDER_ROUTING_NAT64_ENABLE is defined
and used to guard the change.

This initial implementation only supports a single BR.
2022-01-19 00:35:10 -08:00
Jonathan Hui 6eff683369 [cli] add ability to show local network data (#7316) 2022-01-18 18:07:22 -08:00
Abtin Keshavarzian 30ec50c5d2 [mle] simplify management of service ALOCs (#7326)
This commit updates the handling of service ALOCs in `Mle` by adding a
new class `ServiceAloc` (subclass of `Ip6::Netif::UnicastAddress`)
which provides some simple helper methods (e.g., `IsInUse()` to
indicate whether the entry is currently added to `ThreadNetif`). It
also simplifies `UpdateServiceAlocs()` which adds and removes ALOCs
based on the service entries in the Thread Network Data. These changes
allow us to remove some service related methods from `NetworkData`
which are no longer needed or used (harmonizing how we iterate over
service entries in Network Data).
2022-01-18 17:40:46 -08:00
Abtin Keshavarzian 88973676c5 [continuous-integration] enable BORDER_ROUTING in some of build scripts (#7321)
This commit enables `OT_BORDER_ROUTING` feature in some of the
build scripts (e.g., `script/check-scan-build` or `make-pretty`) so
that it is covered by github actions workflow CI.
2022-01-18 16:41:59 -08:00
Jonathan Hui 871a7125c9 [dataset] accept too small Rotation Time in Security Policy TLV (#7323)
Existing deployed networks may have Operational Datasets where the
Security Policy TLV includes a Rotation Time value of 0. Not accepting
such datasets does not allow a Thread device to attach properly.

This commit removes the requirement that the Rotation Time value must
be greater than the minimum value of one hour.
2022-01-18 11:32:50 -08:00
Eduardo Montoya 0b3f87c588 [cmake] make TCP configurable with OT_TCP option (#7306) 2022-01-18 11:31:39 -08:00
Simon Lin 45101c5955 [spinel] recover from RCP failure in Init (#7320) 2022-01-18 10:45:04 -08:00
Simon Lin 167ffe9393 [srp-client] add lease changing test (#7280) 2022-01-18 08:52:03 -08:00
Kangping 395d502576 [cli] fix invalid commissioner mgmtget cli arguments in tests (#7325)
This commit fixex the wrong commissioner mgmt cli args which uses
"binary" to indicate following binary args in HEX string - the format
has been changed to "-x" in #5549.

The reason why cli-commissioner.exp doesn't fail consistently is not
fixed by this commit.
2022-01-15 16:38:29 -08:00
Abtin Keshavarzian 5b9a1c0467 [net] add support for DNS Stateful Operations (DSO) (#7081)
This commit adds support for DNS Stateful Operations (DSO) as
specified in RFC 8490.

It adds `platform/dso_transport.hpp` header file which defines the
platform APIs/callbacks for DSO transport layer (e.g., DSN-over-TLS
or DNS-over-TCP).

The `Dso` module handles establishing connection with a peer, acting
either as a DSO client or server, establishing a DSO session over a
connection, and then sending and processing DSO request, response,
and unidirectional messages (including support for DSO TLV formats).
The `Dso` module also manages the session life cycle and timeouts,
namely the "Inactivity" and "Keep Alive" timeouts (including sending
and processing of Keep Alive messages when needed). It also handles
adding encryption padding before sending a message. It implements the
padding policy "Random-Block-Length Padding" from RFC 8467.

This commit also adds a detailed unit test `test_dso` covering the
behavior (including corner cases) of the `Dso` implementation. The
unit test provides an implementation of the DSO platform APIs which
emulate the DSO transport layer. It also includes a simplified alarm
platform implementation (emulating timers and allowing time to
advance in the unit test). These allow the unit test to cover more
complicated situations and behaviors (timeouts, failures, etc).
2022-01-14 16:25:16 -08:00
Piotr Koziar 169fec2be4 [csl] properly provide IsDataPoll info for determining number of CSL retx (#7319)
The `aFrame.IsDataRequestCommand()` call was checking the frame that
had been already encrypted.

This commit fixes that by using `aIsDataPoll` parameter instead.
2022-01-14 12:59:40 -08:00
Abtin Keshavarzian 612d235cd1 [netdata] simplify checking if network data contains certain entries (#7309)
This commit adds new methods in `NetworkData` to indicate whether or
not it contains a given on mesh prefix, external route, or service
entry. It also adds a new method to check whether it contains all
entries as in another given Network Data all associated with a given
RLOC16. This is then used to simplify comparison between `Local` and
`Leader` network data.
2022-01-14 12:40:59 -08:00
whd 7a1c843ffd [github-actions] run MATN test cases as an individual job (#7308)
MATN test cases often takes long time. We'd better move them to a
separate job so that we don't have to rerun MATN cases every time a
border router test fails.
2022-01-13 10:53:44 -08:00
tomaszkob89 bb658e2705 [thci] fix THCI for T1.1 9.2.4 commissioner (#7311)
During running T.1.1 tests with the T.1.2 capable sample it turned out
that 9.2.4 commissioner TC is not working when using the device that
is T.1.2 capable. The reason is that in MGMT_ACTIVE_SET
listSecurityPolicy list has only two elements and we are entering the
code, where we assume it is three element, which raises IndexError.
2022-01-13 10:38:49 -08:00
Jonathan Donald 26acccc105 [docker] add ping6 to codelab_otsim (#7313) 2022-01-13 10:33:31 -08:00
Eduardo Montoya c9066b6506 [bbr] add bbr skipseqnuminc command for reference device (#7283)
Add a command to allow skipping the increase of Sequence Number
when recovering the BBR Dataset from Network Data.
2022-01-13 09:59:30 -08:00
Abtin Keshavarzian 00e8010a0b [core] remove extra #if config check before header includes (#7310)
This commit removes the extra `#if` config checks in core files before
`#include` of different headers. Such a check is not necessary since
the OT core headers all start with any related `#if` config check.
2022-01-13 09:54:28 -08:00
Abtin Keshavarzian ab28382113 [cli] smaller style changes (#7307)
This commit contains smaller changes in CLI modules:

- Remove unused method declarations.
- Remove unnecessary `SuccessOrExit()` or `ExitNow()`.
- Convert `else` blocks into `else if` sequence (to remove extra
  indentation).
2022-01-12 11:43:28 -08:00
Simon Lin 3c260bd7c7 [thread-cert] cache Border Router test results (#7303)
This commit caches Border Router test results so that success BR tests
will be skipped when re-running the workflow.

The cache keys are chosen in a way that:
- Each new PR push will trigger cache miss and run the tests
- Each ot-br-posix change will trigger cache miss and run the tests
2022-01-11 23:25:21 -08:00
Simon Lin cb31c67e54 [thread-cert] misc enhancements to improve reliability (#7298)
This commit introduces a number of enhancements to `thread-cert`
Border Router tests to improve reliability:
- Checks `ot-rcp` process status for OTBR tests to help catch errors
  earlier
- Make sure `ot-rcp` processes are terminated after one test to avoid
  corrupting subsequent tests
- Upload core dump as artifacts if otbr-agent crashed
2022-01-11 23:23:14 -08:00
whd 299a512c8b [firewall] disable firewall by default (#7305)
The firewall feature should not be enabled on some targets,
e.g. ot-daemon. Although leaving it enabled does not break the
behavior, it creates confusing logs.
2022-01-11 21:24:07 -08:00
Zhanglong Xia 224dd27dbd [posix] add a method to get the infra interface name (#7300)
When setting the IP forwarding rule on Android platform, it needs to
specify the two interfaces between which IP forwarding is enabled.

This commit adds a method to get the infra interface name for setting
IP forwarding rule.
2022-01-11 13:44:22 -08:00
Simon Lin 55af6ce2c8 [github-actions] set MAX_JOBS=3 for Border Router tests (#7301)
This commit sets `MAX_JOBS` to 3 for Border Router tests (using OTBR
Docker) to improve reliability.

The original `MAX_JOBS` value is 10.

Related metrics:
- Border Router tests takes 12 minutes with MAX_JOBS=10
- Border Router tests takes 24 minutes with MAX_JOBS=3
2022-01-10 21:25:11 -08:00
Abtin Keshavarzian 064c91a32d [time] add constants for one sec, minute, hour, or day interval in msec (#7297) 2022-01-10 13:48:21 -08:00
Abtin Keshavarzian a4cba16c39 [common] add BinarySearch module and Stringfy (#7294)
This commit adds set of generic binary search related functions in
OpenThread core under `BinarySearch` module. The binary search module
replaces and enhances the existing `Lookup` table module (which was
limited to search based on strings and mainly used by CLI to map from
command string to a handler function).

This commit also adds a new class `Stringfy` in `string.hpp` to help
convert from a set of `uint16_t` values (e.g., a non-sequential
`enum`) to strings using binary search in a table. The new methods are
used for converting `Coap::Code` and `IpProto` enumerations to
corresponding strings.
2022-01-10 13:19:34 -08:00
George Stefan 91d444c2c5 [sub-mac] fix elapsed time in GetCslWindowEdges() (#7299)
Do all the calculations on uint32_t to prevent bad wraparound check
due to mixing uint32_t with uint64_t.

Signed-off-by: George Stefan <george.stefan@nxp.com>
2022-01-10 13:18:49 -08:00
Marius Preda 1c3a90f9f7 [csl] fix the CSL RX window when not using RX AT mode (#7284) (#7296)
The RX window when not using RX AT mode is much larger than the
correct time and what is reported by the Open Thread log.

In the case of "receive at" we want the timer to fire before the next
RX window to program the exact RX activity in the radio and in the
other case, the timer will fire when the current RX window will end to
close the receiver and go to sleep.

This commit fixes the issue by increasing the sample time with the CSL
period before starting the timer in the case of RX AT and after in the
normal RX case.
2022-01-10 11:27:42 -08:00
Yakun Xu 729780d3f6 [logging] print basename of source file (#7295)
In some build systems, source files is passed as absolute path, log
messages may be truncated. This commit makes VerifyOrDie only prints
basename of the source file.
2022-01-10 11:21:46 -08:00
Zhanglong Xia b69aac4aa8 [simulation] fix the wrong timeout value issue (#7262)
When the type `time_t` is 32 bits wide, the current code will truncate
the value of time and returns a wrong value.
2022-01-09 21:48:25 -08:00
Kangping 442b7e82f6 [srp-server] identify name conflicts by comparing only ECDSA public keys (#7281)
Current `Srp::Server` is comparing the entire KEY RRs to determine if
the two SRP messages are using the same signing key. But the TTL in
the KEY RR can change even between two SRP messages of the same client
and this will result in false name conflicts.

This commit fixes this issue by changing to compare only the rdata of
the KEY RR.
2022-01-06 21:47:04 -08:00
whd 053af39479 [docs] fix the link to route command in CLI doc (#7293) 2022-01-06 21:45:13 -08:00
Abtin Keshavarzian 8361426c67 [core] use const array lookup for converting enum to string (#7279)
This commit updates different modules in OT core and CLI to use
`const` array lookup to convert an enumeration value to string.
2022-01-06 13:27:16 -08:00
Li Cao 1cdd707756 [diag] only do re-tx for diag sending (#7290)
Some platform diag commands (those not in factory_diags module) will
also do repeat sending and the same callback (Diags::TransmitDone)
will be called. However, in those cases, `mRepeatActive` won't be set.
And if some error (like `CHANNEL_ACCESS_FAILURE`) happened,
`TransmitPacket` will be called then, which makes the channel even
more busy, causing more `CHANNEL_ACCESS_FAILURE`, and so on. This PR
ensures that `TransmitPacket` will only be called again when using
`diag send`.
2022-01-06 12:24:36 -08:00
Abtin Keshavarzian c5e8c6b634 [mac] simplify tracking of pending operations (#7289)
This commit updates how `Mac` tracks the pending operations by using
a bitset `mPendingOperations` replacing the current model using a
set of `bool` variables per operation.
2022-01-06 12:22:01 -08:00
Simon Lin a3edc4fcab [flash] fix typo initalized (#7287) 2022-01-05 12:20:16 -08:00
Eduardo Montoya a793c94d61 [posix] enable all ICMPv6 echo handling for reference device (#7288)
Set `OT_ICMP6_ECHO_HANDLER_ALL` when building reference device Posix
border router.
2022-01-05 12:05:58 -08:00
Jonathan Hui ba09f6894a [mle] set ChannelPage value in MLE Announce messages (#7285) 2022-01-05 12:02:10 -08:00
Simon Lin 53a19d961c [posix-netif] refactor address changing logs (#7271) 2022-01-05 11:58:51 -08:00
Esko Dijk 392b9205bb [cli] support 1 or more mcast addresses for ipmaddr add command (#7253)
Because the 2 addresses are registered sequentially from the same
method call, the OpenThread stack will not have had the opportunity to
send out MLR.req with a single address. So this should result in
sending out one MLR.req with two addresses inside, if 2 addresses are
provided.  Without changes in the APIs.
2022-01-05 11:56:53 -08:00
Abtin Keshavarzian a04a68b51b [logging] simplify logging by removing DEFINE_AS_MACRO_ONLY (#7268)
This commit removes `OPENTHREAD_CONFIG_LOG_DEFINE_AS_MACRO_ONLY`.
which helps simplify the logging implementation. This feature enabled
all logging including the platform API to be defined as macros and
was intended for certain restricted platforms. With the new logging
model, OpenThread core itself will prepare the entire log line
instead of platform layer, so this feature is no longer applicable or
useful.
2022-01-04 21:42:27 -08:00
Simon Lin cbd8512f47 [posix-netif] lower transmit log level for OT_ERROR_DROP (#7275)
This commit helps reduce posix-netif WARN logs when transmitting
messages to Thread.

There are certain ICMPv6 messages (e.g. MLDv2) that OpenThread will
filter when transmitting, so the error `OT_ERROR_DROP` is expected.

This commit also assumes that OpenThread knows what it's doing when it
choose to drop a message, thus using lower log level for
`OT_ERROR_DROP`.
2022-01-04 09:55:13 -08:00
Simon Lin e736d2488d [tests] add test steps to verify case-insensitive query works (#7198) 2022-01-03 21:24:08 -08:00
Eduardo Montoya 32bdcae210 [thci] discard IPv4 link local address in mDNS browsing (#7277)
When looking for the Border Agent's link local address in the mDNS
response do not consider a possible IPv4 address record.
2022-01-03 15:17:27 -08:00
Simon Lin d2125032d8 [border-routing] unify initiating routing policy evaluation (#7255)
This commit unifies how immediate or delayed routing policy evaluation
is initiated.

This commit also removes `mRouterAdvertisementTimer` to reduce memory
footprint.
2022-01-03 15:03:35 -08:00
Simon Lin 71ebacca53 [border-routing] invalidate discovered OMR prefixes when Network Data change (#7246)
This commit enhances Border Routing to ignore discovered OMR Prefixes
when Network Data change.  It's possible that a BR may learn an OMR
prefix from RA, and later learn the same OMR Prefix from Network Data.
In such case, the BR should remove the discovered OMR Prefix.
2021-12-30 22:48:23 -08:00
Abtin Keshavarzian 7507617eee [cli] add joiner state command (#7273)
This commit adds new CLI command `joiner state` to get the current
state of `Joiner`. It also adds new public OT API to convert a given
`otJoinerState` to a string.
2021-12-30 22:40:57 -08:00
Abtin Keshavarzian 7334669d61 [meshcop] use NewPriorityMessage() for message allocation (#7274)
This commit removes the function `MeshCoP::NewMeshCoPMessage()` and
uses `NewPriorityMessage()` method directly on `Coap::CoapSecure` or
`Tmf::Agent`. This helps harmonize the message allocation model by
MeshCoP modules.
2021-12-30 22:39:54 -08:00
Simon Lin b5101320f8 [posix-netif] reduce excess WARN logs (#7264) 2021-12-30 22:37:51 -08:00
Jiacheng Guo 7e438caf30 [bbr] fix bbr header C compliance (#7272)
Fix compile errors when including backbone_router_ftd.h in C files.
2021-12-30 10:49:17 -08:00
Eduardo Montoya a65afcdbb0 [border-router] add test to verify multicast traffic on a SBBR (#7183)
Make sure a SBBR handles own multicast traffic routing.
2021-12-29 22:57:40 -08:00
Abtin Keshavarzian d343550976 [string] add ToYesNo() to convert a boolean to "yes" or "no" (#7270) 2021-12-29 22:52:15 -08:00
Abtin Keshavarzian b05340d935 [cli] reuse AddressOriginToString() among CLI modules (#7269)
This commit changes `AddressOriginToString()` to a public `static`
method of `Cli::Interpreter` so we can reuse it in `Cli::History`
module and potentially other modules in future. It also removes
similar method from `Cli::History`.
2021-12-29 22:15:14 -08:00
Abtin Keshavarzian f4efd28e1c [tlv] add As<TlvType>() helper methods (#7265)
This commit adds a set of `As<TlvType>()` methods which cast from base
`Tlv` pointer or reference to a specific sub-class `TlvType` while
preserving whether the input parameter is `const` or not. This
basically acts as a syntax sugar for this commonly used pattern in the
code.
2021-12-29 16:44:12 -08:00
Abtin Keshavarzian 16d2d20e9f [style] use nullptr with backticks in comment (#7267) 2021-12-29 16:26:09 -08:00
Abtin Keshavarzian 7b41859bab [core] use AsCoreType in header files (#7263)
In PR #7128, the `DefineCoreType()` & `DefineMapEnum()` definitions
(which map the public and core types) were moved to header files
that define the corresponding core type. This allows us to use the
`AsCoreType()` in header files. This commit changes some of inline
methods in the core headers to use it.
2021-12-29 12:15:37 -08:00
Zhangwx 8b7d90f167 [cli] add option to print more information for ipaddress (#7245) 2021-12-29 10:14:32 -08:00
Eduardo Montoya be8383bc5a [mlr] MLR_TIMEOUT_MIN does not apply to MLR.req (#7251)
Thread specification defines `MLR_TIMEOUT_MIN` as the minimum value of
the MLR Timeout in the BBR Dataset, but this does not affect to the
Timeout TLV in the Multicast Registration Request messages.
2021-12-28 12:57:49 -08:00
Simon Lin ca6cbba472 [tests] add ping test using LLA source (#7260) 2021-12-28 12:21:24 -08:00
Simon Lin 2129daaf21 [border-routing] fix stale prefixes checking timer (#7241)
Current implementation will reschedule the Stale Timer when discovered
on-link or OMR prefixes or RA messages are updated, but it has a few
issues:

1. It's counting the maximum stale time of all on-link prefixes so
    that we will schedule Router Solicitation when all on-link
    prefixes become stale. But it failed to filter out OMR prefixes in
    the `mDiscoveredPrefixes` list. This results in incorrect stale
    time calculation.

2. A deprecated on-link-prefix is not removed from
    `mDiscoveredPrefixes` directly but the preferred lifetime is set
    to zero. We are not filtering out deprecated on-link prefixes when
    calculating stale time and this results in zero stale timer delay
    if there are no non-deprecated on-link prefixes.

This commit fixes those issues by having a dedicated
`ResetDiscoveredPrefixStaleTimer` to reschedule the stale timer with
following rules whenever discovered prefixes or learnt RA messages are
updated:

1. If BR learns RA header from Host daemons, it should send RS when
   the RA header is stale.

2. If BR discovered any on-link prefix, it should send RS when all
   on-link prefixes are stale.

3. If BR discovered any OMR prefix, it should send RS when the first
   OMR prefix is stale.

`ResetDiscoveredPrefixStaleTimer` is supposed to correctly calculate
stale timer timeout whenever it's called.
2021-12-26 23:15:02 -08:00
Kangping d47dea0b6f [routing-manager] start routing policy evaluation when on-link prefix state changes (#7250)
We should reevaluate routing policy only when a discovered on-link
prefix becomes deprecated or preferred. This change reduces sending RA
messages when another peer is keep advertising deprecated (preferred
lifetime is zero) on-link prefix.
2021-12-24 13:53:04 -08:00
Simon Lin 3726888937 [border-routing] always respond to Router Solicit with Router Advertisement (#7247)
This commit fixes the bug that BR may not respond to a Router Solicit
with a Router Advertisement when the BR itself is Router Soliciting.

This bug may cause Vicarious Router Solicitation more likely to fail
because BRs may failed to send RA for vicarious RS.
2021-12-23 20:33:48 -08:00
Eduardo Montoya f10e662692 [thci] improve mDNS browsing using Zeroconf (#7249)
Previous approach with `dig` was not enough because it was only
parsing one mDNS response and not taking account that the response
could be from an inactive Border Router.

Use Python Zeroconf to properly parse all services.
2021-12-23 12:55:47 -08:00
Simon Lin b7c40afb66 [border-routing] add configuration for Vicarious Router Solicitation (#7248)
This commit adds
`OPENTHREAD_CONFIG_BORDER_ROUTING_VICARIOUS_RS_ENABLE` configuration
to allow disabling Vicarious Router Solicitation feature.
2021-12-23 12:26:04 -08:00
Kangping bd64f29bbd [routing-manager] don't reevaluate routing policy for OMR prefixes in RA messages (#7244)
Currently, we will start routing policy evaluation when new OMR
prefixes are received as RIO options in RA messages. But it's not
necessary to do so because whether we need to advertise our own OMR
prefix is not depending on the discovered OMR prefixes from Wi-Fi link
but the OMR prefixes in Thread network data.
2021-12-23 12:20:47 -08:00
Simon Lin 2e8703dfa5 [border-routing] decide Router Solicitation state with IsRouterSolicitationInProgress (#7242) 2021-12-23 12:19:26 -08:00
Zhanglong Xia 7e2b694c1d [posix] remove GPIO line offset check (#7238)
The `GPIOHANDLES_MAX` represents the maximum number of requested
handles. It should not be used to check the GPIO line offset.
2021-12-22 22:49:52 -08:00
tomaszkob89 4fcd48ce8c [thci] drop empty lines returned in command outout from the response (#7236)
In some cases the first element from the output from __executeCommand
might be empty line, which casues command failures like on below
trace:

__executeCommand('extaddr',) returns ['', '166e0a0000000001', '', 'Done']
FUNC getMAC failed: invalid literal for int() with base 16: ''

This commit filters out empty string from the result of
__executeCommand.
2021-12-22 22:23:02 -08:00
Sarah 9e161b96b5 [documentation] update code comments and contributing section (#7240) 2021-12-22 13:11:33 -08:00
Abtin Keshavarzian 968f29cdb0 [cli] limit radiofilter command to when 15.4 radio link is enabled (#7239)
This commit adds `OPENTHREAD_CONFIG_RADIO_LINK_IEEE_802_15_4_ENABLE`
check to CLI processing methods related to `radiofilter` command which
ensures that this is only available when 15.4 radio is enabled. This
allows us to build CLI app successfully with TREL radio only.
2021-12-22 13:10:24 -08:00
Eduardo Montoya 348f0a10a3 [thci] register multicast addresses on the host side (#7193)
Make use of the `mcast6.py` application in order to listen to
multicast traffic on the host side when required by the harness.
2021-12-22 09:51:47 -08:00
Simon Lin 66dc0c3467 [ip6] change aFromNcpHost to false in otIp6Send (#7187) 2021-12-22 09:49:36 -08:00
Eduardo Montoya a8eeb231d0 [bbr] allow lower MLR Timeout for reference device (#7235)
Thread Certification test plan requires that the reference device
configures a MLR Timeout lower than the allowed by the specification.
2021-12-18 15:33:44 -08:00
Abtin Keshavarzian 686c0de5fa [linked-list] fix OwningList::RemoveAllMatching() (#7231)
This commit fixes the `OwningList::RemoveAllMatching()` to use the
`LinkedList` one. It also updates unit test `test_linked_list` to
cover this method.
2021-12-14 18:37:22 -08:00
Simon Lin 54d848e11b [otci] add method to run shell commands (#7230) 2021-12-13 23:43:11 -08:00
Kangping 847e9ce4ad [posix] logging when infra/backbone interface is not provided (#7228)
The Backbone Router and Border Routing feature will be silently
disabled when the infra/backbone interface is not provided. We should
at least print a warning log in this case since it may not be
intentional.
2021-12-13 23:42:37 -08:00
whd 13870f5e57 [firewall] ingress filtering (#7107)
This commit implements OTBR firewall. This implementation focuses on
ingress filtering. We may also introduce egress filtering when
necessary.

For security purpose, there are some packet forwarding rules to
follow, which were originally introduced in the spec.

- Inbound packets initiated with On-Link addresses source (OMR and
  mesh local prefix based addresses) should be blocked.

- Inbound unicast packets whose destination address is not OMR address
  or DUA should be blocked.

- Inbound unicast packets whose source address or destination address
  is link-local should be blocked. Note that we don’t need to
  explicitly add rules for link-local addresses since this should
  already be handled by the kernel.

These rules can be easily implemented by iptables and ipset.

Before otbr-agent starts, there is a script creating the iptables
rules. The rules themselves are constant so we don't need to change
them dynamically. During the runtime of otbr-agent, otbr-agent updates
ipsets accordingly whenever there's a change of on-link prefixes.
2021-12-13 09:17:21 -08:00
Simon Lin b8df628dfb [build] add OT_POSIX_INSTALL_EXTERNAL_ROUTES option (#7229) 2021-12-12 21:41:48 -08:00
Eduardo Montoya e708324c31 [mlr] send BMLR.ntf for de-registration (#7227)
BBR should send BMLR.ntf to the backbone upon successful
de-registration as well.
2021-12-09 09:12:39 -08:00
whd 270dc21875 [posix] deprioritize the added external routes (#7223)
The current priority of the added routes too high so it may get
preferred over routes learned from RA. Hence we increase the metric to
deprioritize the added routes.
2021-12-07 16:05:26 -08:00
Abtin Keshavarzian 3c01127770 [srp-client] use LinkedList::RemoveAllMatching() (#7221) 2021-12-07 14:43:01 -08:00
Abtin Keshavarzian 8650e15a37 [linked-list] add RemoveAllMatching() method (#7221)
This commit adds a new method `LinkedList::RemoveAllMatching()` which
removes all entries in the list matching a given entry indicator from
the list and adds them to a new "removed" list. A similar method is
also added in `OwningList`. This commit also updates the unit test
`test_linked_list` to validate the behavior of the new method.
2021-12-07 14:43:01 -08:00
Abtin Keshavarzian 8048839206 [srp-client] skip appending services on host remove retry (#7218)
This commit updates `Srp::Client` to skip appending services when the
host is being removed. On the first attempt the `mHostInfo.GetState()`
will be `kToRemove` but on the retries it will be `kRemoving`.
2021-12-03 14:53:05 -08:00
Jonathan Hui 66d76090e0 [srp-client] fix lease time on remove host retransmission (#7216) 2021-12-03 10:31:37 -08:00
Marek Porwisz 1267bdbf68 [mle] out-of-bounds read (OVERRUN) (#7214)
Fix issue after static code analyzer run.

Signed-off-by: Marek Porwisz <marek.porwisz@nordicsemi.no>
2021-12-01 10:51:27 -08:00
Damian Królik 44837a1dae [crypto] store sensitive dataset items in ITS (#7207)
When OPENTHREAD_CONFIG_PLATFORM_KEY_REFERENCES_ENABLE is
set, make sure that sensitive dataset items, such as the
network key or PSKC, are persisted using the secure
Crypto::Storage API (which should encrypt the stored data,
or use secure hardware units) instead of settings.
2021-12-01 10:50:38 -08:00
Abtin Keshavarzian efa5682d60 [timer] declare Timer constructor as protected (#7213)
This commit updates `Timer` class constructor to be `protected` which
ensures that instances of `Timer` can not be created and only
instances of its sub-classes `TimerMilli` or `TimerMicro` can be
used. This helps avoid potential incorrect use of `Timer` class
directly.
2021-11-30 15:33:34 -08:00
canisLupus1313 d5d4d2b2ff [cli] add command to skip VR check when upgrading to router or leader (#7182)
Thread harness requires to create thread network without checking the
if the thread protocol version is correct. This commit adds capability
to disable this check.
2021-11-30 15:33:04 -08:00
whd b2c0c1a2af [tests] use xa instead of dd in the test case (#7204)
We are switching from dd to xa to conform the latest spec.
2021-11-30 12:39:07 -08:00
Yakun Xu 34b64d3c6a [tcplp] remove unused type defines (#7191) 2021-11-30 11:28:41 -08:00
Abtin Keshavarzian 16798fdcc0 [message] simplify method for allocating new message from pool (#7210)
This commit removes different `MessagePool` methods that can be used
to allocate a new message  and combines them into one `Allocate()`
method which uses `Message::Settings`. The `Message::Settings` is
also updated to provide new constructor initializing it with a given
message priority only.
2021-11-29 13:46:07 -08:00
Abtin Keshavarzian 912eca181d [mac] add "Radio Filter" mechanism (#7156)
This commit implements new radio filter mechanism in OpenThread. The
radio filter is mainly intended for testing. It can be used to
temporarily block all tx/rx on the IEEE 802.15.4 radio. When radio
filter is enabled, radio is put to sleep instead of receive (to
ensure that the device does not receive any frame and/or potentially
send ack). Also the frame transmission requests return immediately
without sending the frame over the air (return "no ack" error if ack
is requested, otherwise return success). This commit also add CLI
command `radiofilter` for this feature. It also adds test-case
`test_radio_filter` to validate the behavior of the new feature.
This feature requires `OPENTHREAD_CONFIG_MAC_FILTER_ENABLE`.
2021-11-29 12:45:11 -08:00
Robert Lubos e4da1f6c71 [cli] add option to disable prompt (#7209)
When running OT CLI in Zephyr, it's not desired to print a prompt
after executing a command, as OT CLI is tightly integrated with Zephyr
shell module which provides its own prompt.

Add a config option which allows to disable CLI prompt on the output.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2021-11-26 22:58:28 -08:00
Abtin Keshavarzian 428944b1f6 [mesh-forwarder] ensure message allocation with correct priority (#7203)
This commit fixes the incorrect call to `MessagePool::New()` to
allocate a message in `MeshForwarder::HandleMesh()` method. The
existing code calls `New(Message::kType6lowpan, priority)` with two
parameters which maps to the flavor `New()` method with three
parameters with last one (`Message::Settings`) being optional
(having a default value). Basically, the existing code treats the
`priority` (second argument) as `aReserveHeader` parameter in the
`New()` instead of the message priority.
2021-11-26 22:30:50 -08:00
Abtin Keshavarzian 0e2392bdc2 [heap-allocatable] new method to allocate and init using constructor (#7201)
This commit adds a new static method in `Heap::Allocatable` to
allocate a new object and initialize it using the underlying `Type`
constructor (passing all the parameters to the constructor). This is
in addition to the existing mechanism to use an `Init()` method to
initialize the allocated object. The `Init()` method returns an
`Error` allowing the initialization itself to potentially fail. This
commit also updates `Srp::Server` types `Host` and `UpdateMetadata`
to use the new method.
2021-11-26 22:30:26 -08:00
Kacper Szeweńko 775c568286 [thci] fix failing Thread 1.1 Cert Tests (#7199)
This commit fixes tests of 1.1 certification: SED 6_5_1, 6_5_2, 6_5_3,
9_2_8; Commissioner 9_2_4; Leader 9_2_11
2021-11-26 22:29:44 -08:00
Abtin Keshavarzian a4220690ee [srp-server] use RetainPtr to share Description among services (#7195)
This commit updates `Srp::Server` such that `Service` instances keep a
`RetainPtr` to a `Service::Description`. This allows a service and
all its sub-types to share the same `Description` instance and helps
simplify the management of the `Description` instances. When the last
`Service` that has a pointer to a shared `Description` is removed and
freed, the `Description` instance will be automatically freed as
well.
2021-11-24 21:14:49 -08:00
Abtin Keshavarzian 4acdf1d0fb [common] add Ptr to use as base of OwnedPtr and RetainPtr (#7195)
This commit adds a new class `Ptr<Type>` which represents a wrapper
over a raw pointer. This is then used as the base class of `OwnedPtr`
and `RetainPtr` providing the common simple methods (avoiding repeating
the same code in each smart pointter). The new `Ptr` class also adds
overloads of `==` and `!=` allowing `Ptr` to be compared with a given
raw pointer or another `Ptr` instance.
2021-11-24 21:14:49 -08:00
whd 2d16fa25e4 [tests] fix test_publish_meshcop_service.py (#7202)
This is a workaround that disables the scenario of verifying the
meshcop service when thread is disabled. This scenario sometimes
doesn't work well with mDNSResponder publisher because of the renaming
logic. We are expecting a refactor of advertising proxy & mdns and
this issue should be fixed at that time.
2021-11-24 19:51:21 -08:00
whd 02d29cd5e3 [tests] update meshcop service test case (#6962)
The spec asks border router to publish meshcop service even when
thread interface is inactive. This commit adds test case to verify the
feature.

This commit also introduces boot_delay to add delays between booting
nodes. In this way we can let border routers not starting at the same
time, so that there will be fewer renaming conflicts. This can make
the test more stable.
2021-11-23 21:54:05 -08:00
Abtin Keshavarzian 4ac6b504a4 [dnssd-server] use case-insensitive DNS name match (#7189)
This commit updates `Dns::ServiceDiscovery::Server` to use
case-insensitive string match when comparing DNS names. It also
updates `test_dnssd.py` to use mixed case names when browsing for or
resolving services. This validates the case-insensitive treatment
of names by SRP client and server and DNS-SD server (resolver) and
DNS client.
2021-11-23 16:31:18 -08:00
Abtin Keshavarzian 9d81f99b94 [srp-server] use case-insensitive DNS name match (#7189)
This commit updates `Srp::Server` use case-insensitive DNS name
match for domain name, host, service, or service instance names.
2021-11-23 16:31:18 -08:00
Abtin Keshavarzian e16261aa6c [dns] change Dns::Name::CompareName/Label() to be case-insensitive (#7189)
This commit changes the `Dns::Name::CompareName/Label()` methods to
perform case-insensitive string comparison. This is realized by
adding a new flavor of `Data::MatchesBytesIn()` which accepts a
`ByteMatcher` function pointer. This allows the caller to relax the
definition of a match and how the bytes are compared. `Message` class
methods that compare bytes are also updated to allow `ByteMatcher` as
an input parameter. This commit also updates the unit test `test_dns`
to cover the new method and behaviors.
2021-11-23 16:31:18 -08:00
Abtin Keshavarzian 07031e1651 [string] new functions for case-insensitive comparison (#7189)
This commit adds new string helper functions to convert between
lowercase and uppercase letters. It also adds new function
`StringStartsWith()` which determines whether the string starts with
a given prefix string and `StringMatch()` which compares and matches
two strings.

This commit also adds a new mechanism in all string helper functions
allowing the caller to specify the match mode to be used when
comparing strings: Either an exact match of characters, or a
case-insensitive match where uppercase and lowercase characters are
treated as equal.

This commit also updates `test_string` unit test to validate the new
functions and behaviors.
2021-11-23 16:31:18 -08:00
Jonathan Hui d82a678322 Revert "[github-actions] push README.md to Dockerhub (#7194)" (#7197)
This reverts commit 3b438fd18f.

Current method does not work with personal access tokens.
2021-11-23 15:53:52 -08:00
Jonathan Hui 3b438fd18f [github-actions] push README.md to Dockerhub (#7194) 2021-11-23 12:51:12 -08:00
tomaszkob89 cf4b71d8b9 [thci] fix issue with not initialized isPowerDown flag (#7196)
When the GRL starts, it calls initialize() reset() method on each
device. Reset method call fails due to missing (uninitialized)
attribute `isPowerDown`.
2021-11-23 10:03:10 -08:00
whd 3dd184a0bc [tests] verify the number of published meshcop services (#7192)
There was a bug that avahi publisher may accidentally publish
redundant meshcop services and leave the previous published one
dangling.
2021-11-23 09:07:50 -08:00
Abtin Keshavarzian db9e430876 [common] adding OwningList (a linked list which owns its entries) (#7181)
This commit adds `OwningList<Type>`, a singly linked list which owns
its entries and frees them upon destruction of the list. This commit
also updates `test_linked_list` to validate the behavior of the new
class.
2021-11-22 21:41:56 -08:00
Abtin Keshavarzian 56ca28882a [dns] TxtEntry::AppendEntries() to append into a buffer (#7176)
This commit adds new flavor of `Dns::TxtEntry::AppendEntries()` to
encode and append TXT record entries in a data buffer (in addition to
existing one which appends to a `Message`). `Appender` class is used
in the underlying implementation . This commit also updates
`test_dns` unit test to validate newly added method.
2021-11-22 21:41:28 -08:00
Abtin Keshavarzian 7c284b1517 [common] adding Appender class (#7176)
This commit adds a `Appender` class which acts as a wrapper over
either a `Message` or a data buffer (e.g., `MutableData`) and
provides  different flavors of `Append()` method. This class helps in
construction of message content where the destination can be either a
`Message` or a buffer. This commit also adds a unit test for the new
class.
2021-11-22 21:41:28 -08:00
canisLupus1313 0e8b6604cb [thci] add setCcmState method in thci (#7179)
This commit adds API method setCcmState to THCI file.
2021-11-19 10:34:13 -08:00
Abtin Keshavarzian c127d99668 [common] adding OwnedPtr and RetainPtr classes (#7171)
This commit adds two smart pointer types `OwnedPtr` and `RetainPtr`.

`OwnedPtr` acts as the sole owner of the object it manages. It is
non-copyable but the ownership can be transferred from one `OwnedPtr`
to another using move semantics.

`RetainPtr` is an intrusive reference counted smart pointer allowing
multiple pointers to share management of the same object. It requires
the underlying `Type` object to provide mechanism to track the
current retain count. This may be realized by the `Type` itself
providing this or by having it be a sub-class of the newly added
`RetainCountable` class.

This commit also add a unit test `test_smart_ptr` validating the
behavior of newly added classes.
2021-11-19 10:33:19 -08:00
Abtin Keshavarzian ccceb5f054 [common] adding Heap::Allocatable and use it in Srp::Server (#7168)
This commit adds a new class `Heap::Allocatable<Type>` which provides
`New()` and `Free()` methods to allocate and free instances of a
template `Type` on heap. The static `New()` method requires the
`Type` class to provide a method `Error Init(Args...)` to initialize
the allocated object as `Type`. The initialization itself can fail
(return `Error`) in which case `New()` will release any allocated
buffer and return `nullptr`. The `Free()` method invokes the `Type`
class's destructor before releasing the heap pointer. This ensures
that any heap allocated member variables in `Type` (e.g., any
`Heap::String` or `Heap::Data`) are freed before the `Type` instance
itself is freed.
2021-11-19 10:32:38 -08:00
Eduardo Montoya ed5e5bbb6d [ip6] log encapsulated IPv6 messages (#7178)
When an encapsulated IPv6 header is found, log the message.
2021-11-19 10:01:48 -08:00
Yakun Xu 43778e314d [tcplp] suppress warnings by target_compile_options (#7184)
Add the following options `-Wno-sign-compare` and
`-Wno-unused-parameter` with target_compile_options to suppress
warnings. These options will be appended to the end of options
inherited from COMPILE_OPTIONS and CMAKE_C_FLAGS.
2021-11-19 08:39:14 -08:00
JaneFromSilabs e67f432284 [thci] fix for GRL TH1.1 Leader 5.5.2, Leader 5.5.3 (#7163) 2021-11-19 08:00:14 -08:00
Sam Kumar 024c630b03 [tcp] add TCPlp's FreeBSD-derived protocol code, with explanatory comments (#7074)
This commit adds TCPlp's TCP protocol logic, which is derived from the
TCP protocol logic in the FreeBSD Operating System. The FreeBSD code
had to be refactored to work for TCPlp, and I have added extensive
comments explaining the code that was deleted and changed. The changes
are primarily modifications to work with TCPlp's data buffering (see
#6926), removal of features that depend on dynamic memory allocation
to save memory (SYN cache, compressed TIME-WAIT state) and removal of
features that aren't relevant in this setting (e.g., TCP Segmentation
Offloading, IPv4 support).
2021-11-17 22:24:22 -08:00
tomaszkob89 130957d489 [thci] fix issue with isPowerDown flag and reset method (#7160)
Some certification tests are failing because otbr-agent service is not
started back after calling powerDown (isPowerDown flag is kept False
and reset function fails on checking thread state - since the service
is stopped, we can't return status).

Also minor fixes for printing logs, disabling paramiko DEBUG level.
2021-11-17 11:32:53 -08:00
Simon Lin ffa9d22c9c [tests] add test to make sure BR works as FED (#7174) 2021-11-17 10:16:22 -08:00
Eduardo Montoya 825227a71a [thci] fix mdns_query (#7154)
Avoid parsing responses for not expected cases.

Fixes some issues with Thread 1.2 certification test cases in which
it's not required to parse the mDNS response.
2021-11-17 10:14:32 -08:00
whd 9dedd18696 [posix] add OT_TOOL_WEAK for otPlatLog (#7173)
This PR avoids link error of duplicate `otPlatLog` symbol.
2021-11-16 14:38:55 -08:00
Jonathan Hui 6aa730969a [heap] include stddef.h for size_t (#7172) 2021-11-16 12:24:54 -08:00
Simon Lin 1b1a85f2cf [mlr] remove unnecessary calls to UpdateMldReport (#7167)
This commit removes incorrect calls to UpdateMldReport.

- UpdateMldReport(MA, true) should be called when a MA is registered,
  thus in MulticastRoutingManager::Add.

- UpdateMldReport(MA, false) should be called when a MA is expired,
  thus in MulticastRoutingManager::Remove.

Note that removing an Multicast Forwarding Cache (MFC) does not mean
the MA is expired. The MFCs can be freely removed even when the MA is
still registered and being renewed.
2021-11-16 12:24:29 -08:00
Abtin Keshavarzian 75a46892ee [srp-server] use Heap::Data to store TXT record data bytes (#7166)
This commit updates the `Srp::Server` to use the `Heap::Data` class
for storing the TXT record data bytes. This helps simplify the code.
This commit also adds a new helper method in `Heap::Data` to set
the data from a given number of bytes read from a `Message` at a
given offset. It also updates the unit test to cover the behavior
the new method.
2021-11-16 12:23:25 -08:00
Li Cao 19cd73d691 [settings] do not assert when SettingsFd is -1 in Deinit (#7170)
We added a dry run option. So it is possible that the settings fd is
-1 when de-initialization. The assert here makes the program
crash. This commit updates it to a `VerifyOrExit` to avoid crashing.
2021-11-15 18:14:34 -08:00
Abtin Keshavarzian 88d946cc08 [srp-server] free heap allocated data from Free() (#7165)
This commit fixes the potential memory leak of `mTxtData` when a
`Description` instance is freed. Also addresses similar situation
with `mServiceName` when `Service` instance is freed.
2021-11-15 10:17:58 -08:00
Jonathan Hui b4ac18a273 [dua] assume child does not have DUA if no space to store one (#7164) 2021-11-15 10:17:02 -08:00
Simon Lin 34c8c82ee4 [dnssd] add tests for Service Instance names with spaces (#7143)
This commit adds tests to make sure Service Instance names with spaces
are handled properly by SRP and DNS-SD.
2021-11-15 10:15:10 -08:00
Eduardo Montoya b4c76b3e17 [thci] allow for sufficient time after a ping from OTBR (#7158)
Some certification tests are failing because not enough delay is
applied after a Linux ping command is sent and the capture misses the
ICMP transaction.

Also removing unneeded check for Thread 1.2 harness version when
reconnecting to the serial port after a reset.
2021-11-12 13:31:58 -08:00
whd 04a3ebff22 [tests] stop otbr-agent service for host nodes (#7152)
HostNode is based on OtbrDocker, which has otbr-agent service started
by default. We should disable this service on HostNode otherwise the
border router test cases won't have the exact expected topology.
2021-11-12 13:06:09 -08:00
Eduardo Montoya 44c736c147 [border-router] add test for manual address reachability (#7145)
The purpose of this test case is to verify that BR can manually
configure addresses and comply with the manual address configuration
rules.
2021-11-12 13:04:38 -08:00
Jonathan Hui 5e0d1b1a32 [mle] record child netdata versions in HandleChildUpdateRequest() (#7157)
Thread Specification allows a parent to update child network data by
sending a unicast MLE Data Response. Receiving the child's Leader Data
in a MLE Child Update Request message should serve as an
acknowledgment when the network data is received.
2021-11-12 12:22:38 -08:00
Abtin Keshavarzian 543e32d2ae [srp-server] adding MessageMetadata (#7144)
This commit updates `Srp::Server` adding a new type `MessageMetadata`
which is used during processing of a received SRP Update message.
This class serves two purposes: (1) It helps simplify the code by
combining all related parameters (current offset in the message, DNS
`Header` and `Zone`, and `Ip6::MessageInfo`) into a single `struct`
which is then passed to different `Process{}()` methods. (2) It
defines new fields to represent the time when the message was
received (allowing us to process the message as if it was received
earlier than the current time) and the lease interval values to be
granted during processing of the message. These are added in
preparation for enabling SRP Replication (SRPL). With SRPL we can
receive an SRP Update message from an SRPL partner (i.e., another SRP
server) and then need to process it as if we received it on this
device at the same time as the original SRPL partner processed it and
with the same lease config values.
2021-11-11 22:12:34 -08:00
Abtin Keshavarzian c33c894ee4 [common] adding heap.hpp header and Heap namespace (#7147)
This commit moves the heap functions `CAlloc` and `Free` from
`instance.hpp` header to a separate `heap.hpp` header file. The main
reason is to make it easier to include this header file from other
modules (avoid the header dependency/loop issues by requiring to
include `instance.hpp` to get access to heap functions). This commit
also defines a `Heap` namespace and moves other heap allocated types
under this namespace (`Heap::String` and `Heap::Data`).
2021-11-11 22:05:40 -08:00
Simon Lin c02d111026 [otci] misc enhancements (#7104) 2021-11-10 22:30:19 -08:00
Simon Lin 01009a3eff [thci] fix THCI error on Harness 1.1 (#7148) 2021-11-10 12:04:32 -08:00
Abtin Keshavarzian 2fb1756d61 [common] adding HeapData class (#7129)
This commit adds new class `HeapData` which represents a heap
allocated data buffer of a given variable length. This class provides
methods to set/copy the `HeapData` from/to  a buffer or a `Message.
This commit also adds unit test for the new class.
2021-11-10 09:28:01 -08:00
Eduardo Montoya 7184999022 [thci] override forceSetSlaac for border router (#7149)
Manually configured addresses need to be added to the TUN interface in
order for the host to handle them.
2021-11-10 08:45:33 -08:00
Łukasz Maciejończyk 51db0e54d7 [spinel] fix serialization for SPINEL_PROP_RCP_ENH_ACK_PROBING (#7146)
Signed-off-by: Lukasz Maciejonczyk <lukasz.maciejonczyk@nordicsemi.no>
2021-11-09 08:36:40 -08:00
Simon Lin d1405ec185 [dnssd-server] fix TXT RR format when TXT length is zero (#7141) 2021-11-09 08:11:30 -08:00
Eduardo Montoya dc9ce005f3 [thci] retrieve BA port from mDNS response (#7130)
Modify `mdns_query` to accept a list of reference devices link local
addresses in order to discard their mDNS responses.

Also accept a service string to be used for the Thread 1.3
Certification program.

Return the DUT's Border Agent address and port.
2021-11-09 08:11:04 -08:00
Jonathan Hui 39a1f55447 [routing-manager] require on-link prefix to support SLAAC (#7142)
Existing IPv6 implementations may not implement DHCPv6 to acquire an
IPv6 address. As a result, a Thread Border Router must advertise a ULA
if there is no existing prefix that supports SLAAC (i.e. has A flag
set).
2021-11-08 21:33:21 -08:00
canisLupus1313 dd16a0587e [cli] fix parameter parse in ccm command (#7139)
This commit fixes ccm command parameters handling.
2021-11-08 20:11:31 -08:00
Abtin Keshavarzian 2621219d14 [srp-server] use Array for Host IPv6 address list (#7137) 2021-11-08 14:49:39 -08:00
Abtin Keshavarzian dd39621968 [srp-server] simplify calls to RemoveHost() & RemoveService() (#7136)
This commit adds `enum` types to use as arguments `aRetainName`
and `aNotifyServiceHandler` in the calls to method `RemoveHost()`
and `Host::RemoveService()`.
2021-11-08 14:47:30 -08:00
Jiacheng Guo 663b1bb9a7 [log] check log level before dumping packet to string (#7138)
`otDump` will currently always dump to string and use the log level to
decide whether to print it. Since this function is in the key path of
packet handling, this behavior reduces network throughput. This commit
adds a log level check to fix the issue.
2021-11-08 09:07:33 -08:00
Jonathan Hui 96a17b07ca [docs] clarify otPlatRadioGetNow() as free-running (#7135) 2021-11-08 09:02:53 -08:00
Abtin Keshavarzian d1ae06ea20 [core] move mapping of public to core type in the related headers (#7128)
This commit moves the `DefineCoreType()` & `DefineMapEnum()`
definitions (which map the public and core types) to the related
headers where the core type is defined, e.g., `otIp6Address` to
`Ip6::Address` map is now defined in `net/ip6_address.hpp`. This
allows us to use `AsCoreType()` in more places (avoid the header
file dependency/loop).
2021-11-05 13:12:51 -07:00
Abtin Keshavarzian de0b8dae95 [mle] mParentChanges counter without INFORM_PREVIOUS_PARENT (#7134)
This commit allows `mParentChanges` counter which tracks the number
of times device (as a child) switches its parent to be used without
`INFORM_PREVIOUS_PARENT` feature.
2021-11-05 08:19:42 -07:00
Simon Lin 77b05ce0ab [dua] PBBR should resolve DUA dest for packet initiated from its MTD child (#7133)
This commit fixes a bug that PBBR does not send Address Query and
Backbone Query on behalf of MED Children, and add a test to make sure
DUA forwarding works on PBBR:
- Make sure PBBR sends Address Query and Backbone Query on behalf of
  MED Child
- Make sure PBBR does not send Address Query when the destination is
  MED Child
- Make sure MED Children do not send Address Query by itself
- Verifiy DUA reachability between PBBR and MED Child
- Make sure PBBR reduce IPv6 TTL by 1 when forwarding DUA destined
  messages
2021-11-05 08:18:08 -07:00
Abtin Keshavarzian ca450e5416 [netdata] allow Publisher to be build with service only (#7132)
This commit adds missing `#if` check in `network_data_publisher.cpp`
to ensure it can be built when `CONFIG_BORDER_ROUTER_ENABLE` is
disabled (i.e., with `CONFIG_TMF_NETDATA_SERVICE_ENABLE` only).
2021-11-03 22:45:37 -07:00
Eduardo Montoya a36a931975 [thci] fix Zephyr detection (#7131)
Make sure the variables are accessible in the child class and use
proper line endings for first Zephyr command.
2021-11-03 22:44:55 -07:00
Eduardo Montoya 14acfb8a14 [thci] add Thread 1.2 Certification fixes (#7122)
Several fixes for Thread 1.2 Certification, including:
- getMAC
- setPollingRate
- joinCommissioned
- MGMT_ACTIVE_SET
- setCSLtout
- LinkMetricsMgmtReq
- send_udp
- setCSLsuspension
- set_max_addrs_per_child
- getMlrLogs
- mldv2_query
- mdns_query
- powerDown
- powerUp
2021-11-02 21:02:49 -07:00
whd 2117396a47 [continuous-integration] fix test_dua_routing.py (#7117)
Added new API/CLI for reference devices to set allowed ranges of
router IDs. When the allowed ID range is set, the leader will only
assign router IDs in the range. In this way, we can assign
non-overlapping router ID ranges to different thread networks so that
no RLOC16s will collide across multiple thread networks.
2021-11-02 21:00:38 -07:00
Suvesh Pratapa 3dcf0ba544 [mle] implement CSL accuracy rules from latest Thread spec (#7119)
Apply all CSL accuracy rules from latest spec draft:

- If the Mode TLV in the Parent Request had the 'R' flag set to zero
  AND the Version TLV indicates that the version of the attaching
  device is Thread 1.2 or greater, the Parent SHOULD include the CSL
  Accuracy TLV in the Parent Response.

- A Parent that receives a Child Update Request which includes the CSL
  Synchronized Timeout TLV MUST include the CSL Accuracy TLV in the
  response.

- A Child that receives a Child Update Request which includes the CSL
  Accuracy TLV MUST include the CSL Synchronized Timeout TLV in the
  response if the Child is currently acting as a CSL receiver.
2021-11-01 11:26:08 -07:00
Li Cao 5e8265f455 [posix] use OT_MAX to simplify SPI code (#7124) 2021-11-01 09:26:02 -07:00
Abtin Keshavarzian 60aa8b4fb9 [cli] add OutputSockAddr() method (#7121) 2021-11-01 09:24:50 -07:00
kangping ba08ed6f34 [tests] fix flaky advertising proxy tests (#7105)
- double wait time for advertising proxy top update and multicast the
  SRP updates
- adjust waiting time to avoid collision with lease time schedule
- fully remove the service before starting next test case
- add debug logging
2021-11-01 09:16:31 -07:00
konradderda 09dd21abca [spinel] add missing Link Metrics Subject functionality (#7118)
This commit adds the missing Link Metrics configuration of Enh-ACK
probing in RCP.
2021-10-29 14:26:03 -07:00
Łukasz Maciejończyk 319068637c [mac] don't append header termination IE2 for empty data payload (#7123)
We do not require the HT2 IE if the only thing that follows the header
is the MIC.

This commit reverts #6941.
2021-10-29 10:56:55 -07:00
Simon Lin c9d68a7a01 [thread-cert] fix multicast tests (#7116) 2021-10-28 23:35:47 -07:00
Przemyslaw Bida 0adedb2da5 [posix] add support for ipv6 group join in multicastrouter (#7116)
This commit adds support for joining and leaving multicast group in
order to send proper Multicast Listener Reports from thread network to
backbone link.
2021-10-28 23:35:47 -07:00
Simon Lin f5e995135e [thread-cert] re-add test_mac_scan test (#7112) 2021-10-28 21:41:07 -07:00
Simon Lin ed4dceaa6d [github-actions] add simulation tests registering 500 services to one SRP server (#6991)
This commit adds two simulation tests to verify that SRP clients can
register 500 services to one SRP server:
- Virtual time simulation test with one SRP server and 25 SRP clients,
  each client registering 20 SRP services.
- OTBR simulation test same as above, but run SRP server on OTBR
  (Docker).
2021-10-28 11:36:25 -07:00
Eduardo Montoya 76cdf9dc7f [thci] serial handling improvements (#7113)
Improve handling of timeouts, exceptions and logging for device serial
communication.

Also include other minor syntax editions.
2021-10-28 11:24:54 -07:00
Simon Lin 05e59ade17 [border-router] fix UDP forwarding issue to infrastructure link (#7082) 2021-10-28 00:20:53 -07:00
Simon Lin 5282232e27 [tests] OTBR get_addrs returns only Thread addresses (#7106)
The intention is to make OTBR (in Docker) behaves same as normal
simulation devices.
2021-10-27 23:39:22 -07:00
whd 01f1489ec8 [tests] update test_publish_meshcop_service.py (#7067)
- Relax the assumptions on the names of meshcop services so that it's
  OK for services to change names to resolve conflicts.
- Adjust timeouts.
2021-10-26 22:48:28 -07:00
Eduardo Montoya 02f38b8e72 [dua] send BB.ans with :BB destination port (#7108)
According to the Thread 1.2 Specification, a Backbone Answer
always has :BB (61631) as destination port.
2021-10-26 21:55:15 -07:00
Abtin Keshavarzian dbc9cf7ff0 [ncp-base] limit the TREL property to FTD/MTD builds (#7111) 2021-10-26 17:26:47 -07:00
Sarah bfd26b988b [docs] dark theme support and full image paths (#7110) 2021-10-26 14:29:49 -07:00
Abtin Keshavarzian 0298586f97 [core] use AsCoreType() in core modules (#7091)
This commit uses `AsCoreType()` and other functions from header
`as_core_types.hpp` to cast between public OT C style definitions to
the related C++ core types in the core modules.
2021-10-25 13:21:26 -07:00
Eduardo Montoya 75243e3892 [thci] allow to use Zephyr platforms (#7099)
On initialization, detect if the device is running Zephyr and in that
case modify the commands prefix and line ends.
2021-10-25 13:12:22 -07:00
whd ec1bfac2a3 [continuous-integration] fix MATN-15 ChangeOfPrimaryBBRTriggersRegistration.py (#7103)
In the previous version of this test case, the ED node was actually a
REED, where the test plan asks it to be a ED. Changing the node to ED
makes the topology more stable. I've run the test case 50 times
locally and none of them failed.
2021-10-25 12:39:49 -07:00
Suvesh Pratapa 162ecb10f1 [mle] configure poll/rx-on modes after child role change (#7101)
If we configure CSL parameters before a command to attach, then the
child has configured valid CSL state, but when trying to configure the
auto-sync CSL poll timeout, the check to IsCslEnabled->IsCslCapable
fails because IsChild() fails.

When handling the child ID response success, we now trigger
poll-sender's recalculation, and rx-on-idle states, after role change
to child.
2021-10-25 12:38:30 -07:00
Jiacheng Guo 7e2420ff3d [spinel] export RadioSpinel functions for vendor hooks (#7087)
This commit exports private spinel utility functions to access vendor
implemented properties from the host.

The commit also reserves the vendor property range for Espressif to
avoid collision.
2021-10-25 12:35:31 -07:00
Simon Lin 025405645e [otci] support MLE Discovery (#7073) 2021-10-25 08:34:49 -07:00
Abtin Keshavarzian afcfb7ac00 [script] update check-simulation-build-cmake to local options variable (#7090) 2021-10-22 11:54:11 -07:00
Simon Lin 51bcd00618 [thread-cert] refine CLI output parsing (#7084) 2021-10-22 08:02:52 -07:00
Jonathan Hui 56ce8e2593 Revert "[build] fix android-check (#7092)" (#7095)
This reverts commit 10e6a6e916.
2021-10-20 23:14:59 -07:00
Jonathan Hui ea2783f5cb Revert "[border-router] firewall: ingress filtering (#7043)" (#7096)
This reverts commit c88a37b658.
2021-10-20 23:14:39 -07:00
whd 10e6a6e916 [build] fix android-check (#7092)
The android-check was broken after ingress filtering (#7043) was
checked in. This is because the newly added cpp files are missing in
Android.mk.
2021-10-20 19:49:49 -07:00
whd c88a37b658 [border-router] firewall: ingress filtering (#7043)
This commit implements part of the OTBR firewall. This implementation
focuses on the ingress filtering part. We may also introduce egress
filtering part when necessary.

For security purpose, there are some packet forwarding rules to
follow, which were originally introduced in the spec.
- Inbound packets initiated with On-Link addresses source (OMR and
  mesh local prefix based addresses) should be blocked.
- Inbound unicast packets whose destination address is not OMR address
  or DUA should be blocked.
- Inbound unicast packets whose source address or destination address
  is link-local should be blocked. Note that we don’t need to
  explicitly add rules for link-local addresses since this should
  already be handled by the kernel.

These rules can be easily implemented by iptables and ipset.
- Before otbr-agent starts, there is a script creating the iptables
  rules. The rules themselves are constant so we don't need to change
  them dynamically.
- During the runtime of otbr-agent, otbr-agent updates ipsets
  accordingly whenever there's a change of on-link prefixes.
2021-10-20 17:14:56 -07:00
Abtin Keshavarzian d2c0dac4ba [debug] adding SuccessOrAssert() helper macro (#7083)
This commit adds a new macro `SuccessOrAssert()` which checks a given
status value against zero (zero status indicates success or no error)
and `OT_ASSERT()` if it is not. This helper macro is then used by
other modules where we want to assert that some method/function is
not returning an error.
2021-10-20 17:01:25 -07:00
kangping 50285e4c53 [srp-server] include SRP update ID in log messages (#7089) 2021-10-20 16:59:04 -07:00
hemanth-silabs 4d63d44034 [crypto] update GetPeerCertificateBase64 to support mbedTLS 3.0.0 (#7069) 2021-10-20 15:07:21 -07:00
Simon Lin 5b54727f92 [github-actions] make test_set_mliid more reliable (#7072)
This commit uses a longer duration (10s) to make the test more
reliable.

The root cause why LEADER does not become Leader within 4s is still
unknown and to be investigated.
2021-10-20 12:06:05 -07:00
Simon Lin ee649b141b [github-actions] fix macOS builds (#7086)
This commit fixes macOS build failures by downgrading to macOS 10.15.
2021-10-20 09:36:45 -07:00
nikita-s-wrk f4e1526a49 [cmake] add ability to pick custom lib for MTD/FTD (#7041)
This commit enables different libraries option for ftd, mtd and rcp
builds.
2021-10-19 17:28:02 -07:00
Yakun Xu 71e4df9820 [daemon] add environment to allow all users access (#7076)
This commit adds an environment variable to allow all users access
Thread daemon via ot-ctl.
2021-10-18 13:02:50 -07:00
Jonathan Hui 119da1cd3f [cert] add ability to configure CCM mode (#7077)
Thread Test Harness requires devices to operate as if they were
commissioned using CCM. This commit adds the ability to configure the
device to behave as if it was commissioned using CCM. This
functionality requires `OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE` to
be enabled.
2021-10-18 09:23:09 -07:00
Simon Lin fcadd11ffb [cli-uart] fix va_end may not be called for va_copy (#7079) 2021-10-18 09:07:49 -07:00
Piotr Koziar 3f40cf78e6 [csl] prevent CslTxScheduler from entering the incorrect state (#7070)
Problem:

I have encountered CslTxScheduler entering the incorrect state causing
the device to be unable to perform csl transmission.  The state is
when mCslTxChild is null but mCslTxMessage is not null. As a result
Update() call does not have any effect.

I think that we enter the incorrect state when the following happens:

1. CSL transmission on mac is requested (mCslTxChild is set to the
   best child found in RescheduleCslTx(), mCslTxMessage is set to the
   child's IndirectMessage in HandleFrameRequest())

2. During the ongoing mac CSL transmission, Update() is called (this
   method can be called from multiple places)

3. The mCslTxChild's IndirectMessage differs from the mCslTxMessage
   ==> mCslTxChild is set to nullptr

4. After the finished csl transmission on mac, the HandleSentFrame()
   is called but it does not call RescheduleCslTx() so the mCslTxChild
   remains nullptr

Then every Update() call does not have any effect. To change that we
would have to call RescheduleCslTx() or set the mCslTxMessage to null
but there is no way of doing that.

Solution:

I believe that mCslTxMessage is "tracking" the mac transmission - it
is to be set when transmission is requested, and to be cleared when
the transmission ends. In this commit we are doing it in a clear way.
2021-10-13 22:05:37 -07:00
Li Cao 7dd7a5d7d6 [posix] minimize system initialization when dry-run option is set (#7031)
This commit adds a member mDryRun in otPlatformConfig, allowing the
app to initialize in 'DryRun' mode. In this mode, many modules won't
be initialized. For example, the settings file and the tun device.

Background:

The otbr-agent provides a way to query the RCP version in a single run
which we call as 'DryRun'. During this process, the full posix daemon
initialization will be done (including initialization of the settings
file, access the tun device, create the sock file, etc).  This will
cause such problem - In production, otbr-agent usually runs as a
service in some non-root user and is granted with the capability and
access it requires. But otbr-agent could sometimes also run by other
users to query the RCP version. For example, developers do that from
the console with the root user. In such case, otbr-agent will create
some files owned by the root user first. And then when the service
tries to start (with a non-root user), otbr-agent will find that it
doesn't have enough permission to open the file.

So in this commit, we try to prevent otbr-agent from touching any
files and other permission related stuffs if the DryRun option is set.

However it still needs to access the radio device (for example, the
'spi') since it needs to get the radio version. But accessing the
radio device with the root user doesn't affect the upcoming usage by
other non-root users.
2021-10-13 10:39:30 -07:00
whd f28612f1f8 [tests] keep files for every cert test run when MULTIPLY > MAX_JOBS (#7064)
Some enhancements for cert test run:
- Use a different log name for every test run. With the help of this
  we can get all logs & pcaps after running a test case when MULTIPLY
  > MAX_JOBS.
- While running test cases, print a line showing the test case being
  run.
2021-10-13 10:35:26 -07:00
Zhanglong Xia 987fcfa2d6 [posix] fix fall-through issue (#7066)
When compiling OpenThread in Android, the compiler generates an error:
unannotated fall-through between switch labels [-Werror,-Wimplicit-fallthrough]
2021-10-13 10:31:35 -07:00
Abtin Keshavarzian 9e26a5deab [meshcop] add common Timestamp::Compare() method (#7059)
This commit adds a new common `Timestamp::Compare()` methods which
compares two given `Timestamp` pointers (determines whether they are
equal or one is ahead or behind the other one). The new method allows
either input (or even both) to be `nullptr`. A null timestamp is used
to indicate when there is no timestamp. In terms of comparison
result, a non-null timestamp is considered to be ahead of (or larger
then) a null one and two null timestamps are considered equal. The
new method is used in all different places where the `Timestamp`s are
compared.

This commit also adds a unit test to verify the `Timestamp` class (the
existing `test_steering_data` is renamed to `test_meshcop` which is now
used to include unit tests for all MeshCoP related definitions).
2021-10-12 12:07:48 -07:00
Simon Lin d39fce1fa6 [uptime] enable uptime by default on posix and simulation (#7052)
This commit enables OPENTHREAD_CONFIG_UPTIME_ENABLE and
OPENTHREAD_CONFIG_LOG_PREPEND_UPTIME by default on posix and
simulation platforms.
2021-10-12 12:02:19 -07:00
Jonathan Hui c36c0e77a2 [cli] use OT_ERROR_PENDING instead of kErrorPending (#7061) 2021-10-08 15:39:49 -07:00
Jonathan Hui 9e4a24151e [docs] fix typos in API docs (#7058) 2021-10-08 15:39:31 -07:00
Thomas 27dc37ea8d [logging] add sequence number to the Mac packet log (#7050) 2021-10-06 12:20:13 -07:00
Damian Królik 7342f6cc98 [br-tests] add more steps to test_advertising_proxy.py (#7049)
Add steps which verify the bug fix contributed to OTBR:
https://github.com/openthread/ot-br-posix/pull/1020
That is, verify that SRP updates which modify both a host
and a service can be successfully completed.
2021-10-04 23:09:50 -07:00
Jonathan Hui fa86203ba2 [srp-server] fix typo in OT_SRP_SERVER_ADDRESS_MODE_UNICAST (#7055) 2021-10-04 18:23:59 -07:00
kangping 31320993fb [docs] add document for running BR tests locally (#7044) 2021-10-01 08:13:31 -07:00
Łukasz Maciejończyk 545c089429 [link-metrics] fix endianess for PDU in link metrics report sub-tlv (#7046)
This commit force Big Endian encoding for number of PDUs received in
Link Metrics Report Sub-TLV.
2021-09-30 10:52:15 -07:00
Simon Lin 5e76bd50fa [posix-trel] retry adding interface address if failed (#7047)
This commit enhances TREL UDP6 to retry adding the link-local
interface address until it's successful.
2021-09-30 09:22:45 -07:00
kangping 72c2f630c9 [routing-manager] make sure there is a LLA before enabling routing manager (#7042) 2021-09-30 09:06:02 -07:00
Simon Lin 3e82174c53 [posix] fix potential timeout calculation overflows (#7045) 2021-09-29 23:43:13 -07:00
kangping 0696ce45a8 [routing-manager] retry sending failed RS messages (#7038)
Current implement will start evaluating on-link prefix before
successfully sending kMaxRtrSolicitations=3 RS messages. This commit
fixes this issue by retrying sending failed RS messages in
kRtrSolicitationRetryFailDelay=60 seconds.
2021-09-29 22:24:30 -07:00
Robert Lubos 15141cde23 [tcp] apply ot-config compile options (#7048)
tcplp uses stdio.h which, for some libc implementations, can depend on
Kconfig defines.

These Kconfig defines can be included through compile options in
ot-config.

Link with ot-config to get the compile options.

Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
2021-09-29 12:36:05 -07:00
Simon Lin dc7676a032 [br-tests] enable BR tests with TREL (#7022)
This commit runs all Border Router (OTBR) tests with TREL enabled.
2021-09-28 09:10:26 -07:00
Abtin Keshavarzian aa2adc721a [ip6] clear radio type (link info) when forwarding received message (#7037)
This commit addresses an issue when forwarding received messages under
`MUTI_RADIO` config. We clear the radio type (which indicates the
radio on which the `Message` is received) when the same `Message`
instance is forwarded back to the Thread mesh to be sent out to a
neighbor. This then ensures that `RadioSelector` picks the radio to
send deadpanning on the neighbor's supported radios and their
preference.

This commit also updates `test-703-multi-radio-mesh-header-msg.py` to
verify and cover this situation.
2021-09-28 08:20:01 -07:00
Abtin Keshavarzian 1fa7b4dfeb [spinel-decoder] add extra check to address compiler warnings (#7036)
This commit updates some of the `SpinelDecoder::Read{Item}()` methods
to initialize their local pointer variables to `nullptr`. Though we
technically do not need this change (since the call to `Read(aPtr)`
will set the pointer value on success), some toolchains cannot infer
this from the code and generate error/warning of "pointer may be
used uninitialized".
2021-09-28 08:19:03 -07:00
Łukasz Maciejończyk 312e8a630b [link-metrics] add reverse linear scale for metrics in enh ack (#7035)
This commit add missing reverse operations for linear scale RSSI and
link margin for enhance acknowledgments.
2021-09-28 08:16:30 -07:00
Abtin Keshavarzian 54af1ee416 [key-manager] set frame counter on SubMac on a counter reset (#7034)
This commit changes `KeyManager` to use `SetAllMacFrameCounter(0)` to
reset the frame counter(s). This would then ensure that the new
counter value is also set on `SubMac` and radio platform layer
(which can handle the 15.4 frame counter assignments). This addresses
an issue where on Key Sequence update the frame counter values on
`SubMac` and radio platform can remain unchanged.
2021-09-26 22:17:34 -07:00
Abtin Keshavarzian e20a0a0cff [cli] skip CLI prompt when emitting command input/output to logs (#7030)
This commit updates CLI to not include the CLI prompt string "> " when
emitting the command's input and output to the logs under the config
`OPENTHREAD_CONFIG_CLI_LOG_INPUT_OUTPUT_ENABLE`. It also changes how
the input command is logged to avoid logging empty lines or extra
spaces in between the args.
2021-09-26 21:51:54 -07:00
Abtin Keshavarzian 47efcc6745 [sub-mac] check `IsHeaderUpdated() before signaling counter (#7029)
This commit adds a check in `SignalFrameCounterUsedOnTxDone()` to
ensure that radio platform did indeed update the header (i.e.,
assigned a frame counter) before reading the counter value from the
frame and signaling its use.
2021-09-26 21:51:20 -07:00
Abtin Keshavarzian 645dec173a [sub-mac] fix frame counter update and its sync with KeyManager (#7029)
This commit fixes two related aspects of updating of the frame counter
in `SubMac` and synchronizing the value with `KeyManager`.

It fixes an issue (when radio platform handles tx security and frame
counter management) where the counter value in `SubMac` and
`KeyManager` were set to old value used in the last transmission
(from `TxDone` callback). This would then lead to an already used
frame counter value to be included in MLE Link Frame Counter TLV.
Under `MULTI_RADIO` this could cause more harm since when appending
MLE Link Frame Counter TLV we move all counters for each radio link
up to max value among them and set the counter value on all radio
links(which would then cause the counter on radio platform to be set
to an older value).

This commit also updates the code to handle the case where the counter
value updates may be signaled out of order. This may happen due to a
new counter value being used for an enhanced-ack by radio platform
during tx of a frame. Note that the newer counter used for
enhanced-ack is processed from `SubMac::HandleReceiveDone()` which
can happen before processing of the older counter value from
`HandleTransmitDone()`.
2021-09-26 21:51:20 -07:00
Jiacheng Guo 9d7067f5a7 [crypto] move context to platforms (#7008) 2021-09-26 21:38:23 -07:00
Sam Kumar 5564ea0530 [tcp] add TCPlp data buffering code (used instead of FreeBSD's data buffering) (#6926)
This commit the libraries that I wrote as part of TCPlp to handle data
buffering. These libraries are intended to replace the mbuf-based data
buffering in the FreeBSD TCP implementation. They implement the send
buffer as a linked buffer chain (consistent with otLinkedBuffer in
OpenThread's TCP API) and the receive buffer as a circular buffer and
bitmap (used to keep track of which bytes were received out-of-order).
2021-09-24 23:15:40 -07:00
Abtin Keshavarzian 39fca69650 [meshcop] update handling of Active/Pending Timestamp TLVs (#7027)
This commit updates and simplifies processing of Active/Pending
Timestamp TLVs (in MeshCoP and MLE) by using TLV helper methods
that read/write the TLV's timestamp value from/in a message.
2021-09-23 22:42:09 -07:00
Abtin Keshavarzian 6ef5534a51 [mac] remove "packed" requirement for Mac::KeyMaterial (#7021)
This commit removes the `OT_TOOL_PACKED` requirement from types
`otMacKeyMaterial` and `Mac::KeyMaterial`. Generally, we define a
type as "packed"  if it may be embedded in a message/buffer (e.g. a
TLV) and/or may be cast from a buffer pointer. Neither case applies
to `KeyMaterial`.
2021-09-23 09:48:48 -07:00
Abtin Keshavarzian 8d268663ef [mac] update Mac::NameData to use Data (#7026)
This commit updates `Mac::NameData` to use `Data` as its base
class and then use its method in the `NameData` implementation.
2021-09-23 09:18:29 -07:00
Łukasz Duda a66703773f [dtls] ensure mbedtls_ssl_key_export_type is defined (#7025)
For certain external mbedTLS configurations, there is no much sense to
define MBEDTLS_SSL_EXPORT_KEYS when OT has Joiner || Commissioner ||
DTLS functionalities disabled.

This commit only ensures that such builds don't fail. The
mbedtls_ssl_key_export_type type is defined only when
MBEDTLS_SSL_EXPORT_KEYS is defined, while dtls.hpp is always taken
into the build process.
2021-09-23 09:13:08 -07:00
Abtin Keshavarzian f09a70cfe1 [meshcop] ensure msg has timestamp TLV in DatasetManager::HandleSet() (#7023)
This commit fixes `DatasetManager::HandleSet()` to add a check to
ensure that the message contains `PendingTimestampTlv` when the
Pending Dataset is being updated.
2021-09-22 11:09:30 -07:00
Simon Lin aad4aebdd0 [github-actions] upgrade to macOS-11 (#7024) 2021-09-22 11:07:42 -07:00
Abtin Keshavarzian 3c14f7b30f [mac] fix the Mac::NetworkName length check (length >= 1) (#7018)
This commit fixes the `NetworkName` check (for its length to be larger
than zero) which was recently added in commit e2f0afab5d. This commit
moves the name length check to method `Set(const NameData &aNameData)`
and after the `newLen` is calculated.

This commit also updates `TestMacNetworkName()` in unit test to verify
that setting the network name to an empty string correctly fails with
`kErrorInvalidArgs`.
2021-09-22 11:05:27 -07:00
Abtin Keshavarzian 6153855ae0 [cli] simplify generating output (adding Output & OutputWrapper) (#7012)
This commit adds a new class `Cli::Output` which now includes all the
simple `Output{Item}()` methods that are used by CLI and its
sub-modules. It also adds new `Output` method flavors that output an
item (e.g., an IPv6 address) with an appended newline at the end.
These patterns are often used by CLI modules so having such new
methods help simplify the code.

The commit also adds `OutputWrapper` which is a wrapper over an
`Output` instance providing similar methods. This class is used as
the base class of different CLI sub-modules (e.g., `Cli::Dataset` or
`Cli::Joiner`, etc.) which helps simplify their implementation
(allow them to use the same set of `Output` helper methods as the
ones used by the `Cli::Interpreter` class).
2021-09-21 13:28:19 -07:00
Abtin Keshavarzian 5b8ee97450 [netdata] enhance and simplify NetworkData class (#7004)
This commit updates the `NetworkData` implementation to simplify it
and make it more flexible.  It changes `NetworkData` class such that
it delegates providing the buffer space to store the TLVs to its
sub-classes (`Local`/`Leader`) or its users. This allow us to remove
many `static` methods that expect inputs of `(aTlvs, aTlvsLength)`
and instead the use the `NetworkData` methods directly. Basically,
the `NetworkData` class can now be considered as a wrapper over a
pointer to a buffer containing a sequence of TLVs which provides
methods to parse and process the TLVs. `NetworkData` class assumes
that the TLVs (buffer content) is immutable and we have a new class
`MutableNetworkData` which provides methods to update (add, remove,
or modify) the TLVs.
2021-09-20 22:47:11 -07:00
Abtin Keshavarzian d14acd4324 [message] update Message::Chunk definitions to use Data (#7019)
This commit updates the `Message::Chunk` type to use `Data` as its
base class (thus inheriting the common helper methods from it) which
helps simplify its use. This commit also adds couple of new methods in
`Data` class (method `SetLength()` to  change the `Data` length, and
`MatchesBytesIn()` to compare the `Data` content with bytes from a
given buffer). The `test_data` unit test is also updated to check the
newly added `Data` methods.
2021-09-20 19:13:00 -07:00
kangping 0bb0896c98 [logging] fix dynamic log level (#7016)
Set mLoggingLevel as static member.
2021-09-20 19:00:46 -07:00
Abtin Keshavarzian 541126f26d [mac] remove unnecessary cast of mMode2KeyMaterial to KeyMaterial (#7020) 2021-09-20 13:24:40 -07:00
Abtin Keshavarzian 5c22f6c521 [simulation] update alarm to avoid cast from uint to int (#7017)
This commit updates and simplifies the `alarm` platform implementation
under simulation by adding new functions to determine whether a timer
is expired and calculate the remaining time. The new code does not
use casting a `uint32_t` value to an `int32_t` (since its behavior is
toolchain/compiler dependent and it is not defined by the C++
standard).
2021-09-20 13:21:36 -07:00
Łukasz Duda 00da94e20d [mbedtls] add support for version 3.0.0 (#7001)
This commit adds forward compatibility with mbedTLS 3.0.

Changes that affected OpenThread implementation:

- Rename mbedtls_*_ret() cryptography functions whose deprecated
  variants have been removed (migration guide)

- Replace MBEDTLS_SSL_MAX_CONTENT_LEN with MBEDTLS_SSL_IN_CONTENT_LEN
  and MBEDTLS_SSL_OUT_CONTENT_LEN options (migration guide)

- Signature functions now require the hash length to match the
  expected value (migration guide)

- SSL key export interface change (migration guide) - this change
  affected us a little bit more, since Key Block for KEK generation is
  not part of mbedTLS callback anymore. I was able, however, to
  retrieve it from Master secret (did successfully commissioning
  between 2.2x vs 3.0). By the way, I clean up the code for KEK
  generation - I don't know why we also executed it for application
  CoAP secure?

- Separated MBEDTLS_SHA224_C and MBEDTLS_SHA256_C (migration guide)

- Most structure fields are now private (migration guide) - we use
  private fields just in two files in dtls.cpp and ecdsa.cpp. For now,
  I used a workaround by defining MBEDTLS_PRIVATE macro but we should
  request the mbedTLS team to provide us support for public
  getters.
2021-09-20 13:19:07 -07:00
Li Cao 097aa4f65d [cli] add cli-radio build (#6769)
Background:

In an early stage of developing a new product, developers may want to
verify the Thread related hardware functionality, for example, send,
receive, etc.  However if the product uses the posix <-> RCP mode,
it's hard to verify it before the posix daemon can run on the
host. cli-ftd and cli-mtd could be an alternative. However, if the
product uses the posix <-> RCP mode, the space of the 802.15.4 radio
chip will be very small. For example, nRF52811 doesn't have enough
space to flash cli-ftd or cli-mtd firmware. So this PR creates a new
firmware ot-cli-radio which has very limited functionality for
verifying the hardware.

Basically, the ot-cli-radio consists of openthread-radio and
libopenthread-cli-radio.a. It supports very few cli commands. The most
important command is diag. Currently, there are: diag, help, reset,
version.

Currently, the diag commands have different implementation on RCP:

- For commands like diag start, the process function
  (Diags::ProcessStart) is first called on host. Then host sends an
  SPI frame to the RCP and Diags::ProcessStart (different
  implementation) is called again on RCP.

- For commands like diag send, Diags::ProcessSend is first called on
  host.  Then host sends an SPI frame to the RCP, directly calling
  send API. And there is no Diags::ProcessSend implemented on RCP.

Let's call the implementation of Diags::Process* currently on host as
native diag commands. When we run ot-cli-radio, we should use the
native diag commands because it won't interact with a posix daemon and
it processes the diag commands through the whole process. So this PR
adds a new option OPENTHREAD_CONFIG_DIAG_NATIVE_CMDS_ON_RCP to control
whether to use the native diag implementation on RCP. When we use a
normal RCP, the option should be disabled. While when use
ot-cli-radio, the option should be enabled.
2021-09-18 09:51:35 -07:00
jinran-google ee58635945 [radio] use stack reset in RCP (#6645)
This commit makes RCP use a stack reset instead of doing a hard reset
when a reset command is received.
2021-09-17 18:36:26 -07:00
Abtin Keshavarzian 8841bdd38d [history-tracker] add unicast/multicast IPv6 address history (#6999)
This commit adds support in `HistoryTracker` to record the history of
changes to the Thread interface's unicast and multicast IPv6 addresses.
An entry is recorded when an address is added or removed. For unicast
addresses, each entry provides:

- Timestamp
- Event: Added or Removed
- Address : Unicast address along with its prefix length (in bits).
- Origin: Thread, SLAAC, DHCPv6, or Manual.
- Address Scope.
- Flags: Preferred, Valid, and RLOC (whether the address is RLOC).

For multicast address history, each entry provides:

- Timestamp
- Event: Subscribed or Unsubscribed.
- Address : Multicast address.
- Origin: Thread or Manual.

This commit also updates CLI and adds `history ipaddr` and
`history ipmaddr` commands to get the lists. It also updates the
documentation in `README_HISTORY.md`.
2021-09-17 11:43:02 -07:00
Abtin Keshavarzian 95fa6220d7 [tmf] add AnycastLocator module (#6513)
This commit adds a new class `AnycastLocator` which can be used to
locate the closest destination of an anycast IPv6 address (i.e., find
the related mesh local EID and RLOC16). The closest destination is
determined based on the the current routing table and path costs
within the Thread mesh.

The implementation uses a CoAP confirmable post request to a newly
added URI path ("a/yl"). The destination IPv6 address of such as
request message is set to the anycast address to be located. The
receiver of the request message sends a CoAP response which includes
the "Mesh Local EID"  and "Thread RLOC16" TLVs.

This commit also adds support this new feature in CLI (adding a new
`locate <anycast-addr>` command).

Finally this commit adds `test_anycast_locator.py` to test behavior of
the new feature.
2021-09-17 08:04:44 -07:00
Abtin Keshavarzian 961fd9ae95 [common] adding AsCoreType() to covert from public to core types (#6993)
This commit adds header file `common/as_core_type.hpp` which adds
helper functions `AsCoreType()` which help convert from a
public C OpenThread type to its corresponding C++ core type (e.g.,
`otIp6Address` to `Ip6::Address`). This commit also adds `MapEnum()`
function to convert between public and core `enum` definitions (e.g.,
`otMacFilterAddressMode` and `Mac::Filter::Mode`). These helper
function act as syntactic sugar helping simplify the implementations
of OT API functions (in `api/{module}_api.cpp` files).
2021-09-16 21:15:37 -07:00
Simon Lin 7d91dd19c6 [thread-cert] add test to verify MED informs previous parent on reattach (#7005)
This commit verifies that MEDs can inform previous parent on reattach
with OPENTHREAD_CONFIG_MLE_INFORM_PREVIOUS_PARENT_ON_REATTACH enabled.
2021-09-16 21:00:15 -07:00
Abtin Keshavarzian 063d7a1514 [netdata] add ServiceData and ServerData types (#6984)
This commit adds new types `NetworkData::ServiceData/ServerData`
(which use the `ot::Data` class) which help simplify different
`NetworkData` methods dealing with Service and Server TLVs.
2021-09-16 14:50:23 -07:00
Abtin Keshavarzian ca35753a1e [common] adding Data and MutableData (#6984)
This commit adds two new generic types `Data` and `MutableData` which
are simply wrappers over a pointer to a buffer and a given data
length. The data length can be either `uint8_t` or `uint16_t` which
is determined by a template parameter. The `Data` treats the content
of the buffer as immutable  whereas `MutableData` allows it to be
changed. This commit also adds a unit test `tes_data` to verify the
behavior of newly added types.
2021-09-16 14:50:23 -07:00
Abtin Keshavarzian 79cd482776 [mesh-forwarder] call UpdateRoutes on rx of first fragment frame (#7015)
This commit ensures to call `UpdateRoutes()` on rx of a first lowpan
fragment frame. `UpdateRoutes()` can then update the snooped address
cache entries and check if the message is from a previous child (which
indicates that the child has switched to a new parent). This change
should help address an issue with "inform previous parent" behavior
not removing the child when `MULTI_RADIO` is enabled (due to frag
header added to the frames for duplication detection under
multi-radio).
2021-09-16 14:38:35 -07:00
Jonathan Hui b9fadd227b [github-actions] use --no-check-certificates when invoking wget (#7011) 2021-09-15 19:58:03 -07:00
Jiacheng Guo 6fa642754b [network-data] fix missing header in network_data_publisher.cpp (#7007) 2021-09-14 12:11:59 -07:00
hemanth-silabs 0a5152b4fa [crypto] remove unused references to get key attributes (#7009)
Removing some unused references to get key attribute feature.
2021-09-14 11:09:40 -07:00
Simon Lin 7ba6111516 [thread-cert] output more logs in OTBR tests (#7003) 2021-09-13 08:49:02 -07:00
Li Cao f329722edb [cli] fix warning of strncpy (#6992)
Using memcpy seems to be simplest, most efficient way.
2021-09-10 08:36:26 -07:00
Simon Lin 35e5e20621 [mle] evicts delayed MLE Data Request when sending a newer one (#6996)
This commit evicts delayed MLE Data Requests whenever the device is
sending a newer one.
2021-09-10 08:17:54 -07:00
Simon Lin 7aadbb7b9a [mle] send Delayed Data Request with latest Active/Pending Timestamp (#6995)
This commit fixes a potential bug that delayed Data Requests may use
wrong Active and Pending Timestamps because the Active & Pending
Timestamps may change while a Data Request is being delayed.
2021-09-09 21:49:07 -07:00
Simon Lin db2e313ef0 [cli] disallow concurrent commands (#6695)
This commit disallows concurrent commands.

With this commit, the CLI only execute a new command after it complete
the previous command. CLI can also prompt properly after the command
execution is done.

Other fixes and enhancements:
- Fixes premature command prompt
- Add ping async command for ping in async mode: output Done
  immediately but print ping responses later on.
- Fixes networkdiagnostic get outputs multiple Done by always waiting
  for 5 seconds.
2021-09-09 20:46:43 -07:00
Abtin Keshavarzian 9e631d816e [mle] simplify Start(), Stop(), and SendAnnounce() (#6986)
This commit updates `Start()`, `Stop()` and `SendAnnounce()` in `Mle`
to remove the extra parameters from the `public` versions of these
methods (adding a `private` version with extra parameter for use by
`Mle` class itself). It also adds `StartMode`, `StopMode`, and
`AnnounceMode` enumerations to use as parameter type (instead of
`bool`) in these methods which helps with code readability.
2021-09-09 20:32:03 -07:00
Abtin Keshavarzian db3c64410b [message] update Message:Settings and the default settings (#6985)
This commit updates the `Message::Settings` such that it directly
inherits from the `otMessageSettings` C struct definition. This helps
simplify the initialization of the constant default `Settings`
instance (from `GetDefault()`) to avoid calling object constructor.
It also simplifies the conversion from an `otMessageSettings *` to
a `Settings` (if the pointer is not NULL, the `otMessageSettings`
instance itself can be directly used instead of creating a copy).
2021-09-09 15:57:49 -07:00
Jonathan Hui 6aac6708a7 [script] update scan-build to use cmake/ninja (#6982) 2021-09-09 15:48:53 -07:00
Eduardo Montoya 1057e658ff [csl] fixes on the receiver window duration calculation (#6997)
- kUsPerUncertUnit was declared with two different values.
- clockAccuracy values were not properly read from the Parent
  Response.
2021-09-09 15:48:18 -07:00
whd e2f0afab5d [network-name] implement additional validation rules (#6988)
According to SPEC-981, we need to verify 3 more things while setting a
network name:
- The name length >= 1.
- There are no UTF control characters in the name.
- There are no UTF NUL characters in the name. This is covered by the
  second rule.
2021-09-09 15:41:06 -07:00
Abtin Keshavarzian 7563ee8d1d [srp-server] support address modes & sharing of socket with DNS-SD (#6826)
This commit updates `Srp::Server` to add support for selecting its
address mode (unicast or anycast). The address mode specifies how the
SRP server determines its address and port number and how this info
is published in Thread Network Data.

In anycast address mode, the SRP server will use port number 53 which
is also used by DNS resolver/server. So if both `Srp::Server` and
`Dns::ServiceDiscovery::Server` are enabled on a device, they both
need to listen on the same port number and share the same UDP socket
instance. This commit adds the mechanism in the code to realize this.
The `Srp::Server` will monitor when/if DNS-SD is active and checks
whether the port numbers match and if so it will close its own socket
and re-use the one from DNS-SD. In this case, an incoming UDP message
is first given to `Srp::Server` to process and if it fails to process
it then the message is given to DNS-SD.

This commit also adds CLI commands under `srp server` to get/set the
address mode (and update the `README_SRP_SERVER.md` documentation).
It also adds a new test `test_srp_server_anycast_mode` which covers
the SRP server address mode and the newly added behaviors.
2021-09-08 20:56:53 -07:00
hemanth-silabs cf452fbf7c [crypto] adding ARM PSA (Platform Security Architecture) support (#6862)
- New format for MAC keys, as a union between literal key and keyrefs.
- Modified key_manager to handle both literal keys or keyrefs.
- Modified MAC and sub_mac modules to handle both Literal Keys or keyrefs.
- Updated Crypto Modules to use abstracted APIs.
- New CLIs to handle networkkey and pskc references.
2021-09-08 14:47:46 -07:00
whd 88c2f0f7ed [github-actions] fix brew install issue on macOS (#6990)
When brew install ninja, python 3.9 is being installed as a
dependency. However, the installation failed because there is a
conflict on binary /usr/local/bin/2to3.
2021-09-08 13:29:04 -07:00
Bob MacDonald 0a6fba303a [cmake] remove obsolete efr32 cmake file (#6983) 2021-09-03 18:26:23 -07:00
Abtin Keshavarzian 69bfc4b1c0 [message] simplify Metadata (#6879)
This commit simplifies the `Metadata` definition in `Message` by
rearranging the member variables (to avoid alignment gaps). It moves
the definition to be sub-type of `Buffer`. It also removes the
doxygen documentation for `private` or `protected` definitions
(mainly for simple getters/setters).
2021-09-02 13:50:26 -07:00
Abtin Keshavarzian 6f7684ed8b [logging] add CONFIG_LOG_PREPEND_UPTIME to prepend uptime to the log (#6968)
This commit adds `OPENTHREAD_CONFIG_LOG_PREPEND_UPTIME` config to
prepend the current uptime (as "[x days] hh::mm::ss.mmmm") to the
OpenThread log messages.
2021-09-02 13:44:40 -07:00
Abtin Keshavarzian ca3830fac2 [uptime] new feature to track OT instance uptime (in msec) (#6968)
This commit adds a new module `Uptime` which tracks the number of
milliseconds since OpenThread stack initialization as an `uint64_t`
value. It also adds public OT APIs to get the current uptime value
(either as the number of milliseconds or in human-readable string
format like "2 days 12:45:12.762"). A CLI `uptime` command is also
added. This feature can be enabled using the newly added config
option `OPENTHREAD_CONFIG_UPTIME_ENABLE` (or the related CMake
`OT_UPTIME` option).
2021-09-02 13:44:40 -07:00
Abtin Keshavarzian 0f73466897 [common] add template helper AsConst()/AsNonConst() functions (#6978)
This commit adds a new header `common/const_cast.hpp` which provides
template functions `AsConst()` and `AsNonConst()` to cast between
const and non-const references or pointers. The template functions
simplify the code (act as syntactic sugar) by allowing the compiler
to infer the underlying reference/pointer types.
2021-09-02 13:42:03 -07:00
Abtin Keshavarzian 118511c4f6 [netdata] remove mType in NetworkData class (#6977)
This commit simplifies the `NetworkData` class by removing the `mType`
Instead we add a new parameter in `SendServerDataNotification()` which
indicates whether to append the Network Data TLV to the message or
not (which was previously determined by `mType`).
2021-09-02 13:21:08 -07:00
Jonathan Hui a193a6f23a [coap] remove unnecessary value store (#6973)
To remove compiler warning:

  Value stored to 'isOptionSet' is never read
2021-08-31 14:44:42 -07:00
Jonathan Hui 74420106fc [mac] remove unnecessary value store (#6974)
To remove compiler warning:

  Value stored to 'caps' during its initialization is never read
2021-08-31 11:05:06 -07:00
Łukasz Maciejończyk 812fc1eaea [spinel] refactor connection handling for USB transport (#6963)
This commit simplifies USB connection handling after resetting (hard reset)
RCP device with USB transport.
It drops udev dependency making the new approach generic for USB CDC ACM
across all platform.
It is working also on dockers.
The feature is enabled by new radio Url parameter: 'uart-reset'.

Radio url example:
spinel+hdlc+uart:///dev/serial/by-id/SYMLINK_TO_RCP_DEVICE?uart-reset

It is meant only for connection with RCP devices working with USB
transport and performing hard reset on host reset command.
2021-08-30 12:41:16 -07:00
Abtin Keshavarzian 57ade714a6 [test] simplify unit test platform implementation (#6966)
This commit simplifies `test_platform` module which defines the
platform APIs used by unit tests. It removes the unused global
variables and the function pointer mechanism to override platform
APIs. Instead the platform APIs in `test_platform` are defined as
`OT_TOOL_WEAK` allowing individual tests to override any of the
default implementation with their own version (e.g. `test_timer`
provides its own alarm platform APIs).
2021-08-30 12:07:17 -07:00
Abtin Keshavarzian 03ec5af7b4 [history-tracker] fix EntryAgeToString() calculation of minutes (#6967) 2021-08-30 11:58:44 -07:00
Abtin Keshavarzian 3c10ded88d [simulation] fix handling of overflow in virtual-time simulation (#6969)
This commit updates `platformAlarmGetNext()` in `alarm-sim` in
virtual-time simulation platform to return the remaining duration
to the next alarm as `uint64_t` (in microseconds). This fixes the
issue with potential overflow in calculating the next alarm time.
2021-08-30 11:57:14 -07:00
Mason Tran a935fc51f7 [tcp] fix uninitialized variable warning in TcpExample::ProcessBenchmark() (#6957) 2021-08-27 18:00:07 -07:00
whd 88950e15e1 [dns] allow Data Length = 0 while reading a TXT record (#6961)
RFC 6763 Section 6.1 states the following:

   An empty TXT record containing zero strings is not allowed [RFC1035].
   DNS-SD implementations MUST NOT emit empty TXT records.  DNS-SD
   clients MUST treat the following as equivalent:

   o  A TXT record containing a single zero byte.
      (i.e., a single empty string.)

   o  An empty (zero-length) TXT record.
      (This is not strictly legal, but should one be received, it should
      be interpreted as the same as a single empty string.)

   o  No TXT record.
      (i.e., an NXDOMAIN or no-error-no-answer response.)

This commit reflects the second requirement.
2021-08-27 12:42:07 -07:00
Eduardo Montoya a4a4d8ceb8 [docs] remove stale comment (#6964) 2021-08-27 08:27:44 -07:00
canisLupus1313 81005d2f99 [dua] fix missing error indication when building DUA functionality (#6960)
This commit introduces compilation error for building DUA without
SLAAC dependency.
2021-08-26 13:13:40 -07:00
Abtin Keshavarzian 1b035662c2 [radio] use otError in C radio platform APIs (#6958)
This commit changes `radio_platform.cpp` to use `otError` in the
function definitions (weak/default implementations of) radio
platform APIs. This ensures the definitions are consistent with
their declarations in `radio.h`.
2021-08-26 13:12:49 -07:00
whd 9ea34d1e20 [tests] fix test_publish_meshcop_service.py (#6956) 2021-08-25 21:30:22 -07:00
Simon Lin 8d8128b27b [trel] fix assert failure without TREL URL (#6959) 2021-08-25 21:24:03 -07:00
Simon Lin 934448db6a [cli] add CLI command to enable/disable TREL (#6949) 2021-08-24 21:55:01 -07:00
Abtin Keshavarzian f1e7ceb12e [router-table] fix signalling when neighbor routers are removed (#6948)
This commit updates `RouterTable` to ensure signalling removal of
neighbor routers when router table is fully cleared or when a
`Router` with a specific released router ID is cleared.
2021-08-24 15:07:26 -07:00
Abtin Keshavarzian ee807d3001 [history-tracker] add support for neighbor table history (#6947)
This commit adds support in `HistoryTracker` to record the history of
changes to the neighbor table. An entry is recorded when a child or
router neighbor is added, removed, changed, or being restored (the
restored entries are only used for the previous children list
retrieved from non-volatile settings on the device (re)start). Each
entry provides:

- Timestamp
- Type: Child or Router
- Event: Added, Removed, Changed
- Extended Address
- RLOC16
- MLE Link Mode (rx-on-when-idle, FTD/MDT, full-netdata).
- Average RSS (in dBm) of received frames from the neighbor at
  the time the entry was recorded.

This commit also updates CLI and adds `history neighbor` command
to get the neighbor history. It also updates the documentation.
2021-08-24 15:07:02 -07:00
canisLupus1313 d53e4994d0 [csl] Message transmission timer fixes. (#6942)
This commit fix addresses few problems:
- Method ScheduleMessageTransmissionTimer at first call after CSL is
  enabled calculated interval incorrectly.
- Data Polls after transition from MED to SED were triggered with
  incorrect interval.
2021-08-24 15:05:05 -07:00
Abtin Keshavarzian ed0f4bf412 [test] fix border_router/test_plat_udp_accessiblity.py (#6927)
This commit fixes the test by removing the unnecessary argument
in the call to `srp_client_remove_host()`. Removing the host on
SRP client also removed all previously registered service so
we can remove the call to `client.srp_client_remove_service(...)`.
2021-08-23 23:07:57 -07:00
Abtin Keshavarzian 5851524d7a [srp-client] add aSendUnregToServer param to RemoveHostAndServices() (#6927)
This commit adds a new parameter `aSendUnregToServer` to SRP client's
`RemoveHostAndServices()` API. This parameter determines the behavior
when the host info is not yet registered with the server. If it is
set to `false` (which is the default/expected value) then the SRP
client will immediately remove the host info and services without
sending an update message to server (no need to update the server if
nothing is yet registered with it). If it is set to `true` then the
SRP client will send an update message to the server. Note that if
the host info is registered then the value of `aSendUnregToServer`
does not matter and the SRP client will always send an update message
to the server requesting removal of all info.

One situation where this parameter can be useful is on a device
reset/reboot where the caller may want to remove any previously
registered services with the server. In this case, caller can
`SetHostName()` and then request `RemoveHostAndServices()` with
`aSendUnregToServer` as `true`.

This commit also adds `test_srp_client_remove_host.py` which
verifies the behavior the newly added mechanism between client and
server.
2021-08-23 23:07:57 -07:00
Abtin Keshavarzian da629d63ff [srp-server] update how/where the host addresses are checked (#6927)
This commit changes the check for the number of host addresses in
a newly received SRP update message such that if we have a non-zero
lease, we ensure that there is at least one valid address. It also
moves this check from `ProcessHostDescriptionInstruction()` to
after the Lease Option in the Additional Section is parsed (in
`ProcessAdditionalSection()`) so that we check after we determine
the host lease interval and whether the host is being removed or
registered.
2021-08-23 23:07:57 -07:00
Abtin Keshavarzian 6895edda59 [linked-list] range-based for loop iteration over all entries (#6945)
This commit enables use of range-based `for` loop for iterating over
all the entries in a `LinkedList`. It adds private implementations of
`Iterator` and `ConstIterator` which inherit from `ItemPtrIterator`
and use the `GetNext()` to go to the next entry. The range-based
`for` loop practically acts as a syntactic sugar helping simplify the
code and does not add any code size (or any expected run-time)
overhead.
2021-08-23 14:50:14 -07:00
priyankaCh22 34366834b0 [otci] dns query timeout fix (#6946)
We discovered that dns resolve takes a little longer i.e. 15sec to
finish (rather than default timeout of 10s). Thus using a larger
timeout for dns resolve (and other dns commands), e.g. 30s has helped.
2021-08-23 14:41:11 -07:00
canisLupus1313 deb2a4c97a [csl] disable CSL when detaching (#6936)
When child becomes detached the CSL wasn't disabled in the radio
driver, which caused problems with sending ParentRequest.
2021-08-20 11:10:50 -07:00
Piotr Koziar 5e22e38393 [csl] allow more tx failures when sending CSL data poll (#6931)
Currently, we disable retries on radio/submac of data polls with CSL
IE (I believe to avoid sending outdated CSL IE). To compensate for
this, we use kMaxCslPollRetxAttempts (default 15) instead of
kMaxPollRetxAttempts (default 4), which gives us more possible retx on
mac.

Assuming we get NoAck error, depending on the presence of CSL IE,
there will be:
a) 4 attempts (on mac) with up to 15 retries on radio/submac (if no
   CSL IE)
b) 4 attempts on mac (if CSL IE present) because child is considered
   detached from parent after 4 data poll transmissions that returned
   NoAck error.

So in the end, the increased number of RetxAttempts does not have a
full effect - we start to reattach after 4 retx while having 15 retx
allowed.

This commit adds kFailedCslDataPollTransmissions constant that will be
used instead of kFailedRouterTransmissions in case of data poll with
CSL IE on Child-Parent link.
2021-08-20 11:09:25 -07:00
Simon Lin b825b8b718 [Android.mk] add missing TREL source (#6943) 2021-08-20 08:05:30 -07:00
whd e863d515ed [docs] update README_SRP_SERVER.md (#6935)
Give more informational description about the srp server state
command.
2021-08-20 08:04:42 -07:00
Yakun Xu 12a9ca19a7 [cmake] avoid unnecessary rebuild when git commit id changes (#6881)
This commit removes the PACKAGE_VERSION definition from the global
config target so that when the git commit id is changed, only a few
sources will be re-compiled.
2021-08-19 12:20:30 -07:00
Łukasz Maciejończyk d7749402f0 [mac] append header termination IE2 when data payload is present (#6941)
MIC is a part of data payload, so if it's present, data payload is not
empty even if the data message is empty (ieee802154-2020 7.2.1 -
General MAC frame format).  If so according to Termination IE
inclusion rules (ieee802154-2020 7.4.2.1 Table 7-6) Header Termination
IE2 need to be applied.
2021-08-19 12:17:09 -07:00
Abtin Keshavarzian 9272666541 [neighbor-table] new event to signal child mode change (#6939)
This commits adds a new `otNeighborTableEvent` which indicates that a
child's Device Mode is changed (in addition to existing events which
indicate that a child or a router neighbor is being added or
removed).
2021-08-18 11:40:38 -07:00
Abtin Keshavarzian 4d8cbe6d59 [netif] define related types (unicast/mcast addr, iterator) as nested types (#6928)
This commit renames and moves the related types in `Netif` module like
`UnicastAddress`, `MulticastAddress`, etc. under `Netif` class (as a
nested type). It also moves iterator types under the related type
(for example, `ExternalMulticastAddressIteratorBuilder` becomes
`Iterator::Builder` under `ExternalMulticastAddress` class. These
changes help simplify the code (allow us to use shorter names in the
`Netif` implementation).
2021-08-18 11:37:25 -07:00
gavinmcgovern 1190fb5437 [docs] add markup for history tracker (#6932) 2021-08-18 09:38:10 -07:00
Li Cao 814a6c17ef [ncp] fix auto in enhanced loop (#6938) 2021-08-17 19:44:26 -07:00
Abtin Keshavarzian 3a90ed81f0 [mle] skip removing and re-adding of RLOC IPv6 address on no change (#6920)
This commit updates `Mle::SetRloc16()` to skip removing and re-adding
of the `mMeshLocal16` IPv6 address when it does not change.

It also updates how the cached CoAP messages are cleared such that
they are cleared only if the address gets changed.
2021-08-16 18:56:19 -07:00
Sam Kumar c00c9afa45 [tcp] link third_party TCPlp module in CMake build (#6925)
This commit changes the Makefiles so that the TCPlp module is linked
in to the code when building OpenThread using CMake. This is necessary
when script/build or script/cmake-build is used to build OpenThread.
2021-08-16 18:28:11 -07:00
Sam Kumar 306e030f96 [ip6] add support for ECN in IPv6 MessageInfo and Header (#6790) 2021-08-16 18:26:51 -07:00
Sam Kumar f426ff35c0 [tcp] implement global linked lists and TCP timer management (#6790) 2021-08-16 18:26:51 -07:00
Sam Kumar 06f36c9c3d [tcp] add logging region for TCP (#6790) 2021-08-16 18:26:51 -07:00
Sam Kumar 517b1b762d [tcp] make IPv6 header available to TCP segment processing routine (#6790) 2021-08-16 18:26:51 -07:00
Abtin Keshavarzian 6ccd4ffd78 [mac] tx beacon on the same radio as the request in multi-radio config (#6921)
This commit updates `Mac` under `MULTI_RADIO` config to limit the
radio links used when sending a MAC Beacon frame (which uses
broadcast destination and therefore by default would be sent on all
radios) to the same radio links from which the triggering Beacon
Request frame(s) were received. This ensures that when a multi-radio
node scans another multi-radio node we get one Beacon response on
each radio link.
2021-08-16 09:48:19 -07:00
Abtin Keshavarzian fbe0d3b690 [test] extra wait on multiple prefix add in test_netdata_publisher (#6924)
This commit updates the `test_netdata_publisher` to add extra wait
time between adds (where the same on-mesh prefix is published on all
routers). This should help make the test robust and avoid the
situation where publishing the same prefix on all routers all
together could cause the number of entries in the Network Data to
temporarily go above the desired number. This can happen (though not
often) due to the randomness in how/when nodes using `Publisher` add
their entry in the Network Data.
2021-08-16 09:15:34 -07:00
Abtin Keshavarzian b42261f88c [mle] check netif is up before processing discover scan (#6919)
This commit updates `Mle::DiscoverScanner` to check that IPv6
interface is enabled from `Discover()` (returns `kErrorInvalidState`
if netif is not up).
2021-08-12 21:57:11 -07:00
Jonathan Hui e8e40229fd [dataset-manager] avoid nullptr dereference (#6918)
The CoAP response handler may pass nullptr if an error occurs.
2021-08-12 20:57:34 -07:00
Abtin Keshavarzian 2798cc9c05 [utils] adding HistoryTracker module (#6807)
This commit adds History Tracker feature and its CLI support. This
feature records history of different events as the Thread network
operates (e.g., history of RX and TX IPv6 messages or network info
changes).

Recorded entries are timestamped. When the history list is read, the
timestamps are given as the entry age relative to the time the list
is being read. For example in CLI a timestamp can be shown as
`02:31:50.628 ago` indicating the entry was recorded 2 hours, 31 min,
50 sec, and 628 msec ago. Number of days is added for events that are
older than 24 hours, e.g., `31 days 03:00:23.931 ago`. Timestamps use
millisecond accuracy and are tacked up to 49 days. If an event is
older than 49 days, the entry is still tracked in the list but the
timestamp is shown as old or `more than 49 days ago`.

The `HistoryTracker` currently maintains 3 lists. The Network Info
history tracks changes to Device Role, Mode, RLOC16 and Partition ID.
The RX/TX history list records information about the received/sent
IPv6 messages:
- Message type (UDP, TCP, ICMP6 (and its subtype), etc.)
- Source and destination IPv6 addresses and port numbers
- IPv6 payload length
- The message checksum (for UDP, TCP, or ICMP6).
- Whether or not the link-layer security was used
- Message priority: low, norm, high, net (for control messages)
- Short address (RLOC16) of neighbor who send/received the msg
- Received Signal Strength (in dBm) for RX only
- Radio link info (15.4/TREL) on which msg was sent/received
  (useful when `OPENTHREAD_CONFIG_MULTI_RADIO` is enabled)

Config `HISTORY_TRACKER_EXCLUDE_THREAD_CONTROL_MESSAGES` can be used
to configure `HistoryTracker` to exclude Thread Control message
(e.g., MLE, TMF) from TX and RX history.

The number of entries recorded for each history list is configurable
through a set of OpenThread config options, e.g., number of entries
in Network Info history list is specified by OpenThread config option
`OPENTHREAD_CONFIG_HISTORY_TRACKER_NET_INFO_LIST_SIZE`. The
`HistoryTracker` will keep the most recent entries overwriting oldest
ones when the list gets full.

This commit also adds support for `HistoryTracker` in CLI. The CLI
commands provide two style for printing the history information: A
table format (more human-readable) and list style (better suited for
parsing by machine/code). `README_HISTORY.md` is added to document
the commands and the info provided by each history list entry.

This commit also adds `test_history_tracker.py` test-case which
covers the behavior of `HistoryTracker`.
2021-08-12 15:47:26 -07:00
Simon Lin 59f7a9aed6 [posix] refine system initialization and deinitialization (#6886)
This commit refines system initialization and de-initialization by
separating the process before and after OpenThread instance creation
and destruction:

otSysInit():
  Call platformInit()
  Create OpenThread Instance as `gInstance`
  Call platformSetUp()

otSysDeinit():
  Call platformTearDown()
  Destroy OpenThread Instance `gInstance`
  Call platformDeinit()

This commit should help fix the issue that platform UDP sockets can
not be created when constructing OpenThread instance.

This commit contains other related changes:

- otSysDeinit now destroys the OpenThread instance

- posix/platform code use a global variable gInstance to track the
  single global OpenThread instance, instead of using multiple
  pointers in multiple files.
2021-08-12 15:01:32 -07:00
Abtin Keshavarzian 02ff2110da [netdata] add RoutePreference and related helper functions (#6916)
This commit adds helper functions to convert a `RoutePreference`
to/from a 2-bit unsigned encoded value. These are used in
`NetworkData` (for on-mesh prefix or external route) and also in
`RoutingManager` and `RouterAdv`. 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.
2021-08-12 14:13:16 -07:00
whd cd6d57d1af [cli] add API/CLI to support querying SRP server state (#6914) 2021-08-12 10:52:04 -07:00
canisLupus1313 f99f206bea [csl] allow to configure the CSL auto synchronization (#6913)
This commit allows configuration of auto synchronisation of CSL,
with data poll mechanism.
2021-08-12 10:51:21 -07:00
Simon Lin b6fb0f4f93 [border-routing] fix on-link prefix validation (#6917) 2021-08-12 09:57:17 -07:00
kangping 1fcc67d4cb [routing-manager] replace mAdvertisedOnLinkPrefix with a boolean flag (#6878)
The mAdvertisedOnLinkPrefix can only be nullptr or mLocalOnLinkPrefix.
Change to use a boolean flag mIsAdvertisingOnLinkPrefix to make this
explicit.
2021-08-12 09:28:27 -07:00
kangping 4e717060fd [routing-manager] delay removing external route for on-link prefixes (#6878)
Per RFC 4862 section 5.5.3, the SLAAC address of a on-link prefix
will not immediately be invalidated even if the on-link prefix is
sent with zero PIO valid lifetime but we currently removes the
external route for the on-link prefix when we see zero valid lifetime.
This results in an error case that a Thread device can not reach
a valid SLAAC address of a Wi-Fi host on the same infra link because
there is no routes for this address.

This commit fixes this issue by delay removing the external route
for the discovered on-link prefix untill its valid lifetime expires.
Meanwhile, the Border Router now considers a deprecated (zero preferred
lifetime) on-link prefix not usable. Thus, the Border Router will
start advertising its own on-link prefix when current on-link prefix
is deprecated.
2021-08-12 09:28:27 -07:00
kangping 5598848980 [cli] add commands for getting Border Router OMR and on-link prefix (#6878)
This commit adds the 'br omrprefix' and 'br onlinkprefix' for
getting OMR and on-link prefix of current Border Router.
2021-08-12 09:28:27 -07:00
Simon Lin 06ca16a38f [dua] fix potential issue in DUA.rsp & DUA.ntf processing (#6816)
There is a potential bug in
DuaManager::ProcessDuaResponse(Coap::Message &aMessage).

The original code finds the Child by Child *child =
Get<ChildTable>().GetChildAtIndex(mChildIndexDuaRegistering);, which
assumes that the DUA.rsp must be targeting the current registering
Child. This is true for DUA.rsp, but not correct for DUA.ntf because
BBR may send DUA.ntf at any time to any device.

So, this commit changes DuaManager::ProcessDuaResponse code to search
for the correct Child with the target DUA instead of using
mChildIndexDuaRegistering.

This commit also contains other refactoring on
mChildIndexDuaRegistering usage.
2021-08-12 09:27:22 -07:00
jinran-google 292fe60fcb [dataset] add API otDatasetParseTlvs (#6877)
Adds an API to parse a dataset from TLVs.
2021-08-11 22:09:15 -07:00
Li Cao 95c3f24b92 [docs] fix comment in spinel buffer (#6915) 2021-08-11 13:22:55 -07:00
Abtin Keshavarzian 2e625bfe39 [netdata] adding NetworkData::Publisher (#6768)
This commit implements a new feature "Network Data Publisher" which
provides mechanisms to limit the number of similar entries (service
and/or prefix) in the Thread Network Data by monitoring the Network
Data and managing if or when to add or remove entries. This feature is
enabled using `OPENTHREAD_CONFIG_NETDATA_PUBLISHER_ENABLE` config, or
`NETDATA_PUBLISHER` in autoconf, or `OT_NETDATA_PUBLISHER` cmake
option.

This commit adds support for publishing DNS/SRP anycast/unicast
service, on-mesh prefix, and external route prefix entries.

When there is a request to publish an entry, the `Publisher` monitors
the Network Data and counts the number of similar entries. If there
are fewer entries than a desired target number, the entry is added
after a short random delay.

If there are too many similar entries, `Publisher` starts the process
of removing its own entry (again after some random wait time). When
removing entries, certain entries are preferred over others (e.g., an
entry from a router over one from an end-device or if they are from
the same type of node, the one with smaller RLOC16). If `Publisher`
determines that its own entry is a preferred one, it adds an extra
wait time before removing its entry. This gives higher chance for a
non-preferred entry from another device to be removed before removing
a preferred entry which helps towards quicker convergence of the
process to the desired number of entries.

On-mesh prefix and external route entries have a "preference" field.
When publishing such an entry, a matching entry in the network data is
counted only if its preference is same or higher than the entry's
preference. This ensures that a device with a higher preference entry
publishes its entry even when there are many lower preference similar
entries in the network data (potentially causing a lower preference
entry to be removed).

This commit also adds `test_netdata_publisher.py` to verify the
behavior of the `Publisher`.
2021-08-10 22:32:33 -07:00
jinran-google 71bc37bbc3 [dataset] add callback to receive MGMT_SET responses (#6887) 2021-08-10 20:12:16 -07:00
Abtin Keshavarzian c494b9f25d [bbr/br] replace enum constants with constexpr (#6911) 2021-08-10 18:48:55 -07:00
Abtin Keshavarzian c3b4a35f42 [utils] replace enum constants with constexpr (#6910)
This commit replaces the `enum` constants with `constexpr` definitions
in all the modules under `core/utils`. This commit also contains
some smaller changes: typo fixes in the comments, removal of unused
constants, and adding `uint` type to the named `enum` definitions.
2021-08-10 18:46:54 -07:00
Abtin Keshavarzian bd6e7d88b3 [radio] replace enum constants with constexpr (#6909) 2021-08-10 18:44:43 -07:00
Abtin Keshavarzian 0ad8245702 [meshcop] replace enum constants with constexpr (#6907)
This commit replaces the `enum` constants with `constexpr` definitions
in all the modules under `core/meshcop`. This commit also contains
some smaller changes: removal of unused constants, and adding `uint`
type to the named `enum` definitions.
2021-08-10 18:42:19 -07:00
whd fc8a97997d [tests] attempt to fix intermittent failures of MATN-12 (#6858)
The test failed because the script failed to read the output of ipaddr
rloc. This can be fixed by adding some wait time at the end of the
test.
2021-08-10 18:26:22 -07:00
kangping 37b3d9f628 [posix] set compile-time minimum log level to debug (#6905)
The compile-time log level definition is the lowest log level
that can be set by `otLoggingSetLevel`. This is useful for
dumping more logs for testing.
2021-08-10 18:24:20 -07:00
Abtin Keshavarzian c252ba6ed2 [message] add DequeueAndFree() & DequeueAndFreeAll() to queues (#6902)
This commit adds two new helper methods in `MessageQueue` and
`PriorityQueue` which provide functionality that is commonly used in
other modules: `DequeueAndFree()` which dequeues and frees a message
from the queue), and `DequeueAndFreeAll()` which removes and frees
all messages in the queue).
2021-08-10 18:22:46 -07:00
Jonathan Hui d4005f9d14 [cli] fix usage of strncpy in coap (#6908) 2021-08-10 18:18:15 -07:00
Eduardo Montoya a94e88cd50 [mac] add mIsHeaderUpdated frame flag (#6849)
When a platform provides `OT_RADIO_CAPS_TRANSMIT_SEC` capability,
it updates the frame header with the dynamic data (frame counter,
key id...) and returns it back to MAC together with the transmission
result.

So far the `mIsARetx` flag was being used to instruct the radio
whether to update the header or not, but there was no mean to know
if the radio was able to do so.

This commit introduces the `mIsHeaderUpdated` flag which is used in
both directions, so the MAC layer can react to cases in which the
frame header was not properly updated by the radio platform.

The usage of mIsARetx remains restricted now to two cases:

- When a SSED decides to re-synchronize CSL parameters after a
retransmission.
- To check if sequence number was set for CSL/indirect retransmissions.
2021-08-10 18:17:40 -07:00
whd 3f8462709b [tests] add test to verify name conflict resolution for meshcop service (#6904)
This commit includes a test case to verify that multiple border
routers can publish their meshcop services successfully without
instance name conflicts.
2021-08-10 12:56:09 -07:00
Abtin Keshavarzian 3d1f068c95 [mle] wait till end of announce tx on all channels to attach (#6897)
This commit changes MLE module such that during an attach attempt in
the third phase where we send MLE Announce on all channels we wait
till the end of the phase (i.e., after MLE Announce tx on all
channels and transition from `kAttachStateAnnounce`) to process any
received "Parent Response" and try to attach to a parent. This
ensures that we wait long enough to receive "Parent Response" from
all potential parents during this phase. Note that at the start this
phase we send an extra "Parent Request to routers/REEDs" to have
another chance to find a parent.
2021-08-10 12:41:18 -07:00
Simon Lin 15584dcda3 [cli] allow binding CLI udp socket to unspecified interface (#6761) 2021-08-09 19:49:18 -07:00
Abtin Keshavarzian d559147595 [logging] simplify logging functions (#6903)
This commit simplifies the logging macros by removing the input
string parameter `aRegionPrefix` in the call to the underlying log
function and instead converts the `aLogRegion` to the proper string
from the private `Log()` function. The removal of the additional
argument in the call to the logging functions helps reduce the
overall code size. This is applicable to the default and commonly
used configuration where logging uses functions. In the case where
logging is fully implemented as macros the `aRegionPrefix` is still
needed and used.
2021-08-09 14:07:43 -07:00
Abtin Keshavarzian f9765f2cc2 [srp-client] config to allow/disallow server switch if host is registered (#6896)
This commit adds a new config in `Srp::Client` which specifies whether
the SRP client is allowed to switch server (when auto-start feature
is enabled) on timeouts when host or service info were previously
successfully registered with the currently selected server. Note that
independent of this config, auto-start will always switch and select
a new server when the entry in the Network Data corresponding to the
currently selected server gets removed.
2021-08-09 14:03:34 -07:00
Damian Królik 43997a7d2a [srp-server] fix adding service with subtypes to existing host (#6901)
When a new service with subtypes is added to an existing
host, the SRP server incorrectly merges the subtype service
copies so that the TXT information is lost, i.e. 0-length
TXT record is created.

Moreover, the OT DNS client cannot parse services with
0-length TXT record (instead of ignoring the TXT record
itself) causing that such a service cannot be examined
at all.

The problem is caused by incorrect merging of the service
description structure which is shared across all services
with the same instance name (i.e. among the base type
service and its subtypes).

Signed-off-by: Damian Krolik <damian.krolik@nordicsemi.no>
2021-08-09 11:53:27 -07:00
Sam Kumar 6fa60be75c [tcp] add third_party module for TCPlp (#6885)
This commit creates a module in third_party for TCPlp code. It is a
placeholder for now; the actual code will be added in future commits.
2021-08-06 22:04:31 -07:00
Abtin Keshavarzian c39c4cb2df [tcp] style changes, typo fixes, and smaller changes (#6871)
This commit contains smaller style/code changes in `tcp6` modules.
2021-08-06 12:22:55 -07:00
Abtin Keshavarzian 312ef5ab60 [thread] replace enum constants with constexpr (#6895)
This commit replaces the `enum` constants with `constexpr` definitions
in all the modules under `core/thread`. This commit also contains
some smaller changes: typo fixes in the comments, removal of unused
constants, and adding `uint` type to the named `enum`s.
2021-08-06 10:22:11 -07:00
Jonathan Hui 07c693fe8b [docs] update retval doc style (#6899) 2021-08-06 08:29:19 -07:00
Simon Lin d8ad60ff6d [dns-sd] add DNS-SD server network interface binding configuration(#6838)
This commit allows DNS-SD server to configure the network interface to
bind the UDP socket.
2021-08-05 22:34:31 -07:00
canisLupus1313 02a30e4e33 [csl] fix switch between SSED -> MED -> SSED modes (#6891)
This commit introduces two changes. First is adding capability to turn
off CSL, by implementing missing 0 value handling.
Secondly adds proper transition between SSED (CSL on) and MED states
(CSL off).
2021-08-05 22:13:03 -07:00
whd 0eee7277c2 [tests] update meshcop service instance name in test case (#6894)
This commit aims to update the meshcop service instance name in
test_publish_meshcop_service.py to make it consistent with the change
on ot-br-posix side.
2021-08-05 08:34:30 -07:00
Yakun Xu 02d9ac302d [mle] correct failure errors of Start() doc (#6892) 2021-08-04 23:22:26 -07:00
Abtin Keshavarzian 16c207825f [mle] ensure Link Metrics methods free newly allocated msg on error (#6889)
This commit fixes methods `SendLinkMetricsManagementResponse()`,
`SendLinkMetricsManagementRequest()` and `SendLinkProbe()` in `Mle`
to ensure that the allocated MLE message is freed on an error. Note
that on success the `Mle::SendMessage()` will take the ownership of
the allocated `Message`.
2021-08-04 22:45:13 -07:00
gabekassel a34f5bc76e [otci] allow callbacks on all read lines (#6851)
This allows for registering a callback on all lines read from a
device, making it possible to react to output from asynchronous cli
commands while concurrently executing new commands on the same
device. Normally, executing those new commands would result in the
async command output being lost.

Known caveats:

1. The same limitations as with wait apply to OtbrSshCommandRunner
(you can't get async output).

2. For OtCliCommandRunner, any commands sent to the device in the
callback need to be offloaded to another thread. Otherwise the read
routine thread will be blocked, and the command will timeout.
2021-08-04 22:23:19 -07:00
whd 9cfa0448b5 [tests] fix test_publish_meshcop_service.py (#6888)
The test fails frequently due to missing delay before checking the
meshcop service.
2021-08-03 19:59:16 -07:00
Yakun Xu 354387c931 [test] fix reporting expect failure (#6869)
This commit fixes reporting expect failures by adding fail on error
flag to the ot_exec_expect_script function in script/test script.

This commit also fixes failing expect tests and removes expect tests
on macOS for unstable issues.
2021-08-02 20:26:32 -07:00
Abtin Keshavarzian 974026b5f3 [coap] fix CoapSecure::Stop() accessing freed message instance (#6883)
This commit fixes an issue in `CoapSecure::Stop()` accessing an
already dequeued and freed `Message` instance (from the `for` loop
iteration trying to `GetNext()` message). The code in this commit
removes the head element one by one (`MessageQueue::GetHead()`)
until the queue becomes empty.
2021-08-02 18:26:24 -07:00
whd c33df6f0ee [border-agent] update meshcop test cases (#6865)
Add a new test case to verify the meshcop service is published with
proper fields.
2021-08-02 18:25:13 -07:00
Abtin Keshavarzian 744db375a7 [mesh-forwarder] fix RemoveDataResponseMessages() accessing freed msg (#6880)
This commit fixes a bug in `RemoveDataResponseMessages()` where
`GetNext()` method may be called on an already dequeued and freed
`Message` instance (within the `for` loop iteration). The change in
this commit ensures to get and retain the `next` message before
potentially removing the message from the `mSendQueue` and freeing
it.
2021-08-02 18:19:21 -07:00
Abtin Keshavarzian ba4a44713f [array] add FindMatching() and ContainsMatching() (#6872)
This commit adds template `Find/ContainsMatching<Indicator>()` methods
which search in the array to find the first element matching a given
indicator. Unit test `test_array` is also updated to check the
behavior of newly added methods.
2021-07-31 09:35:14 -07:00
Abtin Keshavarzian 75c525bac8 [array] select the index/length uint type based on array size (#6872)
This commit enhances the template `Array` class implementation to
allow the `uint` type used for array size (which is also used for
length and index) to be specified as a template type parameter. If
not explicitly specified, a default `uint` type is selected based on
the array size `kMaxSize`, i.e., if `kMaxSize <= 255` then `uint8_t`
will be used, otherwise `uint16_t` will be used.
2021-07-31 09:35:14 -07:00
Abtin Keshavarzian cebba034c3 [net] replace enum constants with constexpr (#6875)
This commit replaces the `enum` constants with `constexpr` definitions
in all the modules under `core/net`. This commit also contains some
smaller changes: typo fixes in the comments, removal of unused
constants, and adding `uint` type to the named `enum` definitions.
2021-07-31 09:34:55 -07:00
kangping 706021dfd5 [tests] simplify border router tests (#6870)
This commit simplifies the border router tests by replacing
self.nodes[<NODE_ID>] with shorter names.
2021-07-30 15:51:48 -07:00
Zhanglong Xia 866c9602fb [include] resolve the unknown type name issue (#6867)
When compiling OpenThread public header files independently, the
compiller generates errors, such as `unknown type name "size_t"`
and 'unknown type name "otLogLevel"'.

This commit adds the corresponding header files to the public
headers to resolve this issue.
2021-07-29 08:37:29 -07:00
Sam Kumar 009dba991b [cli] add README for TCP CLI tool (#6857) 2021-07-28 22:03:05 -07:00
Abtin Keshavarzian 068f812060 [csl] add check for TimerMicro when CSL RX is enabled (#6861) 2021-07-28 18:02:49 -07:00
Abtin Keshavarzian 413a5b20af [routing-manager] Use Array for list of OMR or on-link prefixes (#6853)
This commit simplifies the `RoutingManager` class by using `Array`
to store lists of new or advertised OMR/on-link prefixes.
2021-07-28 17:04:05 -07:00
Abtin Keshavarzian 44bf2f1818 [common] adding Array class (#6853)
This commit adds a generic `Array<Type, kMaxSize>` class which
represents a fixed size array of elements of template `Type` which
tracks its current length. Entries can be appended to the array
(`PushBack()`) and removed from the end of array (`PopBack()`). This
simple data model is used in some other modules, so having a generic
version can help simplify the code. This commit also adds a unit test
to verify `Array` methods.
2021-07-28 17:04:05 -07:00
Abtin Keshavarzian 6236d0838a [coap] replace enum constants with constexpr (#6845) 2021-07-28 10:26:29 -07:00
Abtin Keshavarzian 52549988ab [diags] replace enum constants with constexpr (#6845) 2021-07-28 10:26:29 -07:00
Abtin Keshavarzian 2b2eac703d [crypto] replace enum constants with constexpr (#6845) 2021-07-28 10:26:29 -07:00
Abtin Keshavarzian a5a6fba922 [common] replace enum constants with constexpr (#6845)
This commit replaces the `enum` constants with `constexpr` definitions
in all the modules under `core/common`. It also adds type to the
names `enum` definitions.
2021-07-28 10:26:29 -07:00
Abtin Keshavarzian e8b085e09c [link-metrics] renames, using namespace, and style changes (#6848)
This commit contains style changes, simplifications, and renames in
Link Metrics modules.  It moves all the definitions under a new
namespace `LinkMetrics` which allows the use of shorter and simpler
names for types, methods, and constants (omit the `LinkMetrics`
prefix from names). For example, `LinkMetricsTypeIdFlags` and
`LinkMetricsSeriesInfo` are renamed to simpler `TypeIdFlags` and
`SeriesInfo` respectively.
2021-07-27 18:24:32 -07:00
Abtin Keshavarzian b46f7b60e3 [mac] replace enum constants with constexpr (#6824)
This commit replaces the `enum` constants with `constexpr` definitions
in all the modules under `core/mac`. The `constexpr` constants have
the advantage that they are explicitly typed while still being
compile-time constants with no code size overhead.

This commit also contains some smaller changes: typo fixes in the
comments, removal of unused constants, and adding type to the named
`enum` definitions.
2021-07-27 18:23:03 -07:00
Yakun Xu e40c01d355 [build] allow specify build date time (#6856)
This commit adds a macro for specifying OpenThread build date time,
which can be empty so that this field can be omitted.
2021-07-27 18:18:57 -07:00
kangping 2f7f3bf5d9 [backbone-router] fix deinit MulticastRoutingManager (#6854)
The OpenThread instance has already been deinitialized before the
platform MulticastRoutingManager is deinitialized. We can never
reference to mInstance in Deinit.
2021-07-26 22:06:29 -07:00
Abtin Keshavarzian 182770f22d [csl] fix typos in use of "uncertainty" term in constant/method names (#6855) 2021-07-26 21:52:03 -07:00
Abtin Keshavarzian 5030808e05 [simulation] add empty otPlatInfraIf platform APIs in simul/test (#6852)
This commit adds empty implementations of `otPlatInfraIf` platform
APIs under simulation. It also adds `otPlatInfraIfHasAddress()` in
`test_platform`. This allows the unit tests and simulation platform
builds to succeed when `OPENTHREAD_CONFIG_BORDER_ROUTING_ENABLE` is
enabled.
2021-07-26 21:47:11 -07:00
Abtin Keshavarzian 68e3b049b5 [radio-spinel] fix incorrect RX channel after frame TX on another channel (#6837)
This commit fixes a bug in `RadioSpinel` platform implementation where
the request from OT core stack to enter RX mode may be ignored
causing the RCP/radio to stay in RX mode on an incorrect channel.

This situation can happen after a frame TX request on a different
channel (note that the `otRadioFrame` struct specifies the channel on
which the frame should be transmitted). After frame TX, radio driver
is expected to enter RX mode on the same channel on which the frame
TX happened. The OpenThread MAC layer always explicitly instructs the
radio to enter RX mode on the PAN channel (from `Mac::UpdateIdleMode()`
which in turn calls the radio platform API `otPlatRadioRecive()` with
the channel passed in as a parameter). The earlier `RadioSpinel`
platform implementation did not update `mChannel` on a tx request
which caused the subsequent `Receive()` to skip setting the channel on
RCP if the channel was same as before.
2021-07-26 21:46:13 -07:00
Abtin Keshavarzian 6f537ca34a [cli] use OutputExtAddress() (#6846)
This commit updates the CLI modules to use `OutputExtAddress()`
when printing an `otExtAddress`. It also simplifies the uses of
`OutputBytes()`.
2021-07-23 17:27:04 -07:00
canisLupus1313 02d968baa6 [csl] add TLV for CSL clock accuracy (#6802) 2021-07-23 17:08:05 -07:00
kangping daf2ad7c24 [border-routing] dump sent/received RA messages on infra if (#6830)
Dump the RA messages sent/received on infra if for testing scripts.
This commit removes the requirement of OT_REFERENCE_DEVICE but always
dump the RA messages at log level DEBG.
2021-07-22 15:34:48 -07:00
whd 681cfba45e [posix] fix memcpy compiler warning false positive (#6840)
In the issue, compiler complained we were copying 16 bytes to a
location of 12 bytes. This was because in the check, the compiler
thought we are going to copy data to a nlmsghdr which is 12 bytes. The
reality is that we're copying data to a place behind nlmsghdr in req
struct.
2021-07-22 09:00:06 -07:00
Simon Lin 01561e72b9 [posix] fix platform UDP init compile error (#6839)
This commit fixes the platform UDP compile error when platform Netif
is not enabled.
2021-07-22 08:58:35 -07:00
Jonathan Hui de53d721de [tests] fix intermittent failure in Cert_9_2_09_PendingPartition.py (#6833)
Keeping network id timeout at 70 can result in ROUTER2 occasionally
creating its own partition. Reset back to 120 to avoid occasional test
failures.
2021-07-21 11:20:23 -07:00
Simon Lin 5e23211e04 [backbone-router] relax matching BBR dataset (#6752)
This commit relaxes BBR dataset matching to only compare the first
byte of Service Data (i.e. 0x01).

This commit also requires all Service TLV searching methods to
explicitly specify aExactServiceDataMatch argument, helping to reduce
unconscious mistakes.
2021-07-20 23:08:56 -07:00
Abtin Keshavarzian cbd9661308 [cli] new config to log input command and the resulting output (#6827)
This commit adds `OPENTHREAD_CONFIG_CLI_LOG_INPUT_OUTPUT_ENABLE`
option which configures the CLI module to log its input command
string and the resulting output. This is done in addition to emitting
the output string to the console. By default this config is enabled
on all POSIX based platforms and when `LOG_OUTPUT` is not set to use
CLI console itself.
2021-07-20 18:53:27 -07:00
Abtin Keshavarzian ead65718e2 [netdata] update/simplify public API documentations (#6834)
This commit contains no logic/behavior change and only contains
typos/style fixes and documentation updates and simplifications.
2021-07-20 17:32:50 -07:00
Simon Lin 10632805b6 [posix] allow kernel to assign netlink socket port ID (#6835)
This commit fixes a potential bug that the netlink socket may fail to
bind due to port ID conflict.
2021-07-19 23:46:27 -07:00
Zhanglong Xia 3a08490c56 [config] include the default user configuration header (#6829)
OpenThread uses the compile option
-DOPENTHREAD_PROJECT_CORE_CONFIG_FILE=openthread-core-posix-config.h
to specify the OpenThread configuration file. Some build systems do
not support this usage.

This commit includes the default user implemented configuration header
file to avoid specifying the configuration file.
2021-07-19 22:53:56 -07:00
Yakun Xu 2cc89cbfcb [dataset] remove mType from Dataset (#6831) 2021-07-19 22:44:12 -07:00
Abtin Keshavarzian 71e00eb20f [test] add missing tests in the Makefile.am & update file access mode (#6825)
This commits updates `thread-cert/Makefile.am` adding some existing
tests that were not included in the Makefile when the tests were
added. It also sorts the entries to be in alphabetical order.

This commit also updates the access control mode for all script files
to be executable by all (`chmod 755` or "-rwxr-xr-x").
2021-07-19 14:35:50 -07:00
Sam Kumar 6c03a1e962 [cli] add support for TCP in the CLI tool (#6770) 2021-07-19 14:32:49 -07:00
whd 6e2b6fd03d [tests] fix test_external_route test case name (#6828) 2021-07-19 12:15:27 -07:00
Jonathan Hui 5f39ba055b [srp-server] fix clang-tidy warnings (#6822)
- enable SRP server in clang-tidy check
- remove static member access through instance
2021-07-16 09:49:18 -07:00
Jonathan Hui d89f9222f0 [multi-radio] fix clang-tidy warnings (#6821)
- enable TREL in clang-tidy check
- add explicit keyword to constructors
- fix inconsistent parameter names
- remove redundant initializer
- use nullptr
2021-07-16 09:48:56 -07:00
Abtin Keshavarzian 53af491df5 [posix] update the logging in netif module (#6819)
This commit updates the logging in `netif` module under posix platform
code. It adds a prefix `[netif]` to the log line to help distinguish
the logs from this module from other platform layer logs.

It also removes some of the extra logs (e.g., logging `processTx: OK`
or `processRx: OK` on every rx and tx) and only logs failures
(at warning log level).
2021-07-15 13:04:12 -07:00
Abtin Keshavarzian 625e088e52 [routing-manager] update log messages (#6818)
This commit updates the logs in `RoutingManager` so that the log
messages start with capital letter (making them consistent with
logs in other modules).
2021-07-15 13:03:33 -07:00
jinran-google 9f4258d2ea [backbone-router] add deinit API (#6817)
This fixes the infinite loop when OTBR is pseudo-reset by DBus API.
2021-07-15 09:39:36 -07:00
Abtin Keshavarzian f7fd2b0813 [timer] add RemoveAll() method for use by unit test (#6814)
This commit adds a new static method `Timer::RemoveAll()` which
removes all running timers from the `Scheduler`. This method is only
intended for use by by `test_timer` unit test, allowing it to remove
any timers that may be started from constructors of different objects
in an OT instance before starting the unit test. With this change, we
can have timers started from constructors.

To ensure that the `RemoveAll()` is only used by the unit test, it is
defined as a `protected` method which can still be used in the test
which defines and uses `TestTimer` as a sub-class of `Timer`.
2021-07-14 12:10:21 -07:00
Abtin Keshavarzian 6dda0dcd1d [timer] declare Scheduler as nested type of Timer (#6814)
This commit refactors and simplifies the `Timer` module, mainly
declaring the corresponding `Scheduler` as a nested type of `Timer`,
`TimerMilli` or `TimerMicro` classes. It also changes the `Scheduler`
methods to be `protected` or `private` limiting access to them.
2021-07-14 12:10:21 -07:00
Abtin Keshavarzian 82cbc848fb [tasklet] declare Scheduler as nested type of Tasklet (#6815)
This commit also inlines simple constructors.
2021-07-14 09:57:12 -07:00
Li Cao e573f2cebb [diag] don't let the client of diag reserve the \0 byte (#6746) 2021-07-14 08:22:00 -07:00
Jonathan Hui 7d75fc62e1 [meshcop] fix issues in sending updated datasets to leader (#6813)
This commit fixes a couple issues with sending MGMT_SET.req to udpate
the leader with a new operational datset.

- When handling an MLE Child ID Response message,
  DatasetManager::Save() is called before the role is updated to
  child. As a result, a device with a newer dataset prior to attaching
  the network will not send a MGMT_SET.req message. This commit adds a
  delay to allow the role to change to child.

- When receiving a MGMT_SET.rsp, the device will immediately check if
  it should send a MGMT_SET.req message again. However, the
  operational dataset may not have had a chance to propagate from the
  leader. This commit adds additional delay to allow the new
  operational dataset to propagate.
2021-07-13 15:24:47 -07:00
Jonathan Hui c33e2daadb [address-resolver] change max timeout to 120 seconds (#6812)
The latest Thread Specification changes ADDRESS_QUERY_MAX_RETRY_DELAY
to 120 seconds.
2021-07-13 13:39:57 -07:00
Eduardo Montoya feec2e6a6d [mle] prefer higher weight partition even if singleton (#6809)
Rules for partitions preference were updated.
2021-07-13 13:39:31 -07:00
jinran-google f107e139f8 [network-diagnostic] fix initialization of max child timeout (#6806) 2021-07-12 23:25:07 -07:00
Abtin Keshavarzian 9f084ac7bb [netdata] allow zero-len external route prefix (#6784)
This commit allows a zero-len prefix `::/0` to be added as an external
route in Network Data. Such a prefix can act as a default route. This
commit also adds `test_zero_len_external_route.py` testcase to verify
the network's behavior using a zero-len external route.
2021-07-12 20:06:29 -07:00
Abtin Keshavarzian 42d86ed832 [dns-client] feature to auto set the default server address (#6787)
This commit adds a new feature in DNS client to automatically set and
update the server's IPv6 address in the default config. This is done
only when user does not explicitly set or specify the server address.
This behavior requires SRP client and its auto-start feature to be
enabled. SRP client will then monitor the Thread Network Data for
DNS/SRP Service entries to select an SRP server. The selected SRP
server address is also set as the DNS server address in the default
config.

This commit also adds `test_dns_client_config_auto_start.py` which
verifies the behavior of the new feature. In particular, that the DNS
client's default config gets changed and mirrors the SRP client
selected server address (when not set by user) and that it remains
unchanged if user explicitly sets the address in the default config.
2021-07-12 17:25:02 -07:00
gavinmcgovern 75df7a26fb [docs] change thrNetworkKey for docs (#6810) 2021-07-12 14:48:02 -07:00
arun-mahasenan f86ceb43ce [cli] IPv6 counters (#6771)
Add CLI command for IPv6 packet success and failures during
transmission and reception.
2021-07-12 12:54:39 -07:00
Abtin Keshavarzian 5d54dc2c5b [dns-client] use NAT64 prefix from network data (#6783)
This commit updates `AddressResponse::GetNat64Prefix()` to search in
Network Data to find NAT64 prefixes added by BRs. Prefixes with
higher preference are selected first.
2021-07-12 12:45:56 -07:00
Eduardo Montoya 05fd1deb49 [mle] security policy router upgrading rules (#6788)
Implement rules mandated by the network Security Policy for REED
upgrading to router.
2021-07-09 08:45:13 -07:00
canisLupus1313 681214da94 [csl] avoid OT version dependencies in platform config files (#6803) 2021-07-08 09:54:22 -07:00
Eduardo Montoya c5790f3801 [mle] include the CCM flag in the Discovery Response (#6800)
Commercial Commissioning Mode flag from the Security Policy has to be
set in the Discovery Response TLV of the MLE Discovery Response
messages.
2021-07-08 09:51:06 -07:00
whd 0f680af4ba [posix] add external routes to kernel on POSIX (#6782)
This is helpful when POSIX kernel is handling a packet at the thread
TUN device.
2021-07-08 09:45:33 -07:00
kangping 4484042ced [srp-server] track lease time per service instance (#6786)
The SRP draft 09 spec suggests that the SRP Servers SHOULD also track
a lease time per service instance.
2021-07-07 21:53:16 -07:00
Eduardo Montoya 907a9ff62e [thci] allow REED DUTs to upgrade (#6789)
Some Thread 1.2 tests require that REED DUTs upgrade to Router. Allow
it while keeping existent functionality for reference devices.
2021-07-07 18:29:07 -07:00
Eduardo Montoya a0c34f8230 [dua] increase DUA registration test coverage (#6798)
Modify DUA registration test to check that ML-EID TLV content is as
expected for every DUA.req sent.
2021-07-07 14:11:32 -07:00
Eduardo Montoya dc90ed51d4 [link-metrics] fix Link Metrics Status Sub-TLV value (#6799)
When the Initiator requests a reserved Metric Type ID Flag the status
value should be "Value 254: Failure – Other failure".
2021-07-07 12:57:12 -07:00
Simon Lin 8679d997a5 [dua] fix infinite DUA.req loop (#6797)
Verified that this commit fixes the infinite DUA.req loop.

This is a quick fix. We still need to reactor
mChildIndexDuaRegistering because there are still potential issues.
2021-07-07 12:49:18 -07:00
whd 5ac6fb7de1 [posix] remove constants defined by macros (#6795) 2021-07-07 12:47:28 -07:00
Li Cao 3d45d0a58b [script] fix Thread version for check-simulation-build (#6781)
The default Thread version has been set to 1.2 when building. Our test
script which checks building hasn't been updated accordingly. This
commit fixes this error.
2021-07-07 12:31:31 -07:00
kangping 38cb99f0fc [srp-server] avoid re-accessing committed SRP updates (#6785)
We should remove the UpdateMetadata before committing the SRP update
to ensure that the same UpdateMetadata (and the Host object) can never
be touched again.
2021-07-06 11:41:08 -07:00
Abtin Keshavarzian 49817fc417 [dnssd-server] typos and smaller style changes (#6791) 2021-07-06 11:34:10 -07:00
Simon Lin 478fb1e3a3 [otci] add backward compability (#6780) 2021-07-06 11:31:54 -07:00
Abtin Keshavarzian 48b129e74b [dnssd] add support for service subtypes in DNS-SD server and client (#6773)
This commit updates `Dns::ServiceDiscovery::Server` to add support for
browsing a service subtype. In particular, it updates the code which
breaks a DNS name into its components such that it can correctly
parse and accept a service subtype name. It also updates how the
service name compression is done to handle the subtype names.

This commit also updates `Dns::Client` to remove the extra check of
service name (which is already verified) when trying to find a PTR
record for a given service instance name. This change enables browse
for service subtype (parsing the browse response).

This commit also updates and enhances the `test_dnssd.py` script
adding test-cases for browsing for service subtype.
2021-07-02 11:42:55 -07:00
Abtin Keshavarzian 0faa3fd4fe [srp-server] add support for service subtypes (#6760)
This commit adds support for service subtypes in SRP server. It
updates the internal data model to store services in `Srp::Server`.
Every `Host` now has a list of `Service` entries along with a list of
`Service::Description` entries. These types mirror the SRP update
message format and the set of instructions that form the SRP message.
The `Service` entries represent the "Service Discovery Instructions",
i.e., the PTR records mapping a service name or a subtype name to a
service instance. A `Service::Description` entry represents the the
SRV and TXT records. A `Service` entry is always associated with a
`Service::Description` and the subtypes of the same service instance
all share the same `Service::Description` entry.

This commit also adds a new method `Host::FindNextService()` and the
public API `otSrpServerHostFindNextService()` which is very flexible
and can be used in different ways. It can be used to iterate over the
full list of services, or over a specific subset of services matching
certain conditions, e.g., iterate over all base services excluding
subtypes, or over all subtypes of an instance, or over all deleted
services, etc. It can also be used to find a specific service with a
given instance and service names.

This commit also simplifies and enhances the logging in `Srp::Server`.
In particular, when a new host is added, we now also log the list of
services being added along with it. Also a change to a `Service` is
only logged if the `Service` is marked as committed. This ensures
that temporary `Service` entries associated with a newly received SRP
update message are not logged (e.g., when an associated temporary
`Host` object is being freed after its content is merged with an
existing `Host` entry).

Finally, this commit adds a test `test_srp_sub_type.py` to cover the
subtype service registration on SRP client and server.
2021-07-02 09:35:03 -07:00
Abtin Keshavarzian fbe3ffce87 [srp-client] add support for service subtypes (#6724)
This commit adds support for service subtype in `Srp::Client`. The
`otSrpClientService` now includes a pointer to an array of service
subtype labels (which can be set to `NULL` if there is no subtype).
Each subtype is appended as a PTR record (i.e., a Service Discovery
Instruction) in the SRP update message.

This commit also updates The `Utils::SrpClientBuffers` to provide an
array for the subtype labels (pointers). The default size of the
service name buffer is also incremented so that it can be used for
saving subtype label strings.

The CLI `srp client` implementation is also updated to support service
subtypes where the `<servicename>` can optionally include a list of
subtype labels separated by comma (e.g., `_ser._udp,_s1,_s2`).
2021-07-02 08:10:45 -07:00
Jonathan Hui 433e44179f [cmd-parser] add nullptr check to ParseHexString() (#6779) 2021-07-01 10:39:21 -07:00
Abtin Keshavarzian 2124d9d88a [mac] remove the out-of-band frame tx API (#6778)
This commit removes the API to enqueue an out of band frame for
transmission by MAC layer. This API was added as a work-around to
enable legacy (non-Thread based) frames to be sent along with Thread
frames. This model is no longer used and generally not recommended.
The preferred way to handle multi-radio/multi-protocol is to add
support for it in radio platform layer.
2021-07-01 10:38:23 -07:00
Eduardo Montoya e2205fbf79 [thci] add support for SSED DUT (#6775)
Enable joining a network as SSED, which is required for several
Thread 1.2 certification tests.
2021-07-01 10:32:11 -07:00
gabekassel 4c117b92de [otci] fix OTCI.wait arg order (#6777)
In wait, match_line is called with the arguments flipped. The first
argument is supposed to the be the line being checked, and the second
is supposed to be the pattern to match. The reason this still works
for strings is because output is treated as a list of lines to expect,
and each is just compared with == to the actual expected line
2021-06-30 21:25:17 -07:00
Abtin Keshavarzian 8967d62ead [tlv] update and fix Tlv documentations (#6776)
This commit fixes errors in `Tlv` module documentations. It also moves
the private `Tlv::Find()` description to the `cpp` file.
2021-06-30 12:33:18 -07:00
Abtin Keshavarzian 0a6a0b6604 [cli] simplify argument processing (#6767)
This commit changes `ParseCmd()` such that as `aArgs` array entries
are populated with parsed arguments from a command line string, the
remaining unused `aArgs` entries in the array are marked as "empty".
We also ensure that the `aArgs[]` array always end with an "empty"
`Arg` which  indicates end of the list (this is similar to how C
string ends with a null '\0' character). This commit also changes
different methods of `Arg` class (`Arg::ParseAs{Type}()` or overload
of operator `==`, etc) to check and handle when `Arg` is marked
as "empty".

These changes help simplify how the arguments are processed in CLI
modules. In `Cli::Process{Command}()` methods we can just pass the
`aArgs[]` array and do not need to pass a separate args length
parameter. In many cases the args length checks can be removed since
it will be checked from `ParseAs{Type}()` call.
2021-06-29 13:56:41 -07:00
Abtin Keshavarzian 57d072d352 [test] enhance {Verify/Success}OrQuit() and their use in unit test (#6764)
This commit updates `VerifyOrQuit()` and `SuccessOrQuit()` macros to
include the failed condition in the error message that is printed on
a failure (in addition to function name and line number where the
error happened). This commit also changes the second parameter
(`aMessage`) to in these macros to be optional.

This commit also updates unit tests to remove the second `aMessage`
string in cases where the failure can be inferred from the condition
itself.
2021-06-28 11:38:10 -07:00
Abtin Keshavarzian 2db3ddca33 [simulation] remove use of internal definitions/headers in radio platform (#6766)
This commit updates the `simulation/radio.c` and removes the uses of
core internal macro `VerifyOfExit()` and replaces them with
`otEXPECT_ACTION()`. This ensures that radio platform layer does not
include the internal OT header like "common/code_utils.hpp".
2021-06-28 09:45:01 -07:00
Sam Kumar 2752365e03 [tcp] add TCP class and stub implementations of the TCP API (#6744)
This commit implements the boilerplate code for implementing the TCP
API in #6491. It creates a TCP class in src/core/net, and implements
the functions needed to transfer control there when a TCP API function
is called.
2021-06-28 09:42:50 -07:00
Simon Lin 3a7e836dd7 [otci] fix wait duration (#6759) 2021-06-24 22:29:38 -07:00
Simon Lin db51e39cf1 [dua] fix test_dua_dad random fails (#6765)
Relax check for Backbone Query delay.
2021-06-24 21:20:08 -07:00
Simon Lin 98d9b455cc [otci] fix command issue after factoryreset (#6670) 2021-06-24 21:18:14 -07:00
Simon Lin d360c4b601 [backbone-router] fix Leader isn't always selected as PBBR (#6751) 2021-06-24 10:30:49 -07:00
Abtin Keshavarzian 7799bae4ef [srp-server] ensure to clear mHasRegisteredAnyService on server stop (#6763)
This commit updates `Srp::Server` to clear `mHasRegisteredAnyService`
when server is stopped and all the hosts and services are deleted.
This boolean flag is used to save the port number in non-volatile
settings so that we can ensure to pick a different port number the
next time the server starts.

This change addresses an issue where the port number may not be saved
and therefore not changed if the server is stopped and restarted
two times in a row.
2021-06-24 10:28:08 -07:00
Abtin Keshavarzian b11d0d2205 [test] restart SRP server (instead of reset) to validate port change (#6763)
This commit updates `test_srp_server_reboot_port` to restart the SRP
sever instead of performing a full device reset. The SRP restart will
trigger the port number change by the server which is the behavior
this test is intended to verify. This change should help address
intermittent failures on this test.
2021-06-24 10:28:08 -07:00
Mason Tran 11ac430155 [thci] remove assert which checks if the port is unicode (#6762)
In the case where the connection is over Telnet, self.port will be None.
2021-06-23 21:28:31 -07:00
Simon Lin e9e875de24 [udp] forbid udp duplicate open (#6626) 2021-06-23 17:01:47 -07:00
canisLupus1313 d177c610f0 [diags] add minimal IEEE 802.15.4 frame size check (#6756)
Extending checks done by diag send command and diag repeat command
to validate minimal size of frame.
2021-06-23 13:45:53 -07:00
canisLupus1313 126e232ad5 [link-metrics] split OPENTHREAD_CONFIG_MLE_LINK_METRICS_ENABLE macro (#6716)
This commit splits OPENTHREAD_CONFIG_MLE_LINK_METRICS_ENABLE macro
into two subsequent ones:
- OPENTHREAD_CONFIG_MLE_LINK_METRICS_SUBJECT_ENABLE
- OPENTHREAD_CONFIG_MLE_LINK_METRICS_INITIATOR_ENABLE
2021-06-22 10:49:53 -07:00
Abtin Keshavarzian cf66d1c09a [srp-client] add feature for switching server on failure (#6719)
This commit adds new feature in SRP client to switch server on failure
(when auto-start feature is used). When enabled, the client will try
to select the next server from entries in Thread Network Data when
the current server rejects an SRP update or there are timeouts
(no response) after multiple attempts.
2021-06-22 10:21:58 -07:00
Simon Lin d5d6361669 [otci] misc enhancements (#6753)
This commit contains misc enhancements to OTCI:
- Allow connecting to OTBR without password
- Allow not using sudo for ot-ctl commands
- Use -- to separate OT-CLI commands.
2021-06-22 10:20:31 -07:00
Abtin Keshavarzian ec1ae4c0ef [dnssd-server] remove unused using for HostSwap16() (#6758)
This addresses `clang-tidy` warning for unused `using` statement. This
commit also ensures `OT_DNSSD_SERVER` is enabled in `make-pretty`
script and therefore covered by github action `build pretty`
workflow.
2021-06-22 10:19:48 -07:00
Abtin Keshavarzian a662c32eb0 [srp-server] free aHost in CommitSrpUpdate() in case of error (#6754)
This commit ensures that in `Srp::Server::CommitSrpUpdate()` the
`aHost` parameter is correctly freed in case of an error and an early
jump to exit (e.g., from `SuccessOrExit(aError)` at the start of this
method). The `aHost` is now freed at the `exit` label and a boolean
`shouldFreeHost` tracks whether or not it needs to be freed. The
boolean variable is set to `false` when  the ownership of `aHost` is
taken over (e.g., from the call to `AddHost(aHost)`).
2021-06-21 18:08:54 -07:00
Jonathan Hui e086cf5c88 [mle] enable announce sender by default (#6741)
The `OPENTHREAD_CONFIG_ANNOUNCE_SENDER_ENABLE` feature has been
incorporated into the Thread 1.2.1 draft specification.
2021-06-18 15:20:15 -07:00
Abtin Keshavarzian 0b17f6e91d [srp-server] take ownership of resources on updating existing Service (#6747)
This commit changes the `Srp::Server` to take ownership of resources
(e.g., heap allocated buffer for TXT data) when updating an existing
`Service` entry (instead of copying the data). With this change, the
method `Service::SetTxtData()` is no longer needed and is removed.
2021-06-18 15:03:37 -07:00
Simon Lin 875bb57791 [otci] remove debug prints (#6749) 2021-06-18 11:47:59 -07:00
Abtin Keshavarzian e66b9a3958 [cmd-parser] simplify ParseAsHexString() & Cli::UdpExample::ProcessSend() (#6726)
This commit enhances `CmdLineParser` methods that parse a hex string
adding a new version which allows a (longer) hex string to be parsed
in short segments sequentially. The unit test `test_cmd_line_parser`
is also updated to verify the behavior of the newly added method.

This commit also updates CLI `UdpExample` implementation to use the
new method for parsing message payload data from input hex string and
simplifies how `ProcessSend()` parses different arguments indicating
message payload options.
2021-06-17 10:23:25 -07:00
Abtin Keshavarzian d47a3fa9ad [string] new StringFind()/StringEndsWith() for a sub-string (#6733)
This commit adds a new flavor of function `StringFind()` which finds
the first occurrence of a given sub-string within a string. It also
adds `StringEndsWith()` function that works with a sub-string. The
unit test `test_string` is also updated to cover the new behavior of
the newly added function.
2021-06-17 10:13:03 -07:00
Zhangwx dfad64ea14 [csl] fix overflow in calculating semiWindow (#6734)
Regarding:
semiWindow = elapsed * (Get<Radio>().GetCslAccuracy() + mCslParentDrift) / 1000000;

Consider that the worst Get<Radio>().GetCslAccuracy() and
mCslParentDrift are both 255, the max of uint32 is 4294967295, so when
elapsed is about 8500000(just 8.5s elapsed since the last CSL sync),
the product of elapsed and (Get<Radio>().GetCslAccuracy() +
mCslParentDrift) will overflow.

This commit changes the type to uint64_t from uint32_t to avoid the
overflow.
2021-06-17 10:11:37 -07:00
Jonathan Hui 649e8e1756 [cmake] always use git hash for default package version (#6717) 2021-06-17 10:01:02 -07:00
Simon Lin bb00ec3d86 [thci] fix THCI issue on Thread Dev Harness 1.1 (#6745) 2021-06-17 09:45:34 -07:00
Jonathan Hui aaabf25ff2 [network-key] change name from master to network (#6721) 2021-06-16 23:07:23 -07:00
Sam Kumar b0081172af [tcp] add TCP API for OpenThread (#6491)
Co-authored-by: Jonathan Hui <jonhui@google.com>
Co-authored-by: Abtin Keshavarzian <abtink@google.com>
Co-authored-by: Sam Kumar <sam_k@apple.com>
Co-authored-by: Simon Lin <simonlin@google.com>
2021-06-16 22:09:33 -07:00
suveshpratapa f27a3c7b2a [mesh-forwarder] calculate PAN ID compression according to 802.15.4-2015 (#6739) 2021-06-16 13:02:00 -07:00
Abtin Keshavarzian e3930f3c3f [srp-server] update to use HeapString for names (#6732) 2021-06-16 12:26:03 -07:00
Abtin Keshavarzian 2b2b3904f0 [common] adding HeapString class (heap allocated string) (#6732)
This commit adds a new class `HeapString` as heap allocated string.
The buffer to store the string is allocated from heap and is manged
by the `HeapString` class itself, e.g., it may be reused and/or freed
and reallocated when the string is set. The `HeapString` destructor
will always free the allocated buffer.

This commit also adds a unit test `test_heap_string` for the new
class.
2021-06-16 12:26:03 -07:00
Nathan Dyck 8989858c2a [posix] increase default address cache size from 32 to 128 (#6712)
Having this value sufficiently large is important to reduce latency
when multiple simultaneous requests come in to a BR for many if not
all the nodes on the network. This could happen when a client
reconnects on Wifi and needs to query and/or update the state for many
nodes at the same time.
2021-06-16 12:13:38 -07:00
Jonathan Hui 13ec0e7a63 [tests] fix intermittent failures in Cert_9_2_16 (#6731)
Add additional delay to prevent link repair using MLE Link Request on
Adv timeout.
2021-06-16 11:53:52 -07:00
Jonathan Hui deb825bd80 [mle] ensure MLE messages are sent via broadcast (#6730)
MLE Announce messages are sent with link security enabled. This commit
ensures that REEDs always send MLE Announce messages to the broadcast
destination address.
2021-06-16 11:53:09 -07:00
Abtin Keshavarzian 847eee2086 [srp-client] allow callback to be invoked when client is stopped (#6723)
This commit relaxes the condition for invoking the callback from SRP
client allowing it to be invoked when client is stopped.

Note that the user can call SRP client APIs to add or remove services
while it is stopped. A remove request may be processed immediately
(if the service has not yet been registered) and then the callback is
invoked to notify the caller to reclaim the service entry.
2021-06-15 12:57:13 -07:00
Sagar Chinchani 4b36e51156 [settings] fix OT_LOG_LEVEL macros (#6728) 2021-06-14 21:42:13 -07:00
Abtin Keshavarzian 7b4fa7993d [srp-server] inline simple getter/setter methods (#6727) 2021-06-14 21:40:28 -07:00
gavinmcgovern bed089c2cb [docs] add Espressif and Telink logos and links (#6729) 2021-06-14 17:32:55 -07:00
Abtin Keshavarzian 090b7600b7 [string] use StringFind() in core modules (#6725)
This commit replaces uses of `strchr()` with `StringFind()`.
2021-06-14 10:24:18 -07:00
Abtin Keshavarzian f7cfddf57d [mle-router] ensure route table is logged only when changed (#6722) 2021-06-14 10:23:33 -07:00
Abtin Keshavarzian 1394a2aec6 [numeric-limits] use constexpr variables for min/max (#6720) 2021-06-14 10:22:46 -07:00
Simon Lin 95c5cb793a [thci] enhance THCI for 1.2 Certification (#6609)
This commit enhances THCI for 1.2 Certification:
- OpenThread.py: 1.2 non-BR
- OpenThread_BR.py: 1.2 BR and Host (otbr-agent solution)

This commit should also make THCI work for both TH1.1 and TH1.2.
2021-06-10 23:54:47 -07:00
Simon Lin 7344d9c8e1 [udp6] improve frame filtering (#6711)
If OpenThread is part of an OS with it's own IP stack filtering only
control messages is insufficient. Example could be that if application
is using OpenThread API to listen for CoAP messages received messages
are passed also to the IP callback. The message then is delivered to
the OS IP stack and generates error response: "ICMPv6 Destination
Unreachable (Port unreachable)" as the port is not open on the OS
side. OS IP stack is unaware of the OpenThread existence so it can not
be filtered on that level and the shim layer does not receive port, or
protocol information from OT so it can not filter out a frame without
parsing it first. Extended filtering also to ports originating from
OpenThread.
2021-06-10 13:29:31 -07:00
Jonathan Hui deba1024c9 [mle] enable sending MLE Link Request on Adv timeout by default (#6713)
The `OPENTHREAD_CONFIG_MLE_SEND_LINK_REQUEST_ON_ADV_TIMEOUT` feature
has been incorporated into the Thread 1.2.1 draft specification.
2021-06-10 10:58:13 -07:00
kangping b7006ce74c [tests] remove unnecessary host SLAAC assertions (#6715)
The assertion is verifying the (linux) host SLAAC behavior which is
not guaranteed on different platform and linux
distributions. Moreover, it is required for testing the BR behavior.
2021-06-09 21:28:54 -07:00
Abtin Keshavarzian fcee03a908 [cli] harmonize passing of arguments to command handlers (#6708)
This commit updates how the arguments are passed to different CLI
command handles such that the same model is now used by all CLI
modules where all the previously parsed and consumed arguments are
removed and only the remaining un-parsed arguments are passed to the
next handler.
2021-06-09 14:53:10 -07:00
whd df4423e14c [github-actions] enable Avahi in OTBR CI tests (#6710) 2021-06-08 07:35:44 -07:00
whd 185e8e49d5 [docs] update README for ping command (#6705) 2021-06-08 07:34:13 -07:00
Abtin Keshavarzian afa427b7f6 [cli] enhance Cli::Coap and CoapSecure (#6707)
This commit simplifies the handling of request commands (get, post,
put, delete, and observe) in `Cli::Coap` and `Cli:CoapSecure`
classes. It also updates parsing and processing of arguments for
`CoapSecure` request command by removing the optional and actually
unused dest IPv6 address argument. Finally, it removes the use of
OT core headers/types (mainly the `ot:Coap::Message::BlockType`
enumeration) in CLI CoAP modules.
2021-06-07 21:45:45 -07:00
Yakun Xu 1fceb4c490 [posix] make platform udp as mainloop source (#6663) 2021-06-07 21:36:46 -07:00
whd 87e6cf5991 [srp-server] choose different UDP port from previous on reboot (#6702)
This commit implements a mechanism to let an SRP server listen to a
different UDP port on a reboot.
- When an SRP server starts, it reads the UDP port used in the last
  time from Settings. Then the SRP server listens to the next port in
  the reserved range.
- When SRP server successfully starts, store its UDP port in Settings.
2021-06-06 22:11:11 -07:00
Abtin Keshavarzian 7bfdad5f73 [posix] fix issue with logging CLI output (#6709)
This commit reverts the change from PR #6639 which added logging
of the CLI output. Note that the CLI output can be generated and
outputted in smaller pieces (not as a whole line) so the model
from PR #6639 would emit each piece as a different log line which
is not desirable.
2021-06-06 22:07:46 -07:00
Jonathan Hui ac21e00fa1 [mac] avoid potential assert with SetKeyId() on an invalid frame (#6704) 2021-06-04 13:06:24 -07:00
Abtin Keshavarzian f3671d5a75 [mac] new public API to validate and set otNetworkName (#6703)
This commit adds a new public API `otNetworkNameFromString()` to set
an `otNetworkName` instance from a given null terminated C string. The
new API will also validate that the given name string follows UTF-8
encoding and its length is not longer than max network name size.

This commit also simplifies the UTF-8 validation of `NetworkName` by
moving the check from `Mac::SetNetworkName()` to a newly added method
in `Mac::NetworkName` to set it from a C string.

It also defines `DomainName` as a `typedef` of `NetworkName` which
helps simplify its use and remove repeated code.

Finally, it updates the `Cli::Dataset` to use the new public API for
validating `otNetworkName`.
2021-06-03 22:13:51 -07:00
Abtin Keshavarzian d6ff3e5cc0 [cli] adding helper ProcessGet/Set() to handle simpler commands (#6700)
This commit adds a set of helper methods in `Cli` to process simple
commands where we are getting and/or setting a single integral value.
This replaces common pattern in processing of commands where if there
are no arguments, we output the value we retrieve by calling a related
getter OT API, otherwise we parse the argument (to get the proper
`int` value) and call a related setter OT API. For example, for
"channel" command, we use the `otLinkGetChannel()` as the getter and
`otLinkSetChannel()` as setter.
2021-06-03 15:18:18 -07:00
Abtin Keshavarzian d16edaa5ef [cli] add helper Interpreter::OutputTableHeader() (#6696)
This commit adds a helper method `OutputTableHeader()` that can be
used to print a table header from a given array of column widths and
title strings. This is then used in CLI module for different tables
(child/neighbor/router table, active/energy scan result, etc).
2021-06-02 15:22:45 -07:00
Abtin Keshavarzian 5ae8cf527c [cli] use OutputPrefix() in Cli::Dataset (#6699) 2021-06-01 22:46:19 -07:00
Abtin Keshavarzian 60ff174c44 [ip6] add public API to convert otSockAddr to string (#6693)
This commit adds public API `otIp6SockAddrToString()` which converts
an IPv6 socket address (`otSockAddr`) to human-readable string. The
CLI modules (e.g. `ProcessNetStat()`) are then updated to use the new
API.
2021-06-01 13:08:13 -07:00
Tokita, Hiroshi 260f2dde57 [posix] fix strncpy warning about null terminated string length (#6698) 2021-06-01 13:04:48 -07:00
Abtin Keshavarzian 89d0d9ecec [cli] use const name lists to output MAC/MLE/MsgBuffer/Coex counters (#6692) 2021-05-31 21:56:54 -07:00
Abtin Keshavarzian 42e7427156 [cli] remove undefined method decelerations in Interpreter (#6691) 2021-05-31 21:52:39 -07:00
whd f0f536dab3 [udp] fix potential infinite loop in Udp::GetEphemeralPort (#6697)
The current implementation will go into an infinite loop when
mEphemeralPort == Tmf::kUdpPort, since rval is never updated in the
loop. This commit fixes this issue.
2021-05-31 21:47:12 -07:00
kangping fa8ec6ded0 [tests] give more time for SRP client to upgrade to router (#6694) 2021-05-31 21:44:54 -07:00
Abtin Keshavarzian a24b67ef30 [settings] simplify and enhance Settings (#6683)
This commit updates the `Settings` implementation. It adds template
versions of methods `Read<EntryType>()`, `Save<EntryType>()`, and
`Delete<EntryType>()` which make it easier for other modules to use,
while ensuing to share a common underlying implementation for all
entry types.

The settings entry types (e.g., `NetworkInfo`, `ParentInfo`, etc.) are
changed in this commit to provide a constant `kKey` specifying the
associated setting key with the entry. For simple entries, a related
class is added to define the `kKey` constant and the associated value
type (e.g., `OmrPrefix` defines `Ip6::Prefix` as its `ValueType`).
This model makes it easier to add new setting keys and entries in
future.

This commit also simplifies the logging in `Settings`. The entry types
now provide `Log()` method to log their data and a common
`Settings::Log()` method is added which handles all logging (on
success or in case of an error).

Finally, this commit moves the `SettingsDriver` definition to its own
`common/settings_driver.hpp` header file and and ensures that its
methods are defined as inline.
2021-05-27 15:57:06 -07:00
Łukasz Maciejończyk 0869422c2c [docs] fix info about default Thread version supported by OpenThread (#6689)
After changed the default Thread version, the description about it has
not been updated. This commit fixes it.
2021-05-27 10:43:36 -07:00
Jiacheng Guo d346481494 [ip6] fix message leak when using platform TCP (#6679)
When using platform TCP, `Ip6::HandlePayload()` will be called with
`aIpProto = kProtoTcp` and `aMessageOwnerShip =
kTakeCustody`. `FreeMessage()` will be called with `message =
nullptr`, causing the message to leak. This commit fixes this issue.
2021-05-26 14:51:05 -07:00
Yakun Xu 907c9bdcaf [github-actions] show parameter name in cli-sim (#6682) 2021-05-26 14:36:40 -07:00
Abtin Keshavarzian 08f7e5011d [srp-client] add Srp::Client::ClearService() (#6598)
This method clears a service from SRP client, immediately removing it
from the list. Unlike `RemoveService()` which sends an update message
to server to remove/unregister the service, this method clears the
service from client list without any interaction with server. On a
successful call to this method, the `Callback` will NOT be called and
service entry can be reclaimed and re-used by the caller immediately.

This method can be used along with a subsequent call to `AddService()`
(potentially reusing the same service entry with the same service and
instance names) to update some of the parameters in an existing
service.

This commit adds `otSrpClientClearService()` as a related public OT
API and support for this in CLI (command `service delete`). It also
adds support for the deleting service in `NcpBase` and spinel.
2021-05-26 14:25:46 -07:00
Łukasz Maciejończyk b3b50f6da8 [mac] always set Key Identifier for Transmit Security (#6678)
For multi-layer application, the radio requires from the upper layer
to provide information for security processing like Key Identifier,
in the Auxiliary Security Header according to IEEE802.15.4-2015.

This change matters for handling security processing by radio only.
2021-05-26 14:03:48 -07:00
Xinyuan (Amy) a2247da59d [posix] allow empty backbone interface name (#6685)
Add the empty string check for backbone interface.
2021-05-26 13:25:49 -07:00
Yakun Xu 71e6543d9b [posix] make daemon as mainloop source (#6662) 2021-05-25 22:06:03 -07:00
Li Cao da906def50 [logging] optimize dump log for multicast routing manager (#6671) 2021-05-25 19:40:58 -07:00
Abtin Keshavarzian 1796f50264 [srp-client] support saving selected server info (by auto-start) (#6672)
This commit adds support for a new feature in SRP client which allows
it to save the selected server info (by the auto-start feature) in
non-volatile settings. On SRP client restart (e.g., due to a device
reset) the client will select the same server when searching to
discover and pick one from the Thread Network Data service entries.
Config `OPENTHREAD_CONFIG_SRP_CLIENT_SAVE_SELECTED_SERVER_ENABLE` can
be used to enable/disable this feature.

The server info is saved only after the host info is successfully
registered with the server and if it is selected by auto-start from a
network data SRP *unicast* service entry.

This commit also adds `test_srp_client_save_server_info.py` test-case
which verifies the behavior of the new feature.
2021-05-25 18:34:07 -07:00
Jonathan Hui e503c949b9 [meshcop] check channel page value in ChannelTlv::IsValid() (#6667) 2021-05-25 16:53:17 -07:00
Eduardo Montoya 5cd088cd76 [low-power] extend EnableCsl API (#6675)
Include the peer's short address together with the extended address
when enabling the CSL link. This removes the need for the platform
to guess it.
2021-05-25 15:21:38 -07:00
Marek Porwisz abcf3ba152 [static-analysis] address static code analysis issues (#6651)
We have run the static code analyser on the OpenThread code and some
issues were discovered.
This commit addresses those that were marked as High impact and were not
marked false positive after the inspection.

Signed-off-by: Marek Porwisz <marek.porwisz@nordicsemi.no>
2021-05-24 17:22:07 -07:00
Jonathan Hui d0812fb4a0 [github-actions] add markdown lint check (#6669) 2021-05-24 16:56:39 -07:00
Jonathan Hui bde3ec415a [docs] fix broken links (#6669) 2021-05-24 16:56:39 -07:00
Jonathan Hui df8e06aaab [docs] remove doc/STYLE_GUIDE.md (#6668)
Site docs have moved to https://github.com/openthread/ot-docs
2021-05-21 16:58:17 -07:00
Abtin Keshavarzian 5915483063 [string] change String<kSize> to inherit from StringWriter (#6658)
This commit changes the `String<kSize>` class to inherit from
`StringWriter` class. It helps simplify their use allowing
`StringWriter` methods to be directly called on an `String` instance
while ensuring the implementation is still shared among all template
variants of `String<kSize>` class. This change also ensures that
`String<kSize>` is always initialized and set to an empty string from
its constructor.
2021-05-21 12:08:26 -07:00
Yakun Xu 6891fe6e0c [cmake] no cxx extensions (#6664)
This commit sets cxx stand as -std=c++11 instead of -std=gnu++11.
2021-05-21 09:46:22 -07:00
Simon Lin fc513b298d [otci] fix parse dataset security policy (#6661) 2021-05-21 08:27:38 -07:00
Yakun Xu 136ad4e78b [posix] avoid unnecessary recompilation (#6659)
This commit adds ot-posix-config for POSIX platform, so that when
POSIX configurations changed only, other components don't need
recompile.
2021-05-21 08:15:48 -07:00
Yakun Xu e708b308cd [simulation] avoid unnecessary recompilation (#6660) 2021-05-21 08:14:22 -07:00
Yakun Xu 4ff5ab67d7 [posix] make all sockets non-blocking (#6656) 2021-05-20 21:41:17 -07:00
Jiacheng Guo 0833468767 [dnssd] add api for accessing queries in the dnssd server (#6611)
This commit allows the platform implementations to access the name and
the type of the queries, thus reducing the memory overhead of extra
bookkeeping.
2021-05-20 19:37:10 -07:00
Jonathan Hui ac75e9ea3b [posix] avoid compiler warning on use of strncpy (#6653) 2021-05-20 18:30:35 -07:00
Li Cao ed452ca4bd [doc] update posix app README (#6635)
This commit updates the doc for using posix app. Basically, it updates
the instructions to use cmake build posix core and transceiver.
2021-05-20 18:29:56 -07:00
Sagar Chinchani a17d12a263 [radio] remove OT_RADIO_CHANNEL_PAGE_MAX and address gcc warnings (#6646)
This commit modifies the (<=) usage in two ‘if’ conditions as these
operations as written today (with constants), are resulting in the
compile time warnings (and cmake errors) specifically when working
with proprietary radio configurations and setting Channel Min to 0.

Updated the radio header to get rid of OT_RADIO_CHANNEL_PAGE_MAX. Also
adds a compile-time error, if a user sets the proprietary channel page
to a value greater than 31, as it is currently not supported.
2021-05-20 17:16:24 -07:00
kangping f1ab57bb66 [border-router] add vicarious router solicitation (#6514)
This commit adds vicarious router solicitation which is described in
https://www.ietf.org/archive/id/draft-lemon-stub-networks-02.html#section-3.1.1
2021-05-20 12:32:59 -07:00
Jonathan Hui 516ae7df34 [github-actions] pin to clang-10 for coverage (#6652)
To avoid llvm gcov version mismatch.
2021-05-20 11:50:33 -07:00
kangping 9eff7616b3 [srp-server] fix removing services when the host is expired (#6649)
The SRP server tries to notify the advertising proxy when a service is
expired.  The expired service is firstly removed from the service list
and later added back to the head of the service list if the service
name should be retailed. This will result in deadloop when there are
two or more services on the same host.

This commit fixes this issue by keeping the expired service in the
service list by simply mark the service deleted and pass all services
of the host to the advertising proxy. The advertising proxy will
republish those services that are not expired but this should be fine
since service expiration is not a common case.

Also update the advertising proxy test case to cover multiple
services.
2021-05-20 09:07:39 -07:00
Abtin Keshavarzian 713231e144 [ip6] add public APIs to convert an IPv6 address or prefix to string (#6636)
This commit adds new public OpenThread APIs to convert an IPv6 address
or an IPv6 prefix to a human-readable string representation. The
implementation is shared with the `Address/Prefix::ToString()` used by
core modules (through adding a private `ToString(StringWriter &)`
method which can then be used with a `String<kSize>` or a char
buffer).
2021-05-19 23:28:05 -07:00
Łukasz Duda 8b63efe2ae [bootstrap] add support for Ubuntu on RaspberryPi (#6647)
Summary of changes:
- Enable building OpenThread RCP image on the Raspberry Pi (aarch64)
  directly (using Ubuntu)
- Fix problem with not having access to the /opt folder as a user
2021-05-19 19:35:14 -07:00
Yakun Xu 178ac73938 [posix] split readline and stdio handler (#6644)
This commit splits readline and stdio CLI handlers in POSIX app to
better demonstrate how to work with the CLI module.
2021-05-19 12:28:09 -07:00
Yakun Xu ea5a5fbd53 [daemon] logging CLI output (#6639)
The CLI input is already logged as info level messages. This commit
writes the CLI output as info level logging messages.
2021-05-18 18:27:51 -07:00
suveshpratapa 313d1f5d15 [posix] fix unused variable when log level is less than OT_LOG_LEVEL_CRIT (#6642) 2021-05-18 16:58:49 -07:00
Simon Lin cf21d5760a [dua] fix Parent failed to send reregister for MTD Child on receiving ST_DUA_REREGISTER (#6637)
This commit enhances DUA response handling for ST_DUA_REREGISTER:
- Parent will stop registering DUA for MTD Child until the next Child
  Update Request.
- MTD Child will re-register its DUA by Child Update Request or
  DUA.req.
2021-05-17 22:22:53 -07:00
Abtin Keshavarzian 6792eb76af [netdata] add TlvIterator and FindSubTlv<TlvType>() (#6621)
This commit contains the following changes:

- It adds `TlvIterator` to help iterate over TLVs of a given type
  in a given sequence of TLVs or sub-TLVs of another TLV.
- It adds helper method `PrefixTlv::FindSubTlv<TlvType>()` to
  search within the sub-TLVs for a specific one.
- It moves the `static` helper methods which find a TLV (with a
  given type) to `NetworkDataTlv` (from `NetworkData`).
2021-05-17 22:20:40 -07:00
Yakun Xu 3e19ce1f1f [border-router] border routing optional at runtime (#6629)
This commit allows launching an OpenThread daemon which was built with
backbone-router and border-routing support but disabling them at runtime
by not specifying the `-B` option.
2021-05-17 18:26:20 -07:00
Li Cao d3b1a0dac7 [child-supervision] remove dummy implementation of child supervision (#6628)
This commit removes dummy implementation of ChildSupervisor and
SupervisionListener. And add macro to ensure that these data members
only exist in ThreadNetif when child supervisor option is enabled. In
particular, ChildSupervisor only exists when child supervisor option
is enabled and it is FTD.
2021-05-17 10:21:02 -07:00
Yakun Xu 1b72b2d82e [docker] correct commit to build otsim (#6634) 2021-05-14 23:43:56 -07:00
Yakun Xu b4c98045b7 [posix] avoid static local variable (#6634)
This commit avoid static local variable so that it will not fail to
build on multi-threading environment.
2021-05-14 23:43:56 -07:00
Jonathan Hui b9fd3771b0 [trel] avoid compiler warning on use of strncpy (#6630) 2021-05-14 14:16:39 -07:00
Łukasz Maciejończyk fa997aead6 [posix] RCP(USB CDC ACM) hard reset support (#6454)
This commit handles the situation when RCP(USB CDC) performs hard
reset. This commit brings an alternative to pseudo reset by handling
the connection with RCP(USB CDC ACM) by reset the socket connection
after the device is reset.

When RCP is connected by USB CDC and we reset it, the RCP device is
numerated in host operating system.  So far for RCP(USB CDC) pseudo
reset has been performing meaning only specific parts of firmware were
reset thanks to results the connection hasn't been broken. For hard
resetting RCP(USB CDC) device the host needs to handle the connection
properly.

It uses udev library to check if device enumeration has ended if
libudev-dev package is present in the host system otherwise it waits
few seconds.

It works based on symlink to the RCP device created by udev in
/dev/serial/by-id/ directory.
2021-05-14 11:20:32 -07:00
Simon Lin 80487aac36 [udp] allow Reference Devices to send UDP messages to TMF port (#6627)
This commit allows Reference Devices to send UDP messages to TMF port,
which was prohibited by #5911 .

Background: TestHarness sends constructed TMF messages in many TCs to
validate the behavior of nodes on receiving these TMF messages.

Fixes DUA-TC-09
2021-05-14 10:26:01 -07:00
Simon Lin 822f464b9e [dua] send DUA.ntf to notify Child of unsuccessful DUA registration (#6625)
Parent should send DUA.ntf to Child that requested the DUA when status
is not ST_DUA_SUCCESS, according to Thread 1.2 Spec. 5.23.6.2.

Fixes DUA-TC-17.
2021-05-14 10:23:26 -07:00
Jonathan Hui c74ba05c44 [github-actions] fix bootstrap for i386 build (#6622) 2021-05-13 15:05:34 -07:00
Yakun Xu 621769411a [posix] fix removing daemon socket (#6620) 2021-05-13 08:30:56 -07:00
Yakun Xu 85cc73b34b [ip] make mesh-local addresses non-preferred (#6532)
This commit marks anycast addresses and mesh-local addresses as
IPv6 deprecated addresses.
2021-05-13 08:23:07 -07:00
Li Cao 4fd20f7cf2 [cli] fix cli dataset README (#6619) 2021-05-12 21:18:42 -07:00
whd 53b50577d4 [github-actions] fix MATN_16_LargeNumberOfMulticastGroupSubscriptionsToBBR (#6576) 2021-05-12 19:27:41 -07:00
Simon Lin 9347b290e1 [cli] make command output consistent (#6592)
This commit makes the CLI command output consistent under all cases:

- Output Error 6: Parse when the command line is too long (no output
  originally).

- Output Error 7: InvalidArgs when the command line has too many
  arguments. The original output is Error: too many args (max %d),
  which does not strictly follow the Error <code>: <msg> pattern.

- Output Error 13: InvalidState for running non-diag command in
  diagnosis mode to follow Error <code>: <msg> pattern.
2021-05-12 18:50:03 -07:00
Li Cao 7fc5525928 [gitignore] ignore ctags file (#6617) 2021-05-12 16:03:02 -07:00
Abtin Keshavarzian daa10ed2d0 [network-data] simplify config definitions and implementations (#6596)
This commit adds a new header file `networks_data_type.hpp` and its
related `cpp` file which now contain all the Network Data related
types and config definitions (for on-mesh prefix, external route,
service, and server entries) and their implementation (moved from
`network_data.hpp`).

It adds `IsValid()`, `ConvertToTlvFlags()`, and `SetFromTlvFlags()` in
`OnMeshPrefixConfig` and `ExternalRouteConfig` to validate the config
and convert it to/from the corresponding TLV bitmask flags. These
changes help simplify the use of the configs by other classes.
2021-05-12 15:07:08 -07:00
Abtin Keshavarzian 6d48af2e59 [address-resolver] simplify updating snooped cache entries (#6604)
This commit updates `UpdateSnoopedCacheEntry()` to perform the
common checks before adding a snooped entry (e.g., ensuring the
snooped entry source is not an MTD child of the device).
2021-05-12 15:04:36 -07:00
Jonathan Hui 264cb88579 [docs] remove outdated build instructions from CLI docs (#6615) 2021-05-12 11:48:45 -07:00
Jonathan Hui 2f637e99fd [network-data] limit router upgrade delay when registering (#6613)
If a device is a REED and waiting the random delay to upgrade to a
router, the device will wait to register its network data, since it
will have to register again after upgrading to a router. However, the
maximum delay for becoming a router is up to 2 minutes, which is a
long time to wait.

This commit limits the delay that a device will wait to register its
network data.
2021-05-12 11:48:14 -07:00
Jonathan Hui 45a23d89fe [docs] move openthread.io content to openthread/ot-docs (#6415) 2021-05-12 11:29:35 -07:00
Simon Lin e0a1987336 [ip6] set Mesh Local IID for Reference Devices (#6599) 2021-05-11 21:38:14 -07:00
Li Cao 9e0da04598 [mac-frame] fix setting mCslPresent field (#6610) 2021-05-11 17:41:41 -07:00
Jonathan Hui 550c2056de [nrf528xx] move to openthread/ot-nrf528xx (#6585) 2021-05-11 16:53:13 -07:00
Abtin Keshavarzian a40b42e299 [network-data] add new DNS/SRP anycast/unicast service definitions (#6501)
This commit adds new network data service entry definitions to
indicate presence of DNS/SRP servers within the Thread mesh and
provide info about them. Two service TLV formats are added:

`NetworkData::Service::DnsSrpAnycast` indicates that DNS/SRP client on
a device can use the associated anycast address with this service TLV
to reach the DNS/SRP server. The use of anycast address ensures that
the messages are routed to the nearest node which has added such a
service entry in the network data. The service TLV data in this model
contains a one byte sequence number which is used to notify the SRP
clients if they need to re-register with the server(s) (e.g., due
server reset/reboot and/or loss of previous registrations).

`NetworkData::Service::DnsSrpUnicast` directly provides the IPv6
address and port info for a DNS/SRP server which can be included as
part of the service TLV data and/or the server TLV data. Using service
TLV data allows the info about a common infrastructure SRP/DNS server
to be added by multiple BRs. In the case of server TLV, the IPv6
address info can be optionally omitted (i.e. just a port number is
provided) which then causes the associated RLOC/ALOC address of the
node who added the service entry to be used as the server's IPv6
address.

This commit updates the `Srp::Client` to use the new service entries
to discover/select the SRP sever when auto-start mode is enabled. The
client prefers and uses a `DnsSrpAnycast` over `DnsSrpUnicast`
entries. The `Srp::Server` is also updated to publish its info as
`DnsSrpAnycast` entry (using mesh-local address).

This commit also updates the `test_network_data` unit test to cover
the behavior of newly methods which iterate and parse different
service entry formats.
2021-05-11 13:44:29 -07:00
Simon Lin c1e2e168d6 [tests] set default node parameters (#6593)
This commit set default node parameters and remove unnecessary
parameters in topologies.
- router selection jitter to 1s
- panid to 0xface
2021-05-11 12:56:33 -07:00
whd f97d9c7de5 [github-actions] fix MATN_15_ChangeOfPrimaryBBRTriggersRegistration.py (#6608)
The test case failed because pktverify failed to find an ACK packet
sent to TD. However, TD_RLOC has changed during the test while we were
using the latter RLOC to verify the packet. Therefore it wasn't able
to find the packet.

For this test case, we can verify the existence of that ACK packet
using the source address of its according CON packet.
2021-05-11 12:54:28 -07:00
Yakun Xu 833f8e2cff [cli] process exit in ot-ctl (#6605)
The exit command should only exit ot-ctl itself in daemon mode. This
commit adds processing exit command in the ot-ctl.

This commit also moves the exit command implementation out from core
as a user command on simulation and posix cli mode.
2021-05-10 23:22:51 -07:00
Abtin Keshavarzian 3c5c525da8 [srp-client] disallow adding of duplicate services (same service/instance names) (#6597)
This commit updates `Srp::Client::AddService()` to reject and return
`kErrorAlready` if the caller tries to add duplicate service entries
(services with matching service and instance names).
2021-05-10 23:20:19 -07:00
Rongli Sun a7b429c193 [dua] fix unnessary reregistration (#6591) 2021-05-10 21:38:31 -07:00
Rongli Sun a74e0a35c4 [dua] avoid unnecessary log (#6591) 2021-05-10 21:38:31 -07:00
Rongli Sun f7417dc39f [bbr-manager] remove unnecessary namespace (#6591) 2021-05-10 21:38:31 -07:00
Abtin Keshavarzian 18097192ca [mle] ignore "Child Update Request" from a child not yet in valid state (#6539)
This commit updates `MleRouter::HandleChildUpdateRequest()` related to
how a "Child Update Request" message from a child is processed on a
parent. If the child is present in the parent's child table but it is
not yet in valid state, the parent ignores the received "Child Update
Request". This applies to a child being restored due to parent's reset
(child is in `kStateRestored`) or a child which is in the middle of
attach process (e.g., child is in `kStateParentRequest`). If a
matching child entry cannot be found in the parent's child table, the
behavior remains as before (i.e., parent sends a response with an
error Status TLV to notify the child to re-attach).

This change ensures that after a parent reset to restore a child, the
parent node is the one initiating and sending a "Child Update Request"
to the child and then receives a "Child Update Response" from it. Such
an exchange between the parent and the child will then include a
random challenge and response (authenticating the child and providing
replay protection). Also in this exchange the "Child Update Response"
from the child will include the the child's current MAC and MLE frame
counters, therefore ensuring that the parent correctly learns and
tracks the frame counters being used by the child.
2021-05-10 21:24:02 -07:00
Yakun Xu 7721a5119f [posix] avoid CLI buffer overflow (#6578) 2021-05-10 21:19:12 -07:00
Jonathan Hui 9432e9a659 [cmake] add OT_POSIX_SETTINGS_PATH option (#6603) 2021-05-10 21:17:36 -07:00
Yakun Xu 0f65243d63 [ot-ctl] support no separator -- (#6606)
With this change, both the following command should work:

ot-ctl -I wpan0 pskc -p 123456
ot-ctl -I wpan0 -- pskc -p 123456
2021-05-10 21:14:05 -07:00
Łukasz Duda 5078dfcc64 [mbedtls] update to 2.25 (#6555)
List of changes:
- modified Autotools, CMake and Android build systems
- increased heap size as new version requires additional 64B
- replaced deprecated API (mbedtls_ecdsa_sign_det)
- removed workaround with defining mbedtls_ecp_restart_ctx
2021-05-10 09:48:58 -07:00
Yakun Xu f766d8047d [posix] support interface name in ot-ctl (#6552)
This commit adds the Thread interface name to unix socket of
OpenThread daemon, so that ot-ctl can specify which daemon to connect
to.
2021-05-08 18:21:13 -07:00
kangping e7c4236c0a [border-router] add RA message dump for testing (#6567) 2021-05-08 18:10:11 -07:00
Simon Lin 8dc9a53cc7 [tests] fix bbr_5_11_01 random fails (#6589)
Set default BBR registration delay to 2. Defining a smaller BBR jitter
can help all TCs to be more robust.
2021-05-07 21:31:05 -07:00
kangping 6f2b818381 [srp-server] add API for getting LEASE and KEY-LEASE (#6517) 2021-05-07 21:26:36 -07:00
Rongli Sun e99d16e81c [dua/mlr-manager] refine logs (#6590) 2021-05-07 19:27:11 -07:00
Sagar Chinchani 122d8b8d71 [radio] add proprietary radio support (#6558)
This commit adds single-band proprietary radio support for
OpenThread. This feature will enable users to configure OpenThread
stack with proprietary radio parameters and use a PHY as defined by
the Platform.

More specifically:
1. Introduced the following platform configuration options:
   - OPENTHREAD_CONFIG_PLATFORM_RADIO_PROPRIETARY_SUPPORT
   - OPENTHREAD_CONFIG_PLATFORM_RADIO_PROPRIETARY_CHANNEL_MIN
   - OPENTHREAD_CONFIG_PLATFORM_RADIO_PROPRIETARY_CHANNEL_MAX
   - OPENTHREAD_CONFIG_PLATFORM_RADIO_PROPRIETARY_CHANNEL_MASK
   - OPENTHREAD_CONFIG_PLATFORM_RADIO_PROPRIETARY_CHANNEL_PAGE
2. Updated the radio and meshcop tlv implementation to incorporate the
   proprietary radio configurations
3. Updated the network diagnostics code to support channel page mask
   value up to 32.
2021-05-07 19:25:15 -07:00
Simon Lin 5b425a1b58 [tests] fix dig output TXT parsing (#6577) 2021-05-07 12:37:56 -07:00
Abtin Keshavarzian 5b6654d0bc [doc] update the BR name in comments/documentations (#6581)
This commit updates the BR name in comments and documentation
(removes the uses of "duckhorn")
2021-05-06 19:28:54 -07:00
Abtin Keshavarzian 63a4dc1fa5 [router-adv] have RouterAdvMessage inherit from Unequatable (#6580) 2021-05-06 19:28:28 -07:00
Abtin Keshavarzian f4001aa26d [log] fix uninitialized string use (#6584)
This commit fixes an issue with some of the log related methods where
`String` object may be used without being initialized (this was added
from commit b39f5b6dd and PR #6564).

This commit ensures that `String` variable definitions are always
immediately  followed by a `StringWriter()` definition which then
initializes the string buffer (sets it as empty).

This commit also updates `test_string` unit test.
2021-05-06 19:27:58 -07:00
Li Cao e5cdb56a71 [simulation] enhance command line arguments by using get_opt (#6544) 2021-05-06 17:01:38 -07:00
Jonathan Hui 5078323d35 [efr32] move to openthread/ot-efr32 (#6403) 2021-05-06 14:28:28 -07:00
Yakun Xu 394739f3d8 [cli] move netif command to posix platform (#6557) 2021-05-06 10:47:14 -07:00
kangping df2880bf9f [srp-server] accept optional KEY RRs (#6569) 2021-05-06 10:44:27 -07:00
whd 9de2134f67 [tests] fix MATN_09_DefaultBRMulticastForwarding.py (#6579)
The second to the last packet verification statement expects a ping
request sent by Router_1 after BR_2 becomes the PBBR.  However, this
statement wrongly matches a ping request sent by Router_1 before BR_2
becomes the PBBR.  Added a restriction of the echo identifier to make
sure the packet verification statement doesn't match the previous ping
request.
2021-05-06 10:10:36 -07:00
kangping 217727ec62 [border-router] send RA immediately when RA parameters are updated (#6565) 2021-05-06 10:08:07 -07:00
Simon Lin 4b455ca72c [posix-trel] support TREL URL (#6515)
This commit supports TREL URL (e.g. trel://eth0) for posix.
2021-05-05 22:02:04 -07:00
Yakun Xu b39f5b6dd2 [string] introduce StringWriter class (#6564)
This commit moves methods of String out of the header file to save code
size.

Since most use cases of String writers ignores errors, this commit
changes the return of writers to the Writer object itself for chained
writes.
2021-05-05 21:52:59 -07:00
whd 26cdf63231 [github-actions] fix MATN_15_ChangeOfPrimaryBBRTriggersRegistration (#6535) 2021-05-05 19:52:42 -07:00
Yakun Xu b9ba3558f8 [meshcop] support native commissioner (#6541)
This commit adds native commissioner support with the following changes:
* Accept unsecure traffic when Thread is not enabled.
* Accept traffic to border agent service when native commissioner is
  allowed.
2021-05-05 11:14:02 -07:00
Yakun Xu d3bc1acf74 [script] add package (#6540) 2021-05-05 10:41:17 -07:00
Yakun Xu 6d447f96da [test] add 'ot-' prefix to test targets (#6550) 2021-05-04 15:41:51 -07:00
Abtin Keshavarzian 98e353ca69 [cli] fix extra error output when handling user CLI commands (#6562)
It also adds a check in `cli-misc.exp` to verify error on an invalid
CLI command
2021-05-04 15:17:41 -07:00
Yakun Xu 864c4be9e5 [posix] use Url instead of RadioUrl in headers (#6543) 2021-05-03 22:55:54 -07:00
Jonathan Hui cc7b7d991b [routing-manager] add message to static_assert (#6560)
static_assert with no message is a C++17 extension.
2021-05-03 22:51:11 -07:00
Jonathan Hui 54b01df89c [router-advertisement] fix implicit conversion loss (#6559) 2021-05-03 22:50:55 -07:00
Yakun Xu 9ae780091f [cmake] set cxx and c standard once (#6551) 2021-05-03 22:50:41 -07:00
Yakun Xu 847f738cac [posix] escape CLI arguments (#6556) 2021-05-03 22:49:32 -07:00
Jonathan Hui 66802336de [cli] fix args length checking in dataset securitypolicy (#6548) 2021-05-01 10:25:23 -07:00
Jonathan Hui 055adb8467 [cli] add args length checking to dns command (#6547) 2021-05-01 10:25:10 -07:00
Simon Lin c9f1643883 [backbone-router] add cli command for MLR listeners (#6542)
This commit makes the CLI command for printing MLR listeners available
for non Reference Devices.
2021-04-30 08:07:16 -07:00
Li Cao f1fd52b9ef [tests] fix v1_2_LowPower_7_1_01_SingleProbeLinkMetricsWithEnhancedAcks (#6537)
Extend ping timeout.
2021-04-29 18:05:39 -07:00
Abtin Keshavarzian 55cb49160f [mle] clear tag only on a "Child Update Req" Rx from a detached child (#6445)
This commit changes the `MleRouter::HandleChildUpdateRequest()` to
clear the "last rx fragment tag" only if the "Child Update Request" is
from a detached child trying to restore its link with its parent. This
is indicated by the presence of Challenge TLV in the received message.
The "last rx fragment tag" is used for duplicate frame detection when
`MULTI_RADIO` is enabled.
2021-04-29 16:55:11 -07:00
Abtin Keshavarzian fb7ce6232e [cli] simplify arg checking/parsing with new Arg class (#6524)
This commit adds a new `Arg` class in `parse_cmdline` which represents
a single argument (wrapper over a C string). The `Arg` class is then
used in CLI modules. This helps simplify the CLI code mainly using
simpler syntax, e.g., using an overload of `==` operator to compare an
argument with a C string, or calling `ParseAs{Type}()` methods
directly on an `Arg` instance.
2021-04-29 15:36:23 -07:00
kangping 5db938dbed [border-router] learn RA header and parameters from infra interface (#6431)
The commit enhances the Routing Manager to learn RA header and
parameters from RA messages initiated from infra interface. This
addresses the issue that the BR may be using different RA header
against another RA daemon which is working on the same infra interface
(Have BR and another RA daemon working on the same interface is common
for Wi-Fi + Thread routers).

We also changed to accept RS messages initiated from the infra
interface: this is for case that multiple Border Routers run on the
same host (as we are trying to support multiple ot-daemons on the same
host).
2021-04-29 12:56:12 -07:00
Abtin Keshavarzian 91aaa34d9b [build] update build scripts and add multi-radio (TREL) CI build checks (#6518)
This commit updates `toranj/build.sh` script for posix based builds to
generate CLI executable. It also updates the posix platform to provide
log functionality when `LOG_OUTPUT` is set to `LOG_OUTPUT_APP`.

This commit also adds CI build checks for multi-radio and TREL build
configurations under posix platform.
2021-04-29 09:28:07 -07:00
Pieter De Gendt 84876d7f56 [api] expose API to obtain service ALOC for given service ID (#6519) 2021-04-29 09:27:02 -07:00
kangping 257188b5e9 [tmf] avoid binding TMF port for user UDP (#6534) 2021-04-29 07:50:19 -07:00
Yakun Xu bf422ee8b3 [cmake] add OT_DOC option (#6527) 2021-04-29 07:49:10 -07:00
Abtin Keshavarzian f4b188d79d [coap-message] remove the payload marker when no payload (#6516)
This commit updates `Coap::Message` to check and remove the payload
marker byte which is added at the end of header options in the case
that the message contains no payload. This check is performed in
`Finish()` method which finalizes the message for transmission. Note
that the presence of a marker followed by a zero-length payload is
processed as a message format error by receivers.

This change helps simplify the preparation of CoAP message by other
modules (i.e., they no longer need to check for empty payload to
remove the marker themselves and can rely on common code in
`Coap::Message`).
2021-04-28 15:09:33 -07:00
Yakun Xu a78888579b [test] wait factoryreset in check-posix-pty (#6529) 2021-04-28 08:43:40 -07:00
Abtin Keshavarzian 2999f834e6 [posix] update ot-cli to include ot-config definitions (#6474)
It also updates ot-daemon.
2021-04-27 23:14:24 -07:00
Abtin Keshavarzian 30b21f6036 [announce-sender] use trickle to limit number of announce tx (#6401)
This commit updates and enhances the `AnnounceSender` feature. When
this feature is enabled, routers and REEDs periodically send MLE
Announcements (on all channels from the channel mask in the current
Active Operational Dataset). This commit updates the implementation to
use `TrickleTimer` such that a device monitors the number of received
Announce messages within a cycle and if the number is above a
redundancy threshold, the device skips sending Announcement in that
cycle itself. This helps limit the number of Announcement tx in cycle
in a dense network. The same mechanism is used by both routers and
REEDs.
2021-04-27 22:54:58 -07:00
kangping 1704d19035 [git] ignore vscode configuration files (#6498) 2021-04-27 21:48:55 -07:00
Simon Lin 898a10fd79 [joiner] avoid null dereference in CoAP response handler (#6510) 2021-04-27 20:12:20 -07:00
whd 7620e59e7a [scripts] MATN-TC-09: Failure of Primary BBR – Outbound Multicast (#6463) 2021-04-27 18:56:34 -07:00
Jonathan Hui 7b07dc503b [mesh-forwarder] allow 15.4 broadcast of unsecure link-local multicast (#6503) 2021-04-26 14:26:36 -07:00
Simon Lin 8168d7a403 [thci] dump syslog when reset (#6185) 2021-04-26 13:03:00 -07:00
Simon Lin 3128a8e7d5 [otci] add SRP server & client utilities (#6512) 2021-04-26 09:17:05 -07:00
whd b5ec673e2f [scripts] MATN-TC-16: Large number of multicast group subscriptions to BBR (#6507) 2021-04-26 09:14:10 -07:00
Simon Lin 27d1e9d65a [backbone-router] fix incorrect PBBR ALOC (#6505) 2021-04-26 09:09:39 -07:00
kangping 92335ef4fa [border-agent] add logging for border agent events (#6481)
This commit includes several small changes:
- Add logs for Border Agent Start and Stop events to help analysis
  commissioning issues such as openthread/ot-commissioner#193
  (comment).
- Start Border Agent when the native commissioner is stopped.
- Add CLI command ba state to get current Border Agent state.
2021-04-26 07:09:50 -07:00
whd 0656fbc9ed [scripts] MATN-TC-15: Change of Primary BBR triggers a re-registration (#6504) 2021-04-26 07:04:15 -07:00
Abtin Keshavarzian 8a0e7b8c4e [dua-manager] avoid null dereference in CoAP response handler (#6509)
This commit changes `DuaManager::HandleDuaResponse()` to use a pointer
to `aMessage` and `aMessageInfo` (instead of reference) Note that in
case of a failure, the `Coap` module may invoke the response handler
with `nullptr` for these parameters.
2021-04-25 21:41:34 -07:00
Simon Lin ccedef530e [github-actions] add more packet verification tests (#6508)
Packet verification of some test scripts were not executed. This
commit runs these tests in packet verification checks.
2021-04-25 21:36:01 -07:00
Abtin Keshavarzian 524da6d2c4 [tmf] rename TMF agent class to Tmf::Agent (#6502)
This commit renames the TMF agent class from `Tmf::TmfAgent` to
`Tmf::Agent` (to follow style used by other modules).
2021-04-23 07:50:38 -07:00
whd c8902e9419 [scripts] MATN-TC-05: Re-registration to same Multicast Group (#6444) 2021-04-22 22:17:03 -07:00
Yakun Xu b928f148f4 [github-actions] fix unstable issue of pty-macos (#6506) 2021-04-22 21:50:24 -07:00
whd e8ec349ce0 [scripts] MATN-TC-12: Hop limit processing (#6496)
- Implement test case MATN-TC-12
- Also implement a fake layer: 'ipv6inner'. It is useful for fetching
  data in the inner IPv6 layer from a packet.
2021-04-22 19:27:20 -07:00
Li Cao d4d81c39c9 [cli] add cli to get All Thread Nodes multicast address (#6500)
This commit adds APIs to get Link/Realm Local All Thread Nodes
multicast addresses. This commit also adds cli command to get
meshlocal prefix alone for writing tests.
2021-04-22 19:14:56 -07:00
whd 7a2465f751 [cli] support -I {src-addr} for ping command (#6470) 2021-04-22 12:43:26 -07:00
Eduardo Montoya f344098266 [low-power] add receive timing capability to CSL receiver (#6343)
This commit uses the receive timing capability from the radio to
schedule CSL receive operations with a higher precision, allowing for
shorter receive windows.
2021-04-22 11:22:30 -07:00
Simon Lin 1b118d7216 [trel] fix potential compile issues (#6495) 2021-04-22 11:09:14 -07:00
Abtin Keshavarzian f4344792da [network-data] add support for NAT64 flag in HasRoute TLV (#6429)
This commit adds a new flag in `NetworkData::HasRouteEntry` to
indicate that an off-mesh route prefix in the Network Data is also a
NAT64 prefix. It updates the public `otExternalRouteConfig` structure
to include `mNat64` bit flag and adds support for it in the core
modules.

It also updates `test_network_data` unit test to cover the new flag
and also adds some smaller style changes in this test.

This commit updates the CLI modules to add support for the new
flag. It also adds smaller enhancements in CLI related to network
data, adding methods `NetworkData::OutputPreference()` and
`OutputIp6Prefix()` to output common info (shared between on-mesh
prefixes and off-mesh routes), also simplifying how the flags are
mapped to char array string (avoiding extra space char in the output
string).

This commit also updates spinel and NCP code to add support for the
new NAT64 flag.
2021-04-21 22:19:27 -07:00
Jiacheng Guo 6fa74b7674 [cli] fix false alarm when printing empty line (#6499)
The OpenThread cli may print false alarms when calling
`OutputLine("")`. Fix accordingly.
2021-04-21 22:16:04 -07:00
Simon Lin 01186d6610 [thread-cert] use OT_TREL=OFF for OTBR docker build (#6497)
Since OT_TREL is going to be set to ON in OTBR, this commit makes sure
we test OTBR with TREL off.

Also removed -DOTBR_DNSSD_DISCOVERY_PROXY=ON since it's now ON by
default.
2021-04-21 22:07:11 -07:00
Yakun Xu 8467a3d522 [border-agent] use ephemeral port (#6450)
This commit changes border agent service to use ephemeral port by
default. This change makes it easier to support multiple Thread
interfaces on a single host.
2021-04-20 22:32:07 -07:00
Abtin Keshavarzian e3b971e497 [srp-client] add missing #ifndef checks in config header file (#6488)
It also fixes the typo in `MAX_HOST_ADDRESSES` name.
2021-04-20 09:45:31 -07:00
kangping 4e20dff989 [border-router] add platform API otPlatInfraIfHasAddress (#6430)
This commit removes the need of getting LLA of infra interface but
adds a new platform API otPlatInfraIfHasAddress which matches the
infra interface and a given address.

Background:
The infra interface LLA is used in the Routing Manager for only
testing if RA/RS message is initiated from the infra interface.
2021-04-20 08:00:55 -07:00
Yakun Xu 33012716ee [github-actions] download size reporter in workflow file (#6475) 2021-04-20 07:30:37 -07:00
Yakun Xu 2796615cf7 [cmake] print source directory (#6489)
Print source directory during cmake, which is useful to find the source
code location when OpenThread is built by other projects.
2021-04-19 22:23:06 -07:00
Abtin Keshavarzian 0eeab8844a [network-data] add FindNextMatchingService() (#6473)
This commit adds a new method in `NetworkData` class to find and
iterate over all Service TLVs that start with a given Service Data.
Unlike the existing `FindService()` method which searches for a
Service TLV with an exact match with the given Service Data,  this
method performs a relaxed check allowing a matching Service TLV to
contain additional bytes after given data bytes to search for.

This commit also updates `test_network_data` unit test to add new
test to cover the behavior of newly added method.
2021-04-19 21:27:33 -07:00
Abtin Keshavarzian 31cbb28d84 [network-data] check and skip over incomplete TLVs during TLV iteration (#6477)
This commit updates `NetworkData::Iterate()` to check that an entire
TLV (or sub-TLV) is contained within the Network Data (up to its
length) and skips over TLVs that are incomplete. It also updates
`FindTlv()` methods to directly use the stricter check in the
`for()` loop used to iterate over all TLVs.
2021-04-19 21:19:08 -07:00
Jonathan Hui 3e05438d32 [github-actions] install ninja in cli-ftd-otns (#6487) 2021-04-19 19:30:28 -07:00
Simon Lin e4cc10594c [trel] remove Thread LLA on deinit (#6485) 2021-04-19 10:26:12 -07:00
Li Cao 462a783337 [neighbor-table] fix finding neighbor by Ip6 address issue (#6483)
Currently, if using FindNeighbor(const Ip6::Address &aIp6Address,
Neighbor::StateFilter aFilter) when the aIp6Address is the device's
parent's link local address, it cannot be found. This commit fixes
this issue.
2021-04-19 09:22:37 -07:00
Simon Lin 24177cade4 [trel] initialize TREL interface in AfterInit (#6465)
To avoid checking mInitialized repeatedly in TX tasklet.
2021-04-19 08:14:58 -07:00
Simon Lin ce725f8070 [otci] fix test random fails (#6478) 2021-04-19 07:48:33 -07:00
jinran-google 0c5053d0ae [codecov] use Codecov GitHub Action to upload coverage (#6467) 2021-04-19 07:32:58 -07:00
Jintao Lin b091b1ff02 [scripts] remove CSL ping timeout constraint (#6480) 2021-04-19 07:32:08 -07:00
Yakun Xu f81c0b50f0 [posix] remove NCP app (#6428)
The POSIX NCP app(ot-ncp) is simulating of NCP with an RCP. With the
latest otbr-agent, this is not needed any more. It is only used in CI
tests. This commit removes the app to save maintenance efforts.
2021-04-16 07:42:14 -07:00
Jonathan Hui 49adc5cec5 [security-policy] remove assertfrom Get/SetSecurityPolicy() (#6464) 2021-04-16 07:14:34 -07:00
Jintao Lin d8926baa71 [scripts] increase CSL ping timeout value (#6468)
Sometimes CSL cannot be sent out at the sample windows following the
ping command and may need to wait for one or more CSL periods. Use the
default ping timeout which covers several CSL periods.
2021-04-16 07:13:45 -07:00
konradderda 23bbde5c96 [nrf528xx] set frame counter and key idx in otPlatRadioTransmit() (#6458)
This change tackles both problems resolved and introduced by #6427.

For direct transmissions, if the first frame transmission fails,
e.g. due to a CCA failure then retransmissions will contain an invalid
frame counter. It causes problems especially for long IP packets - the
receiver drops a fragment but the transmitter will flood it with the
next fragments since it is not aware that the other party dropped a
fragment. We have identified that it's a root cause of the problem
reported in #6337.

Previous solution (remove the check if a frame is retransmitted) may
cause problems with indirect transmissions where radio frames are
created from scratch and then their frame counter would be
overridden. That is why the best place for setting frame counter and
key index in otPlatRadioTransmit().
2021-04-15 22:52:39 -07:00
Jonathan Hui a913784cc0 [codecov] remove use of bash uploader (#6459)
See https://about.codecov.io/security-update/
2021-04-15 21:01:21 -07:00
whd 58419376bf [scripts] MATN-TC-04: Removal of multicast listener by timeout expiry (#6441) 2021-04-15 13:54:08 -07:00
whd bb142df1a5 [scripts] MATN-TC-03: Thread device incorrectly attempts Commissioners (de)registration functions (#6435) 2021-04-15 13:51:57 -07:00
Simon Lin 796bc8e507 [scripts] fix parsing TXT RR containing " (#6443)
This commit fixes parsing dig TXT RR that contains `"`.
2021-04-15 13:45:13 -07:00
Yakun Xu 3fa6fd7b52 [cmake] export compile commands (#6451)
This commit adds the option CMAKE_EXPORT_COMPILE_COMMANDS=ON to export
compile commands which is helpful for editors/IDEs.
2021-04-15 13:36:08 -07:00
Abtin Keshavarzian 4448b7b426 [radio] update docs on frame counter when RADIO_CAPS_TRANSMIT_SEC (#6448)
This commit updates documentations in `radio.h` and adds more detail
on expected behavior on assigning of the frame counter (on retx or
first attempt frame) when radio provides `OT_RADIO_CAPS_TRANSMIT_SEC`
capability (i.e., radio platform layer handles the tx security and
frame counter management).
2021-04-15 09:12:26 -07:00
Yakun Xu 559f9c8d56 [docs] remove old posix README (#6452)
This commit removes the README.md in src/posix/platform. Read the one
in src/posix/README.md for POSIX apps.
2021-04-15 09:07:56 -07:00
konradderda a9d43fac5d [nrf528xx] set key id and frame counter for retransmissions (#6427)
For nRF52 platforms in order to achieve the best CSL accuracy frame
security processing was moved to the nrf_802154_tx_started() radio
driver callback which is called from the interrupt context when frame
transmission is started by the hardware peripheral.

There is a possibility that a requested transmission will be aborted
before nrf_802154_tx_started() is called. The frame can be then
retransmitted and if nrf_802154_tx_started() is called it will skip
setting key index and frame counter (so they will remain unchanged
with a value equal to whatever is present in RAM).

It seems that we should always set these fields. Moreover, security is
processed only once which is controlled by
mTxInfo.mIsSecurityProcessed member so checking for retransmission is
redundant.
2021-04-14 08:18:05 -07:00
kangping 423575fceb [meshcop] support Thread 1.2 Security Policy flags (#6320) 2021-04-14 08:16:08 -07:00
Abtin Keshavarzian 7d008f6c76 [dns-client] add support for NAT64 during address resolution (#6414)
This commit adds support for NAT64 address translation (from IPv4 to
IPv6) during address resolution in `Dns::Client`. This feature is
enabled using `OPENTHREAD_CONFIG_DNS_CLIENT_NAT64_ENABLE` config
option. When enabled, the caller can specify in the address query
configuration whether to allow or disallow NAT64 address translation
for a specific query. The default behavior can also be set using the
default DNS client config.

When the NAT64 is allowed, if the response from server does not
provide an IPv6 address for the host name, we first check if the
server has provided IPv4 address information in the response, and if
not, start a new query for the IPv4 address. Once the IPv4 address(es)
of the host name are resolved, they are translated to IPv6 address(es)
and reported to the user in the query callback function.
2021-04-14 00:45:18 -07:00
whd 3e833c120f [scripts] MATN-TC-02: Multicast listener registration and first use (#6409) 2021-04-13 21:14:44 -07:00
Jonathan Hui 970fe23dd7 [mesh-forwarder] combine anycast routing functions (#6423) 2021-04-13 21:12:41 -07:00
Jonathan Hui fa99680f02 [mesh-forwarder] add support for Neighbor Discovery Agent Anycast (#6423) 2021-04-13 21:12:41 -07:00
Jonathan Hui 8959216641 [tests] add test for anycast forwarding (#6423) 2021-04-13 21:12:41 -07:00
Jonathan Hui 1363316f5e [mesh-forwarder] use path cost in DHCPv6 ALOC lookup (#6423) 2021-04-13 21:12:41 -07:00
Jonathan Hui e18df9beb1 [dhcp6-server] add anycast address for stateless config (#6423) 2021-04-13 21:12:41 -07:00
Jonathan Hui 25418c15c9 [dhcp6-server] fix removal of anycast address (#6423) 2021-04-13 21:12:41 -07:00
Jintao Lin d514373832 [low-power] resync SSED with its parent after retransmission (#6342)
Per 15.4 spec, transmitter cannot modify frame content in
retransmission which will leads to out-of-date CSL IE being sent to
CSL transmitter. This commit fixes this issue by,
1. Send a follow up data poll with CSL IE to resync the CSL
   transmitter.
2. Send periodic data poll with CSL IE to keep SSED's parent in sync.
3. Move PrepareDataRequest to data_poll_sender.
4. Add test cases to cover.
2021-04-13 13:02:00 -07:00
Kamil Sroka 07eb021679 [nrf528xx] ensure HWFC is triggered when SW buffer is full (#6442)
* [nrf528xx] ensure HWFC is triggered when SW buffer is full
* [nrf528xx] use UARTE peripheral for TX path

Co-authored-by: Łukasz Duda <lukasz.duda@nordicsemi.no>
2021-04-13 08:54:53 -07:00
Simon Lin 62ae1a1c36 [thread-cert] specify MAX_JOBS via env (#6419) 2021-04-12 22:52:58 -07:00
suveshpratapa 21417407dd [cmake] allow custom values for package name and package version (#6373) 2021-04-12 20:47:22 -07:00
Simon Lin a89c73b370 [scripts] fix dig txt RR parsing (#6433)
This commit fixes parsing dig TXT RR that contains whitespace.
2021-04-12 18:49:49 -07:00
Simon Lin 7cc6a1db5c [posix] fix one wrong log level (#6432) 2021-04-12 17:30:23 -07:00
Jonathan Hui 0cdc3f1444 [github-actions] run brew update (#6439) 2021-04-12 17:26:22 -07:00
Simon Lin d5855ab74b [style] bump yapf version to 0.31.0 (#6434) 2021-04-12 07:30:27 -07:00
Abtin Keshavarzian 850468a68a [cli] adding helper method ParseEnableOrDisable() (#6426)
This commit adds a helper method `Cli::ParseEnableOrDisable()` which
checks a given string against two common commands "enable" or
"disable". This method is then used in CLI modules.
2021-04-12 07:27:26 -07:00
Abtin Keshavarzian f7802d60a1 [style] rename header file to locator_getters.hpp (#6422)
This commit renames the `Locator` header file to follow the same style
used by other core modules (i.e., use underscore between words in a
file name).
2021-04-10 10:16:01 -07:00
Jonathan Hui 193d7d3ba1 [k32w] move to openthread/ot-nxp (#6425) 2021-04-10 10:14:51 -07:00
kangping 8987ae4c21 [srp-server] replace SRP Host pointer with use SRP service update ID (#6407)
We are using the SRP Host pointer for indexing an outstanding SRP
update when the Advertising Proxy result is passed back with
otSrpServerHandleServiceUpdateResult. There are chances that an old,
freed Host object may be matched again with a newly allocated Host
object which coincidentally has the same address with the old Host
object.

This commit solves this issue by using a random generated uint32_t SRP
service update ID for indexing outstanding updates.
2021-04-09 22:09:30 -07:00
Abtin Keshavarzian 4acc997bf5 [build] update toranj build script to skip over empty "" args (#6424)
This commit updates `toranj/build.sh` script to skip over empty ""
arguments at the start. This addresses an issue introduced in commit
531cb3484 (PR #6421) where the `start.sh` adds an empty arg when
invoking `build.sh` when coverage is not enabled.
2021-04-09 19:44:32 -07:00
Yakun Xu dfe9b006f4 [docs] add link to UDP commands (#6418) 2021-04-09 13:36:38 -07:00
Paweł Wańczyk 9abd81b11b [border-router] add validation of updated on mesh prefixes (#6313)
This commit adds validation of the on mesh prefixes.

With this change, the domain on mesh prefix can be directly configured
after successful verification.
2021-04-09 13:35:54 -07:00
Li Cao 531cb34849 [tests] fix shell format check warnings (#6421) 2021-04-08 21:39:11 -07:00
Simon Lin 5a39566f81 [dnssd] implement DNS-SD Discovery Proxy (#6191)
This commit implements DNS-SD Discovery Proxy.
- Implemented DNS-SD Discovery Proxy functionalities - OT part
- Fixed an memory issue of NameCompressInfo (introduced in #6155 , but
  somehow revealed by this commit)

Some implementation details:
- Discovery Proxy subscribes to services/service instances/hosts
  through callbacks set by a public OT API. It is up to the platform
  mDNS implementation to collect service instance/host information and
  notify OT via a public OT API.
- Discovery Proxy can handle DNS browsing of one service or DNS
  resolving of one service instance/host. We leave browsing multiple
  services or resolving multiple service instances/hosts for future
  enhancements if necessary.
2021-04-08 18:21:23 -07:00
Neal Jackson e43cd4bb07 [channel-manager] add cli/api functions to modify the CCA failure rate threshold (#6400)
I have found that the default channel manager CCA failure rate
threshold is not necessarily ideal, and some experimentation is
required to determine a good threshold depending on network
characteristics and packet size/periodicity.

For example, I have a network that experiences ~40% packet loss, yet
only ever reports a maximum 4% CCA failure rate, well below the
default of 10%.

This commit adds functions to get/set the threshold, the API layer,
CLI hooks, and CLI documentation.
2021-04-08 14:36:16 -07:00
Yakun Xu 080642e526 [github-actions] fix unknown option m4 --gnu in macos checks (#6420) 2021-04-08 14:23:39 -07:00
kangping 39e6172304 [border-router] accept RA initiated from the infra interface (#6348)
Accept RA initiated from the infra interface so that we can detect the
existence of another RA daemon which is working on the same infra
interface.

Also enhance the test_single_border_router.py test script to make it
more readable.
2021-04-07 11:01:29 -07:00
Jonathan Hui 414cba3048 [cli] add more output to eidcache command (#6408) 2021-04-07 08:41:08 -07:00
whd a145d24352 [ping-sender] let ping return statistics in OTCI (#6370)
- Ping command in CLI will print Done in the end, after printing
  replies and statistics. The old behavior is, ping command prints
  Done before any replies.
- In OTCI, let ping function return statistics.
- Support timeout parameter in ping command.
- Fix a bug that the arguments are not properly passed to ping in
  node.py.
- Adjust timeouts in tests.
2021-04-07 08:40:18 -07:00
Markus Becker 83cecbb8e3 [spinel] fix missing initializer compiler error (#6410) 2021-04-06 17:09:09 -07:00
Abtin Keshavarzian 0ecae494dc [dns-types] Add Dns::ARecord for A records (#6404) 2021-04-06 15:36:19 -07:00
Piotr Koziar 77d3af396c [spinel] handle link metrics (#6228)
This commit allows the spinel interface to deal with link metrics.

There are 7 new properties introduced:
- THREAD_LINK_METRICS_QUERY
- THREAD_LINK_METRICS_QUERY_RESULT
- THREAD_LINK_METRICS_PROBE
- THREAD_LINK_METRICS_MGMT_ENH_ACK
- THREAD_LINK_METRICS_MGMT_ENH_ACK_IE
- THREAD_LINK_METRICS_MGMT_FORWARD
- THREAD_LINK_METRICS_MGMT_RESPONSE
2021-04-06 07:42:46 -07:00
kangping fa09e8a75d [meshcop] fix UDP proxy (#6396)
The MeshCoP UDP Proxy packets should not be sent/received with
platform UDP.
2021-04-05 22:31:43 -07:00
Simon Lin 5bc74b7113 [scripts] add Backbone DUA routes test (#5644) 2021-04-05 21:28:38 -07:00
Abtin Keshavarzian 743e91361c [style] harmonize feature check and header includes (#6399)
This commit harmonizes how the feature config checks are done within
OT core modules. In header `.hpp` files, any related `#if` config
check is done immediately after the `"openthread-core-config.h"` is
included. This way the rest of definitions are skipped over if the
feature is not being used. In `cpp` source files the `#if` check is
done immediately after including the related header file.
2021-04-05 14:13:24 -07:00
kangping 29f6f275b8 [android] enable ping sender (#6402) 2021-04-05 08:37:53 -07:00
Abtin Keshavarzian d1d0dc8aa6 [dns] allow disabling of DNS name compression for testing (#6368)
This commit adds support for "DNS name compression" mode. By default
the DNS name compression is enabled. When disabled, DNS names are
appended as full and never compressed. This is applicable to
OpenThread's DNS and SRP client/server modules. This is intended for
testing only and available when config option
`OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE` is enabled.

This commit also add a CLI command for this feature as `dns
compression [enable|disable]` and updates the CLI's `README.md`.
2021-04-05 08:36:38 -07:00
Jonathan Hui b7751460e0 [cc2650] remove example platform (#6398) 2021-04-02 18:50:37 -07:00
Simon Lin 09c95f9a32 [scripts] make BMLR test more reliable (#6387)
In BMLR test, the commissioner may fail to start because the /c/ps
COAP message failed to reach Leader due to unstable links.  This
commit makes sure the links are established before starting the
commissioner.
2021-04-02 18:25:12 -07:00
Li Cao e54691c3ff [data-poll-sender] use OT_MIN and replace enum with constexpr (#6395)
This commit replaces some enum definition with constexpr since these
enum are used for comparing. The compiler would always give warnings
when comparing enum with other non-enum values. With this change, we
can directly compare the consts with other values. And this commit
replaces UpdateIfLarger with OT_MIN.
2021-04-02 08:49:39 -07:00
Jonathan Hui e360c63779 [cc13x2-cc26x2] move to openthread/ot-cc13x2-cc26x2 (#6389) 2021-04-02 08:37:37 -07:00
Jonathan Hui b9ad0f9391 [cli] avoid div-by-zero in HandlePingStatistics() (#6394) 2021-04-02 08:09:28 -07:00
Abtin Keshavarzian f889437dc6 [spinel] use full names in string lookup table (#6390)
This commit changes the string lookup tables used in `spinel.c` to
convert the property/command definitions to string to use the full
enum names in the table.

This makes the names "search/grep"-able which is helpful during
renaming/refactoring or when adding a new property (by searching and
copying code for an existing one).
2021-04-02 08:09:05 -07:00
Neal Jackson 63e4b7c9ea [docs] add CLI documentation for channel manager/monitor (#6385) 2021-04-01 21:44:30 -07:00
Abtin Keshavarzian a2f63e524d [srp-client] add "service key record inclusion" mode for testing (#6361)
This commit adds support for "service key record inclusion" mode in
SRP client. When enabled, SRP client will include KEY record in
Service Description Instructions in the SRP update messages that it
sends. KEY record is optional in Service Description Instruction (it
is required and always included in the Host Description Instruction).
The default behavior of SRP client is to not include it. This feature
is intended to override the default behavior for testing only and is
is available under the reference device configuration build (i.e.,
when `OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE` is enabled).

This commit also add a CLI command for this feature as `srp client
service key [enable/disable]` and updates the `README_SRP_CLIENT.md`.

Finally, this commit adds new spinel property for SRP client "service
key record inclusion" mode along with its get/set handlers in NCP
build.
2021-04-01 21:41:24 -07:00
Jonathan Hui ab339041fa [github-actions] add setup for i386 arch (#6393) 2021-04-01 18:01:19 -07:00
Simon Lin 51035f564e [scripts] fix multicast routing test false fails (#6388) 2021-04-01 08:13:59 -07:00
Jonathan Hui 5b5a3f6d9e [kw41z] move to openthread/ot-kw41z (#6386) 2021-04-01 08:12:12 -07:00
Yakun Xu 6f382a4ac5 [macos] fix binding interface and build (#6362)
This commit fixes binding interface on macOS and also build errors on
macOS. The pty check is also added on macOS.
2021-04-01 08:10:22 -07:00
whd a274ddea71 [tests] fix wrong usage of ping timeouts (#6381)
In tests/scripts/thread-cert/node.py, the timeout parameter of ping()
function is in seconds. However, in some test cases they called ping()
with a timeout in milliseconds.

I used the following command to list ping() usages with a specified
timeout: grep -rn "ping.*timeout=" tests/scripts/thread-cert/*
2021-03-31 22:22:34 -07:00
Abtin Keshavarzian 153fc8678d [channel-mask] update Mac::ChannelMask::ToString() (#6375)
This commit contains a small fix in `Mac::ChannelMask::ToString()`
string output (e.g, return `{ 11-26 }` instead of `{ 11-26}`). This
commit also updates the unit test to follow naming style and verify
the `ToString()` behavior.
2021-03-31 17:05:58 -07:00
Abtin Keshavarzian 0c003844b0 [docs] fix typos in documentations/comments and small style changes (#6374) 2021-03-31 17:05:10 -07:00
Jonathan Hui 71097eeb0f [qorvo] move to openthread/ot-qorvo (#6382) 2021-03-31 16:30:07 -07:00
Jonathan Hui f81eebeb48 [samr21] move to openthread/ot-samr21 (#6369) 2021-03-30 21:59:21 -07:00
Abtin Keshavarzian 45bd0a0851 [dns] adding Name::AppendTo() to copy DNS name from one message to another (#6365)
This commit adds `AppendTo()` method in `Dns::Name` class. This method
allows appending an already encoded name from one message to another.
This is performed by directly copying labels one by one between the
messages and does not require an intermediate buffer to read and store
the labels or the full name. This commit also updates `test_dns` unit
test to cover the behavior of the newly added method.
2021-03-30 18:49:17 -07:00
Eduardo Montoya fa171812d3 [low-power] adaptative CSL window duration (#6311)
Make CSL receive window dependent on the accuracy of the crystals
used for scheduling and on the elapsed time since last synchronization.

CSL Receive window scheduling
=============================

          a   b  c              d      e              f  g
          |   |  |              |      |              |  |
-------------------------------------------------------------------->

a-b:  kCslReceiveTimeAhead
b-c:  -mCslParentUncert
c-d:  -(mCslParentDrift + otPlatRadioGetCslAccuracy)
d:    mCslSampleTime
d-e:  kMinCslWindow
e-f:  +(mCslParentDrift + otPlatRadioGetCslAccuracy)
f-g:  +mCslParentUncert
2021-03-30 18:39:09 -07:00
Yakun Xu e1a5cca4b3 [ot-ctl] fix ot-ctl hang (#6378) 2021-03-30 18:31:43 -07:00
Abtin Keshavarzian fa7b012da9 [message] add method to append bytes read from another/same message (#6364)
This commit adds `Message::AppendBytesFromMessage()` which appends
bytes to a message read from another or potentially the same message
at a given offset. The bytes are read and copied directly (chunk by
chunk) without requiring an intermediate buffer. This commit also
updates `test_message` unit test to cover the behavior of the newly
added method (for both cases where the source and the destination
messages are the same or different).
2021-03-30 11:56:00 -07:00
whd bbbeee17fb [ping-sender] show ping reply statistics (#6341) 2021-03-30 09:54:14 -07:00
Abtin Keshavarzian b5b5994651 [srp-client] adding buffer and service pool module (#6257)
This commit adds a new module `Utils::SrpClientBuffers` which provides
string/data buffers and a pool of service entries for use for SRP
client. OpenThread SRP client implementation requires that the
service, string/data buffers passed as parameters to its API to
persist. This allows flexibility in how the SRP client can be used
(users of API can decide on how to manage the memory). The new module
provides an option to OT API user to use the buffer and service pool
to allocate/free items (e.g., service entries). The new module is
enabled by `OPENTHREAD_CONFIG_SRP_CLIENT_BUFFERS_ENABLE`. A set of new
configs specifies the number of service entries in the pool, number of
host address entries, and the size of different string buffers (e.g,
size of service instance string, etc).

This commit also updates CLI and NCP implementations to use the new
common service pool for SRP client commands.
2021-03-29 21:30:36 -07:00
Abtin Keshavarzian 2e61433825 [ip6-address] add SetFromTranslatedIp4Address() for NAT64 (#6353)
This commit adds `Ip6::Address::SetFromTranslatedIp4Address()` method
performing NAT64 address translation from an IPv4 address and a NAT64
prefix to construct a corresponding IPv6 address as specified in RFC
6052. This commit also updates the unit test `test_ip6_address.cpp` to
cover the behavior of the newly added method.
2021-03-29 16:20:42 -07:00
Abtin Keshavarzian 4fb42e245b [ip6-address] simplify FromString() (#6346)
This commit updates the implementation `Ip6::Address::FromString()`
simplifying it and handling more special cases where address starts
or ends with `::`. The unit test `test_ip6_address` is also updated
to cover some new test cases.
2021-03-29 07:54:40 -07:00
Abtin Keshavarzian d0bbfe6e4c [dns-client] simplify SendQuery() and add comment (#6357)
This commit contains two small changes in `Dns::Client`: simplifying
the `SendQuery()` call and adding a comment about reason for parsing
the response in a separate method.
2021-03-26 16:03:37 -07:00
Abtin Keshavarzian a6be70f296 [net] add Ip4::Address class (#6334)
This commit adds IPv4 address definitions in OpenThread:
- Adds `Ip4::Address` class.
- Adds methods to convert IPv4 address to/from string.
- Updates the `Ip6::Address::FromString()` to use the IPv4
  `FromString()` for the case where the IPv6 address contains
  an embedded IPv4 address.
- Renames unit test to `test_ip_address` and updates it to
  cover the behavior of newly added IPv4 definitions in addition
  to IPv6 related tests.
2021-03-26 15:56:31 -07:00
Abtin Keshavarzian b0e1712d3b [link-metrics] address header file loop with 'topology.h' (#6345)
This commit addresses the header file include loop between
the `link_metrics.hpp` and `topology.hpp` by forward declaring
`Neighbor` in `link_metrics` header. It also removes some of the
unnecessary header includes and contains smaller style fixes.
2021-03-25 18:18:54 -07:00
Abtin Keshavarzian 7a85841ef7 [string] update doxygen api closing comment (#6331) 2021-03-25 18:03:34 -07:00
gavinmcgovern 1d42a2f194 [docs] remove plat-uart (#6351) 2021-03-25 18:00:03 -07:00
Jonathan Hui ffa5c012fe [github-action] remove use of mplatform/mquery in docker build (#6354) 2021-03-25 16:40:58 -07:00
kangping f2b351e4f9 [border-router] enhance on-link prefix check (#6327)
This commit applies on-link validations described by
https://www.ietf.org/archive/id/draft-lemon-stub-networks-02.html#section-3.1.1
2021-03-25 08:33:34 -07:00
Yakun Xu f8bc783c2f [ot-ctl] send a line at once (#6333)
Calling write multiple times may casing different arguments of a
command line reach to the daemon at different times. This commit
composes arguments into a full command line and sends it at once.
2021-03-24 19:07:15 -07:00
Abtin Keshavarzian 5911ae9db1 [equatable] 'Unequatable' class adding overload of operator != (#6340)
This commit adds `Unequatable<Type>` class which adds an overload of
operator `!=` using an existing `==` overload provided by the `Type`
class. The `Unequatable` should follow CRTP-style inheritance, i.e.,
the `Type` class should publicly inherit from `Unequatable<Type>`.
This provides a solution to avoid repeating the simple implementation
of `operator!=()` overload in different classes.
2021-03-24 11:11:50 -07:00
gavinmcgovern b01b26a18a [ping-sender] adding missing doxygen tags (#6330) 2021-03-24 10:35:22 -07:00
Abtin Keshavarzian d8e3f1d5f6 [dns-types] declare 'Ecdsa256KeyRecord' as 'Equatable' (#6335) 2021-03-24 09:45:30 -07:00
suveshpratapa 846fffed61 [efr32] bug fixes, UART API changes (#6329)
- OPENTHREAD_CONFIG_NCP_UART_ENABLE is now OPENTHREAD_CONFIG_NCP_HDLC_ENABLE
- Pull in cli_uart.cpp UART API interface for sleepy-demo apps.
- Fix some erroneous ifdefs that affect 1.2 SoC builds and 1.1 builds.
- Add OT_RADIO_CAPS_SLEEP_TO_TX to radio capabilities (fixes #5819).
2021-03-24 09:11:17 -07:00
Mason Tran 0cb70ce49d [efr32] switch NAME_WLE to NAME_WE to be CMake 3.10 compatible (#6328)
NAME_WLE was added in CMake 3.14 and isn't available in 3.10, which is
the default requirement for openthread.

This switches imported_libs.cmake to NAME_WL, which is in 3.10.
2021-03-24 09:09:44 -07:00
paragdixit-g eda95b0495 [gn] include lib/platform files in build (#6317)
These are needed to enable logging when building with gn.
This fixes the bug #6316.
2021-03-23 15:29:51 -07:00
Yakun Xu 086be076ee [udp] bind to an interface when sending/connecting (#6332) 2021-03-23 12:47:11 -07:00
kangping fbdafacbc7 [srp-server] do not use platform UDP for SRP server (#6322)
This commit binds SRP Server to Thread netif.

This also adds a configuration option for the SRP server UDP port to
allow using a specific/static port.
2021-03-23 12:45:53 -07:00
kangping a04e164e7d [border-router] more strict state check before evaluating routing policy (#6336) 2021-03-23 12:44:28 -07:00
Yakun Xu 1236839e3e [daemon] log command line (#6326)
This commit adds logs for command line received by daemon which is
helpful debugging daemon issues.
2021-03-22 16:59:49 -07:00
Yakun Xu 0d5d16b315 [notifier] remove extra space in log message (#6323) 2021-03-22 12:12:30 -07:00
jinran-google 80e3b1a460 [config] fix typo in OPENTHREAD_CONFIG_NCP_UART_ENABLE error message (#6324) 2021-03-22 08:44:56 -07:00
Yakun Xu ffc550bf15 [test] package with Thread version (#6325) 2021-03-22 08:41:02 -07:00
Abtin Keshavarzian 60a206d604 [timer] simplify 'TrickleTimer' (#6306)
This commit simplifies and enhances the `TrickleTimer` class. It adds
support for suppression behavior and removes unused `Mode` and unused
end of interval callback. It changes the `Handler` function pointer
to be similar to `Timer` callback.
2021-03-21 17:28:11 -07:00
Yakun Xu 70634bf3d7 [udp] bind to Thread interface by default (#6318)
Bind to Thread network by default so that UDP sockets in CLI can send
multicast packets through Thread network interface.
2021-03-21 09:53:49 -07:00
Abtin Keshavarzian de3ddb7169 [thread-tlvs] rename to follow style (#6315)
This commit renames some of the definitions in `thread_tlvs.hpp`
to follow the camel-case naming style.
2021-03-20 10:11:02 -07:00
Mason Tran 7b3c2ae66b [efr32] add CMake support (#6302)
This commit adds CMake support for the efr32 platforms and Silicon
Labs gecko_sdk_suite. It also adds the option to build the efr32
sleepy-demo apps.

Other changes:
- jlinkrtt: remove NordicSemi specific options/definitions/includes
  from default build
- Remove old include dirs that don't exist anymore from efr32 automake
  files
2021-03-19 16:06:54 -07:00
Abtin Keshavarzian 06ca5d855c [utils] add 'Utils::PingSender' (#6284)
This commit adds a new module `Utils::PingSender`. This module
is then used by CLI to support ping command.
2021-03-19 16:04:55 -07:00
Yakun Xu ae88a2c677 [test] print size diff symbol by symbol (#6305)
This commit enhances the size check by printing size diff symbol by
symbol, which can help us better analyze size changes.
2021-03-19 13:20:38 -07:00
jinran-google 7b7f2e9e37 [codecov] disable project coverage threshold (#6307) 2021-03-18 22:16:04 -07:00
Yakun Xu db1b980e57 [api] remove UART from in cli/ncp API (#6243)
This commit removes application library CLI/NCP dependency on platform
layer UART APIs. Instead, application layer provides callbacks sending
CLI/NCP data.

With this change, platforms with native support for formatted output
can simply implement the CLI output callback with something like
`vprintf()`.
2021-03-18 22:13:05 -07:00
Piotr Koziar 3d10c90da4 [spinel] add multicast listener registration (#6231)
This commit adds Multicast Listeners Register Request and Response
spinel properties:
- SPINEL_PROP_THREAD_MLR_REQUEST
- SPINEL_PROP_THREAD_MLR_RESPONSE
2021-03-18 12:57:10 -07:00
Abtin Keshavarzian 0f7401b866 [build] add config for SRP client feature under BUILD.gn (#6308) 2021-03-18 08:35:28 -07:00
Jintao Lin f38ec1ed8a [tests] add allowlist after reset to restore same network topology (#6309) 2021-03-18 08:15:10 -07:00
suveshpratapa 76d4b3a9d9 [efr32] fix compilation errors in radio.c with Thread 1.2, fix RCP bug in PAL (#6301)
In Thread v1.2, we enable
OPENTHREAD_CONFIG_MAC_SOFTWARE_TX_SECURITY_ENABLE on the RCP, since we
have to modify the MAC-layer packet for outgoing transmissions in some
cases (adding IEs for enhanced ACKs, including CSL sync info etc).
For this purpose, we define otPlatRadioSetMacKey and
otPlatRadioSetMacFrameCounter to store the latest security material
for AES-CCM encryption.

However, the bug was that this info was not being inserted and
transmit security not processed on the outgoing packet, since the
mac_fr expects calls to otMacFrameSetKeyId, otMacFrameSetFrameCounter,
and otMacFrameProcessTransmitAesCcm from the user.  Included this
piece of code to fix the Thread v1.2 RCP bug.

Other changes:
1. Moved a few pieces of helper code to better organize various 1.2
   sections in radio.c, and fix some compilation errors.
2. Added some more clarifying comments in some places.
3. Re-enabled some CSL code which was commented out by accident.
2021-03-18 08:05:08 -07:00
Rafał Kuźnia 8531eed158 [cmake] do not set CMAKE_BUILD_TYPE if OT is not a top-level project (#6289) 2021-03-17 18:00:06 -07:00
Simon Lin c356ca8ee1 [github-actions] move Border Router checks to Border Router workflow (#6294) 2021-03-17 10:20:46 -07:00
Abtin Keshavarzian 4b2c2e5566 [ip6] add operator < overload for 'Ip6::Prefix' comparison (#6274)
This commit adds an overload of operator `<` in `Ip6::Prefix` class. A
prefix with shorter length is considered smaller than the one with
longer length. If the prefix lengths are equal, then the prefix bytes
are compared directly to determine the smaller prefix. This commit
then changes `RoutingManager` to use the newly added operator `<`
overload.

Unit test `test_ip6_address.cpp` is updated to cover the behavior of
the new operator.
2021-03-17 10:16:05 -07:00
Jintao Lin a79eb0f723 [simulation] do not update CSL IE in retransmission (#6275) 2021-03-17 10:15:35 -07:00
kangping e500c296f9 [tests] wait longer after updating SRP host address (#6295) 2021-03-17 10:13:34 -07:00
Abtin Keshavarzian 6e62c9a12b [indirect-sender] skip over HandleSentFrameToChild() for an empty frame (#6293)
This commit updates `IndirectSender` to check exit quickly from the
`HandleSentFrameToChild()` callback if the sent frame is an empty
frame. `PrepareFrameForChild()` prepares an empty frame when there is
no indirect message in the send queue for the child. This can happen
in the (not common) situation where the radio platform does not
support the "source address match" feature and always include "frame
pending" flag in acks to data poll frames. The change in this commit
address a potential issue in this situation and ensures that the "send
done" is not incorrectly processed for any newly added indirect
message after preparing the empty frame (which would cause the message
to be assumed sent and removed without actual tx).
2021-03-17 10:13:01 -07:00
Łukasz Maciejończyk 12d5f793e7 [ncp] remove unused code (#6288)
For the case when otInstanceReset returns during pseudo reset action
setting here SPINEL_STATUS_RESET_SOFTWARE is useless as line below
the current sNcpInstance is cleared. The new status never gets
a chance to be transmitted to the host.
2021-03-16 12:53:27 -07:00
Jonathan Hui 16ebac8a17 [build] set Thread 1.2 as default version (#6281) 2021-03-16 11:38:57 -07:00
Jonathan Hui a7c3588111 [nrf528xx] fix unused param warning in nrf_802154_tx_started() (#6281) 2021-03-16 11:38:57 -07:00
Jonathan Hui a6abb51426 [csl] fix kRadioTypeIeee802154 not declared in scope error (#6281) 2021-03-16 11:38:57 -07:00
Jonathan Hui 7ad23e67e7 [radio-spinel] fix unsigned to signed conversion warning (#6281) 2021-03-16 11:38:57 -07:00
Jonathan Hui b77fa94328 [radio-spinel] fix spinel_ssize_t to spinel_size_t conversion warning (#6281) 2021-03-16 11:38:57 -07:00
Jonathan Hui e7c71e3b11 [csl] fix unused param when 15.4 radio is not enabled (#6281) 2021-03-16 11:38:57 -07:00
Jonathan Hui 34cb1b7d40 [mac-frame] return parse error in GetKeyId() (#6281) 2021-03-16 11:38:57 -07:00
Jonathan Hui 44f79018e8 [dua-manager] fix error is never read warning (#6281) 2021-03-16 11:38:57 -07:00
Eduardo Montoya 636e87f510 [nrf528xx] improve CSL phase calculation (#6287)
Fill a CSL Phase IE with a value for the CSL transmitter to aim at the
center of the receive window, instead of aiming at the beginning.
2021-03-16 11:28:53 -07:00
kangping 818a774bcf [border-router] send at least one router solicitation (#6280) 2021-03-16 08:37:02 -07:00
kangping 762c3c4d1e [border-router] add random delay before chaning routing policies (#6247)
Also fixes an issue that a border router may adds the OMR prefix of
current network as an external route.
2021-03-16 08:35:45 -07:00
Abtin Keshavarzian 2d101cfe28 [radio-spinel] perform "RestoreDatasetFromNcp()" with single OT instance config (#6277)
This commit changes the `RestoreDatasetFromNcp()` to be performed on
single OT instance config and to be skipped when multiple OT instance
config is enabled. This change ensures that the `RadioSpinel` module
can be compiled with `MULTIPLE_INSTANCE_ENABLE` config. Note that the
"restore data set from NCP" mechanism is performed during platform
initialization from `RadioSpinel::Init()` which happens before
any OT instance is allocated or initialized (all platform layer
components/drivers should be initialized before OT instance). So the
"restore dataset from NCP" feature only makes sense under since OT
instance case.
2021-03-16 08:34:25 -07:00
Abtin Keshavarzian 7dca56e982 [error] add 'ot::Error' and 'kError{Name}' for use by core modules (#6237)
This commit adds a new core header files `common/error.hpp` which
defines `ot::Error` (mirroring `otError`) and `kError{Name}` constants
(mirroring the public `OT_ERROR_{NAME}` definitions). The new (C++
style) definitions are used by core modules. This commit also moves
`otThreadErrorToString()` (from `logging.hpp` to `error.hpp`) and
renames it to `ErrorToString()` which is used as the internal (to
core) function to covert an `Error` to a string.
2021-03-15 21:07:07 -07:00
kangping e992b8461c [srp-server] notify advertising proxy of host/service expiration (#6248)
There is an issue that the SRP host or service are not deregistered by
the Advertising Proxy when the host or service is expired. This is
because we didn't notifies the Advertising Proxy of the host/service
expiration. This commit fixes this issue and adds tests for it.
2021-03-15 08:32:14 -07:00
Jintao Lin 6c9d4b3f9e [tests] add radio metadata in sniffer log using TAP TLVs (#6279) 2021-03-15 08:23:55 -07:00
Simon Lin 2da3f98e0d [dua] fix assert failure (#6282)
This commit fix a potential DUA assertion failure.
2021-03-14 22:50:52 -07:00
Yakun Xu 93c994723e [posix] detect POSIX in source (#6259) 2021-03-14 17:27:16 -07:00
Simon Lin 3852ac3d3e [logging] refine BBR log level (#6270)
This commit refines BBR log level usage using otLogResultBbr.
2021-03-12 09:22:19 -08:00
kangping dcc9472ba1 [tests] fix advertising proxy tests (#6276)
zeroconf is not able to discover the services after updating the host
address. We fixed this issue by replacing zeroconf with dns-sd.
2021-03-12 08:00:01 -08:00
kangping 48b09e3130 [tests] update OTBR CI test script (#6215)
To support new OTBR border routing feature.
2021-03-12 07:25:20 -08:00
Zhanglong Xia 96fe3dd59f [android] remove Android.bp (#6266)
Android.bp is unable to be checked by github actions. This commit
removes the Android.bp. The Android.bp will be added to the Android
repo.
2021-03-11 12:05:55 -08:00
Abtin Keshavarzian 66358d3848 [cli] update 'README_UDP.md' (#6265)
This commit updates the `README_UDP.md` to use a bullet list for
possible `type` options in `send` command.
2021-03-11 12:04:34 -08:00
Jonathan Hui 498818a79d [mac] increase macMaxFrameRetries to 15 (#6263)
As specified by Thread 1.2.1-draft4.
2021-03-11 10:03:07 -08:00
nikita-s-wrk a67c42811c [examples] add cmake for gp712, qpg6100, qpg7015m (#6238) 2021-03-11 09:59:44 -08:00
Simon Lin 2aa8775c88 [posix] fix socket issues (#6268)
- Fix Multicast Routing failed to initialize MRT6 after reset.
- Fix DHCP6 client failed to stop the trickle timer.
2021-03-11 09:08:33 -08:00
Jonathan Hui 82cca6294c [dataset-updater] set mDataset to nullptr in Cancel() (#6262) 2021-03-10 11:45:45 -08:00
Eduardo Montoya 09245f0766 [dtls] fix ECDSA configuration for newer mbed TLS versions (#6261)
When using newer versions of mbed TLS, two issues appear when using
`OPENTHREAD_ECDSA`:
- An empty list of configuration hashes is treated as a configuration
error: DTLS fails.
- Identifiers with double underscore are not used anymore: signature
hashes configuration is not included.

This commit addresses both issues.
2021-03-10 10:10:31 -08:00
Piotr Koziar 268cce160a [spinel] add support for Backbone Router service (#6232)
This commit adds spinel properties for Backbone Router:

- SPINEL_PROP_THREAD_BACKBONE_ROUTER_PRIMARY
- SPINEL_PROP_THREAD_BACKBONE_ROUTER_LOCAL_STATE
- SPINEL_PROP_THREAD_BACKBONE_ROUTER_LOCAL_CONFIG
- SPINEL_PROP_THREAD_BACKBONE_ROUTER_LOCAL_REGISTER
- SPINEL_PROP_THREAD_BACKBONE_ROUTER_LOCAL_REGISTRATION_JITTER

Property numbers have been adjusted to match the ones from #6228 and
#6231.
2021-03-09 11:08:08 -08:00
Yakun Xu cf5c3d3666 [git] fix non-fast-forward pull (#6253) 2021-03-09 11:00:19 -08:00
Yakun Xu e5614d8ecb [cmake] auto choose readline library (#6251) 2021-03-09 10:48:47 -08:00
kangping 21cd2d18d7 [tests] test updating SRP host address (#6246)
Test if we can update the host address.
2021-03-09 10:47:47 -08:00
kangping 5b6691eaa0 [spinel] fix unused variables (#6252) 2021-03-09 09:23:40 -08:00
Jonathan Hui da1b0ddbe0 [git] reflect branch rename from 'master' to 'main' (#6249) 2021-03-08 21:58:32 -08:00
Abtin Keshavarzian a10af5a3d6 [tests] allow extra chars in prefix list 'wpanctl' output (#6240)
This commit relaxes the parsing of on-mesh prefix list `wpanctl`
output in `wpan.py` allowing extra chars to be present between
"pref:" and "prio:".
2021-03-08 13:30:01 -08:00
Yakun Xu 7d1691ed09 [cli] remove aBufLength and error message (#6242) 2021-03-08 11:57:45 -08:00
Moandor 46d3a4b7ec [spinel] fix missing prototype warning (#6245)
This function was defined without any declaration before it, causing
build error when compiled with -Werror=missing-prototypes.
2021-03-08 10:10:07 -08:00
Abtin Keshavarzian 7deab4a916 [trel] add 'OT_TREL' CMake option & 'TREL' autoconf switch (#6239)
This commit adds `OT_TREL` as a CMake option and 'TREL' as an autoconf
switch option to enable support for TREL radio link for Thread over
Infrastructure feature.
2021-03-08 08:49:20 -08:00
Jonathan Hui 1e6e9ec8c2 [tests] add test for dataset updater (#6227) 2021-03-08 08:48:04 -08:00
Jonathan Hui c8ef4b6a7c [cli] implement dataset updater CLI commands (#6227) 2021-03-08 08:48:04 -08:00
Jonathan Hui 38ae36271c [dataset] change updater to use DatasetManager (#6227)
This commit changes the dataset updater implementation to leverage
MeshCoP::DatasetManager, which already provides a mechanism to
communicate Pending Dataset updates with the Leader. The
DatasetManager implementation ensures that only one CoAP transaction
is outstanding at a time.

This commit also ensures that any unspecified values are copied from
the Active Dataset.
2021-03-08 08:48:04 -08:00
Paweł Wańczyk 93b6fea3aa [spinel] add interface identifier of the Thread Domain Unicast Address (#6200)
This commit adds new spinel property to configure Interface Identifier
of the Thread Domain Unicast Address.
2021-03-04 15:47:56 -08:00
Esko Dijk 31ed1e2db8 [mac] fix default Thread Domain name per v1.2.1-draft4 spec (#6236)
Name is updated here to specified, latest name "DefaultDomain".
2021-03-04 11:11:39 -08:00
kangping 27bda8e657 [build] add missing files for Android.mk (#6235) 2021-03-04 08:27:10 -08:00
Yakun Xu a3e87b14fe [git] pull dependency pull requests (#6234) 2021-03-04 08:26:26 -08:00
Jiacheng Guo f293d625da [dtls] make the max dtls buffer length configurable (#6233)
On systems where OpenThread share mbedtls configuration with HTTPS and
other TLS based protocols. The TLS max content length can be way larger
than OpenThread requires. Add an OpenThread config macro to reduce stack
consumption under such circumstance.
2021-03-04 08:22:49 -08:00
kangping 244d3e5aa2 [border-router] test host leaves and rejoins (#6216)
This commit tests if a host is still reachable after leaving and
rejoining the infrastructure network. This makes sure that the routing
manager handles router solicitations.
2021-03-04 08:21:20 -08:00
Jonathan Hui 6b4ae20650 [tests] add OTBR_DUA_ROUTING=ON to OTBR build (#6230) 2021-03-03 17:32:19 -08:00
Abtin Keshavarzian 11cf6feb82 [message] use opaque 'otMessage' and add 'otMessageBuffer' (#6221)
This commit defines `otMessage` to be an opaque public `struct`. This
change ensures users of OpenThread APIs can only get `otMessage`
instances through OpenThread public APIs and callbacks. It also hides
the `mNext` field which is not intended for use/access by OT API users
(OT users may assume `mNext` is pointing to the next message when the
message is placed in an `otMessageQueue` which is not correct since
`mNext` is used to chain the fixed-size `Buffer` instances of the same
`Message` instance).

This commit adds `otMessageBuffer` in `platform/messagepool.h` which
is then used when the platform is configured to manage the buffer pool.
The `otMessageBuffer` struct defines `mNext` to ensure the returned
`otMessageBuffer` instances from platform layer are aligned correctly
in memory (i.e., they can be safely cast to `ot::Buffer`).
2021-03-03 11:30:05 -08:00
Abtin Keshavarzian 07267f179a [config] perform OT config checks in the related module (#6217)
This commit adds the checking of the OT config options directly in the
header files of the related module, e.g., the check for DUA feature
being used along with Thread 1.2 is now done in `dua_manager.hpp`. The
`openthread-core-config-check.h` is now used to track the list of
removed, renamed, or replaced configs. This change makes it easier to
find and maintain the dependency/relationship between OT configs
(easier to find them in the related header file than within the list
in `openthread-core-config-check.h`).
2021-03-03 11:25:58 -08:00
Simon Lin a46b565cbf [tests] add test to verify DHCP6 client works after reset (#6204) 2021-03-03 11:21:44 -08:00
Abtin Keshavarzian cacb88defa [github-action] add new workflow to check core makefiles (#6209)
This commit adds a new github workflow which checks that all core
make/build files to be updated when a new PR is submitted.
2021-03-03 11:19:00 -08:00
Abtin Keshavarzian ac5acb4900 [script] adding 'update-makefiles.py' script (##6209)
This commit adds `update-makefiles.py` script which helps update
different make/build files supported by OpenThread project including
`CMakeList.txt`, `BUILD.gn`, `Android.mk`, `Andriod.bp`, and
`Makefile.am` based on the source (`cpp`, `hpp`, and `h`) files in
`./src/core` and `./include/openthread` folders. This script is
intended to make it easier for developer when adding/removing/renaming
source files within OT core to help update all the make/build files.

This commit also updates `Makefile.am` ensuring the list are sorted
alphabetically (this is generated by running the script).
2021-03-03 11:19:00 -08:00
Jintao Lin 8f7024c3e9 [mac] only append header termination IE2 when data payload is present (#6223)
According to IEEE802.15.4, header termination IE2 is present only when
header IE and payload data is present.
2021-03-02 08:02:44 -08:00
kangping bec6213ded [srp] rename Advertising to ServiceUpdate (#6220)
This commit renames *Advertising* to *ServiceUpdate* to keep
consistent with public APIs.  For example, change
HandleAdvertisingResult to HandleServiceUpdateResult.
2021-03-01 18:14:07 -08:00
Abtin Keshavarzian d53776fb77 [mesh-forwarder] add helper 'RemoveMessageIfNoPendingTx()' (#6214)
This commit adds a helper method `RemoveMessageIfNoPendingTx()` in
`MeshForwarder` which removes (dequeues from `mSendQueue` and frees
 it) if there is no pending direct or indirect transmission.

 This commit also changes `UpdateSendMessage()` to exit early when
 there are remaining fragments of the message to be sent.
2021-03-01 08:16:02 -08:00
Eduardo Montoya 9265876f15 [harness-thci] remove pylint issues from THCI file (#6219)
Remove some `pylint` issue and fix `ValidateDeviceFirmware` method.
2021-03-01 08:02:59 -08:00
Simon Lin 0eb14bf5d9 [thread-cert] remove border_routing directory (#6210) 2021-03-01 07:28:54 -08:00
Abtin Keshavarzian d8a2cd9a70 [indirect-sender] free and dequeue the supervision message when removed (#6213)
This commit fixes an issue with removal of supervision message
for child when another message is queued for the same child.
This fixes an issue added by PR#5638 (which itself addresses
an issue that if the supervision message was removed while MAC
was busy sending the message, the MAC layer would not be
notified of the removal).
2021-02-26 15:11:07 -08:00
Mason Tran 8e872ee5ac [efr32] revert removal of support for multiple efr32BandConfig's (#6212)
In #6154, the radio.c changes included the removal of a lot of code
wrapped in #if RADIO_CONFIG_915MHZ_OQPSK_SUPPORT macros. The problem
is there was still one section of code which was not removed.

This caused the 2.4GHz sBandConfig to be overwritten with sub-GHz
config, ultimately causing the efr32mg12 BRD4170A to assert somewhere
in radio initialization.

This commit reverts the removal of support for multiple
efr32BandConfigs.
2021-02-26 11:35:47 -08:00
Abtin Keshavarzian 59a6080205 [mesh-forwarder] update 'ToString()' to use string array (#6208) 2021-02-26 11:18:08 -08:00
Abtin Keshavarzian 1145503d3e [meshcop] update 'ToString()' methods to use string array (#6208) 2021-02-26 11:18:08 -08:00
Abtin Keshavarzian b43bcbf20e [mac] update 'ToString()' methods to use string array (#6207) 2021-02-26 11:15:52 -08:00
Abtin Keshavarzian bc0ac0c117 [mle] update 'ToString()' methods in MLE to use string array (#6206)
This commit changes `ToString()` methods in MLE module which convert
from a given `enum` value to a string to use string array tables. It
also adds `statci_assert` checks to verify the values of `enum`
maps correctly to the array indexes.
2021-02-26 11:14:42 -08:00
kangping 3ce4c77a6e [nrf528xx] enlarge internal heap size (#6205)
The ECDSA signing of the SRP client requires additional internal heap.
This commit enlarges the internal heap size to 4000 bytes. The last value
I tried but failed is 3800.
2021-02-25 15:06:14 -08:00
kangping da0d9f66b6 [posix] handle dynamic infra if status (#6186)
This commit includes below changes:

- handles dynamic infrastructure interface status changes. The Routing
  Manager will be started if the infra interface status turns to be
  RUNNING and a valid link-local address is present. Otherwise, the
  Routing Manager will be stopped.

- changes the default status of the Routing Manager from enabled to
  disabled and it is initially enabled for the posix platform.

- the posix implementation now doesn't require the presence of the
  link-local address at initialization stage. In this case, the
  Routing Manager will not be started before a link-local address is
  added to the infra interface.

- add CI tests for the new behavior.
2021-02-25 13:19:31 -08:00
Abtin Keshavarzian b45f287629 [mle] add wait time for resetting attach backoff interval after attach (#6202)
This commit adds a new behavior related to MLE attach backoff feature.
It adds a configurable delay wait interval before resetting the attach
backoff interval to its minimum value upon a successful attach.
`OPENTHREAD_CONFIG_MLE_ATTACH_BACKOFF_DELAY_TO_RESET_BACKOFF_INTERVAL`
specifies the delay interval.

If it is set to zero then the device resets its backoff attach
interval immediately after a successful attach. With a non-zero value,
if after a successful attach, the device happens to detach within the
delay interval, the reattach process resumes with the previous backoff
interval (as if the attach did not happen).

This behavior is helpful in the situation where a battery-powered
device has poor link quality to its parent and therefore attaches and
detaches frequently from its parent.  Using a non-zero wait interval
ensures that the attach backoff does not reset on each attach and that
the device does not drain its battery quickly trying to re-attach too
frequently.
2021-02-25 08:45:59 -08:00
Li Cao 75ac125771 [mac] refactor code to add frame version and header IE in TX frames (#6189)
This commit refactors the code to set frame version, IE present field
in frame control field and to append Header IE.

- Split UpdateFrameControlField into two methods: CalcIePresent and
  CalcFrameVersion. Currently UpdateFrameControlField` is not
  easy-to-read and hard to extend the method to handle more cases.

- Move this code from Mac to MeshForwarder. I think it should be
  MeshForwarder's responsibility (PrepareDataFrame) to prepare the
  frame (though Mac sometimes prepare data frames itself). Since when
  preparing the frame, most information comes from the Message which
  is only in MeshForwarder, we can put this code for preparing frame
  in MeshForwarder.

- Enhance the way to append Header IEs to the frame. Currently in
  Mac::AppendHeaderIe, it generates a list of HeaderIe first and then
  call Frame::AppendHeaderIe. There are two problems here: 1. it uses
  another copy (copy HeaderIe to the frame's buffer). 2. it has to
  initialize Vendor IE (e.g. TimeSync IE) after Vendor IE header has
  been copied to the buffer. Currently it directly finds the first
  Vendor IE in the buffer and initialize it as TimeSync IE, which is
  not extensible. This commit shifts the responsibility of 'how to
  append the IE' to Frame, by providing AppendHeaderIeAt method. And
  MeshForwarder can decide which IEs to append and directly call the
  method to append IEs to the frame.
2021-02-25 08:02:52 -08:00
Jérôme Pouiller 2195f39e94 [spinel] simplify functions spinel_*_to_cstr() (#6199)
spinel.c provides functions to convert spinel values to printable
strings. These functions are written using huge switch case statements.
This patch replaces these statements with simple loops over arrays
containing the strings.

Thus, the new code takes 3 time less code than the previous. In add, the
value and the string are no more repeated so the new is less error
prone.

Note: I have used the following commands for the conversion:
  sed -nre 's/case SPINEL_CMD_(.*):/SPINEL_COMMAND_CSTR(\1),/p' spinel.c
  sed -nre 's/case SPINEL_PROP_(.*):/SPINEL_PROP_CSTR(\1),/p' spinel.c
  ...
2021-02-25 07:53:27 -08:00
Abtin Keshavarzian ee815fed0b [crypto] update PBKDF2 module to use c++ style (#6198) 2021-02-24 22:38:20 -08:00
kangping d24327fd71 [netdiag] fix setting DIAG_GET response callback (#6192)
This commit sets the DIAG_GET response callback every time the
otThreadSendDiagnosticGet is called. This is because the callback may
be changed to other modules (e,g. OTBR_REST, OTBR_UBUS).
2021-02-23 22:32:57 -08:00
Jiacheng Guo 33f15fac2f [spinel] replace otPlatSettings with SettingsDriver (#6190)
The otPlatSettings api isn't necessarily supported on every platform.
Replace with ot::SettingsDriver which supports both the settings and the
flash platform api.
2021-02-23 15:53:50 -08:00
Yakun Xu 63294a7d66 [github-actions] move POSIX expects to POSIX workflow (#6195) 2021-02-23 13:40:29 -08:00
Abtin Keshavarzian 78c0c4e573 [dns] fix and simplify OPT record reuse of TTL field (#6187)
This commit fixes and simplifies the `OptRecord` implementation. The
OPT RR re-purposes the existing TTL field (which is a `uint32_t`) and
uses it for Extended Response Code (`uint8_t`), Version (`uint8_t`),
and flags. The new implementation treats the `mTtl` as a byte array
and directly reads/writes bytes at different indexes corresponding to
different re-purposed data fields. This ensures that the fields are
encoded correctly independent of the endianness of the platform.
2021-02-23 13:10:36 -08:00
Jonathan Hui f57c5e2370 [dns-client] add arg validation on ResolveService() (#6194) 2021-02-23 11:01:04 -08:00
Abtin Keshavarzian 95b2a8b98f [dns] rename to 'dns_types.hpp' (#6193)
This commit renames the DNS helper module from `dns_header` to
`dns_types`.
2021-02-22 23:26:54 -08:00
Simon Lin da626caa6d [thread-cert] reduce simulator UDP buffer size (#6196)
UDP buffer size was increased to 10M so as to avoid potential UDP
packet loss. However the buffer size is too large to run thread-cert
tests on macOS.

This commit reduces the UDP buffer size to 2M.
2021-02-22 23:25:07 -08:00
Li Cao b7ba04f720 [github-actions] use cmake to build nrf in size action (#6126) 2021-02-22 15:37:41 -08:00
Abtin Keshavarzian 14ef4e4082 [dns-header] add common TXT record entry parsing API (#6157)
This commit adds a new public `ot` API for parsing an encoded DNS TXT
record data into `TxtEntry` key/value pairs. It also updates the TXT
data iterator model used for going through all TXT entries. The new
iterator definition provides a small buffer to store the key string.
This helps simplify the definition of `otDnsTxtEntry` to use
null-terminated C string for the key. The new parsing APIs are used in
CLI module.

This commit also fixes an issue with `TxtEntry::AppendEntries()` using
incorrect value for the key length.

Finally, this commit adds a test covering the behavior of all
`TxtEntry` related methods (encoding and parsing TXT data) in the unit
test `test_dns`.
2021-02-19 16:17:35 -08:00
Abtin Keshavarzian 196aa39c38 [dns-client] add 'QueryConfig' and default config (#6172)
This commit adds a new structure `otDnsQueryConfig` which represents a
DNS query configuration defining a set of parameters:

- The DNS server socket address (IPv6 address and port number).
- Response timeout interval (in msec).
- Maximum number of transmit attempts before reporting failure.
- "Recursion desired" flag (if server can resolve recursively).

There is a default query config used by DNS client. When OpenThread
stack starts, the default DNS query config is determined from a set of
OpenThread config options defined in `config/dns_clinet.h` such as
`OPENTHREAD_CONFIG_DNS_CLIENT_DEFAULT_SERVER_IP6_ADDRESS`, etc. New
APIs `otDnsClient{Get}/{Set}DefaultConfig()` are added to allow user
to get/set the current default config during operation.

When issuing a browse, address, or service resolution query, the user
can choose not to provide a query config in which case the current
default config will be used. The user can also provide a full or
partially specified `otDnsQueryConfig` instance, e.g., some of some of
the fields may be left unspecified (value zero). The corresponding
value from the current default config is then used for any unspecified
field in the given config.

This commit also updates the CLI to add `dns config` sub-command and
update other `dns` commands to follow the new API model.
2021-02-19 12:19:01 -08:00
Abtin Keshavarzian ef259cdd6b [srp-client] adding auto-start feature (#6140)
This commit adds auto-start SRP client feature. Config option
`OPENTHREAD_CONFIG_SRP_CLIENT_AUTO_START_API_ENABLE` adds support for
this feature in SRP client allowing auto-start mode to be enabled or
disabled. When enabled, the SRP client will monitor the Thread Network
Data for SRP Server Service entries and automatically start and stop
the client when an SRP server is detected. If multiple SRP servers are
found, a random one will be selected. If the selected SRP server is no
longer detected (not longer present in the Thread Network Data), the
SRP client will be stopped and then it may switch to another SRP
server (if available).

This commit also adds support for the new feature in CLI and adds a
new test `test_srp_auto_start_mode.py` covering the behavior of this
feature.
2021-02-19 10:00:19 -08:00
Simon Lin c261cf2dff [dns-server] handle multiple questions (#6155)
This commit enhances the DNS-SD server to handle multiple questions.

Specifically for DNS service resolving query with SRV+TXT questions,
this commit would reply with SRV+TXT+AAAA RRs, so that the service
instance can be fully resolved with one query.

More implementation details:
- This commit enhances NameCompressInfo so that question names can be
  compressed together with RR names.
  - Full compression is limited to only one instance / service / host
    name.
- For any RR type in the question, this commit will exclude it in
  additional RRs. For example, if the query contains a AAAA question,
  the response won't include any additional AAAA RR, but will only
  have AAAA answer(s). The purpose is to avoid duplicate RRs in answer
  section and additional section.
2021-02-19 09:38:25 -08:00
Abtin Keshavarzian 5756b9db66 [cli] add CLI commands for multi-radio feature (#6178)
This commit adds new CLI command `multiradio` to get the list of
supported radio types by device and `multiradio neighbor` sub-command
to get the radio info (supported radios and the their preference) for
specific neighbor or for all neighbors.
2021-02-19 09:36:26 -08:00
Paweł Wańczyk a906e14732 [spinel] update domain prefix spinel property (#6174)
This commit update the spinel domain prefix property with new Nd Dns
and Domain Prefix flags.
2021-02-19 09:33:57 -08:00
Jonathan Hui cf0640973e [bbr] handle case where no PBBR exists in network data (#6165) 2021-02-19 09:32:53 -08:00
Abtin Keshavarzian b11a3b2aec [makefile] add missing files in different build/make files (#6182) 2021-02-18 11:22:25 -08:00
Thomas 397e94d35d [qorvo] update Makefiles to reflect a new structure in third_party submodule (#6180)
Qorvo has restructured its third_party/Qorvo/repo submodule.

The linkerscripts for the embedded platforms qpg6095 and qpg6100 have
also been moved to this submodule.
2021-02-18 10:14:22 -08:00
Simon Lin 704d366511 [posix] set readline screen cols according to CLI config (#6183)
The default screen size might be too small for CLI command
input/output. This commit configures the screen cols to according to
CLI configs.
2021-02-18 09:45:52 -08:00
Jintao Lin d8b5a3ee51 [test] add posix verification for OT 1.2 (#6070)
This change:
1. Adds new github action to verify posix app for OT 1.2.
2. Only enable compile flag OT_SIMULATION_VIRTUAL_TIME_UART in
   script/test for ot-rcp build target.
3. Allow mix use of posix node and ot-cli-mtd node by changing python
   test script to accept node type as parameter.
4. Remove CSL test from expect as it is covered by thread-1-2-posix
   tests.
2021-02-18 09:05:29 -08:00
Neal Jackson a8ab584cc7 [nrf52840] update docs to list new cc310/mbedtls libs (#6181) 2021-02-17 18:04:36 -08:00
Jonathan Hui ab7a25faeb [srp-server] specify format string when printing names (#6179) 2021-02-17 11:32:12 -08:00
Jonathan Hui 5038782353 [ip6] enqueue reassembly buffer immediately (#6177)
So that `mReassemblyList.Dequeue()` is always valid on any error.
2021-02-17 11:31:38 -08:00
Mason Tran 3bb025a792 [efr32] change sleepy-demo-mtd to start awake (#6176)
This changes the sleepy-demo-mtd app's startup behavior. Prior to the
change, the MTD would go to sleep immediately. Instead, the MTD will
not sleep until the button is pressed.
2021-02-16 18:55:44 -08:00
Abtin Keshavarzian 7a1f09b20c [dns] update DNS/SRP client documentation to use doxygen lists (#6169)
This commit updates the doxgen documentation of some of the SRP/DNS
client definitions to use list format.
2021-02-16 18:54:54 -08:00
Torsten Tejlmand Rasmussen 32257403b0 [cmake] using cmake -E echo instead of shell echo command (#6175)
The echo command of the host system may have slight variations between
shell built-in echo and the echo command provided by the OS.

Especially the Windows OS echo command is different from practical any
other echo command.

This means that the currently used `COMMAND echo -e "<text>"` does not
work universally.

This commit introduces `etc/cmake/print.cmake` which allow to print a
CMake list where each item is printed on a new line, to get the desired
behavior on the `print-ot-config` target.

Using `cmake -E echo <text>` ensures identical behaviour across
different systems.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2021-02-16 11:30:01 -08:00
Abtin Keshavarzian 8f57637aec [trel] update simulation platform to verify port and IPv6 address (#6162)
This commit updates the trel simulation platform implementation to
include the src/dst IPv6 addresses and port number (as part of new
simulation-specific packet header) in the exchanged message. It also
verifies the port and dest address (against the expected trel
interface unicast or multicast IPv6 addresses) on the received
message. This helps enhance the simulation platform implementation to
cover the behavior if/when the unicast address used by trel changes.
2021-02-16 11:23:14 -08:00
Jonathan Hui b132d11762 [coap] remove use of nullptr in coap.h (#6173) 2021-02-16 11:22:31 -08:00
Mason Tran 30e2a9ee44 [efr32] implement otPlatUartFlush() (#6167)
This commiit implements otPlatUartFlush() for EFR32 with a
configurable timeout, defaulting to 500ms. It also allows multiple
buffers to be sent to the UARTDRV transmit FIFO queue.
2021-02-16 11:21:59 -08:00
Abtin Keshavarzian 4538a5fb7c [cli] add support for DNS-SD command (#6116)
This commit adds new commands in CLI to support DNS-SD browse and
service resolution.
2021-02-12 11:27:11 -08:00
Abtin Keshavarzian 7084422a0e [dns-client] service discovery (DNS-SD) support and enhancements (#6116)
This commit re-designs the `Dns::Client` module enhancing the address
resolution implementation and also adding support for DNS-Based
Service Discovery (DNS-SD).

With regards to address resolution query the new model relaxes the
requirements of the public OT APIs such that caller does not need to
persist the query info (e.g., the host name string buffer can be a
temporary variable and does not need to persist during the query) and
it is all managed by the `Dns::Client` core implementation itself. The
new model also supports the case where the response contains multiple
IPv6 addresses providing new APIs to allow the user to iterate through
the list of addresses and retrieve them one by one.

The implementation also handles the case where the DNS query response
contains CNAME record mapping the queried host name to a canonical
name for which a list of addresses are then provided.

The core implementation is also simplified, instead of cloning a query
message and saving it for possible retx, the new code saves the query
related info from which it can re-construct the query message for retx
if/when needed.

This commit also adds support for DNS-SD in `Dns::Client`. The config
`OPENTHREAD_CONFIG_DNS_CLIENT_SERVICE_DISCOVERY_ENABLE` can be used to
disable service discovery feature. The implementation supports
"service instance enumeration" which is referred to as "browsing" and
"service instance resolution". Callbacks are used to notify the user
when a response is received. In the callback a pointer to an opaque
response object is given to the user which can then be used with the
new set of APIs to get more info about the response, such as the list
of discovered service instances or more details about a specific
service instance (e.g., port number, host name and its address) or
iterate through address lists. This provides a flexible and scalable
solution to handle larger lists in the response without adding memory
overhead in the implementation.
2021-02-12 11:27:11 -08:00
Jonathan Hui 159efe77c0 [coap-message] fix buffer overflow in AppendUintOption() (#6163) 2021-02-12 11:25:58 -08:00
konradderda c8007768c7 [mle] set router's Thread version in Link Accept handler (#6166)
Issue:

Information regarding a neighbor's Thread version is lost.

Context:

This problem can be observed during playing with Link Metrics - few
methods check whenever chosen neighbor supports Thread 1.2. This
information is preserved when a child is promoted to the router role,
but after the reset and Link Request - Link Accept sequence it is not
stored in the neighbor table.
2021-02-12 09:49:42 -08:00
Li Cao 2cd36266ab [low-power] fix csl code wrapper (#6149)
This commit updates the wrapper for CSL code, updating most
occurrences !OPENTHREAD_MTD to OPENTHREAD_FTD.

We used !OPENTHREAD_MTD because we think both FTD and RCP need that
code. But that actually means host side of RCP (posix) need that code
and posix host is always FTD. The radio part itself don't need those
code. The radio part doesn't even contain most of those source files
that has CSL logic (except for sub_mac.cpp).

This commit also adds missing initialization for data field in Mac.
2021-02-10 18:29:36 -08:00
Jonathan Hui f2bb6cfad3 [fuzz] add OSS-Fuzz build script (#6160) 2021-02-10 11:04:13 -08:00
Mason Tran 6fa97e9878 [efr32] update for compatibility with Gecko SDK 3.1.1 (#6154)
This commit updates the EFR32 platform-abstraction layer to work with
GSDK 3.1.1.

- memory.c
  - Implemented otPlatCAlloc() and otPlatFree() to handle #6123
- GSDK mbedtls was updated and moved to
  util/third_party/crypto/mbedtls
- mbedtls_config_autogen.h was regenerated
- system.c
  - NVIC initialization is now done via a simple call to
    sl_device_init_nvic()
- alarm.c
  - Stubs for 1.2 related platform timing functions in alarm.c
- ieee802154mac.h
  - Standardization of 802.15.4 header values and constants
- uart.c
  - Reduce the number of vulnerable windows where interrupts disabled
    by RAIL will cause dropped characters. The OpenThread task now
    polls the UART buffer for arrived data and reads it out. The
    USART0 IRQ handler takes care of waking up the task when data has
    arrived.
- radio.c
  - Implementation of Wi-Fi coexistence and antenna diversity
    features, and corresponding updates to run-time phy select
    configurations.
  - Support for enhanced frame pending and early frame pending for
    Thread 1.2 low power features (temporarily disabled until 1.2
    support is available)
  - Implementation of enhanced ACKs with IEs for CSL.
  - Remove FIFO queue that was maintaining unique identifiers
    (contents of received packet: PHR+MAC header) This was being used
    to tell the upper MAC whether the frame pending bit was set in an
    ACK for a received packet. Changed the implementation so we save
    the state to a reserved bit in the held packet (in the MAC header)
    within the receive completion ISR, and retrieve the value in
    processNextRxPacket() to pass to where the upper MAC expects it.
2021-02-10 10:55:24 -08:00
Abtin Keshavarzian db117e27b2 [cli] add helper method to output "Enabled/Disabled" status (#6158) 2021-02-09 22:14:48 -08:00
Simon Lin 89aacf5dd7 [dns-sd] DNS-SD server implementation (#6103)
This commit implements the DNS-SD server:
- Handle Standard DNS Query from clients
  - Supported resource records: PTR, SRV, TXT, AAAA
- Query services from SRP server
- Add tests
  - simulation test using DNS client (only test AAAA query)
  - OTBR test using dig command to verify all resource records can be
    queried successfully
2021-02-09 20:25:26 -08:00
Zhanglong Xia 779890474b [settings] add APIs to securely store critical settings (#6125)
All the settings are written into a local file on the posix platform.
It is easy for others to get the critical information, such as master
key, from the local file. This commit adds new APIs to allow the
vendor to store the critical settings to a secure area.
2021-02-09 15:31:28 -08:00
kangping 282f8a4a8b [dns-sd] add CI tests for SRP server & Advertising Proxy (#6131)
This commit includes basic service registration & advertising function
verification. More tests including name conflicts and multiple devices
cases will be in future commits.

We changed the border_routing test scripts directory to border_router
as there will be more tests about Thread border router but not only
the routing feature.
2021-02-09 12:18:16 -08:00
Paweł Wańczyk 3a37d347ee [spinel] add domain name spinel property (#6144)
This commit adds new domain name spinel property for NCP.

Such NCP will have also a new capability SPINEL_CAP_NET_THREAD_1_2.
2021-02-08 11:41:21 -08:00
Li Cao 1b1c733146 [script] support to specify cmake build directory in script/test (#6153)
This commit makes the cmake output directory configurable in
script/test. By default the build directory is still ./build.
2021-02-08 11:40:11 -08:00
Simon Lin ad5dd8ecd8 [thread-cert] fix python syntax warning (#6150) 2021-02-08 11:38:38 -08:00
Jonathan Hui abb415c419 [fuzz] add CMake support (#6147) 2021-02-08 11:28:05 -08:00
Yakun Xu d8b89223b4 [url] fix returning empty value (#6142)
This commit fixing returning empty value. The address of `""` is fixed
and cannot be used as aLastValue of Url::GetValue().
2021-02-06 12:33:45 -08:00
kangping 31746000e8 [heap] fix external heap configuration (#6123)
The Instance::HeapCAlloc() method can not be used in constructors when
EXTERNAL_HEAP is enabled but works well when internal heap is
used. This is because the external heap methods are set by public
otHeapSetCAllocFree API after the OT instance is constructed.

This commit fixes this issue by having Instance::HeapCAlloc() using
otPlatCAlloc when EXTERNAL_HEAP is enabled. It also fixes build issues
when MULTIPLE_INSTANCE and EXTERNAL_HEAP are used together.
2021-02-05 10:15:13 -08:00
kangping 099dfa2731 [tests] fix test_srp_name_confclicts.py (#6143)
The SRP service may be in different intermediate states when rejected
by the server and we only need to make sure that the state is not
Registered.
2021-02-05 10:11:07 -08:00
Abtin Keshavarzian add99687fd [socket] add 'SockAddr::ToString()' (#6141)
This commit adds `SockAddr::ToString()` which coverts a socket
address to a string formatted as `"[<ipv6 address>]:<port number>"`.
2021-02-04 21:48:53 -08:00
Simon Lin 9fb778089b [locator] remove OwnerLocator class (#6138)
This commit removes the OwnerLocator class since it's actually
useless.

Timer and Tasklet inherited from OwnerLocator to so that they can use
GetOwner<Type>() to find the owner object. However, these two classes
already inherited from InstanceLocator, thus can use Get<Type>() to
get any component of the OT instance.
2021-02-04 21:29:43 -08:00
Abtin Keshavarzian ba9381649d [srp-client] new method to get server address, set callback (#6134)
This commit adds some new methods/APIs in `Srp::Client` class:
`GetServerAddress()` to get the SRP server's socket address that is
being used by the client, `IsRunning()` to check whether the SRP
client is started and running or not, and `SetCallback()` to allow
user to set the callback at any point (before/after call to
`Start()`). It also adds a new `srp client` sub-command to get the
server address and/or its port number.
2021-02-04 18:56:31 -08:00
Andrzej Kuroś afb4118d9a [spinel] add CSL-related properties (#6135)
This commit adds spinel properties for NCP built with
OPENTHREAD_CONFIG_MAC_CSL_RECEIVER_ENABLE.

Such NCP will have also a new capability
SPINEL_CAP_THREAD_CSL_RECEIVER.
2021-02-04 18:55:08 -08:00
Abtin Keshavarzian 77c74283c5 [net-data] add 'NetworkData::Service' module (#6130)
This commit adds a new module `network_data_service` which includes
the "Thread Network Data Service" entry definitions (e.g., service
number and the associated server data format for each service type).
It also adds `NetworkData::Service::Manager` which manages the Network
Data Service entries and provides helper methods to other core modules
to easily add/remove and/or parse/find info about specific services.
For example, this commit adds a method to get info about the
list of SRP servers (their IPv6 address and port number) from the
"SRP Server Service" entries in the Thread Network Data.
2021-02-04 13:53:15 -08:00
Abtin Keshavarzian 6a0acacaf7 [bbr-local] simplify 'Add/RemoveService()' (#6130)
This commit updates `AddServcie()` and `RemoveService()` in
`BackboneRouter::Local` class such that the methods themselves
after adding/removing the service entry in local network data
inform `NetworkData::Notifier` to send the update to leader.
This helps simplify their use.
2021-02-04 13:53:15 -08:00
Eduardo Montoya 1d03d71a20 [harness-thci] remove pylint issues from THCI file (#6136) 2021-02-04 13:51:59 -08:00
Eduardo Montoya 0d41c4392a [nrf528xx] update nrf_security license (#6137) 2021-02-04 08:24:53 -08:00
Yakun Xu ad91ac3b9c [posix] enable expect tests on macOS (#5384)
This commit enables expect tests on macOS, also includes the following
required changes:

* Fixed bound to interface issue on macOS.
* Added ability to configure scan period, because macOS environment on
  GitHub Actions is much slower.
2021-02-02 21:50:18 -08:00
Abtin Keshavarzian 4755eea1d1 [cli] ensure to init mInstance before other member variables (#6132)
This commit changes the order of member variable in `Cli` class
ensuring `mInstance` is initialized before other member variables.
This then allows the `mInstance` to be safely used from the
constructor of other `Cli` sub-types.
2021-02-02 21:14:06 -08:00
Abtin Keshavarzian ced158e65a [trel-posix] disable DAD when adding unicast address on trel netif (#6122)
This commit updates the trel platform posix implementation to use
linux netlink socket (instead of `ioctl()` command) to add/remove
unicast (link-local) address on the netif used by trel . When netlink
socket is used "Duplicate Address Detection" (DAD) is explicitly
disabled when the address is added. This helps speed up the start time
of OpenThread stack when using TREL.

The `OPENTHREAD_CONFIG_POSIX_TREL_USE_NETLINK_SOCKET` config option
can be used to enable/disable the use of netlink socket by trel
platform layer implementation. By default it is enabled on all
linux-based platforms (determined by `__linux__` macro being
defined).
2021-02-02 13:26:17 -08:00
Abtin Keshavarzian b5b6cf1766 [dns-header] new helper method to find i-th record matching name and type (#6124)
This commit adds a new template helper method in `ResoureRecord` to
search in a given message starting from a given offset and up to a
maximum given number of records, for the i-th occurrence of a specific
record (of given type with a matching record name). If found, it reads
the record from the message into a given record object.

This commit also updates the unit test `test_dns` to cover the behavior of
newly added helper method.
2021-02-01 22:12:05 -08:00
Simon Lin e49d20ff02 [otci] get prefixes/routes/services in thread network data (#6060)
This commit changes these methods to return corresponding entries from
Thread Network Data rather than local network data.
- get_prefixes
- get_routes
- get_services

Added local version to retrieve entries from local network data.
- get_local_prefixes
- get_local_routes
2021-01-29 07:30:36 -08:00
Abtin Keshavarzian ce2bbc92b5 [network-data] remove unused enum constants (#6129) 2021-01-29 07:28:07 -08:00
kangping c71cae350e [posix] set up heap before creating OT instance (#6128)
This is a quick fix that allows heap usage in constructors.
2021-01-29 07:25:42 -08:00
kangping 4bb22d78de [dns] match DNS name with specific domain (#6114)
This commit adds:
- a new method Dns::Name::IsSubDomainOf that matches a DNS name with
given domain. This is useful for SRP and DNS-SD server to verify if a
RR is in our authorized domain.
- domain checks for names in a SRP update to the SRP server.
2021-01-29 07:22:09 -08:00
kangping 46f796d4f0 [srp] get parsed TXT entry from SRP server (#6113)
This commit returns parsed TXT entries for service from the SRP
server, it enables prettier CLI output and easier Advertising Proxy
processing. We moved the otSrpTxtEntry to include/openthread/dns.h
because this structure can ( and will) also be used by DNS-SD
client. We also added one more mKeyLength field in otDnsTxtEntry for
saving length of the TXT key so that we can iterate over the encoded
TXT data without dynamically allocating memory for each entry.
2021-01-28 21:12:56 -08:00
Abtin Keshavarzian c03458433e [dns-name] allow 'Dns::Name' to be given as string or from message (#6117)
This commit allows `Dns::Name` instances to be created which can be
empty or given as a string (a dot '.' separated sequence of labels) or
from a message at a given offset (i.e., name is already encoded in a
message). `CompareName` and `FindRecord()` helper methods are updated
to allow the new `Dns::Name` type to be used when comparing/ searching
for a name.
2021-01-28 14:27:17 -08:00
Li Cao 2a3f13e1c7 [child-table] enhance address iterator method (#6118)
Moving the if statement out of the loop always brings the same result.
2021-01-28 10:43:57 -08:00
Abtin Keshavarzian 563e2a0801 [ncp] add support for SRP client in NCP and spinel (#6062)
This commit adds new spinel definitions for SRP client support
(mirroring the public OT APIs of SRP client) and implements get, set,
add, and remove handlers in `Ncp` for the new spinel properties.
2021-01-28 08:29:12 -08:00
Łukasz Maciejończyk 8bbbe194f1 [cmake] add support for nrf528xx (#6109) 2021-01-27 13:29:49 -08:00
Simon Lin b87abb9e3c [udp] fix UDP not accessible via RLOC/ALOC with PLAT_UDP (#6111)
This commit makes sure that UDP servers are accessible via all IPv6
addresses when PLAT_UDP is on.

We still need to pass the messages with ALOC/RLOC destinations to the
tun interface when PLAT_UDP is used. Otherwise, UDP servers can not
receive any message when PLAT_UDP is enabled.
2021-01-27 11:15:09 -08:00
Aurelio Schellenbaum 02d6d49a5e [coap] add CoAP(s) block-wise transfer support to CoAP(s) client and server (#4247)
Implemented CoAP/-s block-wise transfer according to RFC 7959. The
implementation includes methods and functions available to the
application layer to add Block1 and Block2 option values to a coap
message and an automatic block-wise transfer enabled by the compile
switch "COAP_BLOCK".
2021-01-26 13:27:32 -08:00
Simon Lin a3b5e370be [logging] refine FULL_LOGS option (#6084)
This commits refine the FULL_LOGS option (OT_FULL_LOGS for cmake):
- remove configuration of log regions since they should be 1 by
  default
- set PLATFORM log region to ON by default
2021-01-26 10:19:07 -08:00
Abtin Keshavarzian 9ea89ca204 [dns-header] helper methods to parse/find/read record(s) in a message (#6097)
This commit adds new helper methods in `ResourceRecord` class.
`ParseRecords()` parses and skips over a given number of resource
records in a message. `FindRecord()` searches in a given message to
find the first resource record matching a given record name. And
`ReadRecord<RecordType>()` tries to read a matching resource record
(of a given type) from a message. If the record type does not match
the type, it skips over the record. This commit also adds methods in
`PtrRecord`, `SrvRecord`, `SigRecord` and `TxtRecord` to parse and
read the data fields such as PTR name, host name, signer name and
TXT data.

This commit updates the DNS unit test to add a detailed new test
constructing and parsing a DNS message (covering the behavior of
the newly added and some of the existing methods).
2021-01-25 21:16:39 -08:00
Simon Lin f7825b9647 [scripts] allow virtual time simulator to go less than 1 second (#6112) 2021-01-25 09:02:20 -08:00
Abtin Keshavarzian 57bc0a3396 [dns-header] new methods to compare label/name from message (#6078)
This commit adds new helper methods in `Dns::Name` to parse and
compare a single name label `CompareLabel()` or an entire name
`ComapareName()` from a given message with a given string. Another
flavor of `CompareName()` compares the names read from two different
messages (or same message at different offsets). The name checks are
performed in place (without reading/copying the content from the
messages) and the implementation handles compressed names.

Unit test `test_dns` is updated to verify behavior of newly added
methods.
2021-01-24 21:45:31 -08:00
Simon Lin 6ee13b7a8d [dns] fix dns failed to append names of length 255 (#6088) 2021-01-23 08:50:06 -08:00
Abtin Keshavarzian e12178a256 [dns-name] require message offset to point to DNS header (#6101)
This commit contains two changes in `Dns::Name` class. When reading or
parsing names/labels from a `Message`, we require that the message
offset (i.e., `aMessage.GetOffset()`) to be set by the caller to point
to the start of the DNS header in the message. This is then used to
decode compressed DNS names. This change helps simplify the code and
removes the need to pass `aHeaderOffset` as a separate parameter. The
second change is to the `ParseName()` implementation which now always
goes through and parses the entire compressed name before returning.
This ensures that we correctly detect invalid compressed names when
parsing the name in a message.
2021-01-22 17:38:56 -08:00
nikita-s-wrk 98dea576fd [platform] addition of QPG7015M/GP712 RCP build (#6110)
- Addition of RCP build for QPG7015M and GP712 Qorvo platforms
- Addition required RCP API to glue code
2021-01-22 13:58:33 -08:00
kangping 14fc9eb3a8 [doc] add SRP server & client example (#6074) 2021-01-22 13:19:21 -08:00
kangping 7cd85bfe5d [tests] add CI tests for SRP server & client (#6074) 2021-01-22 13:19:21 -08:00
kangping 1ec9fd525d [net] SRP server implementation (#5986)
This PR includes the initial implementation of the SRP server
defined in https://tools.ietf.org/html/draft-ietf-dnssd-srp-07.

- SRP server Service TLV propagation: Includes only the 2-bytes
  dynamic listening port in the Server TLV.
- SRP request processing (parsing & validation)
- LEASE & KEY-LEASE management
- SIG(0) verification
- Interface for advertising proxy
- CLI commands for testing
- Support removing indivitual SRP service
2021-01-22 13:19:21 -08:00
Abtin Keshavarzian f3e987baa9 [cli] add CLI support for SRP client (#6038)
This commit adds CLI support under `srp client` for SRP Client.
It also adds `README_SRP_CLIENT.md` to document the newly added
CLI commands.
2021-01-22 13:19:21 -08:00
Abtin Keshavarzian 966baf5e6b [net] SRP client implementation (#6038)
This commit adds support for SRP (Service Registration Protocol)
client in OpenThread. The implementation allows a user to provide host
info (host name and a list of host IPv6 addresses) along with a list
of services to be registered with an SRP server. Services and/or host
addresses can be added or removed during operation of client.

Users can get the list of services and host info and their current
state (indicating, for example, if service is registered with server,
being registered or being removed, etc). Users can also provide a
callback to get notified whenever there is change or an error.

When there is a new request (e.g., a new service is added/removed)
that requires an update, the SRP client will wait for a short delay
before preparing and sending an SRP update message to server. This
allows user to provide more changes that are then all sent in the same
update message. The implementation handles retries in case of
different errors and failures. An exponentially increasing retry wait
interval (with configurable min, max, and growth factor) is
implemented.

The implementation also manages the lease renew time for each service
and refreshes (re-registers) services with server before lease is
expired. It supports "opportunistic early refresh" mechanism such that
when sending an SRP update, the services that are not yet expired but
are close, are allowed to refresh early and are included in the SRP
update. This helps place more services on the same lease refresh
schedule reducing number of messages sent to the SRP server. This
behavior (whether to allow early refresh or not, and its related
parameters) can be controlled through a set of OT config definitions.
2021-01-22 13:19:21 -08:00
Simon Lin de62590edb [otci] get router link information (#6105)
This commit adds link information to the router table
(i.e. get_router_table()).
2021-01-22 11:59:55 -08:00
Łukasz Duda a751b35748 [mle] ensure reserved bit in Mode TLV is set (#6107) 2021-01-22 11:51:01 -08:00
Abtin Keshavarzian 099333375f [ncp-base] fix set hander for 'SPINEL_PROP_MAC_DENYLIST' (#6079) 2021-01-21 11:54:02 -08:00
doru91 a8265a5628 [k32w] Project CHIP fixes (#6099)
- enable 15.4 to work together with BLE
- include an additional configure file
2021-01-21 08:18:29 -08:00
Li Cao 8de7b4881c [build] only build unit tests when FTD is enabled (#6092) 2021-01-21 08:17:04 -08:00
Zhanglong Xia 9725cf1531 [android] add library libcutils for compiling ot-cli and ot-ncp (#6104)
When compiling ot-cli and ot-ncp, the Android.mk will compile
the function `property_get` in `src/core/api/instance_api.cpp`.
The function `property_get` is provided by the library `libcutils`.

GitHub Action uses Android NDK to compile Android.mk, Android NDK
only allows adding the shared library `libcutils` for the library
`ot-core`. However, Android requires to add the shared library
`libutils` for the binary `ot-cli` and `ot-ncp`. Therefore, this PR
uses the macro `ANDROID_NDK` to distinguish these two cases.
2021-01-21 08:15:18 -08:00
Simon Lin 42633b19a8 [thread-cert] ignore CLI log lines (#6102)
This commit allows node.py to ignore log lines from node CLI output.

Only if _expect_command_output is used.
2021-01-21 08:14:10 -08:00
Li Cao 1c0d295a04 [script] fix warning string for mdv (#6096)
mdv is only used to post size report and can not format
markdown. Update the warning string to avoid confusion.
2021-01-20 14:12:00 -08:00
kangping 46b1807643 [posix] bind infra IF socket to specific interface (#6089)
This is for ensuring sending ICMP6 packets on only the specified
infrastructure interface.
2021-01-20 13:16:12 -08:00
kangping 0bf8c416ab [posix] logging enhancements to infra if (#6090)
This commit includes two small enhancements to the posix infra if
module:

- simplify logging of socket errors since the VerifyOrDie macro
  already prints the line number and strerror().

- suppress "drop ICMPv6 message" debug logs when there is no input
  data to be read on the socket.
2021-01-20 13:14:34 -08:00
Li Cao d3fc3b7aae [scripts] add option to not build bbr when building 1.2 (#6085) 2021-01-20 10:26:39 -08:00
kangping 5fa21ddbbd [border-router] add external route for on-link prefix and external OMR prefixes (#6008)
This commit includes the enhancement that

1. Adds non-default external route for on-link prefixes.

2. Add external route for OMR prefixes advertised by BRs in other
   Thread Networks.

3. A new API to disable/enable the Border Routing manager at run
   time. CLI commands are added for testing.

4. A new platform API to get the link-local address of the infra
   interface so that we can filter out the ICMPv6 packets from myself
   by the Border Routing Manager rather than the platform
   implementation.
2021-01-20 08:23:24 -08:00
Matthias Deimbacher ba97f96fc7 [bootstrap] overwrite existing links (#6094)
Create links with forced overwrite flag to prevent a failing script if
a link already exist.
2021-01-19 10:32:39 -08:00
Simon Lin 5e5f4c7ed3 [script] script/test cert with multiple arguments (#6082)
This commit allows specifying multiple arguments for script/test cert
path/to/script.py.

This is useful for running a selected test case when the test script
contains multiple test cases.
2021-01-18 17:19:50 -08:00
Simon Lin 0f91cb8129 [otns] fix compile issue when log region CORE is enabled (#6083)
This commit fixes an compile issue in otns.cpp when log region CORE is
enabled.
2021-01-18 17:14:08 -08:00
Simon Lin 4e2b869fe9 [posix] tune core config for posix (#6044)
POSIX platform is generally less resource constrained. This commit
tune several OpenThread core configurations to better fit the POSIX
platform.
2021-01-18 17:12:16 -08:00
Li Cao b432300a07 [mesh-forwarder] remove unused UpdateIndirectMessages() declaration (#6086) 2021-01-18 17:09:42 -08:00
Leon Steenkamp b507527002 [bootstrap] fix gcc-arm-none-eabi install (#6081)
Add fix to extract archive to /opt rather than current directory
which is /tmp
2021-01-17 09:34:51 -08:00
Jonathan Hui c777db38dc [docs] create Operational Dataset group (#6077) 2021-01-17 09:30:40 -08:00
Simon Lin 113c83b885 [dns-client] remove QuestionAaaa struct (#6075)
This commit removes QuestionAaaa class.

Since the format of each question type is exactly same, it seems
unnecessary to define a dozen of QuestionXxx classes for different
resource record types just with different kType.
2021-01-17 09:30:08 -08:00
kangping 763eeea91c [tests] use dedicated _expect_done method for success commands (#6073)
We see self._expect('Done') in many places, looks like it's worth a
dedicated method.
2021-01-17 09:29:12 -08:00
Abtin Keshavarzian a77b1a95ae [message] new helper methods to compare bytes in a message (#6068)
This commit adds new helper `Compare` methods in `Message` class to
compare the bytes from the message (at a given offset) with a byte
array or bytes from a (template) object or bytes read from another
message.

This commit also updates the message unit test to cover the behavior
of the newly added methods.
2021-01-15 08:14:39 -08:00
kangping 4d50cbadbc [tests] fix expecting command output (#6072)
The _expect_command_output(self, ...) doesn't match exactly one line,
it may return a line in several splits. This commit fixes this issue.
2021-01-14 21:08:51 -08:00
Simon Lin a8e5d11e23 [logging] add logging region DNS (#6069)
This commit adds the DNS logging region to be used by OT DNS features.
2021-01-14 21:01:50 -08:00
Diego Ismirlian 50054722a2 [random-manager] fail if unable to seed the CTR DRBG (#6071) 2021-01-14 20:58:45 -08:00
Li Cao 0247d02b9d [github-actions] upload core dump only when crash happens (#6049)
Currently when a test fails, the core dump uploading action would be
executed. (Even when there's no core dump, the binaries and so libs
would be uploaded, which is a waste.)

This commit uses env variables of github actions to only execute the
uploading action when crash actually happens.
2021-01-14 10:21:06 -08:00
Rongli Sun 01bc63ac0e [doc] amend DUA and MLR fast poll comments (#6065) 2021-01-14 10:18:56 -08:00
Li Cao 8625603401 [bootstrap] fix pretty format install (#6066) 2021-01-14 10:17:27 -08:00
Zhanglong Xia 36b16be3a4 [build] add Android.bp support (#6039)
Since Android 7.0, the Soong build system was introduced in Android to
replace Make. This commit adds the Android.bp to support Soong build
system.
2021-01-14 10:16:31 -08:00
Abtin Keshavarzian 31a91d1f5c [dns-client] use 'Header::SetRandomMessageId()' to set query message ID (#6061) 2021-01-12 09:56:02 -08:00
Abtin Keshavarzian 61d3c645aa [dns-headers] fix typos, rename some methods (#6059)
This commit fixes some typos in the documentation/comments and
renames some of methods getting number of RRs in a DNS header
section (`Get{Section}RecordCount` <- `Get{Section}RecordsCount`).
2021-01-12 09:55:02 -08:00
kangping c6ca43a4e1 [build] add missing infra_if.cpp file in Android.mk (#6056) 2021-01-11 08:15:30 -08:00
Li Cao 846e26d71a [neighbor-table] fix typo (macAddresss -> macAddress) (#6055) 2021-01-11 08:13:12 -08:00
kangping 12640b17eb [posix] set external heap callbacks (#6054) 2021-01-10 08:32:01 -08:00
Abtin Keshavarzian 418c9afbe2 [dns] support new resource records (PTR, SRV, TXT, KEY, SIG, OPT) (#6048) 2021-01-10 08:31:14 -08:00
Abtin Keshavarzian b179cf21be [logging] add log support for new region SRP (#6048)
This commit adds a new log region and the related definitions for
Service Registration Protocol (SRP).
2021-01-10 08:31:14 -08:00
Abtin Keshavarzian a774d43fe9 [network-data] check serverTlv data length before parsing (#6052)
This commit adds a check in `GetBackboneRouterPrimary()` to verify
that the server sub-TLV data length is larger than a expected minimum
before casting it to `BackboneRouterServerData` and parsing/reading the
info.
2021-01-09 12:27:34 -08:00
Li Cao 948ad52565 [utils] implement a item-pointer iterator template for many iterators (#6025)
Many Iterators have the same pattern in our code: they have ++,
deference, equal operators, IsDone method and hold a pointer to the an
object. This commit extracts the common pattern into a template class
ItemPtrIterator and use it as a base class for those similar Iterator
classes.
2021-01-09 09:10:09 -08:00
Abtin Keshavarzian 771e0c39f6 [ecdsa] relax/fix the assert check on MPI encoded size (#6051)
This commit fixes the assert check on MPI encoded size. Note that
`mbedtls_mpi_write_binary()` would fill the entire given buffer
(adding zero bytes if the MPI encoded size requires less bytes than
the given buffer size).
2021-01-08 15:50:45 -08:00
suveshpratapa 9ec9070e9d [efr32] fix for trng entropy API (#6050)
When obtaining entropy data, trng_get_random checks the status for any
noise, and if so, cleans its queues and keeps the entropy accumulator
of mbedtls running.

In the process, TRNG might not have any new samples available, so a
zero length output is valid, and we should keep running rather than
exit fatally.
2021-01-08 11:59:26 -08:00
Yakun Xu d9acce1177 [test] enhance parsing addresses (#6045)
Expect sometimes matches the pattern before a line is fully printed to
TTY. As a result, the address returned may not be accurate. This commit
fixes this issue by matching line breaks.
2021-01-08 08:32:07 -08:00
Abtin Keshavarzian 1e80b604b0 [radio-spinel] add option to skip RCP compatibility check during init (#6046)
This commit adds new option to skip RCP API version and capability
compatibility check during initialization. The radio URL key
`skip-rcp-compatibility-check` can be used to enable this behavior.
This is only intended for situations where RCP won't be operating as a
radio (e.g., host trying to perform an RCP firmware update).
2021-01-07 18:13:47 -08:00
Li Cao b2f7bda6b4 [nrf52840] implement enh-ack probing (#6021) 2021-01-07 12:01:06 -08:00
Li Cao 1c70361c0e [nrf528xx] enable unused-parameter warning for platform code (#6020)
This commit enables unused-parameter warning for NRF driver code
except for soft-device.

Currently this warning is disabled for all NRF driver code, which
makes OT_UNUSED_VARIABLE in driver code useless. We only need to
suppress the warning for soft-device code because only that part
includes some headers in third_party/NordicSemiconductor that have
unused parameters.
2021-01-07 08:00:21 -08:00
Jonathan Hui db364960a7 [nrf52811] only build CLI and RCP examples (not NCP) (#6043) 2021-01-06 15:01:56 -08:00
Jonathan Hui 5577219af4 [ncp] increase size of NCP UART buffers to avoid dropped frames (#6043) 2021-01-06 15:01:56 -08:00
paragdixit-g de93711e22 [build] remove unneeded-internal-declaration warning (#6040)
By inlining static functions defined in the header file.
2021-01-05 12:07:07 -08:00
paragdixit-g 9d21f9cb1a [gn] add all mbedtls .c source files to sources (#6019)
Without cmac.c, Fuchsia's -O0 compilation was failing.
Adding other missing files to BUILD.gn as well.
2021-01-05 10:55:53 -08:00
Simon Lin 9fcdb290ae [simulation] increase simulator UDP buffer size (#6006) 2021-01-05 10:27:42 -08:00
Jonathan Hui 32e49ada39 [posix] increase message buffer pool to 256 (#6037) 2021-01-05 09:36:58 -08:00
Jonathan Hui ee4bdc6bbe [link-raw] do not disable link raw during transmit/scan operation (#6026) 2021-01-05 09:36:30 -08:00
Jonathan Hui f64c597fc6 [coap] fix order of operations in TxParameters::IsValid() (#6027)
To match CalculateInitialRetransmissionTimeout() implementation.
2021-01-05 09:35:45 -08:00
Li Cao df047ed5cb [scripts] optional install pretty format for Raspbian in bootstrap script (#6035)
It seems to be unnecessary to install these format dependencies when
setting up OpenThread on a Raspbian (Mostly people don't develop or
submit PR from a Raspberry pi). So by default don't install these
format dependencies on Raspbian to save time.
2021-01-04 08:57:20 -08:00
Simon Lin 22b043bf62 [otci] add OpenThread Controller Interface library (#5779)
This commit introduces the Proof of Concept implementation of the
OpenThread Controller Interface (OTCI) which can be used to connect
and manage various kinds of OT devices.

This commit also adds the tests to verify that OTCI works for both
simulation and real OT devices.

- Device Connectors
  - CLI Virtual Time Simulation
  - CLI Real Time Simulation
  - CLI SOC Device
  - NCP Virtual Time Simulation (not all APIs work)
  - Real device via SSH
- OTCI tests of simulation devices are executed in Github Actions
- OTCI tests of real devices can be executed like below:

# Install otci python library
cd tests/scripts/thread-cert/otci && python3 setup.py install --user
# Test OT CLI SOC device at /dev/ttyACM0
REAL_DEVICE=1 OT_CLI_SERIAL=/dev/ttyACM0 python3 tests/test_otci.py
# Test OTBR device via SSH
REAL_DEVICE=1 OTBR_SSH=172.16.243.151 python3 tests/test_otci.py
2020-12-30 11:29:27 -08:00
Moandor 069e26b51e [key-manager] remove default master key (#5998)
When initializing, we should use randomly generated network parameters
instead of default ones, to eliminate the possibility of unintentional
use of default credentials.
2020-12-30 11:25:48 -08:00
Jintao Lin 263084baef [nrf52811] use RTC1 instead of RTC0 (#6023) 2020-12-30 11:21:31 -08:00
Li Cao 82c682fbc9 [low-power] fix test case Low Power 5_3_01 (#6022) 2020-12-30 11:20:03 -08:00
Mason Tran 9ca79ddd9a [efr32] conditional definition for MBEDTLS_SSL_MAX_CONTENT_LEN (#6004) 2020-12-28 10:33:14 -08:00
Abtin Keshavarzian 2c3bcbe804 [android] add missing 'ecdsa.cpp' src file in android makefile (#6012) 2020-12-28 10:32:23 -08:00
Simon Lin 471cf8bedf [ip6] use ALOC source address (#6007)
CoAP requires that the source address of a response must match the
destination addresses of the request. So, if a device sends a TMF
request using ALOC as destination address, the TMF response SHOULD use
the ALOC as source address. Otherwise, CoAP implementations (beside
OpenThread) may fail to match the request and response.
2020-12-24 11:00:03 -08:00
kangping 41e7f52f41 [cli] fix typo in joiner readme doc (#6009) 2020-12-24 10:58:32 -08:00
Jing Ma e0bff3641f [thread-cert] fix case 7.1.5 intermittent failure (#5973) 2020-12-23 15:45:01 -08:00
kangping 995ad66846 [border-router] initial implementation of prefix/route management (#5856)
This is the initial implementation of Thread Border Router
prefix/route management with:

- Create & publish off-mesh routable (OMR) prefix for Thread network
  - configure the BR as default route.
  - converge to the smallest OMR prefix if multiple prefixes are
    present at the same time.
- Create & advertise on-link prefix for infrastructure network
  - monitor RA messages on infra link and stops myself if there is
    someone else advertising an on-link prefix.

It currently supports single infrastructure link with possibly
multiple BRs. Support for multiple infrastructure links is left for
future.
2020-12-23 15:19:12 -08:00
Thomas 8f9894f7c0 [examples] update Qorvo qpg6095 and gp712, add qpg6100 and qpg7015m (#5903) 2020-12-23 15:17:07 -08:00
Abtin Keshavarzian 65eac03ad9 [crypto] add new flavors of 'Update()' for SHA-256 and HMAC computation (#6002)
This commit updates `Sha256` and `HmacSha256` classes adding new
flavors of `Update()` method which inputs bytes from a given buffer,
or from an object, or read from a `Message` for hash calculation.

This commit also updates unit test to add more test-cases (from RFC
4231) for HMAC and adds new set of test-cases for SHA-256. The test
also covers calculating hash over data read directly from a `Message`.
2020-12-23 14:56:33 -08:00
Jiacheng Guo 01d169ad87 [ip6] add filter for packets from host (#5911)
This change filters out unsupported ICMP packets, Tmf and Mle udp
packets from the host.
2020-12-22 22:58:58 -08:00
Simon Lin 24ed1ffd37 [cli] router table command to output Link (#5997)
This commit enhance OT CLI command router table to output whether Link
Established in Link field.
2020-12-22 22:52:14 -08:00
Jiacheng Guo b306cb0bbe [radio] send radio command to the region (#5999)
Some radio region has further limit over max power table. We need to
send the region code the radio driver as well.
2020-12-22 22:51:03 -08:00
kangping 677e2f01ec [tests] add "return" for dummy test platform API (#6000) 2020-12-22 20:37:34 -08:00
Moandor 27609159d9 [expect] fix CLI router tests (#5996)
The next hop here is not deterministic. This changes it to expect any
4-digit hex.
2020-12-22 08:54:29 -08:00
Piotr Koziar a3faaa2043 [doc] add description of common switches (#5484) 2020-12-22 08:52:46 -08:00
kangping 22570e5a5b [heap] expand internal heap size for ECDSA (#5988)
The ECDSA feature needs more heap to run because buffers for signing
and signature verification are dynamically allocated.

The number 2600 is the minimum (not precise) size to pass the
test_ecdsa unittest case. This is not revealed in CI tests because
DTLS is enabled (and thus we have much larger heap) for unittest
check.
2020-12-21 10:55:11 -08:00
kangping fe98fdc2d1 [ecdsa] fix ECDSA public key size for DNSKEY (#5989)
Per Sec 4 of RFC 6605:
"ECDSA public keys consist of a single value, called "Q" in FIPS
186-3.  In DNSSEC keys, Q is a simple bit string that represents the
uncompressed form of a curve point, "x | y"."

The bit string of the two curve points (X, Y) should have a fixed
length of 64 bytes and the additional `1` byte prefix should not be
included, because only uncompressed form is allowed.
2020-12-21 09:59:50 -08:00
Łukasz Duda a3a76f1ea3 [dns-client] randomize ID of outgoing query (#5981) 2020-12-21 07:29:11 -08:00
Jiacheng Guo 42e1da5573 [nrf528xx] add max power table support (#5961) 2020-12-21 07:22:00 -08:00
Zhangwx e0ff88879f [harness-automation] fix the result parsed uncorrectly using Chrome 80 (#5958) 2020-12-21 07:13:44 -08:00
Jing Ma 7d2d228fa7 [thread-cert] relax time difference to less than 1.1 for case 5.1.13 to fix issue #5979 (#5987) 2020-12-21 07:12:25 -08:00
Jing Ma cd355d499e [thread-cert] remove deprecated case 6.1.9 referring to testplan v67 (#5984) 2020-12-20 16:27:50 -08:00
Abtin Keshavarzian 8ff8526061 [posix] disable trel platform when empty/no trel interface name is given (#5971)
This commit changes the trel platform implementation under posix such
that if the interface name used for trel is empty, the platform layer
would disable trel. This is done by having all `otPlatTrel` functions
returning immediately without performing any action. This commit also
changes the `OPENTHREAD_CONFIG_POSIX_APP_TREL_INTERFACE_NAME` to be
empty string. This is the posix config option specifying the interface
name to be used by the trel platform layer. Note that the trel
interface name can be given using this build-time config, or through
the `-trel-interface` (or `-t`) input arg option. When the input arg
is not used, the interface name is determined from the build-time
config `POSIX_APP_TREL_INTERFACE_NAME`. This commit therefore makes
the default behavior when `-t` is not used to disable trel platform.
2020-12-20 16:18:58 -08:00
Jing Ma 3b832ef470 [thread-cert] add case 7.1.7 using pktverify (#5881) 2020-12-19 19:00:41 -08:00
Jing Ma 6583a3d8cf [thread-cert] fix case 8.3.1 intermittent failure (#5975) 2020-12-19 08:23:36 -08:00
Jing Ma 1811223a25 [thread-cert] fix case 7.1.6 intermittent failure (#5974)
An issue is caused by tiny time difference as well between step 5 and
step 6, step 6 occasionally is sent out ahead of step5.
2020-12-19 08:22:20 -08:00
Jing Ma ae43f3fda2 [thread-cert] fix case 5.1.12 intermittent failure (#5976)
An issue is caused by The Challenge TLV and TLV Request TLV MUST be
included if the response is an Accept and Request message in Step 4,
delete these two TLV checks when the response is a Link Accept
message.
2020-12-19 08:20:53 -08:00
Jing Ma 3166f6a0ed [thread-cert] add case 9.2.6 DatasetDissemination using pktverify (#5972) 2020-12-18 20:24:49 -08:00
Eduardo Montoya 91cc43b647 [diags] fix broken anchor in Diags Readme (#5978) 2020-12-18 08:56:13 -08:00
Jing Ma 0e105524cb [thread-cert] add case 5.8.4 SecurityPolicyTLV using pktverify (#5967) 2020-12-18 08:05:08 -08:00
paragdixit-g a8198d0aa0 [gn] changes for fuchsia (#5649)
src/ncp/BUILD.gn: Added new targets

spinel/BUILD.gn: Added configs to propagate the flags to dependent
  targets

BUILD.gn: Updated top level BUILD.gn to include ncp targets

radio_spinel_impl.hpp: Removed compiler error for unused variable

mbedtls/BUILD.gn: Added a missing src file, added compiler flag to
  ignore conversion as there is implicit unsigned int to unsigned char
  conversion in ctr_drbg.c and ecp.c
2020-12-17 18:04:09 -08:00
Abtin Keshavarzian c00cb8a4c4 [crypto] add ECDSA (P-256 curve) key-gen, signing, and verification (#5954)
This commit adds support for ECDSA using NIST P-256 curve and SHA-256
hash. `KeyPair` type is added which represents a set of public and
private keys. It provides methods for generation a new key-pair and
getting a DER format byte sequence representation of the key-pair.
This commit also adds methods to calculate ECDSA signature and verify
a signature for a hashed message. The underlying implementation uses
`mbedtls` APIs.

It also adds a unit-test `test-ecdsa` to cover behavior of the newly
added types and methods. The unit test also verifies the signature
calculation using the test vector example from RFC 6979.
2020-12-17 15:13:31 -08:00
Moandor 572388d30e [github-actions] enable full logs in expect tests (#5968)
Currently if OpenThread dies with something like VerifyOrDie, we can't
get any logs from GitHub Actions. This enables full logs and uploads
them when expect tests fail, making it easier to diagnose such errors.
2020-12-17 07:52:10 -08:00
Jing Ma f1e0fad475 [thread-cert] refactor case 9.2.9 using pktverify (#5962) 2020-12-17 07:10:26 -08:00
Jonathan Hui b3fc7bc453 [dataset] do not allow Extended TLVs in Operational Dataset (#5966) 2020-12-17 07:08:15 -08:00
Jonathan Hui 14cab3a7f0 [border-agent] remove UDP receiver on commissioner disconnect (#5964) 2020-12-16 22:10:14 -08:00
Moandor d4c1c5d725 [spinel] fix errors in RCP recovery (#5965)
If mError is set to error state before entering the RCP recovery, this
error will be recognized as an error in the recovery process, and
cause it to die, while there is actually no error.

This fixes it by clearing mError when starting the recovery process.
2020-12-16 22:08:59 -08:00
Jing Ma 03cd73ad1c [thread-cert] add case 9.2.5 ActiveDataset using pktverify (#5959) 2020-12-16 20:08:07 -08:00
Jing Ma 4caecf44fb [thread-cert] add case 8.2.5 JoinerRouter using pktverify (#5924) 2020-12-16 08:07:44 -08:00
Jing Ma f3968c5891 [thread-cert] refactor case 9.2.8 using pktverify (#5930) 2020-12-16 08:06:12 -08:00
Li Cao 3a86ed9aa9 [nrf528xx] fix sleep_to_tx transition problem (#5960)
After coex precondition is approved, no action is taken to notify the
core. As a result, the coex precondition is not met when doing the
transmission. Now we move the code before HFCLK handling so that HFCLK
handling would notify the core.
2020-12-16 08:05:34 -08:00
Abtin Keshavarzian d103d827ad [link-raw] disable/enable MAC layer when link-raw is enabled/disabled (#5956)
This commit addresses an issue with `LinkRaw` on FTD/MTD builds. In
FTD/MTD builds, we add code to disable/enable MAC layer when link-raw
is being enabled/disabled. This ensures to avoid any conflict in
control of radio and sub-mac between `Mac` and `LinkRaw`. In RADIO
build, we directly enable/disable sub-mac (note that in FTD/MTD build
then `Mac` layer would be enable sub-mac).
2020-12-15 10:29:55 -08:00
Jonathan Hui bb94384d92 [multi-radio] copy all TX buffers before encryption (#5957)
Performing MAC frame encryption immediately after each copy results in
copying the already-encrypted frame, rather than the original frame
before encryption.
2020-12-15 10:14:02 -08:00
Jing Ma 69e97581e7 [thread-cert] add case 8.1.6 using pktverify (#5898) 2020-12-14 23:24:43 -08:00
Yakun Xu 09292f5d12 [posix] fix build warnings/errors on macOS (#5839) 2020-12-14 18:01:14 -08:00
Jing Ma bd00cafbec [thread-cert] add case 9.2.19 PendingDatasetGet using pktverify (#5951) 2020-12-14 11:49:24 -08:00
Jing Ma 53aebc851e [thread-cert] add case 5.7.2 CoapDiagCommands using pktverify (#5940) 2020-12-14 11:48:31 -08:00
Simon Lin 7bc6841004 [backbone-router] fix build option compile issues (#5955) 2020-12-14 08:44:05 -08:00
kangping caedb4dac5 [cli] fix typo in commissioner/joiner docs (#5953) 2020-12-14 08:42:14 -08:00
Jing Ma b1dd1d7bf5 [thread-cert] refactor case 9.2.2 using pktverify (#5913) 2020-12-14 08:38:18 -08:00
Jing Ma 69e57d52e0 [thread-cert] refactor case 9.2.11 using pktveriy (#5931) 2020-12-14 08:37:15 -08:00
Jing Ma 98e70c425c [thread-cert] add case 9.2.3 ActiveDatasetGet using pktverify (#5949) 2020-12-14 08:36:33 -08:00
Jing Ma 234562a577 [thread-cert] add case 9.2.1 MGMTCommissionerGet using pktverify (#5952) 2020-12-14 08:34:39 -08:00
Jing Ma c455eb9cdd [thread-cert] add case 5.7.3 CoapDiagCommands using pktverify (#5938) 2020-12-14 08:33:43 -08:00
Bob MacDonald e76cf7f907 [meshcop-tlv] fix typo with ChannelMasEntry (Note missing 'k') (#5948) 2020-12-13 08:22:16 -08:00
Abtin Keshavarzian 6b48c74787 [crypto] add 'Sha256::Hash' type (#5946)
This commit adds new public type 'otCryptoSha256Hash' and its internal
mirror `Sha256::Hash` type which represent a SHA-256 hash value.
2020-12-12 11:09:54 -08:00
Abtin Keshavarzian 89cc2ef432 [test] add 'otPlatEntropyGet()' using TRNG for unit test (#5945) 2020-12-12 11:05:21 -08:00
Jonathan Hui 02aab70419 [meshcop-tlv] fix ChannelMaskTlv::GetChannelMask() (#5947) 2020-12-12 11:02:46 -08:00
Eduardo Montoya 4e6924ea1d [low-power] small improvements in CSL code (#5939)
- Simplify 'GetNextCslTransmissionDelay'. Remove one unneeded function
  argument.

- For a CSL transmission using 'nrf_802154_transmit_raw_at' there is
  no need for 'nrf_802154_channel_set'.
2020-12-12 10:58:31 -08:00
Jonathan Hui 0c18108100 [mac-links] fix setting Ext Address on TREL link (#5943) 2020-12-11 14:00:19 -08:00
Jonathan Hui 670d76e794 [tests] fix comparison in test_cmd_line_parser (#5937) 2020-12-11 13:59:48 -08:00
Abtin Keshavarzian c35e19361a [posix] add error logs in trel platform implementation under posix (#5935)
This commit adds explicit error logs messages for the more common
error situation in trel platform implementation under posix, e.g., if
the trel netif cannot be found, or a unicast address cannot be added
to the netif. The new logs provide is included to provide more details
in addition to log message by `VerifyOrDie()` and/or `DieNow()`
2020-12-11 07:36:21 -08:00
Jing Ma 3cb8c7b03d [thread-cert] add case 8.3.1 CommissionerPetition using pktverify (#5904)
Also fix wrong COMMISSIONING_DATA_TLV const in cases 5.6.6 and 5.6.9.
2020-12-11 07:35:44 -08:00
Jeff Bumgardner 294fa264b6 [devsite] migrate Porting guide to GitHub (#5936) 2020-12-10 23:49:15 -08:00
Li Cao ae07fe27ff [low-power] implement enhanced-ack based probing (#5780)
This commit implements Enhanced-ACK Probing (on simulation platform).

- Add a new public API otLinkMetricsConfigEnhAckProbing which sends
  Link Metrics Management Request to configure the probing. This is
  called on Probing Initiator side.

- Add a new radio platform API otPlatRadioConfigureEnhAckProbing. This
  API should be called on Probing Subject side when handling the
  requests from Initiators. This API notifies the radio to start/stop
  aggregating link metrics info and include the data into Vendor IE in
  enhanced-ACK for the specific neighbor. As discussed in #5746, the
  code for doing such thing should be put in radio driver.

- Add a util module util/link_metrics, which provides a group of APIs
  to implement Probing Subject side logic for Enh-ACK Probing. Any
  platform could use this module to implement the feature easily in
  radio driver.

- Add new util APIs in util/mac_frame to generate Enh-ACK Probing IE
  (Vendor IE with Thread OUI and SubType = 0) and set value for this
  IE.

- Update the implementation in simulation/radio.c to support Probing
  Subject side logic for Enh-ACK Probing, using APIs in
  util/link_metrics and util/mac_frame.

- Add a test
  v1_2_LowPower_7_1_01_SingleProbeLinkMetricsWithEnhancedAcks.py for
  testing.

Misc:

  - Add check for all the public Link Metrics APIs (Initiator side) to
    ensure that the Subject is a neighbor of the Initiator. If the
    address is not link-local or the neighbor is not found, an error
    UNKNOWN_NEIGHBOR would be returned.

  - Update PrepareEmptyFrame so that when it's called for reference
    device, its frame version would be set to 2015.
2020-12-10 23:31:41 -08:00
Jonathan Hui 02f7dbb42b [meshcop-tlvs] fix ChannelMaskBaseTlv::IsValid() (#5929) 2020-12-10 11:49:57 -08:00
Abtin Keshavarzian 3d21a846d9 [test] add multi-radio and TREL test cases (#4440)
This commit  adds new builds under "simulation-build-autotools"
to cover multi-radio configurations: TREL only, 15.4+TREL,
15.4+TREL+ToBLE.

It also adds new GitHub action tests covering all `toranj`
test-cases with different configurations:

  1) NCP model with TREL radio only,
  2) POSIX App and RCP model with TREL radio only (emulated over
     a virtual Ethernet netif).
2020-12-10 11:46:07 -08:00
Abtin Keshavarzian 451ae39be4 [toranj] add support for multi radio and TREL (#4440)
This commit updates `toranj` test framework to support running tests
in posix-app mode over a TREL radio link (a virtual Ethernet netif is
used for TREL). It also updates the build script to easily set up
different configurations, ncp/posix-app with any radio combination:
15.4 only, TREL only, or multi radio (15.4 + TREL).
2020-12-10 11:46:07 -08:00
Abtin Keshavarzian 07d734b1be [ncp] add new properties for multi radio and TREL support (#4440)
This commit adds new spinel properties (and their getters) related
to multi radio link feature. `SPINEL_PROP_SUPPORTED_RADIO_LINKS`
allows host to get the list of supported radio links by the device
itself, `SPINEL_PROP_NEIGHBOR_TABLE_MULTI_RADIO_INFO` provides
info about the radio links supported by all neighbors.
2020-12-10 11:46:07 -08:00
Abtin Keshavarzian 3da1c540e9 [multi-radio] adding new public OT APIs for multi radio link config (#4440)
This commit adds new public OT definitions and API for radio link
configuration in `openthread/multi_radio.h`. Mainly the function
`otMultiRadioGetNeighborInfo()` is added which allows info about a
neighbor to be retrieved (e.g., which radio links are supported by the
neighbor and their preference value).
2020-12-10 11:46:07 -08:00
Abtin Keshavarzian 925f75cf06 [mesh-forwarder] limit the Mesh Header frame MTU (#4440)
This commit allows us to use different MTU on different radio links.
Mesh Header frames are forwarded by routers over multiple hops to
reach a final destination. The forwarding path can have routers
supporting different radio links with varying MTU sizes. Since the
originator of the frame does not know the path and the MTU sizes of
supported radio links by the routers in the path, we limit the max
payload length of a Mesh Header frame to a fixed minimum value
(derived from 15.4 radio) ensuring it can be handled by any radio
link.
2020-12-10 11:46:07 -08:00
Abtin Keshavarzian 0829514edc [posix-app] adding support for TREL over IPv6/UDP (#4440)
This commit implements TREL IPv6/UDP platform under POSIX App. The
implementation uses datagram sockets to exchange packets over a given
network interface (netif). The interface name can hard-coded in the
build using `OPENTHREAD_CONFIG_POSIX_APP_TREL_INTERFACE_NAME` config
or be specified as part of the input program arguments (using
`--trel-interface` or `-t` option).
2020-12-10 11:46:07 -08:00
Abtin Keshavarzian 2d36853fe6 [trel] implementing Thread Radio Encapsulation Link (TREL) (#4440)
This commit implements TREL protocol to encapsulate and exchange IEEE
802.15.4 frames over a packet switched network (e.g., a wireless LAN).
This commit also provides a TREL IPv6/UDP interface implementation
(using link-local IPv6 unicast/multicast addresses to communicate over
a subnet). It defines a platform abstraction (`otPlatTrelUdp6*`) for
TREL over IPv6/UDP.

This commit also provides an implementation of the TREL platform under
`examples/posix` focusing on simulating the behavior of the link.
2020-12-10 11:46:07 -08:00
Abtin Keshavarzian ffb3fdf9bd [radio-selector] adding multi radio link support (#4440)
This commit adds support for multi radio links in OpenThread core.

A set of `OPENTHREAD_CONFIG_RADIO_LINK_*` definitions (in header
`config/radio_link.h`) determines the supported radio link types.

This commit adds a new class `RadioSelector` which selects the radio
link for each message transmission. Per neighbor it tracks the
supported radio types and a preference value for each type.
`RadioSelector` updates the preference value based on the history of
rx/tx events with the neighbor, e.g., a successful tx on a radio link
increases the preference, whereas a failed tx attempt decreases it.

A new class `Mac::Links` is added defining a layer between `Mac` and
different radio links (e.g., `SubMac` for 802.15.4 radio type).
Broadcast frames are sent in parallel over all radio links. A unicast
transmission is sent over a single radio link at a time but on a tx
failure it may be retransmitted over other radio links.

This commit also adds the concept of deferred ack, allowing radio
links report status of ack at a later time through a different
callback.
2020-12-10 11:46:07 -08:00
Abtin Keshavarzian 48333ce530 [crypto] adding HMAC Key Derivation Function (HKDF) using SHA-256 (#4440)
This commit adds a new class `Crypto::HkdfSha256` which implements
HMAC-based Extract-and-Expand Key Derivation Function from RFC-5869
using SHA-256. It also adds a unit test for the new module.
2020-12-10 11:46:07 -08:00
Abtin Keshavarzian 61e77bf6ed [topology] adding Neighbor::StateToString() (#4440)
The `Neighbor::StateToString()` converts a given `Neighbor::State`
to a human-readable string.
2020-12-10 11:46:07 -08:00
Diego Ismirlian d23f3581ea [efr32] radio: fix otPlatRadioGetTransmitPower (#5932)
The efr32 platform shows the following behavior:

> txpower -10
Done
>
> txpower
-113 dBm
Done

The bug is caused by the C promotion rules during the division of
int16_t by unsigned in otPlatRadioGetTransmitPower. This commit fixes
the issue.
2020-12-10 07:59:56 -08:00
Li Cao e2856b9111 [github-actions] upload core dumps for expects tests (#5933) 2020-12-09 23:38:45 -08:00
Jing Ma eb3f6fd2f2 [thread-cert] refactor case 6.5.2 using pktverify (#5886) 2020-12-09 23:32:16 -08:00
Simon Lin 9380ffd07c [scripts] test multicast routing across Thread and Backbone (#5852)
- This commit fixes some issue in multicast forwarding from Thread to
  Backbone.
- It also adds a test to verify that multicast forwarding works across
  Thread and Backbone.
  - Test script tests/scripts/thread-cert/mcast6.py is added for Host
    to subscribe to a multicast address

The ping reply can not reach ROUTER1 since DUA feature is not
complete.
2020-12-09 08:49:07 -08:00
Simon Lin 80c180d60d [tmf] TMF not to use platform udp (#5910)
This commit fixes TMF issues related to the Host tun interface.

- Do not pass TMF messages to Host tun interface
  - Backbone TMF (also using port 61631) keeps passing TMF messages to
    Host tun interface
- Re-enable packet filters for ALOC/RLOC destined and TMF packets for
  PLAT_NETIF and PLAT_UDP
2020-12-09 07:42:12 -08:00
Jing Ma fdc8a97594 [thread-cert] refactor case 8.1.1 using pktverify (#5883) 2020-12-09 07:34:07 -08:00
Abtin Keshavarzian 73126f7099 [dns] add helper methods to append/parse DNS names (#5922)
This commit adds `Dns::Name` type which provides a set of helper
methods to encode/decode DNS names. `AppendName()` method encodes and
appends a full name (e.g., "test.example.com") to a message. Other
helper methods enable appending labels (or groups of labels) and/or
constructing a compressed name (using pointer labels). `ParseName()`
method parses and skips over a full name in a message. `ReadLabel()`
method reads labels one by one and works independently of whether the
encoded name is compressed or not. `ReadName()` method read an entire
name from message. The new methods are used in `Dns::Client`.

This commit also add a unit test `test-dns` covering the behavior of
the newly added helper methods.

Finally, this commit adds few helper methods in `ResourceRecords` to
get the size and check the type of a DNS record.
2020-12-08 12:20:19 -08:00
Simon Lin c70e47d16c [dua] delay registration for DUA newly added (#5925)
We found that it's possible that a Router, in a topology like above,
could send DUA.req so quickly after receiving Data Response from
Leader that the PBBR is not able to process the same Data Response
message and update the network data accordingly. Consequently, PBBR
sends DUA.rsp with kDuaInvalid status because it can't find a valid
Domain Prefix in the Network Data.

This commit help resolve this issue with two fixes:
- Node to delay for up to 1000ms before sending DUA.req when domain
  prefix addresses is generated
- PBBR to respond with kDuaGeneralFailure to allow the node to
  re-register the same DUA again.
2020-12-08 10:41:21 -08:00
Jing Ma 17d813eadd [thread-cert] add case 7.1.8 BorderRouterAsFED using pktverify (#5869) 2020-12-08 10:39:17 -08:00
Jing Ma 60344b6c57 [thread-cert] refactor case 7.1.5 using pktverfiy (#5882) 2020-12-07 22:43:16 -08:00
Jing Ma f804879b8a [thread-cert] add case 7.1.6 BorderRouterAsLeader using pktverify (#5868) 2020-12-07 20:17:26 -08:00
Mason Tran 97d416be9e [efr32] add missing bytes to sleepy-demo masterkey (#5917) 2020-12-07 14:15:06 -08:00
Yakun Xu 7a7390b9ee [test] separate code coverage data files (#5920)
This commit ensures each node create its own profile data, so that they
can be merged after tests to produce more accurate profile data.

This commit also prints the coverage data of message.cpp after all
profile data are merged.
2020-12-07 13:23:26 -08:00
Jing Ma dc5c25799d [thread-cert] refactor case 7.1.3 using pktverify (#5859) 2020-12-07 10:09:31 -08:00
Li Cao 90d9d3a052 [build] remove FTD/MTD/RADIO from core config file (#5923) 2020-12-07 10:07:58 -08:00
Jing Ma c6c079baaf [thread-cert] fix case 5.3.6 issue #5909 (#5912) 2020-12-07 10:06:05 -08:00
Li Cao 11c08b86ab [mac] stop timer before starting non-idle operation (#5921) 2020-12-07 09:53:11 -08:00
Li Cao f1ffa66f00 [github-actions] update binaries path in upload action (#5916) 2020-12-07 09:51:25 -08:00
Simon Lin 82eee1f8d3 [backbone-router] add build options for Backbone Router features (#5891)
This commit introduces two configurations for Backbone Router to turn
off corresponding features:

- OPENTHREAD_CONFIG_BACKBONE_ROUTER_DUA_NDPROXYING_ENABLE: 1 by
  default, set to 0 to disable Backbone Router DUA ND Proxying

- OPENTHREAD_CONFIG_BACKBONE_ROUTER_MULTICAST_ROUTING_ENABLE: 1 by
  default, set to 0 to disable Backbone Router Multicast Routing

Both configuration requires OPENTHREAD_CONFIG_BACKBONE_ROUTER_ENABLE.

NOTE: At least one of these two configurations must be ON if
OPENTHREAD_CONFIG_BACKBONE_ROUTER_ENABLE=1(otherwise it's meaningless
to turn on OPENTHREAD_CONFIG_BACKBONE_ROUTER_ENABLE).
2020-12-04 08:11:35 -08:00
Jiacheng Guo f5a7dc2b9a [radio] send max power table to radio (#5867)
This change sends the max power table to the radio so that the radio
chip can manage the transmit power by self.
2020-12-04 08:08:52 -08:00
Yakun Xu 65fb7924df [github-actions] add dependent PR support (#5899) 2020-12-03 12:44:34 -08:00
Seth Rickard 3981d15fdc [cc1352,cc26xx] add C++ constructor calls (#5907)
* add C++ constructor calls
* add c++ init array to the cc2650 linker script
2020-12-03 09:32:32 -08:00
Moandor 49ae4feba3 [github-actions] remove coverage artifacts after uploading (#5778)
This removes artifacts when they are no longer needed, saves storage
space.
2020-12-03 09:27:30 -08:00
Jonathan Hui 761f8304c1 [dataset] implement ChannelMaskTlv::IsValid() (#5906) 2020-12-03 08:30:16 -08:00
Zhanglong Xia 4f10f593a4 [android] remove settings storage path from config file (#5895)
This commit removes settings storage path from
`include/openthread-config-android.h` to allow users define
the settings storage path on Android platform.
2020-12-02 23:17:29 -08:00
Yakun Xu a8b5b07849 [diag] check state before entering diagnostic mode (#5908)
This commit restrict diagnostic mode only when network stack is not up,
which prevents some issues caused by switching to diag mode after the
device was attached. For example, timers may not be triggered properly
after returnning from diagnostic mode.
2020-12-02 23:16:08 -08:00
Yakun Xu 63b9f3ebb4 [style] simplify build paths (#5888)
This commit simplifies the build paths:

* remove cmake prefix from `script/test`
* use fixed name for simulation and posix platforms just like others
2020-12-02 22:55:10 -08:00
Shu Chen ad67e8b47b [udp6] initialize Socket variables in its constructor (#5902) 2020-12-02 22:08:27 -08:00
Simon Lin 6088200bf0 [thread-cert] fix 5.3.3 random fail by small chance (#5892)
5.3.3 pktverify fail by small chance when the ping reply is forwarded
from Router3 -> Leader -> Router2 instead of Router3 -> Router2. In
such case, the direct wpan.dst16 is not Router2's RLOC16, but Leader's
RLOC16.

This commit change 5.3.3 to check for both 6lowpan mesh dst16 and
wpan.dst16 against Router2's RLOC16.
2020-12-02 21:26:31 -08:00
Mason Tran da6662c793 [efr32] remove -nostartfiles to use Newlib _start (#5905)
Remove -nostartfiles. There's currently no custom __START defined
anywhere.

Remove -D__STARTUP_CLEAR_BSS for silabs. Standard initialization
should already take care of this.
2020-12-02 13:57:46 -08:00
Jing Ma 8f2e1138e8 [thread-cert] refactor case 5.7.1 using pktverify (#5834) 2020-12-02 12:03:35 -08:00
Jing Ma 54b7e2b951 [thread-cert] refactor case 5.5.1 using pktverify (#5827) 2020-12-02 12:02:22 -08:00
Jing Ma 11930730c6 [thread-cert] refactor case 5.3.11 using pktverify (#5825) 2020-12-02 12:02:09 -08:00
Jing Ma 141208b9d3 [thread-cert] refactor case 5.3.9 using pktverify (#5823) 2020-12-02 12:01:58 -08:00
Jing Ma d218dfcb35 [thread-cert] refactor case 7.1.1 using pktverify (#5855) 2020-12-02 08:31:12 -08:00
Jing Ma 5abb781691 [thread-cert] add case 6.1.4 REEDAttachConnectivity using pktverify (#5850) 2020-12-02 08:30:23 -08:00
kangping 06f9ee83bf [border-router] move configuration check from api to inner class (#5884)
This commit moves the border router configuration check into
NetworkData::Local.
2020-12-02 08:23:48 -08:00
Simon Lin 42af4a946f [backbone-router] fix otBackboneRouterMulticastListenerGetNext missing (#5894)
otBackboneRouterMulticastListenerGetNext is also used by non reference
device code.
2020-12-02 08:22:31 -08:00
Jing Ma 8630547d10 [thread-cert] refactor case 5.3.6 using pktverify (#5813) 2020-12-01 21:37:19 -08:00
Li Cao 6956d5e0f9 [github-actions] upload core dump, so libs and binaries for crashed programs (#5861)
This commit adds action to upload core dumps, so libs and binaries for
1.2 certification. This is intended to solve issues where programs
intermittently crash however hard to reproduce it.

This is added first for thread-1-2 and low-power-packet-verification
first as an experimental work. We can add same actions for other items
when it's necessary.
2020-12-01 17:00:32 -08:00
Simon Lin 15b413a2b6 [dua] delay DUA registration to avoid transmission failure (#5893) 2020-12-01 07:30:55 -08:00
Zhanglong Xia 0d14e85439 [mle] let the command partitionid return the current partition id (#5872)
If user doesn't set the Partition Id using the command
'leaderpartitionid xxx', the current cli command 'leaderpartitionid'
always return 0. This commit renames the command 'leaderpartitionid'
to partitionid and let the command partitionid returns the current
leader Partition Id and add command partitionid preferred to set or
get preferred Partition Id.
2020-11-30 21:15:18 -08:00
Abtin Keshavarzian 24bc5c87ad [radio-spinel] simplify 'Request()' (#5890)
This commit removes the unused `aWait` parameter from `Request()`
and `RequestV()` methods.
2020-11-30 19:09:46 -08:00
Abtin Keshavarzian 0ca10a6538 [radio-spinel] check RCP API Version to be in the supported range (#5863)
This commit adds a new method `CheckRcpApiVersion()` which is used
during `Init()` to get the API version from RCP and verify that it
is within supported range.
2020-11-30 18:22:35 -08:00
Abtin Keshavarzian 5111bbee65 [spinel] add RCP API Version and compatibility check (#5863)
This commit adds a new compatibility check model for RCP and host. It
updates the compatibility guideline documentation stating how the
compatibility policy for NCP versus RCP are handled differently. For
NCP, we continue to require new NCP firmware to remain backward
compatible and work with an older host driver.

For RCP and host, this commit introduces the RCP API Version model.
The API version numbers are used to check the compatibility between
host implementation and RCP firmware. Generally, a newer host side
implementation would work with a range of previous or older RCP
firmware versions.

This commit adds `SPINEL_RCP_API_VERSION` definition which  specifies
the current spinel RCP API version. This number MUST be incremented
anytime there is a change in any of RCP specific spinel definitions.
`SPINEL_MIN_HOST_SUPPORTED_RCP_API_VERSION` specifies the minimum
spinel RCP API version which is supported by the host-side
implementation.

This commit also reserves a block of spinel properties value ranges
from `0xB0 - 0xFF` for RCP related property definitions. The smaller
property values help decrease the encoded byte stream length,
resulting in shorter spinel frames exchanged between RCP and host.
2020-11-30 18:22:35 -08:00
Jintao Lin 5cfdbfc54d [low-power] remove obsolete CSL functions (#5885) 2020-11-30 17:58:10 -08:00
Ciaran Woodward d24833f890 [docs] fix typo in sntp docs (#5889) 2020-11-30 12:58:08 -08:00
Moandor c7192ba798 [string] add UTF-8 validation (#5810) 2020-11-30 08:33:05 -08:00
Simon Lin 18b82fdef5 [github-actions] use ubuntu-20.04 for github actions (#5871)
This commit update Github Actions workflows to use ubuntu 20.04
whenever applicable.

- Change ubuntu-latest to ubuntu-20.04 to cleanup the annotations:
  Ubuntu-latest workflows will use Ubuntu-20.04 soon. For more
  details, see
  https://github.com/actions/virtual-environments/issues/1816

- Change ubuntu-18.04 to ubuntu-20.04 wherever ubuntu-20.04 works.
  - Fixed a compile issue in tests/unit/test_link_quality.cpp on
    ubuntu-20.04
  - Can not get Simulation/expects work on ubuntu 20.04 due to unknown
    issue. Leave for further enhancement.
2020-11-30 07:34:33 -08:00
Jonathan Hui 9a0f973530 [coap] update OPENTHREAD_CONFIG_COAP_ACK_TIMEOUT error message (#5866) 2020-11-30 07:32:12 -08:00
Abtin Keshavarzian d954ae9fd3 [dns] misc enhancements (#5876)
This commit contains a set of smaller enhancements/changes in DNS
modules:

- Adds `Client::QueryInfo` class (mirroring `otDnsQuery`).
- Simplifies iteration over `mPendingQueries`.
- Uses `Ip6::Address` instead of `otIp6Address` (internally).
- Updates documentation style in `dns_headers.hpp` .
- Changes internal constant/enum definitions to be `private`.
- Adds `ResourceRecordAaaa::IsAaaa()` helper to check whether a
  given Resource Record is of AAAA type.
- Small style fixes.
2020-11-29 20:59:47 -08:00
kangping fc5df5e4eb [logging] fix typo in documents (#5878) 2020-11-29 20:27:32 -08:00
Jing Ma 4d23b98aef [thread-cert] refactor case 6.1.1 using pktverify (#5838) 2020-11-29 20:12:55 -08:00
Seth Rickard b09e2cfc7b [docs] updates to run CC1352 and CC2652 as rcp with ot-br-posix (#5865) 2020-11-29 20:03:03 -08:00
Abtin Keshavarzian 23f5d09d66 [dataset] set key rotation time in security policy on random generation (#5877)
This commit updates `Dataset::Info::GenerateRandom()` to set the Key
Rotation Time in Security Policy component on a Dataset using the
default value (from `KeyManager`). This addresses the issue where the
generated Operational Dataset could potentially use zero for Key
Rotation time.

This commit also changes Security Policy Flags to use default value
from `KeyManager`.
2020-11-29 20:02:17 -08:00
Yakun Xu c7165c9bf0 [test] fix missing attribute _message_factory (#5879) 2020-11-29 19:58:42 -08:00
Jing Ma d932d55b58 [thread-cert] refactor case 6.4.1 using pktverify (#5843) 2020-11-27 10:39:34 -08:00
Li Cao dbc34478e5 [ip6] tiny enhancement for HandleOptions (#5874)
aForward in Ip6::HandleOptions is a purely 'in' parameter.
2020-11-27 09:15:13 -08:00
Simon Lin 532951d46a [tmf] allow turning off TMF proxying for DUA and MLR (#5875)
This commit allows turning off TMF proxying for DUA and MLR by
predefining CFLAGS.  It's still enabled by default for Thread 1.2 FTD.
2020-11-27 09:12:31 -08:00
Simon Lin f8e002260e [docs] OT CLI doc minor fixes (#5873) 2020-11-27 09:08:34 -08:00
Jing Ma b120158975 [thread-cert] refactor case 6.1.6 using pktverfiy (#5845) 2020-11-27 09:05:07 -08:00
Jing Ma cb7d8ff5ca [thread-cert] refactor case 6.1.2 using pktverify (#5844) 2020-11-27 09:03:49 -08:00
Jing Ma e1d1e0aad8 [thread-cert] refactor case 6.4.2 using pktverify (#5842) 2020-11-27 09:02:44 -08:00
Moandor 9d9646afaa [spinel] RCP restoration on failures (#5694)
This commit implements the RCP restoration on failure feature. It
keeps the host process running while resetting and initializing the
RCP.
2020-11-26 08:57:13 -08:00
Jintao Lin f4554e8ff7 [low-power] enable CCA sampling before CSL transmission (#5862)
CCA should be performed before CSL transmission. This commit enables
CCA for CSL transmissions on nRF platform.
2020-11-26 08:47:45 -08:00
Jing Ma 723ee23794 [thread-cert] refactor case 5.3.10 using pktverify (#5824) 2020-11-26 08:37:49 -08:00
Jing Ma 4f5a6b11b1 [thread-cert] refactor case 5.3.8 using pktverify (#5816) 2020-11-26 08:33:49 -08:00
Jing Ma 5f2d8fcca2 [thread-cert] refactor case 5.3.7 using pktverify (#5815) 2020-11-26 08:32:51 -08:00
Yakun Xu 9164355b8c [ip6] enable multicast loop (#5848)
This commit enables the feature IPV6_MULTICAST_LOOP into OpenThread IPv6
stack. The default-enabled feature allows a node receives a multicast
message sent by its own.
2020-11-26 08:29:03 -08:00
Li Cao 39e6a881c5 [thci] add low power thci (#5835)
This commit adds THCI for Thread 1.2 low power features.
2020-11-25 08:34:25 -08:00
Li Cao 0bf825797b [spinel] misc style fixes in radio spinel (#5864) 2020-11-25 08:17:49 -08:00
Marek Porwisz d969884df8 [nrf52840] Improved nrf security - fix for first unencrypted packet (#5837)
Software aes was using tables from RAM instead of ROM. It caused firsit
call to take longer than expected due to the need to fill the data.
Had to move to the most recent nrf security vestion as the one used did
not support this feature.

Oberon backend is software crypto implementation faster than mbedtls.
Since now AES can not be handled by cc310 switched to using Oberon
instead of vanilla mbedtls.
Also updated doc as some files were renamed.

Signed-off-by: Marek Porwisz <marek.porwisz@nordicsemi.no>
2020-11-25 00:40:13 -08:00
Simon Lin 9ab50c094d [posix] fix macro typo (#5860) 2020-11-25 00:34:11 -08:00
Jonathan Hui c821b3854f [mle] add missing defs when LONG_ROUTES is enabled (#5858) 2020-11-24 21:08:11 -08:00
Yakun Xu 52296ddc29 [cmake] avoid unnecessary rebuilds (#5857)
This commit avoid unnecessary rebuilds. The issue is caused by the
openthread-mbedtls-config target added by add_custom_target will always
be run, so the generated openthread-mbedtls-config.h is always
re-generated. This commit changes to use add_custom_command to generate
the header file.
2020-11-24 19:23:30 -08:00
Jintao Lin b6e2c2c970 [low-power] frame pending bit handling for enh-ack in simulation (#5853)
MAC command frame has its command ID encrypted in frame version
802.15.4-2015. Radio driver cannot decrypt this frame payload without
extended address. So the frame pending bit is not correctly set in the
ACK in response to data request command with version 2015. This commit
adds a special handling for frame version 2015 and only checks the
frame type when deciding if it needs to set the frame pending bit.
2020-11-24 17:37:21 -08:00
Abtin Keshavarzian 6918698345 [mle] simplify parsing and appending of 'TimeRequestTlv' (#5849) 2020-11-24 09:43:11 -08:00
Jiacheng Guo 088d193cd0 [android] always enable SLAAC (#5854) 2020-11-24 08:23:59 -08:00
Jing Ma 92de94cde4 [thread-cert] refactor case 6.2.1 using pktverify (#5846) 2020-11-24 08:23:04 -08:00
Jintao Lin 91d2c29fd8 [low-power] fix CSL scheduler to avoid packets stuck in queue (#5833)
This commit:
- Fixes the issue in CSL scheduler dealing with multiple SSEDs.
- Fixes the issue when CSL tx attempts reach max, CSL transmission to
  this child cannot resume.
- Reset CSL sync status after child mode change to RxOnWhenIdle.
- Adds MLE version, CSL synchronization status and queued message
  count to child table.
2020-11-23 22:59:21 -08:00
Yakun Xu d33c2f12af [test] add rcp-ncp node type (#5847)
This commit enables `script/test` to run cert tests on NCP nodes of
POSIX platform.
2020-11-23 17:02:11 -08:00
Abtin Keshavarzian 6d9975dfa6 [cli] add helper 'Output()' methods which prepend indentation space (#5841)
This commit simplifies the CLI module by adding new flavors of helper
methods `OutputLine/Format(aIndentSize, ...)` which prepend a given
number of indentation space characters before the format string.

It also harmonizes the other `Output{Item}()` methods which output an
item with a given indentation to use `aIndentSize` as the parameter
name and as the first parameter of the method.

It also simplifies the implementation of `OutputSpaces()`.
2020-11-23 16:33:39 -08:00
Abtin Keshavarzian 1cac116526 [utils] adding 'DatasetUpdater' (#5807)
This commit adds a new module `DatasetUpdater` which provides
easy-to-use APIs for user to request an update to any component (a
subset of components) in Operational Dataset of the Thread network.
The change can be requested from any node in the network. The
implementation uses `MGMT_PENDING_SET` command and takes care of
preparing the Pending Dataset and updating timestamps and monitoring
for the Dataset to be updated and possibly retrying. It reports the
outcome (success or failure status) back to the user in a callback.

This commit also updates the `ChannelManager` module is to use the
`DatasetUpdater` to change the channel.
2020-11-23 16:27:54 -08:00
Simon Lin 6af97d61b5 [mlr] implement native multicast routing for backbone router (#5793)
This commit implements native multicast routing using kernel Ip6
multicast forwarding.
2020-11-22 23:31:05 -08:00
Abtin Keshavarzian a8c869a849 [cli] small enhancements and style fixes (#5840)
This commit contains small style changes in CLI module
- Not using `a{VariableName}` style for local variables
- Harmonize the use `char *aArgs[]` as the parameter type in command
  handlers.
2020-11-22 19:50:56 -08:00
Jonathan Hui a0a3ae544b [cmake] add OT_NCP_VENDOR_HOOK_SOURCE support for RCP (#5828) 2020-11-20 18:22:45 -08:00
Yakun Xu 76022b2e55 [cli] enhance buffer info (#5831)
This commit enhances buffer info when using heap for message buffers.
2020-11-20 18:22:23 -08:00
Moandor acbd38a5f1 [posix] add radio URL parameter cca-threshold (#5832) 2020-11-20 16:01:57 -08:00
Abtin Keshavarzian 01c2f53329 [radio-spinel] verify host is connected to an RCP (#5822)
This commit addresses an issue in `RadioSpinel::Init()` to correctly
verify that device is connected to an RCP (i.e., capability list
includes `SPINEL_CAP_CONFIG_RADIO`) and if not then exit (`DieNow()`)
with `OT_EXIT_RADIO_SPINEL_INCOMPATIBLE` code.

It also simplifies the checking of capabilities for log stream support
(`SPINEL_CAP_OPENTHREAD_LOG_METADATA`) by changing the code to get and
process the `SPINEL_PROP_RADIO_CAPS` list only once from `IsRcp()`.
2020-11-19 09:28:51 -08:00
Abtin Keshavarzian 1a33e50baa [ncp-base] fix missing error checks in some property handlers (#5830)
This commit adds missing error check during parsing of the input
parameters in property handlers for `NETWORK_NAME`, `THREAD_MODE`,
`STREAM_NET_INSECURE`, and `MAC_FIXED_RSS`.

It also changes the encoding of dataset and the msg buffer counter
to ensure to check for error.
2020-11-19 09:22:14 -08:00
Jing Ma 5bd9aba799 [thread-cert] refactor case 5.2.7 using pktverify (#5786) 2020-11-17 23:01:28 -08:00
Diego Ismirlian 1d722c561e [efr32] radio: fill in rx info for received ACKs (#5818)
Currently, processNextRxPacket fills in the received frame's mRxInfo
only for non-ack packets. When a SED polls its parent, the ACK frame
is passed up to the OT core in efr32RadioProcess, but the rx info is
incorrect (it is actually the rx info for the last received non-ack
packet).

OT core uses the RSSI and LQI internally, and for applications that
don't transmit/receive data frequenty, the rx info is stale. This
commit changes this behavior, so the radio driver populates the rx
info also for ACK packets.
2020-11-17 13:48:18 -08:00
Rongli Sun e73882255f [tests] fix tun-realm-local-multicast.exp (#5821)
This commit introduces short wait time per new router
to allow link/route establishment.
2020-11-16 22:32:40 -08:00
Jing Ma 1484847c55 [thread-cert] refactor case 5.2.6 using pktverify (#5777) 2020-11-16 22:29:25 -08:00
Jing Ma 4e696af655 [thread-cert] refactor case 5.2.4 using pktverify (#5790) 2020-11-16 22:28:59 -08:00
Jing Ma 1fc75aee9c [thread-cert] refactor case 5.2.5 using pktverify (#5798) 2020-11-16 22:28:21 -08:00
Abtin Keshavarzian 9272e36f77 [toranj] use msg pool (do not use heap) in toranj config (#5820) 2020-11-16 22:26:46 -08:00
Jing Ma 580d649e97 [thread-cert] refactor case 5.3.3 using pktverify (#5809) 2020-11-16 18:10:14 -08:00
Jing Ma 503f72dfc1 [thread-cert] refactor case 5.3.4 using pktverify (#5811) 2020-11-16 17:18:23 -08:00
Jing Ma 1fc0a7be77 [thread-cert] refactor case 5.3.2 using pktverify (#5803) 2020-11-16 17:17:48 -08:00
Jing Ma 515b2bb067 [thread-cert] refactor case 5.3.5 using pktverify (#5814) 2020-11-16 08:57:36 -08:00
Jing Ma 8e705b0ada [thread-cert] refactor case 5.3.1 using pktverify (#5800) 2020-11-16 08:53:26 -08:00
Jonathan Hui b9c956174e [clang-tidy] readability-else-after-return (#5808) 2020-11-16 08:52:10 -08:00
Zhanglong Xia b7728d4ba7 [build] include project Android.mk in OpenThread Android.mk (#5804) 2020-11-15 18:44:38 -08:00
Yakun Xu 8367f00923 [memory] use heap for messages (#5792)
This commit adds an option to allow share heap memory with message
buffer pool.

For MTD, there is usually no border agent or commissioner service. This
change allows the heap for meshcop to be used by application or network
management data after the device is attached. Thus the total memory
usage can be reduced.
2020-11-12 18:37:51 -08:00
Li Cao 10086a4f56 [low-power] fix csl simulation (#5785)
On nRF platform, otPlatRadioGetNow always gets the LSB part of an
uint64_t time. However, on simulation platform, this is not the
case. So in

  if (otPlatRadioGetNow(&GetInstance()) <
    mTransmitFrame.mInfo.mTxInfo.mTxDelayBaseTime +
      mTransmitFrame.mInfo.mTxInfo.mTxDelay)

we don't get the result expected. otPlatRadioGetNow(&GetInstance()) is
a very big number on simulation platform, and mTxDelayBaseTime is the
LSB part of the rx time.
2020-11-12 10:05:11 -08:00
Moandor d06d83ef07 [github-actions] retry coverage uploading on failures (#5799) 2020-11-11 19:42:51 -08:00
Moandor 697266a522 [codecov] enable project coverage threshold (#5797) 2020-11-11 19:41:44 -08:00
Jonathan Hui ef4f33cb22 [clang-tidy] readability-inconsistent-declaration-parameter-name (#5796) 2020-11-11 10:35:36 -08:00
Zhanglong Xia 3b72401739 [nrf528xx] allow users to implement power setting functions (#5745)
When users add a FEM after the radio chip, the actual output power is
determined by both the radio chip and FEM. The radio driver only
provide a function to set the radio output power. This commit adds
macros and functions to allow users to implement the power setting
functions by themselves.
2020-11-10 17:33:57 -08:00
Jintao Lin e4bc4abff2 [posix] reduce RCP time sync log (#5791) 2020-11-10 07:22:49 -08:00
Simon Lin 312d1ed28b [posix] increase max log size (#5794)
This commit increases the OPENTHREAD_CONFIG_LOG_MAX_SIZE from 150 to
1024 for posix.
2020-11-10 07:21:19 -08:00
Diego Ismirlian 5c2ad91cff [spinel] print error on RCP reset before dying (#5784)
This commit makes ot-daemon print the RCP reset cause before exit, in
case the RCP resets unexpectedly.
2020-11-09 20:28:22 -08:00
Li Cao aeb46baa14 [mle] fix mle log MessageTypeToString (#5789) 2020-11-09 20:27:14 -08:00
Moandor 5bc7e7d6a0 [posix] add radio URL parameter fem-lnagain (#5788) 2020-11-09 10:43:46 -08:00
Yakun Xu 6fda0786ed [posix] forkpty-arg value as a single argument (#5772) 2020-11-08 23:31:11 -08:00
Rongli Sun 59b4a51f99 [tests] fix tun-realm-local-multicast.exp (#5776)
Given the linear topology in this test, this commit
introduces wait time so that the Thread Links are
synced well before ping happens.
2020-11-07 19:46:21 -08:00
Jonathan Hui 451d8827ad [clang-tidy] readability-redundant-member-init (#5781) 2020-11-07 19:45:28 -08:00
Jonathan Hui 753089865b [dhcp6-client] return error if Identity Association is not found (#5782) 2020-11-07 19:45:04 -08:00
Yakun Xu cc89e0eb20 [style] fix unused variable in release build (#5763)
assert() is not defined when NDEBUG is defined.
2020-11-06 08:20:21 -08:00
Jing Ma ebb2fd53ef [thread-cert] refactor case 5.2.3 using pktverify (#5775) 2020-11-05 21:11:05 -08:00
Jonathan Hui c35ccd83bb [clang-tidy] readability-static-accessed-through-instance (#5771) 2020-11-05 10:18:11 -08:00
Simon Lin d5ee7ddbd4 [scripts] enhance cert_suite to run multiple tests concurrently (#5586) 2020-11-05 09:04:58 -08:00
Jing Ma 014b4fbe70 [thread-cert] refactor case 5.1.4 using pktverify (#5723) 2020-11-04 20:47:02 -08:00
Jing Ma f6f76b74a3 [thread-cert] refactor case 5.1.8 using pktverify (#5739) 2020-11-04 20:45:01 -08:00
Simon Lin 1671adc736 [bootstrap] show warning but not fail when install llvm@9 failed (#5751)
This commit allows bootstrap not to fail but print warning if
installing llvm@9 or clang-format-9 or clang-tidy-9 failed. This has
been the best practice for installing other pretty tools.
2020-11-04 19:26:16 -08:00
Jing Ma 9fa2c70742 [thread-cert] refactor case 5.1.9 using pktverify (#5743) 2020-11-04 19:24:51 -08:00
Li Cao 23b921f2da [linked-list] add an overload for LinkedList::FindMatching for convenience (#5769)
This commit adds an overload version for LinkedList::FindMatching
which doesn't require prev as parameter. In many cases we don't need
to get the previous item's pointer when finding in a list. This
version would help in these cases.
2020-11-04 13:54:01 -08:00
Jing Ma 606573d134 [thread-cert] refactor case 5.2.1 using pktverify (#5770) 2020-11-04 10:46:48 -08:00
Jing Ma a698677dd4 [thread-cert] refactor case 5.1.13 using pktverify (#5766) 2020-11-04 10:42:56 -08:00
Jing Ma a60cc488df [thread-cert] add more info and tlv checks in case 5.1.7 (#5740) 2020-11-04 10:42:22 -08:00
Abtin Keshavarzian 75b3c17e89 [mle] add helper ReadFrameCounters() to read Link/MLE Frame Counters (#5762)
This commits adds a common helper method to read Link and/or MLE Frame
Counters from a message. The Link Frame Counter TLV is expected to be
present in the message. The MLE Frame Counter TLV, however, is optional
and when not present the Link Frame Counter is also used as MLE Frame
Counter value.
2020-11-04 06:52:16 -08:00
Li Cao 2dc8d711c7 [clearable] reuse clearable for some classes (#5768)
This commit applies Clearable for some classes in link_quality to
replace Reset method and enhance consistency.
2020-11-03 16:06:04 -08:00
Abtin Keshavarzian f516736763 [tlvs] new simplified model to process/append TLVs (#5755)
This commit adds template flavors of `Append<Tlv>()`, `Find<Tlv>()`,
and `Read<Tlv>()` in the common base `Tlv` class. This helps simplify
the processing and generating of TLVs in other modules and also adds
build-time type check for the value of simple TLVs (build error when
incorrect TLV Value type is used).

All `Tlv` sub-classes now inherit from `TlvInfo<kTlvType>` which
provides a constant `kType` specifying the TLV Type value. Simple TLVs
which contain a single value also track their TLV Value type by
inheriting from either `UintTlvInfo` (when their value is an integral
(unsigned int) type) or `SimpleTlvInfo` (when their value is
non-integral).

This commit also add `IsSame<A,B>()` to `TypeTraits` to check whether
two given types are the same. It also adds template flavors of
`HostSwap<IntType>()` in `Encoding` module.
2020-11-03 16:03:26 -08:00
Jonathan Hui 85477edf7b [pretty] apply clang-format-9 (#5761) 2020-11-03 07:17:05 -08:00
Jonathan Hui 0eecd1c481 [pretty] downgrade to clang-format/tidy v9.0 (#5761) 2020-11-03 07:17:05 -08:00
Jing Ma 2fb64c6055 [thread-cert] refactor case 5.1.6 using pktverify (#5730) 2020-11-02 23:34:19 -08:00
Jing Ma 5dd9aec1cd [thread-cert] refactor case 5.1.10 using pktverify (#5757) 2020-11-02 23:26:41 -08:00
Jing Ma e21864df16 [thread-cert] refactor case 5.1.12 using pktverify (#5765) 2020-11-02 23:00:52 -08:00
Jing Ma 3da49e6f8f [thread-cert] refactor case 5.1.11 using pktverify (#5756) 2020-11-02 22:59:37 -08:00
Jintao Lin f886f34d00 [low-power] use correct CslFrameRequestAhead for scheduling CSL transmission (#5764) 2020-11-02 22:06:16 -08:00
Abtin Keshavarzian abdf275126 [script] update 'make-pretty clang-tidy' to output warning/error only (#5754)
This change limits the output (when clang-tidy check fails) to error
or warning messages along with next 5 lines (remove `^|`)
2020-11-02 20:11:18 -08:00
Mason Tran 0b0d6eef1d [efr32] use -mfpu=fpv4-sp-d16 for efr32mg1x chips (#5760)
This fixes a bug where Series 1 chips are failing to boot when
compiles with arm-none-eabi-gcc version 7.2.1.
2020-11-02 09:57:57 -08:00
Simon Lin 61cf7c9a48 [dua] implement ND Proxy callbacks (#5595)
This commit:
- Add callback for Domain Prefix events
- Add callback for ND Proxy events
- Add corresponding test to verify ND Proxy works
- Some misc enhancements to the Backbone tests
  - Run sudo modprobe ip6table_filter in Docker host so that ip6tables
    works in ubuntu docker instances.
  - Use -DOTBR_REST=OFF -DOTBR_WEB=OFF for building OTBR Docker image
    since these features are not used in tests.
  - Setup radvd on Host to send Router Advertisements for the Domain
    Prefix using configuration: AdvOnLink on; AdvAutonomous off;
    AdvRouterAddr off;
  - Set sysctl net.ipv6.conf.eth0.accept_ra=2 for BBR and Host
2020-11-02 08:06:45 -08:00
Simon Lin c0cae3477a [thci] add ssh connection support on OpenThread_BR.py (#5758) 2020-11-02 07:13:27 -08:00
Jing Ma 33ea36f28e [thread-cert] refactor case 5.1.5 using pktverify (#5728) 2020-11-02 07:04:27 -08:00
Zhanglong Xia 78c6c90c6a [logging] correct the log level and region settings (#5749) 2020-11-02 06:56:48 -08:00
Yakun Xu 466ebf4d60 [ip6] allow anycast source (#5747)
This commit allows IPv6 anycast as source address given it is not
forbidden in standards.
2020-10-30 15:55:10 -07:00
Simon Lin 050129a819 [virtual-time-simulator] optimize ACK radio events (#5559)
This commit optimizes Virtual Time Simulator by only sending ACK to
nodes that are expecting it.
2020-10-30 12:28:39 -07:00
Mason Tran a6e8848a5e [efr32] call mbedtls_hardware_poll directly in otPlatEntropyGet() (#5744) 2020-10-30 11:56:59 -07:00
Rongli Sun c0a6963db9 [dua] convert to matching time unit when computation (#5750) 2020-10-30 11:52:32 -07:00
Simon Lin 903f677215 [dua] implement Backbone query and answer (#5664)
This commit implements DUA features of Thread 1.2 DUA that involves
sending and processing Backbone query and answer:

- Extend address query to the Backbone Link
  - Send BB.qry for Thread address query
  - Send ADDR_ANS.ntf for BB.ans
- DAD process
  - PBBR to send BB.qry on the Backbone link (3 times if not answered)
  - PBBR to receive and handle BB.qry and sends BB.ans
  - PBBR to receive BB.ans and sends ADDR_ERR.ntf if duplicated
- PRO_BB.ntf
  - Send PRO_BB.ntf when DUA registration is updated
  - Handle PRO_BB.ntf
- Add test_dua_dad.py to test the DAD process when it was successful
  or duplicated
  - Verify the normal DAD process
  - Verify Address Query can be extended to the Backbone link
  - Verify DAD duplicate is handled correctly
  - Verify PRO_BB.ntf for duplicated DUA is handled correctly
2020-10-30 11:18:05 -07:00
Yakun Xu ca8425d7bf [cc2538] fix a typo in energy scan (#5748) 2020-10-30 10:23:51 -07:00
Abtin Keshavarzian cc21b0bbf1 [dataset] add 'Info' and 'Components' types (#5733)
This commit adds `Dataset::Info` and `Dataset::Components` types
mirroring `otOperationalDataset` & `otOperationalDatasetComponents`
definitions and providing helper methods to get/set different fields
in the dataset.
2020-10-29 21:44:48 -07:00
Li Cao 42fb2e44be [low-power] implement forward tracking series (#5608)
This commit implements the Forward Tracking Series feature in Link Metrics.

- Two new apis are added:
  - otLinkMetricsSendMgmtRequestForwardTrackingSeries, which is used
    to send an MLE Link Metrics Management Request
  - otLinkMetricsSendLinkProbe, which is used to send an MLE Link Probe

- A new class LinkMetricsSeriesInfo is used to maintain the data of
  one Series configured by a neighbor. This class inherits
  LinkedListEntry and each Neighbor has a list of
  LinkMetricsSeriesInfo. All LinkedListEntrys are allocated and freed
  by a Pool in LinkMetrics.

- To specify SeriesFlags in cli command for Forward Tracking Series, a
  similar approach with LinkMetricsFlags is used. Another character
  flags is used to represent SeriesFlags.

- Whenever the node receives a frame (including ACK) from a neighbor,
  it would call Neighbor::AggregateLinkMetrics which goes through each
  LinkMetricsSeriesInfo entry in the neighbor's list and aggregate the
  data if the frame type matches the entry.

- Two test scripts are added to test this function:
  - v1_2_LowPower_7_2_01_ForwardTrackingSeries.py
  - v1_2_LowPower_test_forward_tracking_series.py
2020-10-29 20:04:39 -07:00
Diego Ismirlian 1586c4c628 [efr32] radio: increase FIFO size to allow handling of heavy traffic (#5742)
This commit increases the FIFO size used for storing the handles of
the data request packets that were ACKed with the frame pending bit
set.
2020-10-29 11:13:15 -07:00
Yakun Xu 0603ed1c14 [test] verify realm-local multicast on POSIX (#5738) 2020-10-29 10:37:51 -07:00
Jonathan Hui 4ac6e5509c [clang-tidy] google-explicit-constructor (#5734) 2020-10-29 08:37:31 -07:00
Jonathan Hui 8941a367a6 [clang-tidy] misc-unused-using-decls (#5732) 2020-10-29 08:36:27 -07:00
Moandor 713662bf80 [continuous-integration] use lcov to generate coverage data (#5635) 2020-10-29 08:34:37 -07:00
Abtin Keshavarzian ac33c75fce [type-traits] add 'IsPointer<Type>' and use it in message/dataset (#5735)
This commit adds a new header `common/type_traits.hpp` which provides
`IsPointer<Type>` to check whether a template `Type` is a pointer type
or not. This is then used in `Message` and `Dataset` methods where we
append/set a generic object to check (as an `static_assert`) that the
object type is not a pointer. This adds protection (causing a compile
time error) against potential incorrect use of these methods (i.e.,
passing a pointer instead of a reference to an object by mistake).
2020-10-29 08:11:16 -07:00
Jonathan Hui b22d1dc084 [posix] set default IPv6 hop limit to OPENTHREAD_CONFIG_IP6_HOP_LIMIT_DEFAULT (#5736) 2020-10-29 07:46:39 -07:00
kangping fc159a706f [net-diag] invoke the callback when failed to get the response (#5653)
This commit fixes the bug that the Network Diagnostic callback is not
called when we failed to get the response (e.g. the request
timeouted). This results in no command output in the CLI.
2020-10-28 22:13:03 -07:00
Seth Rickard 704f183914 [site] fix border router guide typo in network (#5731) 2020-10-28 15:35:30 -07:00
Li Cao e95d7b6761 [cli] update cli doc (#5729)
`s` in mode has been deprecated.
2020-10-28 08:42:16 -07:00
Jing Ma 305bdd8897 [thread-cert] refactor case 5.1.3 using pktverify (#5708) 2020-10-28 08:41:05 -07:00
Jing Ma 3e776b0c46 [thread-cert] refactor case 5.1.2 using pktverify (#5686) 2020-10-27 22:58:20 -07:00
Yakun Xu f489593824 [test] arm build with cmake 3.10 (#5727)
This commit changes the cmake version used to verify building on
arm-based platforms.
2020-10-27 22:00:20 -07:00
Jonathan Hui 7fe84c59cd [clang-tidy] google-readability-casting (#5720) 2020-10-27 21:41:37 -07:00
Jonathan Hui 5c5d5f4dd9 [clang-tidy] modernize-use-equals-default (#5719) 2020-10-27 21:07:41 -07:00
Jonathan Hui 41a73b8add [clang-tidy] readability-avoid-const-params-in-decls (#5717) 2020-10-27 21:07:13 -07:00
Jonathan Hui c91820f789 [clang-tidy] modernize-use-equals-delete (#5718) 2020-10-27 19:42:58 -07:00
Mason Tran 5173214188 [efr32] add MG21/BRD4180B support (#5725)
This adds support for efr32mg21 BRD4180B.

It also removes BSP_SERIAL_APP_PORT and
gecko_sdk_suite/v3.0/hardware/kit/common/drivers/retargetserial.c from
efr32mg13.
2020-10-27 19:42:14 -07:00
Moandor 357b1da140 [posix] fix cast-align build error on ARM (#5672) 2020-10-27 17:11:32 -07:00
Abtin Keshavarzian 9964e5ee39 [logging] add optional otPlatLogLine() & use it in NCP/CLI (#5704)
This commit adds a new platform function `otPlatLogLine()`. This
function is optional and if not implemented by platform layer, a
default weak implementation is provided and used by the OpenThread
core using `otPlatLog()`.The new function is used by OpenThread core
when the feature `OPENTHREAD_CONFIG_LOG_DEFINE_AS_MACRO_ONLY` is not
enabled (which is the default behavior). In this case, the OT core
itself will prepare a full log line.

This commit also adds implementations of the new platform function for
the NCP and CLI modules.
2020-10-27 16:59:47 -07:00
Jonathan Hui 5711151d08 [clang-tidy] readability-simplify-boolean-expr (#5716) 2020-10-27 16:03:17 -07:00
Jonathan Hui 81688a0447 [clang-tidy] modernize-use-nullptr (#5715) 2020-10-27 11:39:35 -07:00
Abtin Keshavarzian b69275f450 [dataset] add new helper 'SetTlv()' with a template 'ValueType' (#5722)
This commit also adds two specializations of the `SetTlv()` for
`uint16_t` and `uint32_t` value types where the given integral value
is `BigEndian::HostSwap()`-ed before written as the TLV value (these
specializations replace `SetUint16Tlv()` and `SetUint32Tlv()`).
2020-10-27 10:58:39 -07:00
Abtin Keshavarzian 5fb5e941cd [dataset-manager] simplify 'SendSetRequest()' (#5721)
This commit simplifies `DatasetManager::SendSetRequest()` by adding a
method to `AppendDatasetToMessage()` which uses `Dataset::SetFrom()`
method to convert a given `otOperationalDataset` to a TLV sequence
before appending it to a given message. The conversion is performed in
a new method to ensure that the stack/temporary variable `Dataset` is
released before the call to process/send the prepared message.
2020-10-27 10:33:42 -07:00
Zhanglong Xia 5300e2e28d [nrf528xx] fix SPI issue (#5703)
When the SPI is transmitting a frame, the ncp_spi sets the SPI to
transmit the second frame.  After the current frame is transmitted,
the SPI generates the END and ACQUIRED event at the same time. The
SPI driver processes the ACQUIRED event first and then the END event.
The ACQUIRED event notifies the up layer to set the SPI GPIO interrupt
pin. The END event notifies the up layer that the transmission has
completed. Because the SPI tx/rx buffer variables in the `spi_slave.c`
has been updated to the second frame buffer. The ncp_spi thinks that
the second frame has been transmitted in the END event. Then the second
frame is lost.

This CL processes the END event first then ACQUIRED event. To avoid
the cached frame buffer variables are passed to the ncp_spi, the SPI
driver gets the frame buffers directly from the SPI buffer registers.
2020-10-27 09:26:06 -07:00
Jonathan Hui cabb859e5a [clang-tidy] modernize-use-bool-literals (#5714) 2020-10-27 09:17:39 -07:00
Yakun Xu d1981e04ae [cmake] no target_link_options in cmake 3.10 (#5706) 2020-10-27 09:00:02 -07:00
Li Cao 3fd161e4d4 [low-power] enhance CSL transmission on NRF52840 using transmit_at (#5545) 2020-10-27 08:26:34 -07:00
kangping 3de6b9a86a [build] fix warning of clearing non-trivial type (#5710) 2020-10-27 08:10:56 -07:00
Simon Lin 8707b63894 [scripts] add MLR Backbone multicast routing test (#5578)
- backbone/test_mlr_multicast_routing.py verifies the basic features
  of Backbone multicast routing

- backbone/test_mlr_multicast_routing_timeout.py verifies that MLR
  timeout works

- backbone/test_mlr_multicast_routing_commissioner_timeout.py verifies
  that Commissioner MLR timeout works
2020-10-26 22:46:48 -07:00
Jintao Lin 12b967cce2 [mlr] fix build when OPENTHREAD_CONFIG_IP6_SLAAC_ENABLE is disabled (#5711) 2020-10-26 09:19:54 -07:00
Yakun Xu 9cfe25993a [cmake] use init flags in toolchain files (#5705)
From https://cmake.org/cmake/help/v3.10/variable/CMAKE_LANG_FLAGS_INIT.html,
`CMAKE_<LANG>_FLAGS_INIT` should be used instead of `CMAKE_<LANG>_FLAGS' in
toolchain files so that CMake can prepend or append content based on the
environment or target platform.
2020-10-26 08:24:45 -07:00
Yakun Xu de34f75b58 [cmake] set default build type to Debug (#5709) 2020-10-26 08:17:31 -07:00
Jing Ma 7b18147e03 [thread-cert] refactor case 5.1.1 using pktverify (#5680) 2020-10-26 08:16:51 -07:00
Rongli Sun 7a24666bf4 [posix] fix udp close (#5690) 2020-10-25 21:05:59 -07:00
Mason Tran fbcc9a662b [efr32] remove sTxPowerDbm and use RAIL_GetTxPowerDbm() (#5701) 2020-10-25 18:21:41 -07:00
Jonathan Hui 38fb6dbdb8 [cmdline-parser] avoid casting -INT32_MIN directly to int32_t (#5702)
Fixes the following error:

utils/parse_cmdline.cpp:230:28: runtime error: negation of -2147483648
cannot be represented in type 'int32_t' (aka 'int'); cast to an
unsigned type to negate this value to itself
2020-10-25 18:19:52 -07:00
Mason Tran 7fccf3840e [efr32] use OT_PLAT_RESET_REASON_OTHER for brown-out/EM4 reset (#5699) 2020-10-25 18:19:28 -07:00
Mason Tran 72d3ebb54b [efr32] disable OT software CSMA backoff and energy scan (#5700) 2020-10-25 18:16:22 -07:00
Simon Lin f192c6dd00 [posix] fix MLE sends ICMPv6 destination unreachable (#5585) 2020-10-23 11:07:34 -07:00
Jiacheng Guo 7a2ce9e93d [api] check on prefix length when slaac is enabled (#5530) 2020-10-23 10:40:03 -07:00
Diego Ismirlian 96fa787d05 [efr32] avoid asserts during data requests (#5697)
If the RAIL interrupt fires late (for example, when the MCU is heavily
loaded), then RAIL_IEEE802154_GetAddress and
RAIL_IEEE802154_SetFramePending return RAIL_STATUS_INVALID_STATE
because it is too late to modify the outgoing Immediate ACK. The
proposed solution is to avoid asserting and print a warning to make
the user aware of such problems.
2020-10-23 10:31:15 -07:00
Yakun Xu deb36032cf [posix] ignore unexpected host netif state notification (#5691) 2020-10-23 10:26:54 -07:00
Simon Lin de6d0e883e [style] clang-tidy misc enhancements (#5695)
This commit introduces misc clang-tidy enhancements:
- Avoid creating symlinks in /usr/bin directory
- Search for clang-tidy-10 executables
- Fix potential bootstrap fail: permission denied in /opt directory
2020-10-23 10:25:55 -07:00
Simon Lin e00e5b3d70 [backbone-router] backbone TMF enhancements (#5660)
This commit enhances Backbone TMF:

- Subscribe Backbone TMF on multicast addresses on the Backbone
  interface
  - All Network BBRs Multicast Address
  - All Domain BBRs Multicast Address

- Thread Netif no longer subscribe these two addresses, because BBR
  Multicast Addresses are only defined for the Backbone Link in Thread
  Spec 9.4.8.1

- Make sure backbone messages are using link local src addresses
  - Verify src addr for b/bmr messages
2020-10-23 08:48:54 -07:00
Yakun Xu f83d1ff999 [cmake] add external platform support (#5693)
This commit adds external platform support into cmake build system.
2020-10-23 07:23:00 -07:00
Jintao Lin aaf553ee7d [spinel] use OT version rather than MAC config in radio spinel (#5683) 2020-10-22 21:33:00 -07:00
Abtin Keshavarzian 50f9881a19 [spinel-interface] add config option to change the rx frame buffer size (#5687)
Adds `OPENTHREAD_CONFIG_PLATFORM_RADIO_SPINEL_RX_FRAME_BUFFER_SIZE`
config option which specifies the rx frame buffer size used by
`SpinelInterface` in RCP host (posix) code. This is applicable/used when
`RadioSpinel` platform is used.
2020-10-22 21:29:04 -07:00
Yakun Xu a04b6ea753 [cc2538] add energy scan (#5681)
This commit provides a simple energy scan implementation on CC2538
platform.
2020-10-22 10:43:30 -07:00
Jonathan Hui cf5f5ee08b [clang-tidy] apply readability-make-member-function-const (#5675) 2020-10-22 10:36:59 -07:00
Jonathan Hui 700ef9fe93 [script] add clang-tidy check and fix (#5675) 2020-10-22 10:36:59 -07:00
Yakun Xu 3d189a10ce [nrf528xx] fix typo of return value in otPlatSpiSlavePrepareTransaction (#5682) 2020-10-22 08:21:00 -07:00
Yakun Xu ff76aac3db [cli] add energy scan channel (#5677) 2020-10-21 12:17:28 -07:00
Abtin Keshavarzian 8787cc106c [logging] update OT logging (use functions) (#5674)
This commit updates and enhances OT logging by implementing some of
more common operations as functions (instead of macros) and preparing
the entire log line (appending log level and/or log region to the log
string if the corresponding OT config options are enabled) before
passing it to platform layer.

The OT logging previously used macro definitions all the way to
platform layer call to `otPlatLog` (which itself can be defined as a
macro through an OT config). This model was adopted to address a
restriction/requirement on certain platforms (e.g., platforms that
required to enable/use log tokenization). However, using macros adds
an overhead on all other platforms that do not have such a
requirement.

This commit adds `OPENTHREAD_CONFIG_LOG_DEFINE_AS_MACRO_ONLY` which
when enabled (set to 1) keeps the implementation as before (i.e.,
macros are used in the logging module). By default this is disabled
which enables the new implementation added from this commit.

This commit also adds `OPENTHREAD_CONFIG_PLAT_LOG_MACRO_NAME` which
replaces the previous `OPENTHREAD_CONFIG_PLAT_LOG_FUNCTION_NAME`. This
config is used to override the `otPlatLog` and define it as a macro. A
build-time check is added in the `config-check.h` to help any project
that is integrating OT and may be using the macro name override
behavior to detect the change from this commit and update its config
definitions.

Finally, this commit updates `check-simulation-build-autotools` script
to add a build with `OPENTHREAD_CONFIG_LOG_DEFINE_AS_MACRO_ONLY`
enabled.
2020-10-21 12:16:53 -07:00
Abtin Keshavarzian 5f956cfe95 [notifier] define 'kEventStrings[]' as const pointer (#5673) 2020-10-21 12:06:00 -07:00
Mason Tran 968440da34 [efr32] common platform abstraction layer (#5666)
This merges the PAL sources for all efr32-based platforms.
2020-10-21 12:04:27 -07:00
Abtin Keshavarzian dcebe97f82 [border-agent] misc enhancements (#5663)
This commit contains smaller enhancements in `BorderAgent` module

- define `ForwardContext` as a private sub-type of BorderAgent
- change `ForwardContext` to be `InstanceLocatorInit` and avoid
  `new` (use `Init()`)
- add `HandleCoapResponse()` method which is called from `static`
  method `HandleCoapResponse()`.
- convert file `static` functions `SendErrorMessage()` to `BorderAgent`
  methods
- Add `State` enum and inline/remove `SetState()`.
- Smaller style/documentation fixes (e.g., remove unnecessary `{ }`).
2020-10-20 11:17:08 -07:00
Abtin Keshavarzian d98f935131 [cmake-build] ensure cc2538 uses 'CMAKE_BUILD_TYPE=Release' (#5669)
This change ensures the cc2538 cmake build uses the release build type
and the compile option `-Os` (optimize for size). This harmonizes the
cmake build with automake version. It also helps address an issue with
recent PRs failing on cc2538 cmake build with arm-gcc-5 due to
reaching flash size limit (without `-Os` option).
2020-10-19 21:54:45 -07:00
Jonathan Hui a740350c5c [bootstrap] use sudo when creating arm symlinks (#5668) 2020-10-19 21:20:40 -07:00
Abtin Keshavarzian 80d4cb01f7 [notifier] simplify 'EventToString()' (#5657)
This commit changes `EventToString()` to use an array instead of
`switch`. This helps with code size due to enumerator cases being
`uint32_t` bitmask values and therefore compliers may not be able to
optimize the `switch` statement as a table.
2020-10-19 10:25:07 -07:00
Abtin Keshavarzian 7b570c7fc1 [notifier] signal change to active or pending Operational Dataset (#5657) 2020-10-19 10:25:07 -07:00
Abtin Keshavarzian 7011a12e9a [coap] add helper method 'Message::SetTokenFromMessage()' (#5661)
This commit adds a new helper method to set the token on a CoAP
`Message` by copying it from another `Message`. It also renames the
method which generates a random token of a given length to
`GenerateRandomToken()`.
2020-10-19 10:15:12 -07:00
Abtin Keshavarzian e48a1ff980 [dataset-manager] misc enhancements (#5655)
This commit contains miscellaneous smaller enhancements in
`DataseManager` module:

- keep `public`, `protected` `private` definitions in this order
- add helper `GetType()`, `IsActiveDataset()`, `IsPendingDataset()`
- use `Read()` helper  instead of `mLocal.Read()`
- remove unused definitions of `HandleUdpReceive()`
- remove `mUriGet`, `mUriSet`, and determine them based on the
  dataset type (active/pending).
- re-order member variables to help with packing
- update method documentations
2020-10-16 12:38:59 -07:00
Simon Lin 913037b508 [simulation] add configuration MAX_NETWORK_SIZE (#5565)
Currently, the WELLKNOWN_NODE_ID = 34 is not properly defined.

- In virtual time simulation, WELLKNOWN_NODE_ID limits the number of
  ports each PORT_OFFSET can occupy. The virtual time simulator
  listens at the nodeid=0 port rather than nodeid=34 port. So, there
  is no such thing as wellknown node ID in virtual time simulation.

- In real time simulation, the sniffer listens at the nodeid=34
  port. This PR changes it to nodeid=0 port to be consistent with
  other parts.

- In posix virtual time, the simulator listens at the nodeid=0
  port. So, there is no such thing as wellknown node ID in Posix
  virtual time.

This commit changes it to MAX_NETWORK_SIZE = 33 and make it
(configuration OPENTHREAD_SIMULATION_MAX_NETWORK_SIZE) configurable in
simulation by:

- Makefile configuration: MAX_NETWORK_SIZE
- Cmake configuration: OT_SIMULATION_MAX_NETWORK_SIZE
2020-10-16 10:57:03 -07:00
Abtin Keshavarzian 92078815f5 [lib-url] update 'Makefile' to include 'src/core' in header path search (#5659)
The `url.cpp` can use core header files (e.g. `common/core_utils.hpp`)
This change ensure the core header files should be able to see each
other (e.g., `code_utils.hpp` including `arg_macros.hpp`).
2020-10-16 08:07:16 -07:00
Abtin Keshavarzian c9c0cf404d [code-utils] enhance 'VerifyOrExit' to make action optional (#5659)
This commit uses the newly added macros from `arg_macros.hpp` to
enhance `VerifyOfExit()` enabling `aAction` argument to be optional.
2020-10-16 08:07:16 -07:00
Kevin Schoedel 8691e90d55 [autoconf] remove bashisms from configure.ac (#5658)
The `configure` script runs with `#!/bin/sh`, but actually required
bash. POSIX sh does not have either the `function` keyword or pattern
replacement in variable subsititutions.
2020-10-16 06:19:04 -07:00
Simon Lin 85ea871a7e [otns] emit COAP send/receive events to OTNS (#5656) 2020-10-16 06:16:32 -07:00
Abtin Keshavarzian eb6874c307 [logging] update logging to use new helper macros (#5650) 2020-10-16 06:10:06 -07:00
Abtin Keshavarzian 05b71b9dc2 [common] macros to get first/second/rest of variadic arguments (#5650)
This commit adds three macros in a new header `arg_macros.hpp`
`OT_GET_FIRST()`, `OT_GET_RESET(...)`, and `OT_GET_SECOND()`. These
macros help with parsing variadic arguments passed to a function/macro
and can handle the case where variadic macro arguments is empty
without requiring toolchain specific behavior/support. This commit
also adds a unit test `test_macros` for the newly added macros.
2020-10-16 06:10:06 -07:00
Moandor 5c7850ebe5 [continuous-integration] kill ot-rcp and ot-cli in pty check (#5654)
This adds kill commands to POSIX pty check, to make sure all processes
are stopped before the check completes.
2020-10-15 08:01:31 -07:00
Jiacheng Guo fdb9e43fa0 [cli] add context for the user commands (#5587)
This makes using a class method as the cli handler easier.
2020-10-15 07:58:37 -07:00
Simon Lin 54b8d29e8f [thread-cert] turn off OTBR NAT64 in 1.2 Backbone tests (#5652)
This commit fixes random fails in Thread 1.2 Backbone tests that uses
OTBR Docker.

The fails are caused by failing to start tayga service when there are
many OTBR Dockers running.  This commit turns off NAT64 feature of
OTBR in 1.2 Backbone tests to avoid this issue since NAT64 is not
useful for Backbone tests.
2020-10-15 07:38:19 -07:00
Jintao Lin c416b72cb6 [low-power] add an Enh-ACK frame link layer counter (#5583)
On the transmitter side, only maintain a single frame counter, and
never reuse it.

On the receiver side, maintain a second incoming frame counter eFC
alongside FC for each device, where eFC >= FC >= 0. When an Enh-ACK is
received, verify it against eFC. Update eFC to be equal to the
received frame counter. Do not touch FC. When a frame other than
Enh-ACK is received, verify it against FC. Update both eFC and FC to
be equal to the received frame counter.
2020-10-15 07:36:51 -07:00
Jing Ma c2903713a1 [thread-cert] refactor case 9.2.12 and 9.2.13 using pktverify (#5442) 2020-10-14 12:23:55 -07:00
Simon Lin 946a90520c [coap] allow max URI path length (#5645)
- allow max URI path length of 32
- change error to OT_ERROR_PARSE (used to be OT_ERROR_NOT_FOUND)
2020-10-14 12:17:45 -07:00
Jing Ma 487ec3aa94 [harness-automation] update readme (#5646)
Update latest supported Test Harness version in README file.
2020-10-14 10:16:13 -07:00
Li Cao 8e7d775448 [common] use non-copyable for more instance-unique classes (#5639)
This commit applies NonCopyable for more classes that has unique
object in an Instance.
2020-10-14 07:19:45 -07:00
Yakun Xu c595ee6c36 [linux] fix missing correct mtu (#5642)
Set correct MTU so that big IPv6 datagrams can automatically be fragmented
by host IP stack.
2020-10-14 07:17:40 -07:00
Jeff Bumgardner ad87f636e5 [docs] update Doxygen menu (#5641)
- Remove the Platform BLE module
- Add the Link Metrics module
2020-10-14 07:15:20 -07:00
Jing Ma 690ddbf881 [thread-cert] enhance case 5.6.7 for data version increment (#5643) 2020-10-13 22:40:57 -07:00
Seth Rickard 9d4cff48dc [cc1352,cc2652] add check before claiming transmit done (#5640)
Check the global state in the radio when an ack frame is found before
reporting a transmit was completed. This change avoids the case where
an acknowledgment frame from another transmission is mistaken for our
acknowledgment frame.
2020-10-13 09:37:44 -07:00
Jintao Lin eee652cc9e [cli] add command to set/get external FEM's LNA gain (#5563) 2020-10-13 08:12:14 -07:00
Yakun Xu d0d2b71af3 [ip6] no anycast as source address (#5632)
- Check source address of packets from users
- Determine anycast address by MLE API for accuracy
- Replace anycast address with a valid unicast address when sending
  with platform UDP in UDP layer
- Replace anycast address with a valid unicast address in IP layer
2020-10-13 08:10:29 -07:00
Jiacheng Guo 831406ce90 [debug] prefer user provided assert to system assert (#5624)
This allows users to enable OT_ASSERT in release builds on posix systems.
2020-10-13 08:09:05 -07:00
Abtin Keshavarzian 5ac1fbeade [indirect-sender] remove existing supervision msg on new msg add (#5638) 2020-10-12 21:25:15 -07:00
Moandor ee6ffd7e10 [cmd-parser] remove dependency of <limits> (#5636)
We don't have C++ STL on some platforms, so this replaces it.
2020-10-12 20:52:54 -07:00
Jeff Bumgardner 5716ff40d7 [docs] update BBB guide formatting (#5637)
Fixing a few formatting things I should've caught when reviewing the
update to the BBB guide:
- The callouts should only have a single > on the first line
- The ### within a code block was causing issues with my import
  script... easier to just change them to a single #
2020-10-12 17:50:27 -07:00
Yakun Xu b668394871 [posix] map address with rtnetlink API on Linux (#5629)
* no DAD for anycast address.
* add anycast address as non-preferred address.
* update address callback to provide more address info.
2020-10-12 08:26:54 -07:00
Yakun Xu 9e3b450218 [expect] refactor common functions (#5634)
* unify node creating and destroying
* simplify switching between nodes
2020-10-12 08:21:48 -07:00
Yakun Xu c8ba04702c [bootstrap] fix link to clang-format-10 (#5633) 2020-10-11 23:16:15 -07:00
Simon Lin 8642f998cc [thread-cert] set node addr64 to EXTENDED_ADDRESS_BASE + nodeid (#5601)
This commit sets nodes' extaddrs to 0x166e0a0000000000 + nodeid, which
does not change node behavior but makes it easier for us to analyze
pcaps.
2020-10-11 23:02:29 -07:00
Jing Ma f01f4d96a3 [thread-cert] refactor case 9.2.7 using pktverify (#5459) 2020-10-11 16:26:13 -07:00
Jing Ma d2d4df6260 [thread-cert] refactor case 5.5.3 using pktverify (#5448) 2020-10-11 16:25:32 -07:00
Rongli Sun d5cc6edc2c [tests] init joiner with different masterkey before start (#5626)
For 8.x.x, there is validation that joiner has the same keys as the
commissioner after commissioning, it should be configured with a
different master key before start commissioning.
2020-10-11 11:09:40 -07:00
Jonathan Hui c3dea5abf7 [cmake] avoid recompiling common sources multiple times (#5623) 2020-10-11 11:09:01 -07:00
Jonathan Hui 84097f706a [cmake] replace mbedcrypto with ${OT_MBEDTLS} (#5622) 2020-10-11 11:08:43 -07:00
Jonathan Hui 115e04f435 [cmake] add build options for FTD, MTD, and RCP (#5622) 2020-10-11 11:08:43 -07:00
Abtin Keshavarzian 4cbe122352 [toranj] add new test-case covering joiner-router behavior (#5621)
This commit adds a new test-case in `toranj` to cover MeshCoP and
joiner-router behavior.
2020-10-11 11:08:20 -07:00
Jing Ma 1f10fe814f [thread-cert] enhance case 9.2.4 to avoid reverifying coap retransmission packets (#5614)
Replace must_verify with filter to avoid possible verification of coap
retransmission packets which could cause filter incorrect packets.
2020-10-11 10:47:07 -07:00
Li Cao a4368909ff [low-power] add cli command macsend for certification (#5573)
This command allows an Rx-Off-When-Idle device to send an empty mac
data frame or mac datarequest to its parent. This command is only used
for certification.
2020-10-11 10:46:20 -07:00
Jonathan Hui a06bba9d1e [codecov] disable project coverage threshold (#5631)
Coverage reporting by codecov.io seems unstable. For example, it is
not respecting LCOV_EXCL_START/STOP. Disable until we figure out the
issue.
2020-10-11 09:31:31 -07:00
Li Cao fa57212b82 [cli] add cli command to control child supervision (#5620) 2020-10-09 08:36:39 -07:00
Rongli Sun 893e7c00db [commissioner] specify src for c/tx (#5625) 2020-10-09 08:34:35 -07:00
Abtin Keshavarzian 4b3b37c312 [cmd-parser] adding helper 'ParseAs{Type}' function (#5607)
This commit adds new helper functions under `Utils::CmdLineParser` to
parse a given ASCII string as different simple types, namely signed or
unsigned integers of different bit lengths (`uint8/16/32/64`, and
`int8/16/32`). The new functions validate that the parsed value fits
within the supported range of the expected int type. This commit also
adds different flavors of `ParseAsHexString()` to parse a hex string
into sequence of bytes (with fixed/known size or unknown size allowing
or disallowing truncation). It also moves the parse related methods
(like `ParseAsIp6Prefix`) from CLI modules in `CmdLineParser`.

The CLI modules are then updated to use the new `ParseAs{Type}`
functions simplifying the code and adding extra checks when parsing
the CLI input.

Finally, this commit adds a unit test `test_cmd_line_parser` verifying
the behavior of new `ParseAs{Type}()` functions.
2020-10-08 10:28:38 -07:00
Abtin Keshavarzian 41f7cba459 [logging] update 'otDump' to use 'ot::String' (#5618) 2020-10-08 08:23:33 -07:00
Abtin Keshavarzian f6d1ffeffe [cli] replace 'PRIx64' use (#5615) 2020-10-08 07:25:22 -07:00
Jonathan Hui 18344b1cb2 [scan-build] update to clang-tools-10 (#5617) 2020-10-07 21:18:04 -07:00
Jonathan Hui 58b0486bcd [clang-format] update to clang-format-10 (#5616) 2020-10-07 21:17:44 -07:00
Seth Rickard 061806620a [docs] update BeagleBone setup guide (#5606)
Added language to show how to replace Connman with Network Manager to
enable the default setup scripts.

Added pointers on setting up a WiLink 8 module for Wi-Fi AP
development.

Removed explanation of downloading and flashing the BeagleBone image
in favor of linking to the public BeagleBone documentation.

Removed explanation of expanding and truncating the filesystem in
favor of using the helper tool from BeagleBone.
2020-10-07 18:11:31 -07:00
Jonathan Hui 5806432619 [script] fix arm-gcc toolchain install on ubuntu (#5613) 2020-10-07 12:19:46 -07:00
Jonathan Hui 0bc366a78d [github-actions] fix expect check (#5610)
Add `apt-get update` before `apt-get install`.
2020-10-06 18:07:25 -07:00
Abtin Keshavarzian e0bc277ccb [ip6] use 'Get<Filter>()' (remove unnecessary namespace) (#5605)
This commit also fixes warning error with unused returned `otError`
value when calling `RemoveUnsecurePort()`.
2020-10-04 16:28:33 -07:00
Abtin Keshavarzian 1f40793255 [message] add new flavors of Read/Write/Append/Prepend methods (#5604)
This commit adds new helper methods in `Message` class. It adds new
template methods to allow an object (of any type) to be read from or
written/appended/prepended to the message. The `Read<ObjectType>()`
method returns a parse `otError` if there are not enough bytes
remaining in the message to read the entire object.

The template methods are used in other core modules which help
simplify the code (there is no need to specify the template type since
it can be deduced by the complier from the passed-in argument). Also
since the template methods directly use the `sizeof` the object type,
they help reduce the chance of incorrect use (using incorrect
read/write length when calling the method).

This commit also updates and renames the methods which read/write raw
bytes from/to the message to `ReadBytes()`/`WriteBytes()`. The order
of parameters in these methods are changed to follow the common
pattern used by other modules and the OT public APIs (i.e., the
pointer to the buffer is given first, followed by its length).
2020-10-03 08:28:42 -07:00
Abtin Keshavarzian 0becde2952 [cli] add new helper 'ParseIp6Prefix()' (#5603) 2020-10-03 08:28:13 -07:00
Abtin Keshavarzian 4db030c6c9 [utils] adding 'LookupTable' class and use it in CLI (#5602)
This commit adds `LookupTable` module which provides helper methods to
perform binary search in a generic sorted lookup table for specific
entry matching a given name string. It also provides `constexpr`
methods to check (at build-time) whether a lookup table array is
sorted. This commit also updates CLI modules to use the `LookupTable`
methods for command lookup. It also adds a unit test for the lookup
table.
2020-10-02 17:35:35 -07:00
Jeff Bumgardner 946141ed32 [docs] add source for BeagleBone Black guide (#5593)
The end formatting on openthread.io will be different (many step lists
removed and some text shifted around).

Also updated the Style Guide to add a Contributor tag section.
2020-09-30 18:41:58 -07:00
Piotr Koziar b3c21f086c [nrf_security] use vanilla mbedtls only for AES (#5596)
* removed CC310 backend for AES in nrf_security module
* removed crypto glue libraries that become unnecessary
2020-09-30 08:52:07 -07:00
Simon Lin 809947e1f9 [mlr] send BMLR.ntf on Backbone link (#5388)
This commit enhances Backbone Router to send BMLR.ntf on the backbone
link for Multicast Listeners.
- Send BMLR.ntf to the Backbone link
- Add Backbone test with packet verification
- Includes some revision to the Thread 1.2 Backbone CI scripts to make
  it more stable
2020-09-29 22:37:33 -07:00
Jing Ma aa6abe1535 [thread-cert] enhance case 9.2.18 for SED packet order (#5584)
Copy the pkt to verify Step 13 and Step 14 SED packets since the
packets could be in front of the packet in Step 12.
2020-09-29 22:36:16 -07:00
Jonathan Hui 13d2de89d2 [cli] do not pass user-controlled input as format string (#5599) 2020-09-29 21:12:21 -07:00
Simon Lin 32ffa64902 [github-actions] use docker/setup-buildx-action@v1 (#5600) 2020-09-29 19:52:39 -07:00
Jing Ma 01d17c609b [thread-cert] enhance case 9.2.10 for MED packets order (#5598) 2020-09-29 19:47:41 -07:00
Jing Ma 318b688539 [thread-cert] enhance case 5.6.6 for potential SED packet out-of-order (#5597) 2020-09-29 19:47:10 -07:00
Jing Ma 68673aa52c [thread-cert] enhance case 9.2.4 (#5590)
Extend the mgmt set simulation execution and waiting time for
potential miss-catching packets.
2020-09-29 19:46:21 -07:00
Jonathan Hui dc9b032dad [mle] remove secure data request mode bit (#5560)
- Always set to 1 on transmission.
- Always ignore on reception.
2020-09-29 15:30:37 -07:00
Abtin Keshavarzian 1f834a56c5 [cli] add 'OutputExtAddress()' helper method (#5591)
This commit also adds a template version of `OutputBytes()` which
accepts a reference array of a specific length. This helps simplify
the calls to this helper method where the array length can be
inferred. It also changes the code to use `OutputBytes()` for
outputting master key, pskc, xpanid, etc.
2020-09-29 06:51:44 -07:00
Mason Tran f45b588e11 [linked-list] fix spelling for Indicator typename (#5592) 2020-09-28 19:49:01 -07:00
Abtin Keshavarzian 6b6a3b8f74 [cli] style fixes and smaller enhancements (#5581)
This commit contains a group of style fixes and smaller enhancements
in CLI modules:
- Remove unnecessary `struct` when declaring variable.
- Remove use of single `"%s"` in `Output` methods.
- Fix order of `#include` headers.
- Remove unnecessary use of `OT_UNUSED_VARIABLE`.
- Remove unnecessary temp variables and casts.
- Add comments to `#endif` directives than are more than  than 20
  lines away from the corresponding `#if` they are associated with.
2020-09-28 17:28:06 -07:00
Moandor 3d22a37267 [continuous-integration] fix API change detector (#5589) 2020-09-28 08:29:50 -07:00
Simon Lin 81996b0f3b [dua] handle coap error code for DUA.rsp (#5523)
- Configure next response to 5.00 for Reference Device
- Handle 5.00 (and other COAP error codes) in DUA.rsp (required by 1.2
  Test Spec)
- Update DUA test to handle COAP code 5.00
2020-09-27 22:30:15 -07:00
Simon Lin 6c6d5f6179 [scripts] fix test_route_table.py fails by chance (#5580) 2020-09-27 18:47:49 -07:00
Simon Lin fad92841e7 [dua] handle AddressError (#5516)
This commit enhances DUA feature to handle Address Error by increasing
the DAD counter and generating new DUA address if a DUA conflict is
detected.
2020-09-27 11:32:33 -07:00
Simon Lin f013a30409 [pktverify] verify offline test info (#5525)
This commit allows running packet verification on a test info (.json)
directly without running the test procedure, which can be helpful for
developing and debugging packet verification code.
2020-09-27 11:22:49 -07:00
Simon Lin efccfe2252 [scripts] fix test_route_table.py (#5558) 2020-09-26 20:22:50 -07:00
Li Cao dc94758e84 [low-power] implement link metrics - single probe (#5481)
This commit is the first part in link metrics. It implements single
probe function.

An overview of major changes:
- Add link metrics apis which allow apps to send a single probe and
  set report callback.
- Add cli commands for calling link metrics api and related README
  doc.
- Add a new module link_metrics to implement the query process and
  handle the report.
- Add related tlv types.
- Add simple script test to run single probe process.
2020-09-25 09:50:09 -07:00
Moandor 88c976e3f7 [codecov] only post coverage check statuses to PRs (#5575) 2020-09-25 07:46:52 -07:00
Simon Lin 81b71a2d27 [github-actions] fix thread-wireshark missing (#5577) 2020-09-25 06:51:09 -07:00
Simon Lin cd80f94a81 [reference-device] send fake ADDR_NTF.ntf (#5537) 2020-09-24 20:31:25 -07:00
Simon Lin ce336257ee [thread-cert] Thread 1.2 CI with OTBR and Backbone link (#5489)
Thread 1.2 CI with OTBR and Backbone link:
- Run OTBR in Dockers with Backbone link
- Enhance node.py to work with OTBR Docker
- Add Packet Verification for 5.11.1
  - incomplete, some steps can not pass yet, just to make sure
    Backbone traffic verification works
- Support running multiple tests simultaneously (default: each test
  run 3 instances)
- Build OTBR Docker using OpenThread PR code
- Upload code coverage in Docker

Some implementation details:
- Most existing code of node.py is shared by OTBR Docker
- Backbone related test scripts are found in
  tests/scripts/thread-cert/backbone
- A new script tests/scripts/thread-cert/run_bbr_tests.py is added to
  manage multiple running tests
- Test configuration differs according to PORT_OFFSET
  - Backbone interface name: Backbone{PORT_OFFSET}
  - Backbone network prefix: 91{PORT_OFFSET:02x}::/64
  - Docker instance name: otbr_{PORT_OFFSET}_{nodeid}
  - Output Files:
    - Pcap:
      - Thread: {test_name}_{PORT_OFFSET}.pcap
      - Backbone: {test_name}_{PORT_OFFSET}_backbone.pcap
      - Merged: {test_name}_{PORT_OFFSET}_merged.pcap
    - Log: {test_name}_{PORT_OFFSET}.log
2020-09-24 20:16:27 -07:00
Simon Lin 2daa097bb4 [github-actions] run Thread 1.1 cert tests for 1.2 build (#5547)
This commit runs Thread 1.1 certification tests with packet
verification for 1.2 build because Thread 1.2 certified devices are
supposed to be able to pass Thread 1.1 certification first.

Note: changes to test TOPOLOGY:
- Original: nodes use version=1.1 by default
- Now: nodes use version according to ENV, except explicitly specified
2020-09-24 19:13:30 -07:00
Abtin Keshavarzian 83072bb012 [message] add helper macros to free message (on error) (#5555)
This commit adds macros `FreeMessage()`, 'FreeMessageOnError()' and
`FreeAndNullMessageOnError()` which would free a given `Message`
pointer if not `nullptr` (conditionally on an `otError`).

These macros implement small yet common code patterns used in many of
the core modules. They are intentionally defined as macros instead of
inline methods/functions to ensure that they are fully inlined. Note
that an `inline` method/function is not necessarily always inlined by
the toolchain, and not inlining such small implementations could add a
rather large code-size overhead.
2020-09-24 13:06:17 -07:00
Jeff Bumgardner 5ed9081142 [docs] add style guide for documentation contributions (#5567)
Now that we have a process in place where openthread.io can source
documentation from GitHub, we need a documentation style guide to
ensure that the format of docs here on GitHub meet the format
requirements for hosting on openthread.io.
2020-09-24 11:57:36 -07:00
Diego Ismirlian ba5231237c [script] fix output when no arguments are specified (#5551)
When no arguments are provided to script/test, the script prints $1:
unbound variable and exits without printing the usage
information. This is due to the set -u at the top.

This commit has a small fix so that this usage is presented with the
usage information. Also, it prints an error when it detect an unknown
command.
2020-09-23 18:48:37 -07:00
Li Cao f77c5d4653 [thread-cert] add low power case 6_1_07 (#5557) 2020-09-23 08:33:50 -07:00
Jintao Lin 9a6a9122db [gn] add missing files to BUILD.gn (#5564) 2020-09-22 23:28:48 -07:00
Michael Spang aaad03522b [style] fix warnings -Wextra-semi (#5566) 2020-09-22 18:02:47 -07:00
Jing Ma f787275eee [thread-cert] refactor case 9.2.4 using pktverify (#5412)
1. add timestamp parse and check
2. add leader aloc parse and check
2020-09-22 09:41:39 -07:00
Moandor b5cc12c92c [meshcop] include logging.hpp for helper function 'LogError()' (#5562)
LogError() uses otLogWarnMeshCoP(), which was included by
thread/thread_netif.hpp -> meshcop/joiner.hpp -> common/logging.hpp.
thread_netif.hpp includes joiner.hpp only if OT_JOINER=ON, so the
build would fail if OT_JOINER=OFF.

This commit fixes the above.
2020-09-21 23:06:43 -07:00
Zhanglong Xia d38859c963 [cli] fix compile warning (#5552)
Fix compile warning: "OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE"
is not defined, evaluates to 0 [-Wundef]
2020-09-21 20:14:13 -07:00
Simon Lin 1d8e4da7f7 [ot-ctl] auto reconnect session (#5466)
- ot-ctl automatically reconnect session when disconnected
- add test for reset/factoryreset
2020-09-21 19:44:50 -07:00
Moandor d29c2c6077 [continuous-integration] add code coverage threshold (#5283)
The overall coverage must not drop more than 1% against the parent
commit.
2020-09-21 19:43:22 -07:00
Simon Lin 1d0af0d202 [thci] support network name with space for wpanctl (#5515) 2020-09-21 19:42:23 -07:00
Jonathan Hui efde29d3ed [mac] only apply neighbor check when key id mode is 1 (#5550)
Allows receiving a Joiner Entrust message even after the device has
been commissioned.
2020-09-21 08:49:19 -07:00
Jonathan Hui 0683f78e17 [cli] service and server data as hex-encoded binary values (#5556) 2020-09-21 08:46:50 -07:00
Diego Ismirlian f974f38155 [cli] implement setting/getting cca threshold (#5532)
This commit adds a command to the CLI to be able to set (and get) the
CCA threshold. This is useful when there is a LNA in the radio's RX
path.
2020-09-21 08:46:19 -07:00
Simon Lin 787284e3a0 [otns] test with a specific OTNS commit (#5553) 2020-09-21 08:44:49 -07:00
Li Cao 73c522a543 [posix] fix options dependency (#5548)
A compile error can occur in the absence of LIBREADLINE. However the
error I got is confusing and doesn't indicate that because the options
dependencies are not good. I think the options' dependency and
relationship here should be:

- When DEAMON=0 (ot-cli, ot-ncp will be built and ot-cli depends on
  console), CLI_TRANSPORT=CONSOLE MUST be used. And otherwise
  (DEAMON=1), CLI_TRANSPORT=UART MUST be used. So when users build
  posix, they don't need to consider the option CLI_TRANSPORT. It's
  reasonable to add the evaluation for CLI_TRANSPORT in
  Makefile-posix.

- When CLI_TRANSPORT=CONSOLE, (HAVE_LIBEDIT || HAVE_LIBREADLINE) MUST
  be defined and DAEMON=0 MUST be satisfied. I think (HAVE_LIBEDIT ||
  HAVE_LIBREADLINE) is a result of CLI_TRANSPORT instead of the
  reason. The reason for CLI_TRANSPORT should be DEAMON.  Now I set
  CLI_TRANSPORT option based on DAEMON and make (HAVE_LIBEDIT ||
  HAVE_LIBREADLINE) as a check for CLI_TRANSPORT=CONSOLE.

If READLINE lib is not found, in this implementation, there will be an
error indicating that it's not found.
2020-09-21 08:43:25 -07:00
Moandor e7e84b6ae7 [cli] add api version command (#5544)
This adds a CLI command to get the API version number.
2020-09-21 08:38:33 -07:00
Abtin Keshavarzian eabb34fc26 [cli] return error from 'Process{Cmd}()' methods, adding 'OT_ERROR_PENDING' (#5540)
This commit changes the CLI `Process{Cmd}()` handler methods to return
an `otError` (instead of outputting the result). This helps harmonize
the `Process{Cmd}()` handlers in different CLI modules. It also
enables the result of CLI command to be outputted from `ProcessLine()`
after the command is looked up in the table and the corresponding
`Process{Cmd}()` handler is invoked.

This commit also adds a new error code `OT_ERROR_PENDING`. This
special error code indicates the success or error status of an
operation is not yet known and is pending. This is then used by some
of the CLI `Process{Cmd}()` methods which perform an async operation,
e.g., `ProcessDiscover()` returns `OT_ERROR_PENDING` if the discover
scan starts successfully, and later the final result is outputted from
scan callback. The `OutputResult(aError)` method is changed to output
nothing if the error is `OT_ERROR_PENDING`.
2020-09-20 21:46:08 -07:00
Jonathan Hui 0d8a99bd05 [cli] implement network data print (#5543)
- Print human-readable network data.
- Create network data sub-command.
2020-09-19 10:28:17 -07:00
Abtin Keshavarzian 8fbcd22064 [meshcop] add helper function 'LogError()' (#5509) 2020-09-19 09:05:08 -07:00
Jonathan Hui 42d76a0a4e [cli] change 'binary' arg to '-x' for consistency (#5543) (#5549) 2020-09-19 08:53:34 -07:00
Abtin Keshavarzian 0628746701 [cmake] list targets one per line in unit test CMakeLists (#5541)
This commit changes the unit tests `CMakeLists.txt` file to list
the targets in `set_target_properties()` call one per line. This
helps make it easier to read, also reduces the chance of merge
conflicts when new unit tests are added.
2020-09-18 15:02:36 -07:00
kangping 3820c3b6ed [simulation] fix error handling in simulation flash APIs (#5500) 2020-09-17 23:19:42 -07:00
Eduardo Montoya 1ece16dba2 [doc] fix broken anchors in CLI Readme (#5542)
Fix ping and prefix anchors from the command list.
2020-09-17 10:31:46 -07:00
Mason Tran 04ed75eb53 [efr32] update for compatibility with GSDK 3.0 (#5529)
This commit includes a relatively minimal set of changes that are
required to allow the efr32 platforms to function with the newly
released Silabs Gecko SDK v3.0.

Change Log:
- Pull in definitions for halInitChipSpecific() and all child
  functions from GSDK v2.7.
  - These will be replaced with a more elegant solution in a future
    commit.
- Switch to the mbedtls that is packaged with GSDK v3.0.
- Allow for mixed casing when specifying BOARD environment variable
2020-09-17 07:48:16 -07:00
Simon Lin 0c0e1dfe67 [coap] make CoAP start and stop reentrant (#5539) 2020-09-16 22:17:27 -07:00
Jonathan Hui d8cda7e610 [platform] remove unused header file (#5538) 2020-09-16 22:15:55 -07:00
Li Cao 500337bc63 [low-power] fix csl channel (#5501)
If CSL Channel is never specified, the actual CSL channel should
always be the phy channel that the device is using. If CSL Channel
hasn't been specified and radio channel changes, the actual CSL
channel should also change. In current implementation, CSL Channel is
by default a valid value (not specified by upper layer) and wouldn't
change when radio channel changes even if it's never specified.

This commit fixes this issue. On CSL receiver, a bit is extracted from
mCslChannel to be used as a flag mIsCslChannelSpecified. If it is
false, mCslChannel would keep synchronized to the value of
mRadioChannel in Mac and Csl Channel TLV wouldn't be appended in Child
Update Request to its parent. On CSL transmitter, CSL channel info in
child is allowed to be 0. If it's 0, the channel info in frame would
be set using Mac::GetPanChannel.
2020-09-16 22:15:37 -07:00
Jiacheng Guo ef72bb65e1 [cmake] make UART RAW config visible in daemon mode (#5535)
This fixes UART RAW mode not enabled in ot-br-posix.
2020-09-16 08:01:32 -07:00
Moandor d9b82f8b97 [continuous-integration] fix expect router link (#5534)
Sometimes the router command returns Link: 0 and makes the test fail.
2020-09-16 07:59:55 -07:00
Moandor 1d9d016f9a [continuous-integration] use sudo to kill daemon (#5533)
This makes kill commands in pty checks run with sudo. Otherwise
ot-daemon won't be killed and has to exit by itself, which makes
posix-pty-daemon fail sometimes.
2020-09-15 23:40:24 -07:00
Li Cao 011d0eb347 [thread-cert] add low power case 5_3_01 (#5522) 2020-09-15 23:18:40 -07:00
Jing Ma 3486358a84 [thread-cert] refactor case 9.2.10 using pktverify (#5452) 2020-09-15 06:59:29 -07:00
Abtin Keshavarzian b735193857 [cli] misc enhancements (#5528)
This commit contains a group of smaller enhancements in Cli modules:
- Add and use OutputLine() helper method which outputs a formatted
  string line (appends newline \r\n).
- Use binary search when finding the command in sCommands array (also
  adds static_assert check to ensure sCommands array is sorted).
- Define Command struct as a private nested type.
- Use enum constants (replacing #define).
- Rename method to OutputResult() (from AppendResult) to harmonize
  with rest of a Output{Something}() methods.
- Remove comments at #endif when within 20 lines of #if
2020-09-15 06:58:14 -07:00
Jintao Lin 8c90ade062 [low-power] add RCP support for CSL (#5456) 2020-09-14 21:20:14 -07:00
Simon Lin 31c7208ac8 [gitignore] ignore more files (#5518)
This commit ignore more files from git:
- C-Lion / IDEA project files
- Python bytecode in __pycache__
- PCAP files
2020-09-14 08:42:26 -07:00
Simon Lin dda81d8ef5 [github-actions] misc enhancements to otns test (#5519)
This commit introduces enhancements to the cli-ftd-otns test job:
- Use Virtual Time UART
- Upload test results as artifacts when failed
- Use Go 1.14
2020-09-14 08:40:45 -07:00
Abtin Keshavarzian a481fe6bdb [commissioner] add State and JoinerEvent enums (c++ style constants) (#5521) 2020-09-14 08:38:52 -07:00
Jonathan Hui 5bffd8bc4d [mac-filter] change whitelist/blacklist to allowlist/denylist (#5507)
To promote inclusivity and eliminate any unintentional bias.
2020-09-11 16:03:39 -07:00
Abtin Keshavarzian 11faac0aad [coap] update/simplify CoAP Options generation/processing (#5503)
This commit simplifies the generation/processing of CoAP Options in a
CoAP message. It adds helper methods `ReadExtendedOptionField()`,
`WriteExtendedOptionField` to decode/encode extended Option Header
fields (Option Number Delta or Option Length). It simplifies
`Option::Iterator` (using `Init()`/`Advance()` to parse and iterate
through all CoAP Options in a message). Note that the public OT
`otCoap` APIs and their behavior remain as before and unchanged.
2020-09-11 14:31:12 -07:00
Abtin Keshavarzian 5892a52b89 [joiner] add 'Joiner::State' enumeration (c++ style constants) (#5511)
Also changes discover scan callback to use `ScanResult` as its input
parameter type.
2020-09-11 10:49:58 -07:00
Simon Lin d783c7abc8 [tmf] add Backbone TMF agent (#5471) 2020-09-11 10:11:42 -07:00
Jing Ma 5e3b169068 [thread-cert] refactor case 5.6.7 using pktverify (#5453) 2020-09-11 09:00:04 -07:00
Simon Lin 8b842d39a6 [scripts] fix test_router_reattach (#5517)
Fix test_router_attach.py failing by a small chance.

Root cause: routerdowngradethreshold restored back to default (23)
after node reset, so the test had 5/120 chance to downgrade. We should
set it back to 32 before starting it.

This commit also enhances the test for a little bit:
- Make sure the node reattached as Router within 1 second
- Make sure the node does not downgrade after Router Selection Jitter
  (3s)
2020-09-11 08:56:53 -07:00
Simon Lin d251a743fc [thci] avoid globbing in scanJoiner (#5513)
This commit avoids globbing in scanJoiner since xEUI can be "*".
2020-09-11 08:52:24 -07:00
Simon Lin 653cb34b72 [reference-device] increase CLI RX buffer size (#5514)
This is required by 5.10.12 PBBR to send large fake UDP messages.
2020-09-11 08:51:08 -07:00
Jing Ma 1e08cea585 [thread-cert] refactor case 5.6.6 and 5.6.9 using pktverify (#5371) 2020-09-11 08:49:48 -07:00
Simon Lin c9004a6f3f [link-quality] optimize RSS calculation (#5508) 2020-09-10 12:22:32 -07:00
Simon Lin cf1057b780 [github-actions] upload test result artifacts (#5479) 2020-09-10 08:40:22 -07:00
Jing Ma 29ace9cf52 [thread-cert] refactor case 9.2.14 using pktverify (#5429) 2020-09-10 08:30:54 -07:00
Simon Lin 21b49e2e2b [size-report] add size-report for Thread 1.2 (#5424)
This commit adds size-report for Thread 1.2 features in the simplest
way that does not require any change to openthread-size-report on
Glitch.
2020-09-09 21:27:37 -07:00
Jintao Lin 3ea1e9d1f2 [nrf528xx] check nrf_802154_sleep_if_idle() return status to set correct pending event (#5504) 2020-09-09 10:54:56 -07:00
Jing Ma 209347c3b4 [thread-cert] refactor case 9.2.18 using pktverify (#5444) 2020-09-09 10:53:44 -07:00
Abtin Keshavarzian 210ff5a139 [mle] further simplifications of logging in MLE (#5495)
This commit updates the logging in `Mle` modules by adding two
enumerations `MessageAction` and `MessageType` to indicate the action
(send, receive, delay, etc.) and the message type in the updated
`Log()` methods.
2020-09-09 08:20:52 -07:00
Simon Lin 5e4df31787 [link-quality] fix fuzzer compile failure (#5505) 2020-09-09 08:01:31 -07:00
Li Cao e9d578da51 [mac-frame] handle exception case for payload of mac cmd (#5499)
In current Mac::Frame implementation, when the frame is a Mac command,
the CommandId is always not included as its private payload, which
means we won't encrypt the CommandId.

In most cases the Private Payload(things we need to encrypt) shall be
set to the MAC Payload field(For Mac cmd, this field includes
CommandId, shown in Figure 7-17) and the Open Payload shall be
empty. The only 2 exception cases are listed in Table 9-1.

So for Mac command with version >= 2, its CommandId should be included
in Private Payload and should be encrypted when necessary. For Mac
command with version < 2, CommandId should be in included in Open
Payload and shouldn't be encrypted.

This commit fixes this problem and adds unit tests for this.
2020-09-08 18:24:17 -07:00
Li Cao 3ffc503c32 [low-power] remove extra csl tx after buffered message sent by indirect tx (#5497)
Consider such a case:
- The CSL transmitter has a buffered message for a CSL receiver and
  has scheduled that tx.
- Before the CSL transmitter actually sends it, the receiver sends a
  data request.
- The CSL transmitter immediately sends the buffered message to the
  receiver.
- The scheduled time comes.

In current CSL implementation, though the buffered message has been
sent through indirect tx, when the origin CSL tx time comes, it would
send another 'empty frame' due to the missing of check and the
implementation of IndirectSender::PrepareFrameForChild. This commit
adds the check for this case and avoid to send the meaningless empty
frame.
2020-09-08 18:22:27 -07:00
Jing Ma a2d6901404 [thread-cert] refactor case 9.2.15 and 9.2.16 using pktverify (#5439) 2020-09-08 10:30:50 -07:00
doru91 2c5d22f0b7 [k32w] use a custom Persistent Data Manager (#5496)
This commit add support for a custom PDM (Persistent Data Manager)
which is also used inside Project CHIP.

Signed-off-by: Doru Gucea <doru-cristian.gucea@nxp.com>
2020-09-07 21:56:45 -07:00
Mason Tran f5508ad5dd [efr32] fix NVM3 initialization error due to alignment issue (#5491) 2020-09-07 21:51:45 -07:00
Simon Lin 1fedcb2426 [dua] add NdProxy table on Backbone Router (#5422) 2020-09-07 21:34:52 -07:00
Jing Ma 2280a54064 [thread-cert] fix case 5.5.2 random fail (#5490) 2020-09-07 21:26:58 -07:00
Abtin Keshavarzian 34ac7c751a [mle] declare 'Header' as a private nested type of 'Mle' (#5488)
This commit declares MLE `Header` as a `private` nested type of `Mle`
class. It also  moves the `Command` enumeration definition into the
`Mle` class (from `Header`).
2020-09-03 12:43:59 -07:00
Moandor debdb49b6a [style] remove usage of std::numeric_limits (#5487)
This replaces the usage of std::numeric_limits with C macro
UINT32_MAX. Removes the dependency of C++ header limits, which isn't
available on some platforms.
2020-09-03 08:28:32 -07:00
Li Cao b940baf9b6 [low-power] add CSL implementations on nrf52840 (#5449) 2020-09-02 22:32:16 -07:00
Li Cao 00c6d7b41e [style] fix include directives (#5485)
This commit fixes some public include directives that uses #include
"xxx.h". It should be #include <xxx.h> for public headers.
2020-09-02 19:53:35 -07:00
Abtin Keshavarzian ece6ac61e6 [coap] misc enhancements (#5482)
This commit contains a group of smaller changes/renames in `Coap`
modules:
- Add enumeration (c++ style) constants for CoAP `Type` and `Code`
  and `OptionType`.
- Add helpers `Message::Is{Method}Request()` e.g., `IsPostRequest()`
- Define Thread URI Paths (in `uri_paths.hpp/cpp`) as char array.
- Add helper method in `Coap::Message` for common initializations
  e.g., `InitAsConfirmablePost()`.
- Add helper methods for common `Coap:Message` type and code checks
  e.g., `IsConfirmablePost()`.
- Re-define `OT_COAP_TYPE` values to use 2-bit unsigned int values
  (per RFC-7252).
2020-09-02 19:47:50 -07:00
Jing Ma 7b6c41d329 [thread-cert] fix case 6.1.9 random fail (#5486) 2020-09-02 13:05:50 -07:00
Moandor f96376e4bb [github-actions] fix POSIX workflow coverage uploading (#5472)
Upload data one build at a time.
2020-09-01 22:57:38 -07:00
Jing Ma 2bf3086cc3 [thread-cert] refactor case 6.1.3, 6.1.5, 6.1.7 and 6.1.9 using pktverify (#5352) 2020-09-01 22:45:02 -07:00
Jing Ma 63a7a2a80c [thread-cert] refactor case 5.6.1, 5.6.2, 5.6.3, 5.6.4, 5.6.5 using pktverify (#5366) 2020-09-01 22:44:17 -07:00
Abtin Keshavarzian 002cc8e912 [network-data] remove unused/undefined method decelerations (#5480) 2020-09-01 14:29:42 -07:00
Abtin Keshavarzian d16d202179 [net] add 'Checksum' class (#5434)
This commit adds `Checksum` class which implements IP checksum
calculation and verification (all related code from other modules is
now moved to `Checksum` class). The new checksum calculation allows
any message chunk size (removes a limitation with previous model
of requiring even sized chunks). This commit also adds a unit test
`test_checksum` covering the behavior of `Checksum` methods.
2020-09-01 14:27:50 -07:00
Jing Ma 398aaa5256 [thread-cert] refactor case 7.1.2 and 7.1.4 using pktverify (#5369) 2020-09-01 10:13:18 -07:00
Jonathan Hui 42ecab1a24 [lgtm] add configuration file (#5473) 2020-08-31 10:04:33 -07:00
Jonathan Hui ec3a9f87a7 [posix] fix potential buffer overflow in otPlatDiagProcess() (#5478) 2020-08-31 08:27:01 -07:00
Abtin Keshavarzian 631e9ba0b8 [sub-mac] do not assert when parsing raw-link frames (#5475)
This commit relaxes the assert checks when parsing raw-link frame from
the radio tx-done callback to update the security frame counter. In an
FTD/MTD build, if/when raw-link is enabled, the `TxFrame` is prepared
and given by user and may not necessarily follow 15.4 frame format
(raw-link can be used with vendor-specific format), so we allow
failure when parsing the frame. In other cases (in an RCP build or in
an FTD/MTD build without raw-link) since the `TxFrame` should be
prepared by OpenThread core, we expect no error and therefore assert
if parsing fails.
2020-08-31 08:25:33 -07:00
Jonathan Hui 7a05ce5b14 [cli] fix format string (#5474) 2020-08-30 17:53:50 -07:00
Li Cao 2e9f1e50cd [low-power] fix csl posix build problem (#5467)
This commit changes TimeMicro::kMaxDuration to Time::kMaxDuration
because in posix OPENTHREAD_CONFIG_PLATFORM_USEC_TIMER_ENABLE is not
set and TimeMicro is not defined.

And in this context, the intent is just to set the variable to a
maximum value.
2020-08-30 13:06:02 -07:00
Simon Lin 7266e1b909 [mlr] add Commissioner API to register Multicast Listeners (#5346) 2020-08-29 08:52:29 -07:00
Yakun Xu 5e233fb617 [posix] allow bind to Thread interface only (#4965) 2020-08-28 18:52:31 -07:00
Abtin Keshavarzian e952128c05 [mle] simplify logging and add helper log methods (#5470)
This commit simplifies the logging in `Mle` modules. It renames and
simplifies the existing MLE logging methods. They are now defined as
`static` methods and the main implementation uses `#if` guards
checking the proper log level (when logs are not enabled they are
defined as empty inline methods).

This commit also adds new helper methods to log failure of sending or
processing of an MLE message, namely `Mle::LogSendError()` and
`Mle::LogProcessError()`. These are then used to simplify logging in
many methods in `Mle` and other related modules.
2020-08-28 11:51:21 -07:00
Jonathan Hui 38e1fbed15 [dns-client] avoid overflow in offset computation (#5464) 2020-08-28 11:48:28 -07:00
Jonathan Hui d3195e2a4f [dhcp6-client] avoid overflow in offset computation (#5463) 2020-08-28 11:48:11 -07:00
Abtin Keshavarzian 6abb89ade2 [ip6] skip copying message from 'ProcessReceiveCallback()' (#5469)
This commit adds a new parameter to `Ip6::ProcessReceiveCallback()`
allowing caller to indicate whether the method can take custody of the
passed-in message or whether it needs to make a copy of it (to use in
receive callback). This is indicated by a new `enum` definition
`Message::Ownership`. In case of `kTakeCustody` value, the caller
transfers custody of message to the called method (i.e. the method can
`Enqueue()` the message and would need to `Free()` the message when no
longer needed).

The `Ip6::HandleDatagram()` uses this to avoid copying the message in
cases where it is not needed (e.g. for a message that is passed to
host through callback but does not need to be processed by Thread
core).
2020-08-28 09:15:06 -07:00
Simon Lin 8d5e641668 [pktverify] misc enhancement (#5430)
This commit includes several enhancements to pktverify
- Add more fields of thread_meshcop and thread_address layers
- Remove COAP TLV manual parsing for now since it's not correctly
  implemented
  - Fix 5.5.2 which had already been using p.coap.tlv.status,
    p.coap.tlv.rloc16, ...
2020-08-27 19:11:16 -07:00
Simon Lin c3845e72ff [mlr] configure MLR.req response status (#5350) 2020-08-27 14:13:07 -07:00
Jing Ma 53e18618ae [thread-cert] refactor case 6.6.1 and 6.6.2 using pktverify (#5368) 2020-08-27 08:26:07 -07:00
Li Cao e9eef0b074 [build] add option to build 1.2 alone (#5364)
Currently script/test can only build 1.2 together with 1.1. This
commit adds support to build 1.2 alone. And when THREAD_VERSION=1.2
and INTER_OP=1 are both set, both versions would be built. Sometimes
we only want to build 1.2. This would save some time for us.
2020-08-27 00:01:35 -07:00
Yakun Xu 70ddb40519 [diag] clear output in case no output given (#5465)
The stop command doesn't write anything to the output buffer.
2020-08-26 23:02:37 -07:00
Jing Ma dc133baa68 [thread-cert] refactor case 8.1.2, 8.2.1 and 8.2.2 using pktverify (#5411) 2020-08-26 21:18:07 -07:00
Li Cao 35ede082ac [low-power] add csl debug option (#5455)
This commit adds a option to debug CSL feature. When the option is
turned on, a CSL receiver wouldn't actually sleep so that it could
receive all packets from its parent and know the tx time.
2020-08-26 20:52:21 -07:00
Jing Ma c3d2b1f8b9 [thread-cert] refactor case 9.2.17 using pktverify (#5443) 2020-08-26 18:23:33 -07:00
Jing Ma 627dcb72ca [thread-cert] refactor case 6.3.1 and 6.3.2 using pktverify (#5372) 2020-08-26 16:01:27 -07:00
Jing Ma 553af7a9de [thread-cert] refactor case 6.5.1 and 6.5.3 using pktverify (#5367) 2020-08-26 16:00:46 -07:00
Abtin Keshavarzian 1b4c3ba2e2 [ip6] avoid recursive call in 'HandleDatagram()' (#5440)
This commit also uses `VerifyOrExit` to check hop limit and removes
the `else` block indentation.
2020-08-26 13:51:42 -07:00
Simon Lin db54323b9e [cli] fix netdata readme typo (#5461) 2020-08-26 13:48:56 -07:00
Abtin Keshavarzian e507e24ffb [message] update 'Write()' to use 'memmove()' instead of 'memcpy()' (#5462)
This change allows `CopyTo()` method to be used to copy bytes backwards
within the same message (i.e., src and dest messages are the same and
the dest offset is before src offset). Unit test `test_message` is
updated in this commit to cover such a use.

However, the `CopyTo()` implementing can still potentially overwrite
the data when bytes are being copied forward within the same message.
This commit adds an assert not allowing such a use and updates the
method documentation mentioning this restriction.
2020-08-26 13:45:42 -07:00
Abtin Keshavarzian babb66d9c7 [neighbor-table] add 'StateFilter' parameter in 'Find' methods (#5435) 2020-08-25 07:59:21 -07:00
doru91 ce0f6b420e [k32w] rtos uart fixes (#5451)
This commit adds fixes which are needed for running Project CHIP on
K32W.

Fixes are related to UART handling, radio interrupts and Free RTOS
support.
2020-08-25 07:49:56 -07:00
Abtin Keshavarzian 2911018ad8 [message] update and fix 'CopyTo()' (#5454)
This commit updates `Message::CopyTo()` method to use data chunks
(this copies data directly from the source message to the destination
avoiding the need for an extra buffer copy). It also addresses an
issue where if the requested copy length is more than the available
bytes in the source message, incorrect bytes may be copied into the
destination message, and the returned value (i.e. number of bytes
copied) can be invalid.

This commit also updates the unit test `test_message` covering
behavior of `CopyTo()` for different offsets and copy lengths. It also
checks the behavior of `Read()` when the read length goes beyond the
end of the message (trying to read more bytes than available in the
message).
2020-08-25 07:48:27 -07:00
Simon Lin 04a6a9b925 [scripts] add 1.2 build test without additional features (#5425) 2020-08-24 11:26:41 -07:00
Rongli Sun d506afca33 [time-ticker] fix typo in kNumReceivers (#5446) 2020-08-24 11:24:47 -07:00
Abtin Keshavarzian 9f2b678836 [message] change 'Write()' to be a 'void' method (#5441)
This commit changes `Message::Write()` to return `void` instead of
returning the number of bytes written. The `Write()` method does not
resize the message and requires that the given data can be fully
written into the message within its existing length. The `Write()`
already contains an `OT_ASSERT()` to verify this.

This commit also removes the redundant `OT_ASSERT()` checks in few
places where `Write()` method's returned value was being used.
2020-08-23 19:34:55 -07:00
Moandor 18c701a3c5 [github-action] fail on Codedov uploading errors (#5437) 2020-08-21 17:14:49 -07:00
Michael Spang d20a8951fe [gn] fix OpenThread build with -Wundef (#5436)
Always define all of OPENTHREAD_{FTD,MTD,RADIO} and add a define for
OPENTHREAD_POSIX.
2020-08-21 08:43:02 -07:00
Simon Lin c73320ff3e [mlr] add MulticastListenersTable on BBR (#5292)
This commit adds the Multicast Listener Table for BBR:

- Implements Multicast Listener Table on BBR
  - Adds registered MAs to MulticastListenerTable
  - Reject when the table is full or the multicast address is invalid
    and return failed status
  - Respond with unsuccessful status along with failed addresses
  - Expire Listeners from MulticastListenerTable per second (using
    MinHeap for better performance)
- MLR enhancement
  - Re-register only failed multicast addresses (used to register all
    registering multicast addresses)
- Reference Device only APIs
  - Some APIs are defined for reference devices and tests.
- Add tests
  - Add unit test: test_multicast_listener_table.cpp (runs for 1.2-bbr
    only)
  - Add functional tests
2020-08-21 08:40:58 -07:00
Simon Lin ec0373c354 [tests] check send MLR.req for MAs when PBBR is enabled (#5337)
This commit adds one test to verify that if a node subscribed MAs when
there is no PBBR in the network, it should still be able to send
MLR.req after PBBR is enabled.

This is a case that wasn't tested in existing tests.
2020-08-20 22:22:23 -07:00
Jintao Lin 9eb960e3e2 [security] verify received Enh-ACK integrity (#5393)
With Thread 1.2, it is possible to receive an Enh-ACK with security
enabled. This commit:

- Move receive AES CCM related code to Frame class.

- Verify received Enh-ACK in Mac layer. If MIC check failed, the
  transmitted frame will be marked as OT_ERROR_NO_ACK.
2020-08-20 22:19:48 -07:00
Jintao Lin 53245bd06c [nrf528xx] add received ACK timestamp info to mRxInfo (#5417)
To enable CSL, it is necessary to get received Enh-ACK timestamp so
that the next sample time could be calculated with this timestamp and
CSL phase in CSL IE.
2020-08-20 14:48:04 -07:00
Yakun Xu d6fb9de9f3 [cmake] support setting log level (#5433) 2020-08-20 10:37:54 -07:00
Li Cao e438c2e383 [low-power] fix CSL_RECEIVER build option (#5428)
This commit removes the config setting
OPENTHREAD_CONFIG_MAC_CSL_RECEIVER_ENABLE automatically when it's 1.2
and MTD. The reason is that it's in core config and it's also used in
platform (radio) which cannot access core config.

If CSL_RECEIVER is not set in options in cmake and it's 1.2, then in
core config, OPENTHREAD_CONFIG_MAC_CSL_RECEIVER_ENABLE would be turned
on if it's MTD. While in platform, it's not turned on. And then there
would be a link issue.
2020-08-20 10:34:55 -07:00
Eduardo Montoya 0bcc2611b5 [low-power] keep configured CSL channel for child (#5432)
A SSED uses the Child Update Request to start CSL synchronization. If
the CSL Channel TLV is not present in the message, the parent assigns
the Thread Network channel as the CSL channel for this child during
the attachment.

However, it may happen that a child changes its CSL channel to a
different one with a Child Update Request and decides to keep using
it. In a subsequent Child Update Request it could omit the CSL Channel
TLV (no changes) but the parent would change its CSL channel to the
Thread Network channel. This commit avoids that.
2020-08-20 10:32:23 -07:00
Eduardo Montoya 801d4227c8 [style] prettier CSL comments and logs (#5431)
Mostly renaming 'Csl' to 'CSL', and some other minor changes.
2020-08-20 10:30:35 -07:00
Jiacheng Guo 00d88427d3 [cmake] allow set extension sources in cmake (#5419) 2020-08-20 10:11:23 -07:00
Abtin Keshavarzian 6886ff1e4c [message] add helper methods to get first/next data chunks (#5415)
The `Message` data is stored in a sequence of linked-listed `Buffer`
instances. When reading or writing data in the `Message`, the internal
implementation iterates over the `Buffer` list and updates the data in
chunks. This commit adds two helper methods `GetFirstChunk()` and
`GetNextChunk()` to get first/next data chunk (contiguous buffer)
corresponding to a given offset and length into the message. These
helper methods are then used to simplify `Read()`, `Write()`, and
`UpdateChecksum()` methods. The unit test `test_message` is also
updated to verify reading and writing data at different offsets and
lengths.
2020-08-19 14:06:36 -07:00
Abtin Keshavarzian 8fd46dde18 [time-ticker] adding 'TimeTicker' class (#5379)
This commit adds `TimeTicker` class which emits periodic ticks (with
one second period interval) to a set of registered tick receiver
modules. The `TimeTicker` would invoke `HandleTimeTick()` method
periodically on the registered receiver objects.

The `TimeTicker` model helps simplify the implementation of many
modules (such as `MeshForwarder`, `MleRoutuer`, `AddressResolver`,
`Ip6`, `DuaManager`, etc) which require periodic update/check of some
state (avoid each class using its own timer).
2020-08-19 14:04:41 -07:00
Bob MacDonald e1cc23ce48 [ncp] remove left over references to OPENTHREAD_CONFIG_LOG_OUTPUT_NCP_SPINEL (#5427) 2020-08-19 12:34:25 -07:00
Yakun Xu 1a1dd31089 [cmake] use OT_CONFIG for OPENTHREAD_CONFIG_FILE (#5421)
OT_CONFIG was used to specify a customized OpenThread core config file
which is only included by OpenThread core library. This commit changes
the behavior so that it specifies the OPENTHREAD_CONFIG_FILE which is
used by all components of OpenThread including the core library.
2020-08-19 08:49:05 -07:00
Moandor e865281ddc [github-action] fix coverage uploading for expects (#5423)
This commit changes the coverage data uploading for expects job so
that it only uploads data for one build at a time, to make coverage
more stable.
2020-08-19 08:47:29 -07:00
Jing Ma 2373fcbf01 [thread-cert] refactor case 6.2.2 using pktverify (#5353) 2020-08-19 08:42:27 -07:00
Jing Ma 2ab2f9af3e [thread-cert] refactor case 5.5.5 using pktverify (#5332) 2020-08-19 08:41:36 -07:00
Jing Ma 9fec90ffe1 [thread-cert] refactor case 5.5.7 using pktverify (#5313) 2020-08-19 08:38:39 -07:00
Moandor 1f05edabf4 [build] allow custom config file in Android.mk (#5418)
This commit moves OPENTHREAD_CONFIG_FILE to OPENTHREAD_PROJECT_CFLAGS
in Android.mk to allow projects to specify their own config files.
2020-08-18 21:08:28 -07:00
Abtin Keshavarzian d493c671f2 [extension] add method to receive and handle notifier events (#5420)
This commit adds `ExtensionBase` (base class of vendor `Extension`)
as one of the event receivers from `Notifier` class.
2020-08-18 19:43:14 -07:00
Abtin Keshavarzian 07cfc9a7d1 [ip6] simplify Ip6:Header and misc. enhancements (#5413)
This commit contain a list of smaller enhancements in `Ip6` modules:
- Simplify `Ip6::Header` removing the PoD definition and providing
  `enum` constants for the byte offset to different fields in the header
  (replacing/removing static methods).
- Declare some of the `Ip6` methods as `private`.
- Remove error logs (not used/applicable anymore).
- Simplify checking of `destPort` in `ProcessReceiveCallback()`.
- Specify `int` size of `enum` definitions (declare internally-used
  `enum`s a `private`).
- Add unit test `TestIp6Header()`.
2020-08-18 18:49:23 -07:00
kangping 04b8b30df0 [posix] fix potential socket resource leakage (#5405)
This commit fixes a potential socket resource leakage when preparing
new UART session socket failed.
2020-08-18 18:46:31 -07:00
Li Cao 7db8c6815c [low-power] add csl feature for Thread 1.2 (#4557)
This commit implements the CSL feature in Thread 1.2.

- Add macro definitions for low power to control the compiling of
  source code.

- Add data and methods for running CSL in Mac and SubMac. This mainly
  includes setting CSL parameters, starting/stopping CSL, and the
  timer handling process.

- Add otPlatTimeGetAPI and implementation.

- Add CSL transmission implementation. CSL transmission is a new kind
  of transmission, the related definition and implementaion for the
  whole transmitting process is added.

- Add calling of start/stop CSL in certain cases.

- Implement CSL synchronization maintainence. If a CSL cordinator
  didn't get a frame containing CSL IE for CSLTimeout, the CSL
  receiver is regarded as de-synchronized.

- Add Cli interface for using CSL.

- Implement enhanced Ack with IE. The original code can only generate
  auto ack for Imm-Ack. As CSL requires CSL IE included in enhanced
  ack. This PR implements it.

- Add basic functional test for CSL transmission. More tests
  corresponding to test plan would be added later.
2020-08-18 10:55:33 -07:00
Yakun Xu 5b7f3b9acf [posix] remove unused node id (#5416) 2020-08-18 09:09:12 -07:00
4020 changed files with 398706 additions and 1384354 deletions
+2 -1
View File
@@ -20,7 +20,8 @@ AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: false
BinPackArguments: true
BinPackParameters: false
BraceWrapping:
BraceWrapping:
AfterCaseLabel: true
AfterClass: true
AfterControlStatement: true
AfterEnum: true
+1 -1
View File
@@ -9,4 +9,4 @@ ignore:
comment:
layout: "diff, flags, files"
after_n_builds: 16
after_n_builds: 5
+1 -1
View File
@@ -1,3 +1,3 @@
GitHub Issues are for bugs and feature requests. To make bugs and feature requests more easy to find and organize, we close issues that are deemed out of scope for GitHub Issues.
The openthread-users Google Group is the recommended place for users to discuss OpenThread and interact directly with the OpenThread community. https://groups.google.com/forum/#!forum/openthread-users
OpenThread GitHub Discussions is the recommended place for users to discuss OpenThread and interact directly with the OpenThread community. https://github.com/openthread/openthread/discussions
+115 -48
View File
@@ -33,33 +33,44 @@ on: [push, pull_request]
jobs:
cancel-previous-runs:
runs-on: ubuntu-latest
runs-on: ubuntu-20.04
steps:
- uses: rokroskar/workflow-run-cleanup-action@master
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
if: "github.ref != 'refs/heads/master'"
if: "github.ref != 'refs/heads/main'"
pretty:
runs-on: ubuntu-18.04
runs-on: ubuntu-20.04
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 remove -y clang-6.0 libclang-common-6.0-dev libclang1-6.0 libllvm6.0
sudo apt-get autoremove
sudo apt-get --no-install-recommends install -y clang-tools clang-format-6.0 shellcheck
python3 -m pip install yapf==0.29.0
sudo apt-get --no-install-recommends install -y clang-format-9 clang-tidy-9 shellcheck
python3 -m pip install yapf==0.31.0
sudo snap install shfmt
- name: Check
run: |
script/make-pretty check
markdown-lint-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: gaurav-nelson/github-action-markdown-link-check@v1
with:
use-verbose-mode: 'yes'
max-depth: 3
cmake-version:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
with:
submodules: true
- name: Bootstrap
run: |
sudo pip3 install --system -U cmake==3.10.3
@@ -67,12 +78,13 @@ jobs:
sudo apt-get --no-install-recommends install -y ninja-build libreadline-dev libncurses-dev
- name: Build
run: |
NODE_MODE=rcp ./script/test build
OT_NODE_TYPE=rcp ./script/test build
package:
name: package-${{ matrix.compiler }}
runs-on: ubuntu-18.04
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
include:
- compiler: gcc
@@ -86,6 +98,8 @@ jobs:
CXX: ${{ matrix.compiler_cpp }}
steps:
- uses: actions/checkout@v2
with:
submodules: true
- name: Bootstrap
run: |
sudo rm /etc/apt/sources.list.d/* && sudo apt-get update
@@ -95,23 +109,43 @@ jobs:
script/test package
scan-build:
runs-on: ubuntu-18.04
runs-on: ubuntu-20.04
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 remove -y clang-6.0 libclang-common-6.0-dev libclang1-6.0 libllvm6.0
sudo apt-get autoremove
sudo apt-get --no-install-recommends install -y clang-tools
sudo apt-get --no-install-recommends install -y clang-tools-9 ninja-build
- name: Run
run: |
script/check-scan-build
mbedtls3-build:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
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
with:
repository: ARMmbed/mbedtls
ref: v3.1.0
path: third_party/mbedtls/repo
- name: Build
run: |
./script/test build
arm-gcc:
name: arm-gcc-${{ matrix.gcc_ver }}
runs-on: ubuntu-18.04
strategy:
fail-fast: false
matrix:
include:
- gcc_ver: 4
@@ -131,16 +165,18 @@ jobs:
gcc_extract_dir: gcc-arm-none-eabi-9-2019-q4-major
steps:
- uses: actions/checkout@v2
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
wget ${{ matrix.gcc_download_url }} -O gcc-arm.tar.bz2
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
# required for jn5189 and k32w061
pip install pycryptodome
# use the minimal required cmake version
sudo pip3 install --system -U cmake==3.10.3
cmake --version | grep 3.10.3
- name: Build
run: |
export PATH=/tmp/${{ matrix.gcc_extract_dir }}/bin:$PATH
@@ -150,16 +186,24 @@ jobs:
name: gcc-${{ matrix.gcc_ver }}
runs-on: ubuntu-18.04
strategy:
fail-fast: false
matrix:
gcc_ver: [5, 6, 7, 8, 9]
gcc_ver: [5, 6, 7, 8, 9, 10, 11]
env:
CC: gcc-${{ matrix.gcc_ver }}
CXX: g++-${{ matrix.gcc_ver }}
steps:
- uses: actions/checkout@v2
with:
submodules: true
- name: Bootstrap
run: |
sudo rm /etc/apt/sources.list.d/* && sudo apt-get update
case ${{ matrix.gcc_ver }} in
11)
sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
;;
esac
sudo apt-get --no-install-recommends install -y gcc-${{ matrix.gcc_ver }} g++-${{ matrix.gcc_ver }} ninja-build libreadline-dev libncurses-dev
- name: Build
run: |
@@ -168,18 +212,28 @@ jobs:
clang:
name: clang-${{ matrix.clang_ver }}
runs-on: ubuntu-18.04
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
clang_ver: ["6.0", "7", "8", "9"]
clang_ver: ["6.0", "7", "8", "9", "10", "11", "12", "13"]
env:
CC: clang-${{ matrix.clang_ver }}
CXX: clang++-${{ matrix.clang_ver }}
steps:
- uses: actions/checkout@v2
with:
submodules: true
- name: Bootstrap
run: |
sudo rm /etc/apt/sources.list.d/* && sudo apt-get update
sudo rm /etc/apt/sources.list.d/*
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
echo 'deb http://apt.llvm.org/focal/ llvm-toolchain-focal main
deb-src http://apt.llvm.org/focal/ llvm-toolchain-focal main
# 13
deb http://apt.llvm.org/focal/ llvm-toolchain-focal-13 main
deb-src http://apt.llvm.org/focal/ llvm-toolchain-focal-13 main' | sudo tee -a /etc/apt/sources.list
sudo apt-get update
sudo apt-get --no-install-recommends install -y clang-${{ matrix.clang_ver }} clang++-${{ matrix.clang_ver }} ninja-build libreadline-dev libncurses-dev
- name: Build
run: |
@@ -188,10 +242,11 @@ jobs:
clang-m32:
name: clang-m32-${{ matrix.clang_ver }}
runs-on: ubuntu-18.04
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
clang_ver: ["6.0", "7", "8", "9"]
clang_ver: ["6.0", "7", "8", "9", "10", "11", "12", "13"]
env:
CC: clang-${{ matrix.clang_ver }}
CXX: clang++-${{ matrix.clang_ver }}
@@ -200,21 +255,31 @@ jobs:
LDFLAGS: -m32
steps:
- uses: actions/checkout@v2
with:
submodules: true
- name: Bootstrap
run: |
sudo dpkg --add-architecture i386
sudo rm /etc/apt/sources.list.d/* && sudo apt-get update
sudo apt-get --no-install-recommends install -y clang-${{ matrix.clang_ver }} clang++-${{ matrix.clang_ver }} g++-multilib ninja-build
sudo apt-get --no-install-recommends install -y libreadline-dev:i386 libncurses-dev:i386
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
echo 'deb http://apt.llvm.org/focal/ llvm-toolchain-focal main
deb-src http://apt.llvm.org/focal/ llvm-toolchain-focal main
# 13
deb http://apt.llvm.org/focal/ llvm-toolchain-focal-13 main
deb-src http://apt.llvm.org/focal/ llvm-toolchain-focal-13 main' | sudo tee -a /etc/apt/sources.list
sudo apt-get update
sudo apt-get --no-install-recommends install -y clang-${{ matrix.clang_ver }} clang++-${{ matrix.clang_ver }} ninja-build
sudo apt-get --no-install-recommends install -y g++-multilib libreadline-dev:i386 libncurses-dev:i386
- name: Build
run: |
script/check-simulation-build
script/check-posix-build
gn:
runs-on: ubuntu-18.04
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
with:
submodules: true
- name: Bootstrap
run: |
sudo rm /etc/apt/sources.list.d/* && sudo apt-get update
@@ -228,40 +293,42 @@ jobs:
export PATH=/tmp/bin:$PATH
script/check-gn-build
macos-clang:
macos:
name: macos-${{ matrix.CC }}
strategy:
fail-fast: false
matrix:
include:
- CC: clang
CXX: clang++
- CC: gcc
CXX: g++
runs-on: macos-10.15
env:
CC: clang
CXX: clang++
CC: ${{ matrix.CC }}
CXX: ${{ matrix.CXX }}
steps:
- uses: actions/checkout@v2
with:
submodules: true
- name: Bootstrap
run: |
brew install automake ninja llvm
- name: Build
run: |
script/check-posix-build
script/check-simulation-build
macos-gcc:
runs-on: macos-10.15
env:
CC: gcc
CXX: g++
steps:
- uses: actions/checkout@v2
- name: Bootstrap
run: |
brew install automake ninja
rm -f '/usr/local/bin/2to3'
brew update
brew install automake m4 ninja
[ ${{ matrix.CC }} != clang ] || brew install llvm
- name: Build
run: |
export PATH=$(brew --prefix m4)/bin:$PATH
script/check-posix-build
script/check-simulation-build
android:
runs-on: ubuntu-18.04
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
with:
submodules: true
- name: Build
run: |
docker run --rm -v $PWD:/build/openthread openthread/android-trusty /build/openthread/script/check-android-build
+16 -19
View File
@@ -33,27 +33,26 @@ on: [push, pull_request]
jobs:
cancel-previous-runs:
runs-on: ubuntu-latest
runs-on: ubuntu-20.04
steps:
- uses: rokroskar/workflow-run-cleanup-action@master
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
if: "github.ref != 'refs/heads/master'"
if: "github.ref != 'refs/heads/main'"
buildx:
name: buildx-${{ matrix.docker_name }}
runs-on: ubuntu-latest
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
include:
- docker_name: environment
- docker_name: codelab_otsim
steps:
- uses: actions/checkout@v2
with:
submodules: true
- name: Set up Docker Buildx
uses: crazy-max/ghaction-docker-buildx@v3
- name: Prepare
id: prepare
run: |
@@ -67,34 +66,32 @@ jobs:
echo ::set-output name=docker_image::${DOCKER_IMAGE}
echo ::set-output name=version::${VERSION}
echo ::set-output name=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} .
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Docker Buildx (build)
run: |
docker buildx build --output "type=image,push=false" ${{ steps.prepare.outputs.buildx_args }}
- name: Docker Login
- name: Login to DockerHub
if: success() && github.repository == 'openthread/openthread' && github.event_name != 'pull_request'
env:
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
run: |
echo "${DOCKER_PASSWORD}" | docker login --username "${DOCKER_USERNAME}" --password-stdin
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Docker Buildx (push)
if: success() && github.repository == 'openthread/openthread' && github.event_name != 'pull_request'
run: |
docker buildx build --output "type=image,push=true" ${{ steps.prepare.outputs.buildx_args }}
- name: Docker Check Manifest
- name: Inspect Image
if: always() && github.repository == 'openthread/openthread' && github.event_name != 'pull_request'
run: |
docker run --rm mplatform/mquery ${{ steps.prepare.outputs.docker_image }}:${{ steps.prepare.outputs.version }}
- name: Clear
if: always() && github.repository == 'openthread/openthread' && github.event_name != 'pull_request'
run: |
rm -f ${HOME}/.docker/config.json
docker buildx imagetools inspect ${{ steps.prepare.outputs.docker_image }}:${{ steps.prepare.outputs.version }}
+1 -1
View File
@@ -30,7 +30,7 @@ name: CIFuzz
on: [pull_request]
jobs:
Fuzzing:
runs-on: ubuntu-latest
runs-on: ubuntu-20.04
steps:
- name: Build Fuzzers
uses: google/oss-fuzz/infra/cifuzz/actions/build_fuzzers@master
+50
View File
@@ -0,0 +1,50 @@
#
# Copyright (c) 2021, 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: Makefile Check
on: [push, pull_request]
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
with:
submodules: true
- name: Check
run: |
script/check-core-makefiles
+235
View File
@@ -0,0 +1,235 @@
#
# Copyright (c) 2021, 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: Border Router
on: [push, pull_request]
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:
REFERENCE_DEVICE: 1
VIRTUAL_TIME: 0
PACKET_VERIFICATION: 1
THREAD_VERSION: 1.3
INTER_OP: 1
COVERAGE: 1
MULTIPLY: 1
PYTHONUNBUFFERED: 1
VERBOSE: 1
# The Border Routing and DUA feature can coexist, but current wireshark
# packet verification can't handle it because of the order of context ID
# of OMR prefix and Domain prefix is not deterministic.
BORDER_ROUTING: 0
steps:
- uses: actions/checkout@v2
with:
submodules: true
- name: Build OTBR Docker
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
run: |
./script/test build_otbr_docker
- name: Bootstrap
run: |
sudo rm /etc/apt/sources.list.d/* && sudo apt-get update
sudo apt-get --no-install-recommends install -y python3-setuptools python3-wheel ninja-build socat lcov
python3 -m pip install -r tests/scripts/thread-cert/requirements.txt
- name: Build
run: |
./script/test build
- name: Get Thread-Wireshark
run: |
./script/test get_thread_wireshark
- name: Run
run: |
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
with:
name: cov-thread-1-3-backbone-docker
path: /tmp/coverage/
- uses: actions/upload-artifact@v2
if: ${{ failure() }}
with:
name: thread-1-3-backbone-results
path: |
*.pcap
*.json
*.log
coredump_*
otbr-agent_*
- name: Generate Coverage
run: |
./script/test generate_coverage gcc
- uses: actions/upload-artifact@v2
with:
name: cov-thread-1-3-backbone
path: tmp/coverage.info
thread-border-router:
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
include:
- otbr_mdns: "mDNSResponder"
otbr_trel: 0
cert_scripts: ./tests/scripts/thread-cert/border_router/*.py
packet_verification: 1
description: ""
- otbr_mdns: "mDNSResponder"
otbr_trel: 1
cert_scripts: ./tests/scripts/thread-cert/border_router/*.py
packet_verification: 2
description: ""
- otbr_mdns: "mDNSResponder"
otbr_trel: 0
cert_scripts: ./tests/scripts/thread-cert/border_router/MATN/*.py
packet_verification: 1
description: "MATN"
- otbr_mdns: "mDNSResponder"
otbr_trel: 0
cert_scripts: ./tests/scripts/thread-cert/border_router/LowPower/*.py
packet_verification: 1
description: "LowPower"
- otbr_mdns: "avahi"
otbr_trel: 0
cert_scripts: ./tests/scripts/thread-cert/border_router/*.py
packet_verification: 1
description: ""
- otbr_mdns: "avahi"
otbr_trel: 1
cert_scripts: ./tests/scripts/thread-cert/border_router/*.py
packet_verification: 2
description: ""
name: BR ${{ matrix.description }} (${{ matrix.otbr_mdns }}, TREL=${{matrix.otbr_trel}})
env:
REFERENCE_DEVICE: 1
VIRTUAL_TIME: 0
PACKET_VERIFICATION: ${{ matrix.packet_verification }}
THREAD_VERSION: 1.3
INTER_OP: 1
COVERAGE: 1
MULTIPLY: 1
OTBR_MDNS: ${{ matrix.otbr_mdns }}
PYTHONUNBUFFERED: 1
VERBOSE: 1
BORDER_ROUTING: 1
MAX_JOBS: 3
steps:
- uses: actions/checkout@v2
- name: Build OTBR Docker
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
TREL: ${{ matrix.otbr_trel }}
run: |
./script/test build_otbr_docker
- name: Bootstrap
run: |
sudo rm /etc/apt/sources.list.d/* && sudo apt-get update
sudo apt-get --no-install-recommends install -y python3-setuptools python3-wheel ninja-build socat lcov
python3 -m pip install -r tests/scripts/thread-cert/requirements.txt
- name: Build
run: |
./script/test build
- name: Get Thread-Wireshark
run: |
./script/test get_thread_wireshark
- name: Run
run: |
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
with:
name: cov-thread-border-router-docker
path: /tmp/coverage/
- uses: actions/upload-artifact@v2
if: ${{ failure() }}
with:
name: thread-border-router-results
path: |
*.pcap
*.json
*.log
coredump_*
otbr-agent_*
- name: Generate Coverage
run: |
./script/test generate_coverage gcc
- uses: actions/upload-artifact@v2
with:
name: cov-thread-border-router
path: tmp/coverage.info
upload-coverage:
needs:
- backbone-router
- thread-border-router
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
with:
submodules: true
- name: Bootstrap
run: |
sudo apt-get --no-install-recommends install -y lcov
- uses: actions/download-artifact@v2
with:
path: coverage/
- name: Combine Coverage
continue-on-error: true
run: |
script/test combine_coverage
- name: Upload Coverage
continue-on-error: true
uses: codecov/codecov-action@v2
with:
files: final.info
fail_ci_if_error: true
delete-coverage-artifacts:
needs: upload-coverage
runs-on: ubuntu-20.04
steps:
- uses: geekyeggo/delete-artifact@1-glob-support
with:
name: cov-*
useGlob: true
+72
View File
@@ -0,0 +1,72 @@
#
# Copyright (c) 2020, 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: OTCI
on: [push, pull_request]
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
strategy:
fail-fast: false
matrix:
virtual_time: [0, 1]
env:
REFERENCE_DEVICE: 1
VIRTUAL_TIME: ${{ matrix.virtual_time }}
REAL_DEVICE: 0
steps:
- uses: actions/checkout@v2
- 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
python3 -m pip install -r tests/scripts/thread-cert/requirements.txt
- name: Build
run: |
./bootstrap
make -f examples/Makefile-simulation THREAD_VERSION=1.3 DUA=1 MLR=1 BACKBONE_ROUTER=1 CSL_RECEIVER=1
- name: Install OTCI Python Library
run: |
(cd tools/otci && python3 setup.py install --user)
- name: Run
run: |
export PYTHONPATH=./tests/scripts/thread-cert/
export OT_CLI=./output/simulation/bin/ot-cli-ftd
python3 tools/otci/tests/test_otci.py
+205
View File
@@ -0,0 +1,205 @@
#
# Copyright (c) 2020, 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: OTNS
on: [push, pull_request]
env:
COVERAGE: 1
REFERENCE_DEVICE: 1
VIRTUAL_TIME: 1
VIRTUAL_TIME_UART: 1
MAX_NETWORK_SIZE: 999
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
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'"
unittests:
name: Unittests
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v1
with:
go-version: '1.14'
- name: Set up Python 3.6
uses: actions/setup-python@v1
with:
python-version: 3.6
- 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
./script/git-tool clone --depth 1 https://github.com/openthread/ot-ns.git /tmp/otns
(
cd /tmp/otns
./script/test py-unittests
)
- uses: actions/upload-artifact@v2
if: ${{ failure() }}
with:
name: unittests-pcaps
path: |
./output/*/bin/*.pcap
./output/*/bin/*.replay
- name: Generate Coverage
run: |
./script/test generate_coverage gcc
- uses: actions/upload-artifact@v2
with:
name: cov-otns-unittests
path: tmp/coverage.info
examples:
name: Examples
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v1
with:
go-version: '1.14'
- name: Set up Python 3.6
uses: actions/setup-python@v1
with:
python-version: 3.6
- 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
./script/git-tool clone --depth 1 https://github.com/openthread/ot-ns.git /tmp/otns
(
cd /tmp/otns
./script/test py-examples
)
- uses: actions/upload-artifact@v2
if: ${{ failure() }}
with:
name: examples-pcaps
path: |
./output/*/bin/*.pcap
./output/*/bin/*.replay
- name: Generate Coverage
run: |
./script/test generate_coverage gcc
- uses: actions/upload-artifact@v2
with:
name: cov-otns-examples
path: tmp/coverage.info
stress-tests:
name: Stress ${{ matrix.suite }}
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
include:
- suite: "network-forming"
stress_level: 8
- suite: "commissioning"
stress_level: 14
- suite: "connectivity"
stress_level: 6
- suite: "network-latency"
stress_level: 10
- suite: "multicast-performance"
stress_level: 10
- suite: "otns-performance"
stress_level: 10
env:
STRESS_LEVEL: ${{ matrix.stress_level }}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v1
with:
go-version: '1.14'
- name: Set up Python 3.6
uses: actions/setup-python@v1
with:
python-version: 3.6
- 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
./script/git-tool clone --depth 1 https://github.com/openthread/ot-ns.git /tmp/otns
(
cd /tmp/otns
./script/test stress-tests ${{ matrix.suite }}
)
- uses: actions/upload-artifact@v2
if: ${{ failure() }}
with:
name: stress-tests-${{ matrix.suite }}-pcaps
path: |
./output/*/bin/*.pcap
./output/*/bin/*.replay
- name: Generate Coverage
run: |
./script/test generate_coverage gcc
- uses: actions/upload-artifact@v2
with:
name: cov-otns-stress-tests-${{ matrix.suite }}
path: tmp/coverage.info
upload-coverage:
needs:
- unittests
- examples
- stress-tests
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- name: Bootstrap
run: |
sudo apt-get --no-install-recommends install -y lcov
- uses: actions/download-artifact@v2
with:
path: coverage/
- name: Upload Coverage
run: |
script/test upload_codecov
+198 -65
View File
@@ -33,29 +33,103 @@ on: [push, pull_request]
jobs:
cancel-previous-runs:
runs-on: ubuntu-latest
runs-on: ubuntu-20.04
steps:
- uses: rokroskar/workflow-run-cleanup-action@master
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
if: "github.ref != 'refs/heads/master'"
if: "github.ref != 'refs/heads/main'"
posix-cli:
expects-linux:
runs-on: ubuntu-18.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: Bootstrap
run: |
sudo apt-get --no-install-recommends install -y expect ninja-build lcov socat
- name: Run RCP Mode
run: |
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: 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
if: ${{ failure() && env.CRASHED_RCP == '1' }}
with:
name: core-expect-rcp
path: |
./ot-core-dump/*
- name: Generate Coverage
run: |
./script/test generate_coverage gcc
- uses: actions/upload-artifact@v2
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
host ipv6.google.com ::1
ulimit -c unlimited
./script/test prepare_coredump_upload
OT_OPTIONS='-DOT_READLINE=OFF -DOT_FULL_LOGS=ON -DOT_LOG_OUTPUT=PLATFORM_DEFINED' OT_NATIVE_IP=1 VIRTUAL_TIME=0 OT_NODE_TYPE=rcp ./script/test clean build expect
- name: Check Crash
if: ${{ failure() }}
run: |
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
if: ${{ failure() && env.CRASHED_TUN == '1' }}
with:
name: core-expect-linux
path: |
./ot-core-dump/*
- uses: actions/upload-artifact@v2
if: ${{ failure() }}
with:
name: syslog-expect-linux
path: /var/log/syslog
- name: Generate Coverage
run: |
./script/test generate_coverage gcc
- uses: actions/upload-artifact@v2
with:
name: cov-expects-linux-2
path: tmp/coverage.info
thread-cert:
runs-on: ubuntu-20.04
env:
COVERAGE: 1
PYTHONUNBUFFERED: 1
READLINE: readline
REFERENCE_DEVICE: 1
THREAD_VERSION: 1.1
VIRTUAL_TIME: 1
VIRTUAL_TIME_UART: 1
steps:
- uses: actions/checkout@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 libreadline6-dev python3-setuptools python3-wheel
sudo apt-get --no-install-recommends install -y libreadline6-dev python3-setuptools python3-wheel lcov
python3 -m pip install -r tests/scripts/thread-cert/requirements.txt
- name: Build
run: |
@@ -64,49 +138,32 @@ jobs:
make -f src/posix/Makefile-posix
- name: Run
run: |
VERBOSE=1 OT_CLI_PATH="$(pwd)/$(ls output/posix/*/bin/ot-cli) -v" RADIO_DEVICE="$(pwd)/$(ls output/*/bin/ot-rcp)" make -f src/posix/Makefile-posix check
- name: Codecov
uses: codecov/codecov-action@v1
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
if: ${{ failure() }}
with:
name: thread-cert
path: build/posix/tests/scripts/thread-cert
- name: Generate Coverage
run: |
./script/test generate_coverage gcc
- uses: actions/upload-artifact@v2
with:
name: cov-thread-cert
path: tmp/coverage.info
posix-ncp:
runs-on: ubuntu-18.04
env:
COVERAGE: 1
NODE_TYPE: ncp-sim
PYTHONUNBUFFERED: 1
READLINE: readline
REFERENCE_DEVICE: 1
VIRTUAL_TIME: 1
VIRTUAL_TIME_UART: 1
steps:
- uses: actions/checkout@v2
- 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
python3 -m pip install -r tests/scripts/thread-cert/requirements.txt
sudo python3 -m pip install git+https://github.com/openthread/pyspinel
- name: Build
run: |
./bootstrap
make -f examples/Makefile-simulation
make -f src/posix/Makefile-posix
- name: Run
run: |
VERBOSE=1 OT_NCP_PATH="$(pwd)/$(ls output/posix/*/bin/ot-ncp)" RADIO_DEVICE="$(pwd)/$(ls output/*/bin/ot-rcp)" make -f src/posix/Makefile-posix check
- name: Codecov
uses: codecov/codecov-action@v1
posix-ncp-rcp-migrate:
runs-on: ubuntu-18.04
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
sudo apt-get --no-install-recommends install -y expect lcov
- name: Build
run: |
./bootstrap
@@ -114,19 +171,31 @@ jobs:
- name: Run
run: |
script/check-ncp-rcp-migrate check
- name: Codecov
uses: codecov/codecov-action@v1
- name: Generate Coverage
run: |
./script/test generate_coverage gcc
- uses: actions/upload-artifact@v2
with:
name: cov-ncp-rcp-migrate
path: tmp/coverage.info
posix-pty:
runs-on: ubuntu-18.04
pty-linux:
name: pty-linux OT_DAEMON=${{ matrix.OT_DAEMON }}
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
OT_DAEMON: ['off', 'on']
env:
COVERAGE: 1
OT_DAEMON: ${{ matrix.OT_DAEMON }}
OT_READLINE: 'readline'
steps:
- uses: actions/checkout@v2
- name: Bootstrap
run: |
sudo rm /etc/apt/sources.list.d/* && sudo apt-get update
sudo apt-get --no-install-recommends install -y socat expect
sudo apt-get --no-install-recommends install -y socat expect lcov net-tools ninja-build
cd /tmp
wget https://github.com/obgm/libcoap/archive/bsd-licensed.tar.gz
tar xvf bsd-licensed.tar.gz
@@ -137,39 +206,103 @@ jobs:
sudo make install
- name: Build
run: |
./bootstrap
script/check-posix-pty build
- name: Run
run: |
script/check-posix-pty check
- name: Codecov
uses: codecov/codecov-action@v1
- name: Run (OT_DAEMON_ALLOW_ALL)
if: matrix.OT_DAEMON == 'on'
env:
OT_DAEMON_ALLOW_ALL: 1
run: |
script/check-posix-pty check
- name: Generate Coverage
run: |
./script/test generate_coverage gcc
- uses: actions/upload-artifact@v2
with:
name: cov-pty-linux-${{ matrix.DAEMON }}
path: tmp/coverage.info
posix-pty-daemon:
runs-on: ubuntu-18.04
pty-macos:
name: pty-macos OT_DAEMON=${{ matrix.OT_DAEMON }}
runs-on: macos-10.15
strategy:
fail-fast: false
matrix:
OT_DAEMON: ['off', 'on']
env:
COVERAGE: 1
DAEMON: 1
OT_DAEMON: ${{ matrix.OT_DAEMON }}
OT_READLINE: 'off'
steps:
- uses: actions/checkout@v2
- name: Bootstrap
run: |
sudo rm /etc/apt/sources.list.d/* && sudo apt-get update
sudo apt-get --no-install-recommends install -y socat expect
cd /tmp
wget https://github.com/obgm/libcoap/archive/bsd-licensed.tar.gz
tar xvf bsd-licensed.tar.gz
cd libcoap-bsd-licensed
./autogen.sh
./configure --prefix= --exec-prefix=/usr --with-boost=internal --disable-tests --disable-documentation
make -j2
sudo make install
rm -f '/usr/local/bin/2to3'
brew update
brew install ninja socat
- name: Build
run: |
./bootstrap
script/check-posix-pty build
- name: Run
run: |
script/check-posix-pty check
- name: Codecov
uses: codecov/codecov-action@v1
rcp-stack-reset:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- name: Bootstrap
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
run: |
sudo apt-get --no-install-recommends install -y expect ninja-build lcov socat
sudo python3 -m pip install git+https://github.com/openthread/pyspinel
- name: Build
run: |
script/cmake-build simulation -DOT_CSL_RECEIVER=ON -DOT_FULL_LOGS=ON -DOT_LOG_OUTPUT=PLATFORM_DEFINED
- name: Run
run: |
python3 tests/scripts/misc/test_rcp_reset.py build/simulation/examples/apps/ncp/ot-rcp
- name: Generate Coverage
run: |
./script/test generate_coverage gcc
- uses: actions/upload-artifact@v2
with:
name: cov-rcp-stack-reset
path: tmp/coverage.info
upload-coverage:
needs:
- expects-linux
- ncp-rcp-migrate
- pty-linux
- thread-cert
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
with:
submodules: true
- name: Bootstrap
run: |
sudo apt-get --no-install-recommends install -y lcov
- uses: actions/download-artifact@v2
with:
path: coverage/
- name: Combine Coverage
run: |
script/test combine_coverage
- name: Upload Coverage
uses: codecov/codecov-action@v2
with:
files: final.info
fail_ci_if_error: true
delete-coverage-artifacts:
needs: upload-coverage
runs-on: ubuntu-20.04
steps:
- uses: geekyeggo/delete-artifact@1-glob-support
with:
name: cov-*
useGlob: true
+387
View File
@@ -0,0 +1,387 @@
#
# Copyright (c) 2020, 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: Simulation 1.1
on: [push, pull_request]
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:
PACKET_VERIFICATION: 1
REFERENCE_DEVICE: 1
THREAD_VERSION: 1.1
VIRTUAL_TIME: 1
MULTIPLY: 3
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 g++-multilib python3-setuptools python3-wheel ninja-build lcov
python3 -m pip install -r tests/scripts/thread-cert/requirements.txt
- name: Build
run: |
./script/test build
- name: Get Thread-Wireshark
run: |
./script/test get_thread_wireshark
- name: Run
run: |
./script/test cert_suite ./tests/scripts/thread-cert/Cert_*.py ./tests/scripts/thread-cert/test_*.py
- uses: actions/upload-artifact@v2
if: ${{ failure() }}
with:
name: packet-verification-pcaps
path: |
*.pcap
*.json
- name: Generate Coverage
run: |
./script/test generate_coverage gcc
- uses: actions/upload-artifact@v2
with:
name: cov-packet-verification
path: tmp/coverage.info
cli-ftd:
runs-on: ubuntu-20.04
env:
CFLAGS: -m32
CXXFLAGS: -m32
LDFLAGS: -m32
COVERAGE: 1
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 g++-multilib python3-setuptools python3-wheel lcov
python3 -m pip install -r tests/scripts/thread-cert/requirements.txt
- name: Build
run: |
./bootstrap
make -f examples/Makefile-simulation
- name: Run
run: |
VERBOSE=1 make -f examples/Makefile-simulation check
- uses: actions/upload-artifact@v2
if: ${{ failure() }}
with:
name: cli-ftd-thread-cert
path: build/simulation/tests/scripts/thread-cert
- name: Generate Coverage
run: |
./script/test generate_coverage gcc
- uses: actions/upload-artifact@v2
with:
name: cov-cli-ftd
path: tmp/coverage.info
cli-mtd:
name: cli-mtd MESSAGE_USE_HEAP=${{ matrix.message_use_heap }}
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
message_use_heap: [0, 1]
env:
CFLAGS: -m32
CXXFLAGS: -m32
LDFLAGS: -m32
COVERAGE: 1
REFERENCE_DEVICE: 1
THREAD_VERSION: 1.1
USE_MTD: 1
VIRTUAL_TIME: 1
MESSAGE_USE_HEAP: ${{ matrix.message_use_heap }}
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 g++-multilib python3-setuptools python3-wheel lcov
python3 -m pip install -r tests/scripts/thread-cert/requirements.txt
- name: Build
run: |
./bootstrap
make -f examples/Makefile-simulation
- name: Run
run: |
VERBOSE=1 make -f examples/Makefile-simulation check
- uses: actions/upload-artifact@v2
if: ${{ failure() }}
with:
name: cli-mtd-thread-cert
path: build/simulation/tests/scripts/thread-cert
- name: Generate Coverage
run: |
./script/test generate_coverage gcc
- uses: actions/upload-artifact@v2
with:
name: cov-cli-mtd-${{ matrix.message_use_heap }}
path: tmp/coverage.info
cli-time-sync:
runs-on: ubuntu-20.04
env:
CFLAGS: -m32
CXXFLAGS: -m32
LDFLAGS: -m32
COVERAGE: 1
REFERENCE_DEVICE: 1
THREAD_VERSION: 1.1
TIME_SYNC: 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 g++-multilib python3-setuptools python3-wheel lcov
python3 -m pip install -r tests/scripts/thread-cert/requirements.txt
- name: Build
run: |
./bootstrap
make -f examples/Makefile-simulation
- name: Run
run: |
VERBOSE=1 make -f examples/Makefile-simulation check
- uses: actions/upload-artifact@v2
if: ${{ failure() }}
with:
name: cli-time-sync-thread-cert
path: build/simulation/tests/scripts/thread-cert
- name: Generate Coverage
run: |
./script/test generate_coverage gcc
- uses: actions/upload-artifact@v2
with:
name: cov-cli-time-sync
path: tmp/coverage.info
expects:
runs-on: ubuntu-18.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: Bootstrap
run: |
sudo apt-get --no-install-recommends install -y expect ninja-build lcov socat
- name: Run
run: |
ulimit -c unlimited
./script/test prepare_coredump_upload
OT_OPTIONS='-DOT_TIME_SYNC=ON -DOT_FULL_LOGS=ON -DOT_LOG_OUTPUT=PLATFORM_DEFINED' VIRTUAL_TIME=0 ./script/test build expect
- name: Check Crash
if: ${{ failure() }}
run: |
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
if: ${{ failure() && env.CRASHED_CLI == '1' }}
with:
name: core-expect-cli
path: |
./ot-core-dump/*
- name: Generate Coverage
run: |
./script/test generate_coverage gcc
- uses: actions/upload-artifact@v2
with:
name: cov-expects
path: tmp/coverage.info
ot-commissioner:
runs-on: ubuntu-20.04
env:
THREAD_VERSION: 1.1
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 install -y avahi-daemon avahi-utils lcov
script/git-tool clone https://github.com/openthread/ot-commissioner.git /tmp/ot-commissioner --depth 1 --branch main
- name: Build
run: |
cd /tmp/ot-commissioner
script/bootstrap.sh
cmake -GNinja \
-DCMAKE_CXX_STANDARD=11 \
-DCMAKE_CXX_STANDARD_REQUIRED=ON \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/usr/local \
-DOT_COMM_COVERAGE=ON \
-DOT_COMM_CCM=OFF \
-S . -B build
cmake --build build
sudo cmake --install build
- name: Run
run: |
export OT_COMM_OPENTHREAD="$(pwd)"
cd /tmp/ot-commissioner/tests/integration
./bootstrap.sh
./run_tests.sh
- name: Generate Coverage
run: |
./script/test generate_coverage gcc
- uses: actions/upload-artifact@v2
with:
name: cov-ot-commissioner
path: tmp/coverage.info
multiple-instance:
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
with:
submodules: true
- name: Bootstrap
run: |
sudo apt-get --no-install-recommends install -y python3-setuptools python3-wheel lcov
python3 -m pip install -r tests/scripts/thread-cert/requirements.txt
- name: Build
run: |
./bootstrap
make -f examples/Makefile-simulation
- name: Run
run: |
VERBOSE=1 make -f examples/Makefile-simulation check
- uses: actions/upload-artifact@v2
if: ${{ failure() }}
with:
name: multiple-instance-thread-cert
path: build/simulation/tests/scripts/thread-cert
- name: Generate Coverage
run: |
./script/test generate_coverage gcc
- uses: actions/upload-artifact@v2
with:
name: cov-multiple-instance
path: tmp/coverage.info
upload-coverage:
needs:
- packet-verification
- cli-ftd
- cli-mtd
- cli-time-sync
- expects
- ot-commissioner
- multiple-instance
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
with:
submodules: true
- name: Bootstrap
run: |
sudo apt-get --no-install-recommends install -y lcov
- uses: actions/download-artifact@v2
with:
path: coverage/
- name: Combine Coverage
run: |
script/test combine_coverage
- name: Upload Coverage
uses: codecov/codecov-action@v2
with:
files: final.info
fail_ci_if_error: true
delete-coverage-artifacts:
needs: upload-coverage
runs-on: ubuntu-20.04
steps:
- uses: geekyeggo/delete-artifact@1-glob-support
with:
name: cov-*
useGlob: true
+273 -26
View File
@@ -26,66 +26,313 @@
# POSSIBILITY OF SUCH DAMAGE.
#
name: Simulation 1.2
name: Simulation 1.3
on: [push, pull_request]
jobs:
cancel-previous-runs:
runs-on: ubuntu-latest
runs-on: ubuntu-20.04
steps:
- uses: rokroskar/workflow-run-cleanup-action@master
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
if: "github.ref != 'refs/heads/master'"
if: "github.ref != 'refs/heads/main'"
thread-1-2:
name: thread-1-2-${{ matrix.compiler.c }}-${{ matrix.arch }}
runs-on: ubuntu-18.04
thread-1-3:
name: thread-1-3-${{ matrix.compiler.c }}-${{ matrix.arch }}
runs-on: ubuntu-20.04
env:
CFLAGS: -${{ matrix.arch }}
CXXFLAGS: -${{ matrix.arch }}
LDFLAGS: -${{ matrix.arch }}
COVERAGE: 1
THREAD_VERSION: 1.2
THREAD_VERSION: 1.3
VIRTUAL_TIME: 1
INTER_OP: 1
CC: ${{ matrix.compiler.c }}
CXX: ${{ matrix.compiler.cxx }}
strategy:
fail-fast: false
matrix:
compiler: [{c: "gcc", cxx: "g++"}, { c: "clang", cxx: "clang++"}]
compiler: [{c: "gcc", cxx: "g++", gcov: "gcc"}, { c: "clang-10", cxx: "clang++-10", gcov: "llvm"}]
arch: ["m32", "m64"]
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 g++-multilib ninja-build python3-setuptools python3-wheel
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: |
./bootstrap
./script/test build
- name: Run
run: |
ulimit -c unlimited
./script/test prepare_coredump_upload
./script/test unit
./script/test cert_suite tests/scripts/thread-cert/v1_2_*
- name: Keep-1-2-only
- name: Check Crash
if: ${{ failure() }}
run: |
./script/test tar 1.1
./script/test tar 1.2-bbr
- name: Codecov
uses: codecov/codecov-action@v1
- name: Keep-1-2-bbr-only
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
if: ${{ failure() }}
with:
name: thread-1-3-${{ matrix.compiler.c }}-${{ matrix.arch }}-pcaps
path: "*.pcap"
- uses: actions/upload-artifact@v2
if: ${{ failure() && env.CRASHED == '1' }}
with:
name: core-packet-verification-thread-1-3
path: |
./ot-core-dump/*
- name: Generate Coverage
run: |
./script/test tar 1.2
./script/test untar 1.2-bbr
- name: Codecov
uses: codecov/codecov-action@v1
- name: Keep-1-1-only
./script/test generate_coverage "${{ matrix.compiler.gcov }}"
- uses: actions/upload-artifact@v2
with:
name: cov-thread-1-3-${{ matrix.compiler.c }}-${{ matrix.arch }}
path: tmp/coverage.info
packet-verification-low-power:
runs-on: ubuntu-20.04
env:
REFERENCE_DEVICE: 1
VIRTUAL_TIME: 1
COVERAGE: 1
PACKET_VERIFICATION: 1
THREAD_VERSION: 1.3
MAC_FILTER: 1
INTER_OP: 1
INTER_OP_BBR: 0
steps:
- uses: actions/checkout@v2
with:
submodules: true
- name: Bootstrap
run: |
./script/test tar 1.2-bbr
./script/test untar 1.1
- name: Codecov
uses: codecov/codecov-action@v1
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 ninja-build lcov
python3 -m pip install -r tests/scripts/thread-cert/requirements.txt
- name: Build
run: |
./script/test build
- name: Get Thread-Wireshark
run: |
./script/test get_thread_wireshark
- name: Run
run: |
ulimit -c unlimited
./script/test prepare_coredump_upload
for i in {1..10}
do
./script/test cert_suite ./tests/scripts/thread-cert/v1_2_LowPower*.py
done
- name: Check Crash
if: ${{ failure() }}
run: |
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
if: ${{ failure() }}
with:
name: packet-verification-low-power-pcaps
path: |
*.pcap
*.json
- uses: actions/upload-artifact@v2
if: ${{ failure() && env.CRASHED == '1' }}
with:
name: core-packet-verification-low-power
path: |
./ot-core-dump/*
- name: Generate Coverage
run: |
./script/test generate_coverage gcc
- uses: actions/upload-artifact@v2
with:
name: cov-packet-verification-low-power
path: tmp/coverage.info
packet-verification-1-1-on-1-3:
runs-on: ubuntu-20.04
env:
REFERENCE_DEVICE: 1
VIRTUAL_TIME: 1
PACKET_VERIFICATION: 1
THREAD_VERSION: 1.3
MULTIPLY: 3
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 g++-multilib python3-setuptools python3-wheel ninja-build lcov
python3 -m pip install -r tests/scripts/thread-cert/requirements.txt
- name: Build
run: |
./script/test build
- name: Get Thread-Wireshark
run: |
./script/test get_thread_wireshark
- name: Run
run: |
./script/test cert_suite ./tests/scripts/thread-cert/Cert_*.py ./tests/scripts/thread-cert/test_*.py
- uses: actions/upload-artifact@v2
if: ${{ failure() }}
with:
name: packet-verification-1.1-on-1.3-pcaps
path: |
*.pcap
*.json
- name: Generate Coverage
run: |
./script/test generate_coverage gcc
- uses: actions/upload-artifact@v2
with:
name: cov-packet-verification-1-1-on-1-3
path: tmp/coverage.info
expects:
runs-on: ubuntu-20.04
env:
COVERAGE: 1
THREAD_VERSION: 1.3
VIRTUAL_TIME: 0
steps:
- uses: actions/checkout@v2
with:
submodules: true
- name: Bootstrap
run: |
sudo apt-get --no-install-recommends install -y expect ninja-build lcov socat
- name: Run RCP Mode
run: |
ulimit -c unlimited
./script/test prepare_coredump_upload
OT_OPTIONS=-DOT_READLINE=OFF OT_NODE_TYPE=rcp ./script/test build expect
- name: Check Crash
if: ${{ failure() }}
run: |
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
if: ${{ failure() && env.CRASHED == '1' }}
with:
name: core-expect-1-3
path: |
./ot-core-dump/*
- name: Generate Coverage
run: |
./script/test generate_coverage gcc
- uses: actions/upload-artifact@v2
with:
name: cov-expects
path: tmp/coverage.info
thread-1-3-posix:
runs-on: ubuntu-20.04
env:
COVERAGE: 1
PYTHONUNBUFFERED: 1
READLINE: readline
THREAD_VERSION: 1.3
OT_NODE_TYPE: rcp
USE_MTD: 1
VIRTUAL_TIME: 1
INTER_OP: 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 libreadline6-dev g++-multilib ninja-build python3-setuptools python3-wheel llvm lcov
python3 -m pip install -r tests/scripts/thread-cert/requirements.txt
- name: Build
run: |
./script/test build
- name: Run
run: |
ulimit -c unlimited
./script/test prepare_coredump_upload
./script/test cert tests/scripts/thread-cert/v1_2_LowPower_5_3_01_SSEDAttachment.py
./script/test cert tests/scripts/thread-cert/v1_2_LowPower_6_1_07_PreferringARouterOverAReed.py
./script/test cert tests/scripts/thread-cert/v1_2_router_5_1_1.py
./script/test cert tests/scripts/thread-cert/v1_2_test_csl_transmission.py
./script/test cert tests/scripts/thread-cert/v1_2_test_enhanced_frame_pending.py
./script/test cert tests/scripts/thread-cert/v1_2_test_parent_selection.py
- name: Check Crash
if: ${{ failure() }}
run: |
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
if: ${{ failure() }}
with:
name: thread-1-3-posix-pcaps
path: "*.pcap"
- uses: actions/upload-artifact@v2
if: ${{ failure() && env.CRASHED == '1' }}
with:
name: core-thread-1-3-posix
path: |
./ot-core-dump/*
- name: Generate Coverage
run: |
./script/test generate_coverage gcc
- uses: actions/upload-artifact@v2
with:
name: cov-thread-1-3-posix
path: tmp/coverage.info
upload-coverage:
needs:
- thread-1-3
- packet-verification-low-power
- packet-verification-1-1-on-1-3
- expects
- thread-1-3-posix
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
with:
submodules: true
- name: Bootstrap
run: |
sudo apt-get --no-install-recommends install -y lcov
- uses: actions/download-artifact@v2
with:
path: coverage/
- name: Combine Coverage
run: |
script/test combine_coverage
- name: Upload Coverage
uses: codecov/codecov-action@v2
with:
files: final.info
fail_ci_if_error: true
delete-coverage-artifacts:
needs: upload-coverage
runs-on: ubuntu-20.04
steps:
- uses: geekyeggo/delete-artifact@1-glob-support
with:
name: cov-*
useGlob: true
-347
View File
@@ -1,347 +0,0 @@
#
# Copyright (c) 2020, 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: Simulation
on: [push, pull_request]
jobs:
cancel-previous-runs:
runs-on: ubuntu-latest
steps:
- uses: rokroskar/workflow-run-cleanup-action@master
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
if: "github.ref != 'refs/heads/master'"
distcheck:
runs-on: ubuntu-18.04
env:
CC: clang
CXX: clang++
REFERENCE_DEVICE: 1
VIRTUAL_TIME: 1
steps:
- uses: actions/checkout@v2
- 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
./bootstrap
make -f examples/Makefile-simulation distcheck
cli-ftd-otns:
runs-on: ubuntu-18.04
env:
CFLAGS: -m32
CXXFLAGS: -m32
LDFLAGS: -m32
COVERAGE: 1
REFERENCE_DEVICE: 1
VIRTUAL_TIME: 1
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v1
with:
go-version: '1.13'
- name: Set up Python 3.6
uses: actions/setup-python@v1
with:
python-version: 3.6
- name: Bootstrap
run: |
sudo rm /etc/apt/sources.list.d/* && sudo apt-get update
sudo apt-get --no-install-recommends install -y g++-multilib
./bootstrap
- name: Run OTNS Tests
run: |
git clone https://github.com/openthread/ot-ns.git --depth 1 --branch master ~/otns
export OT_DIR=$PWD
cd ~/otns
./script/test py-unittests py-examples
- name: Codecov
uses: codecov/codecov-action@v1
packet-verification:
runs-on: ubuntu-18.04
env:
REFERENCE_DEVICE: 1
VIRTUAL_TIME: 1
PACKET_VERIFICATION: 1
steps:
- uses: actions/checkout@v2
- 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 ninja-build
python3 -m pip install -r tests/scripts/thread-cert/requirements.txt
- name: Build
run: |
./script/test build
- name: Run
run: |
for i in {1..10}
do
./script/test cert_suite ./tests/scripts/thread-cert/Cert_*.py
done
- name: Codecov
uses: codecov/codecov-action@v1
cli-ftd:
runs-on: ubuntu-18.04
env:
CFLAGS: -m32
CXXFLAGS: -m32
LDFLAGS: -m32
COVERAGE: 1
REFERENCE_DEVICE: 1
VIRTUAL_TIME: 1
steps:
- uses: actions/checkout@v2
- 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
python3 -m pip install -r tests/scripts/thread-cert/requirements.txt
- name: Build
run: |
./bootstrap
make -f examples/Makefile-simulation
- name: Run
run: |
VERBOSE=1 make -f examples/Makefile-simulation check
- name: Codecov
uses: codecov/codecov-action@v1
cli-mtd:
runs-on: ubuntu-18.04
env:
CFLAGS: -m32
CXXFLAGS: -m32
LDFLAGS: -m32
COVERAGE: 1
REFERENCE_DEVICE: 1
USE_MTD: 1
VIRTUAL_TIME: 1
steps:
- uses: actions/checkout@v2
- 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
python3 -m pip install -r tests/scripts/thread-cert/requirements.txt
- name: Build
run: |
./bootstrap
make -f examples/Makefile-simulation
- name: Run
run: |
VERBOSE=1 make -f examples/Makefile-simulation check
- name: Codecov
uses: codecov/codecov-action@v1
cli-time-sync:
runs-on: ubuntu-18.04
env:
CFLAGS: -m32
CXXFLAGS: -m32
LDFLAGS: -m32
COVERAGE: 1
REFERENCE_DEVICE: 1
TIME_SYNC: 1
VIRTUAL_TIME: 1
steps:
- uses: actions/checkout@v2
- 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
python3 -m pip install -r tests/scripts/thread-cert/requirements.txt
- name: Build
run: |
./bootstrap
make -f examples/Makefile-simulation
- name: Run
run: |
VERBOSE=1 make -f examples/Makefile-simulation check
- name: Codecov
uses: codecov/codecov-action@v1
expects:
runs-on: ubuntu-18.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: Bootstrap
run: |
OT_OPTIONS=-DOT_READLINE=OFF sudo apt-get --no-install-recommends install -y expect ninja-build
- name: Run
run: |
OT_OPTIONS=-DOT_TIME_SYNC=ON VIRTUAL_TIME=0 ./script/test build expect
- name: Codecov
uses: codecov/codecov-action@v1
- name: Run RCP Mode
run: |
OT_OPTIONS=-DOT_READLINE=OFF VIRTUAL_TIME=0 NODE_MODE=rcp ./script/test clean build expect
- name: Codecov
uses: codecov/codecov-action@v1
- name: Run TUN Mode
run: |
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
host ipv6.google.com ::1
OT_OPTIONS=-DOT_READLINE=OFF OT_NATIVE_IP=1 VIRTUAL_TIME=0 NODE_MODE=rcp ./script/test clean build expect
- name: Codecov
uses: codecov/codecov-action@v1
external-commissioner:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
- name: Bootstrap
run: |
sudo rm /etc/apt/sources.list.d/*
sudo apt-get install avahi-daemon avahi-utils -y
git clone https://github.com/openthread/ot-commissioner.git /tmp/ot-commissioner --depth 1 --branch master
- name: Build
run: |
cd /tmp/ot-commissioner
script/bootstrap.sh
cmake -GNinja \
-DCMAKE_CXX_STANDARD=11 \
-DCMAKE_CXX_STANDARD_REQUIRED=ON \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/usr/local \
-DOT_COMM_COVERAGE=ON \
-DOT_COMM_CCM=OFF \
-S . -B build
cmake --build build
sudo cmake --install build
- name: Run
run: |
export OT_COMM_OPENTHREAD="$(pwd)"
cd /tmp/ot-commissioner/tests/integration
./bootstrap.sh
./run_tests.sh
- name: Codecov
uses: codecov/codecov-action@v1
multiple-instance:
runs-on: ubuntu-18.04
env:
COVERAGE: 1
MULTIPLE_INSTANCE: 1
REFERENCE_DEVICE: 1
VIRTUAL_TIME: 1
steps:
- uses: actions/checkout@v2
- name: Bootstrap
run: |
sudo apt-get --no-install-recommends install -y python3-setuptools python3-wheel
python3 -m pip install -r tests/scripts/thread-cert/requirements.txt
- name: Build
run: |
./bootstrap
make -f examples/Makefile-simulation
- name: Run
run: |
VERBOSE=1 make -f examples/Makefile-simulation check
- name: Codecov
uses: codecov/codecov-action@v1
ncp-gcc-m32:
runs-on: ubuntu-18.04
env:
CFLAGS: -m32
CXXFLAGS: -m32
LDFLAGS: -m32
COVERAGE: 1
NODE_TYPE: ncp-sim
PYTHONUNBUFFERED: 1
REFERENCE_DEVICE: 1
VIRTUAL_TIME: 1
steps:
- uses: actions/checkout@v2
- 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
python3 -m pip install -r tests/scripts/thread-cert/requirements.txt
sudo python3 -m pip install git+https://github.com/openthread/pyspinel
- name: Build
run: |
./bootstrap
make -f examples/Makefile-simulation
- name: Run
run: |
VERBOSE=1 make -f examples/Makefile-simulation check
- name: Codecov
uses: codecov/codecov-action@v1
ncp-clang:
runs-on: ubuntu-18.04
env:
COVERAGE: 1
NODE_TYPE: ncp-sim
PYTHONUNBUFFERED: 1
REFERENCE_DEVICE: 1
VIRTUAL_TIME: 1
CC: clang
CXX: clang++
steps:
- uses: actions/checkout@v2
- name: Bootstrap
run: |
sudo rm /etc/apt/sources.list.d/* && sudo apt-get update
sudo apt-get --no-install-recommends install -y python3-setuptools python3-wheel
python3 -m pip install -r tests/scripts/thread-cert/requirements.txt
sudo python3 -m pip install git+https://github.com/openthread/pyspinel
- name: Build
run: |
./bootstrap
make -f examples/Makefile-simulation
- name: Run
run: |
VERBOSE=1 make -f examples/Makefile-simulation check
- name: Codecov
uses: codecov/codecov-action@v1
+9 -3
View File
@@ -33,15 +33,15 @@ on: [push, pull_request]
jobs:
cancel-previous-runs:
runs-on: ubuntu-latest
runs-on: ubuntu-20.04
steps:
- uses: rokroskar/workflow-run-cleanup-action@master
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
if: "github.ref != 'refs/heads/master'"
if: "github.ref != 'refs/heads/main'"
size-report:
runs-on: ubuntu-18.04
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- name: Bootstrap
@@ -53,6 +53,12 @@ jobs:
env:
OT_BASE_BRANCH: "${{ github.base_ref }}"
SIZE_REPORT_URL: "https://openthread-size-report.glitch.me/size-report/1354027"
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
run: |
export PATH=$PATH:$HOME/.local/bin
if [ ${{ github.event_name }} == pull_request ]; then
curl -s --retry 5 "${SIZE_REPORT_URL}/bash" >size-report
chmod a+x size-report
export OT_SIZE_REPORTER=./size-report
fi
./script/check-size
+78 -22
View File
@@ -33,20 +33,30 @@ on: [push, pull_request]
jobs:
cancel-previous-runs:
runs-on: ubuntu-latest
runs-on: ubuntu-20.04
steps:
- uses: rokroskar/workflow-run-cleanup-action@master
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
if: "github.ref != 'refs/heads/master'"
if: "github.ref != 'refs/heads/main'"
toranj-ncp:
name: toranj-ncp-${{ matrix.TORANJ_RADIO }}
runs-on: ubuntu-18.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
@@ -55,8 +65,9 @@ jobs:
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
git clone --depth=1 --branch=master https://github.com/openthread/wpantund.git
script/git-tool clone --depth=1 --branch=master https://github.com/openthread/wpantund.git
cd wpantund
./bootstrap.sh
./configure
@@ -65,34 +76,79 @@ jobs:
- name: Build & Run
run: |
top_builddir=$(pwd)/build/toranj ./tests/toranj/start.sh
- name: Codecov
uses: codecov/codecov-action@v1
- 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-rcp:
toranj-cli:
name: toranj-cli-${{ matrix.TORANJ_RADIO }}
runs-on: ubuntu-18.04
strategy:
matrix:
TORANJ_RADIO: ['15.4']
env:
COVERAGE: 1
TORANJ_POSIX_RCP_MODEL: 1
TORANJ_RADIO : ${{ matrix.TORANJ_RADIO }}
TORANJ_CLI: 1
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
git clone --depth=1 --branch=master https://github.com/openthread/wpantund.git
cd wpantund
./bootstrap.sh
./configure
sudo make -j2
sudo make install
sudo apt-get --no-install-recommends install -y lcov
python3 -m pip install -r tests/scripts/thread-cert/requirements.txt
- name: Build & Run
run: |
top_builddir=$(pwd)/build/toranj ./tests/toranj/start.sh
- name: Codecov
uses: codecov/codecov-action@v1
- 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-cli-${{ matrix.TORANJ_RADIO }}
path: tmp/coverage.info
upload-coverage:
needs:
- toranj-ncp
- toranj-cli
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
with:
submodules: true
- name: Bootstrap
run: |
sudo apt-get --no-install-recommends install -y lcov
- uses: actions/download-artifact@v2
with:
path: coverage/
- name: Combine Coverage
run: |
script/test combine_coverage
- name: Upload Coverage
uses: codecov/codecov-action@v2
with:
files: final.info
fail_ci_if_error: true
delete-coverage-artifacts:
needs: upload-coverage
runs-on: ubuntu-20.04
steps:
- uses: geekyeggo/delete-artifact@1-glob-support
with:
name: cov-*
useGlob: true
+5 -3
View File
@@ -32,17 +32,19 @@ on: [pull_request]
jobs:
cancel-previous-runs:
runs-on: ubuntu-latest
runs-on: ubuntu-20.04
steps:
- uses: rokroskar/workflow-run-cleanup-action@master
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
if: "github.ref != 'refs/heads/master'"
if: "github.ref != 'refs/heads/main'"
api-version:
runs-on: ubuntu-18.04
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
with:
submodules: true
- name: Check
run: |
script/check-api-version
+10
View File
@@ -11,6 +11,7 @@
*.ninja*
*.opendb
*.orig
*.pcap
*.pyc
*.suo
*.swn
@@ -58,3 +59,12 @@ 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
.idea/**
.vscode/**
cmake-build-*/**
/tags
# Python bytecodes
__pycache__
+37
View File
@@ -0,0 +1,37 @@
#
# Copyright (c) 2020, 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.
#
extraction:
cpp:
prepare:
packages:
- cmake
- ninja-build
index:
build_command:
- THREAD_VERSION=1.2 NODE_MODE=rcp OT_NATIVE_IP=1 ./script/test build
+384 -271
View File
@@ -28,18 +28,31 @@
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\"
OPENTHREAD_PROJECT_CFLAGS ?= \
-DOPENTHREAD_PROJECT_CORE_CONFIG_FILE=\"openthread-core-posix-config.h\" \
$(NULL)
OPENTHREAD_PUBLIC_CFLAGS := \
-DOPENTHREAD_CONFIG_COMMISSIONER_ENABLE=1 \
-DOPENTHREAD_CONFIG_FILE=\<openthread-config-android.h\> \
-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_POSIX_CONFIG_RCP_PTY_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_POSIX=1 \
-DOPENTHREAD_PLATFORM_POSIX=1 \
-DOPENTHREAD_POSIX_CONFIG_RCP_PTY_ENABLE=1 \
-DOPENTHREAD_SPINEL_CONFIG_OPENTHREAD_MESSAGE_ENABLE=1 \
$(NULL)
@@ -67,7 +80,6 @@ ifeq ($(USE_OTBR_DAEMON), 1)
OPENTHREAD_PUBLIC_CFLAGS += \
-DOPENTHREAD_CONFIG_PLATFORM_NETIF_ENABLE=1 \
-DOPENTHREAD_CONFIG_PLATFORM_UDP_ENABLE=1 \
-DOPENTHREAD_CONFIG_UNSECURE_TRAFFIC_MANAGED_BY_STACK_ENABLE=1 \
-DOPENTHREAD_POSIX_CONFIG_DAEMON_ENABLE=1 \
$(NULL)
else
@@ -117,6 +129,7 @@ LOCAL_C_INCLUDES := \
$(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 := \
@@ -138,187 +151,352 @@ LOCAL_EXPORT_C_INCLUDE_DIRS := \
LOCAL_CPPFLAGS := \
-std=c++11 \
-Wno-error=non-virtual-dtor \
-pedantic-errors \
$(NULL)
LOCAL_SRC_FILES := \
src/core/api/backbone_router_api.cpp \
src/core/api/backbone_router_ftd_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/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/diags_api.cpp \
src/core/api/dns_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_raw_api.cpp \
src/core/api/logging_api.cpp \
src/core/api/message_api.cpp \
src/core/api/netdata_api.cpp \
src/core/api/netdiag_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/tasklet_api.cpp \
src/core/api/thread_api.cpp \
src/core/api/thread_ftd_api.cpp \
src/core/api/udp_api.cpp \
src/core/backbone_router/bbr_leader.cpp \
src/core/backbone_router/bbr_local.cpp \
src/core/backbone_router/bbr_manager.cpp \
src/core/coap/coap.cpp \
src/core/coap/coap_message.cpp \
src/core/coap/coap_secure.cpp \
src/core/common/crc16.cpp \
src/core/common/instance.cpp \
src/core/common/logging.cpp \
src/core/common/message.cpp \
src/core/common/notifier.cpp \
src/core/common/random_manager.cpp \
src/core/common/settings.cpp \
src/core/common/string.cpp \
src/core/common/tasklet.cpp \
src/core/common/timer.cpp \
src/core/common/tlvs.cpp \
src/core/common/trickle_timer.cpp \
src/core/crypto/aes_ccm.cpp \
src/core/crypto/aes_ecb.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/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/mac.cpp \
src/core/mac/mac_filter.cpp \
src/core/mac/mac_frame.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/dtls.cpp \
src/core/meshcop/energy_scan_client.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/panid_query_client.cpp \
src/core/meshcop/timestamp.cpp \
src/core/net/dhcp6_client.cpp \
src/core/net/dhcp6_server.cpp \
src/core/net/dns_client.cpp \
src/core/net/icmp6.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/netif.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/thread/address_resolver.cpp \
src/core/thread/announce_begin_server.cpp \
src/core/thread/announce_sender.cpp \
src/core/thread/child_table.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_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_diagnostic.cpp \
src/core/thread/panid_query_server.cpp \
src/core/thread/router_table.cpp \
src/core/thread/src_match_controller.cpp \
src/core/thread/thread_netif.cpp \
src/core/thread/topology.cpp \
src/core/utils/channel_manager.cpp \
src/core/utils/channel_monitor.cpp \
src/core/utils/child_supervision.cpp \
src/core/utils/heap.cpp \
src/core/utils/jam_detector.cpp \
src/core/utils/parse_cmdline.cpp \
src/core/utils/slaac_address.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/entropy.cpp \
src/posix/platform/hdlc_interface.cpp \
src/posix/platform/logging.cpp \
src/posix/platform/misc.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/uart.cpp \
src/posix/platform/udp.cpp \
third_party/mbedtls/repo/library/md.c \
third_party/mbedtls/repo/library/md_wrap.c \
third_party/mbedtls/repo/library/memory_buffer_alloc.c \
third_party/mbedtls/repo/library/platform.c \
third_party/mbedtls/repo/library/platform_util.c \
third_party/mbedtls/repo/library/sha256.c \
third_party/mbedtls/repo/library/bignum.c \
third_party/mbedtls/repo/library/ccm.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/ctr_drbg.c \
third_party/mbedtls/repo/library/debug.c \
third_party/mbedtls/repo/library/ecjpake.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/ssl_cookie.c \
third_party/mbedtls/repo/library/ssl_ciphersuites.c \
third_party/mbedtls/repo/library/ssl_cli.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/aes.c \
third_party/mbedtls/repo/library/ecp.c \
$(OPENTHREAD_PROJECT_SRC_FILES) \
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)
@@ -343,7 +521,6 @@ LOCAL_C_INCLUDES := \
LOCAL_CFLAGS := \
$(OPENTHREAD_PUBLIC_CFLAGS) \
$(OPENTHREAD_PRIVATE_CFLAGS) \
-DOPENTHREAD_CONFIG_UART_CLI_RAW=1 \
$(OPENTHREAD_PROJECT_CFLAGS) \
$(NULL)
@@ -357,10 +534,14 @@ LOCAL_SRC_FILES := \
src/cli/cli_coap.cpp \
src/cli/cli_coap_secure.cpp \
src/cli/cli_commissioner.cpp \
src/cli/cli_console.cpp \
src/cli/cli_dataset.cpp \
src/cli/cli_history.cpp \
src/cli/cli_joiner.cpp \
src/cli/cli_uart.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)
@@ -371,6 +552,10 @@ 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 \
@@ -386,7 +571,6 @@ LOCAL_C_INCLUDES := \
LOCAL_CFLAGS := \
$(OPENTHREAD_PUBLIC_CFLAGS) \
$(OPENTHREAD_PRIVATE_CFLAGS) \
-DOPENTHREAD_POSIX_APP_TYPE=OT_POSIX_APP_TYPE_CLI \
$(OPENTHREAD_PROJECT_CFLAGS) \
$(NULL)
@@ -400,93 +584,14 @@ LOCAL_LDLIBS := \
-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)
include $(CLEAR_VARS)
LOCAL_MODULE := libopenthread-ncp
LOCAL_MODULE_TAGS := eng
LOCAL_C_INCLUDES := \
$(OPENTHREAD_PROJECT_INCLUDES) \
$(LOCAL_PATH)/include \
$(LOCAL_PATH)/src \
$(LOCAL_PATH)/src/core \
$(LOCAL_PATH)/src/ncp \
$(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/lib/spinel/spinel_buffer.cpp \
src/ncp/changed_props_set.cpp \
src/ncp/ncp_base.cpp \
src/ncp/ncp_base_mtd.cpp \
src/ncp/ncp_base_ftd.cpp \
src/ncp/ncp_base_dispatcher.cpp \
src/ncp/ncp_uart.cpp \
$(NULL)
include $(BUILD_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := ot-ncp
LOCAL_MODULE_TAGS := eng
LOCAL_C_INCLUDES := \
$(OPENTHREAD_PROJECT_INCLUDES) \
$(LOCAL_PATH)/include \
$(LOCAL_PATH)/src \
$(LOCAL_PATH)/src/core \
$(LOCAL_PATH)/src/ncp \
$(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) \
-DOPENTHREAD_POSIX_APP_TYPE=OT_POSIX_APP_TYPE_NCP \
$(OPENTHREAD_PROJECT_CFLAGS) \
$(NULL)
LOCAL_CPPFLAGS := \
-std=c++11 \
-pedantic-errors \
$(NULL)
LOCAL_SRC_FILES := \
src/posix/main.c \
$(NULL)
LOCAL_LDLIBS := \
-lrt \
-lutil
LOCAL_STATIC_LIBRARIES = libopenthread-ncp ot-core
include $(BUILD_EXECUTABLE)
ifeq ($(USE_OTBR_DAEMON), 1)
include $(CLEAR_VARS)
@@ -498,8 +603,10 @@ LOCAL_CPPFLAGS := \
-pedantic-errors \
$(NULL)
LOCAL_CFLAGS := \
-DOPENTHREAD_CONFIG_FILE=\<openthread-config-android.h\> \
LOCAL_CFLAGS := \
$(OPENTHREAD_PUBLIC_CFLAGS) \
$(OPENTHREAD_PRIVATE_CFLAGS) \
$(OPENTHREAD_PROJECT_CFLAGS) \
$(NULL)
LOCAL_C_INCLUDES := \
@@ -515,3 +622,9 @@ 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)
+21 -4
View File
@@ -28,6 +28,7 @@
import("etc/gn/openthread.gni")
config("openthread_config") {
defines = []
if (openthread_config_file != "") {
defines += [ "OPENTHREAD_CONFIG_FILE=${openthread_config_file}" ]
}
@@ -41,15 +42,27 @@ config("openthread_config") {
}
config("openthread_ftd_config") {
defines = [ "OPENTHREAD_FTD=1" ]
defines = [
"OPENTHREAD_FTD=1",
"OPENTHREAD_MTD=0",
"OPENTHREAD_RADIO=0",
]
}
config("openthread_mtd_config") {
defines = [ "OPENTHREAD_MTD=1" ]
defines = [
"OPENTHREAD_MTD=1",
"OPENTHREAD_FTD=0",
"OPENTHREAD_RADIO=0",
]
}
config("openthread_radio_config") {
defines = [ "OPENTHREAD_RADIO=1" ]
defines = [
"OPENTHREAD_RADIO=1",
"OPENTHREAD_FTD=0",
"OPENTHREAD_MTD=0",
]
}
group("libopenthread-ftd") {
@@ -89,6 +102,10 @@ group("libopenthread-spinel-rcp") {
if (current_os == "fuchsia") {
group("lib-ot-core") {
public_deps = [ ":libopenthread-ftd" ]
public_deps = [
":libopenthread-ftd",
"src/core:libopenthread-ftd",
"src/ncp:libopenthread-ncp-ftd",
]
}
}
+63 -20
View File
@@ -37,8 +37,14 @@ project(openthread VERSION ${OT_DEFAULT_VERSION})
option(OT_BUILD_EXECUTABLES "Build executables" ON)
option(OT_COVERAGE "enable coverage" OFF)
set(OT_EXTERNAL_MBEDTLS "" CACHE STRING "Specify external mbedtls library")
option(OT_MBEDTLS_THREADING "enable mbedtls threading" OFF)
add_library(ot-config INTERFACE)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_C_STANDARD 99)
message(STATUS "OpenThread Source Directory: ${PROJECT_SOURCE_DIR}")
target_include_directories(ot-config INTERFACE
${PROJECT_SOURCE_DIR}/include
@@ -52,10 +58,21 @@ if(OT_BIG_ENDIAN)
target_compile_definitions(ot-config INTERFACE "BYTE_ORDER_BIG_ENDIAN=1")
endif()
include("${PROJECT_SOURCE_DIR}/etc/cmake/checks.cmake")
include("${PROJECT_SOURCE_DIR}/etc/cmake/options.cmake")
include("${PROJECT_SOURCE_DIR}/etc/cmake/functions.cmake")
if(NOT CMAKE_BUILD_TYPE)
# Check if this is a top-level CMake.
# If it is not, do not set the CMAKE_BUILD_TYPE because OpenThread is a part of something bigger.
if ("${CMAKE_PROJECT_NAME}" STREQUAL "openthread")
set(CMAKE_BUILD_TYPE "Debug" CACHE STRING "default build type: Debug" FORCE)
endif ()
endif()
if (CMAKE_BUILD_TYPE)
message(STATUS "OpenThread CMake build type: ${CMAKE_BUILD_TYPE}")
endif ()
if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID MATCHES "(Apple)?[Cc]lang")
option(OT_COMPILE_WARNING_AS_ERROR "whether to include -Werror -pedantic-errors with gcc-compatible compilers")
if (OT_COMPILE_WARNING_AS_ERROR)
@@ -74,24 +91,25 @@ if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID MATCHES "(Apple)?[Cc]lang")
)
endif()
execute_process(
COMMAND bash "-c" "third_party/nlbuild-autotools/repo/scripts/mkversion -b ${OT_DEFAULT_VERSION}"
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
OUTPUT_VARIABLE OT_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE
)
message(STATUS "Version: ${OT_VERSION}")
set(OT_PACKAGE_NAME "OPENTHREAD" CACHE STRING "OpenThread Package Name")
target_compile_definitions(ot-config INTERFACE "PACKAGE_NAME=\"${OT_PACKAGE_NAME}\"")
message(STATUS "Package Name: ${OT_PACKAGE_NAME}")
target_compile_definitions(ot-config INTERFACE
"PACKAGE_NAME=\"OPENTHREAD\""
"PACKAGE_VERSION=\"${OT_VERSION}\""
)
set(OT_PACKAGE_VERSION "" CACHE STRING "OpenThread Package Version")
if(OT_PACKAGE_VERSION STREQUAL "")
ot_git_version(OT_PACKAGE_VERSION)
message(STATUS "Setting default package version: ${OT_PACKAGE_VERSION}")
endif()
message(STATUS "Package Version: ${OT_PACKAGE_VERSION}")
set(OT_THREAD_VERSION "1.1" CACHE STRING "Thread version chosen by the user at configure time")
set_property(CACHE OT_THREAD_VERSION PROPERTY STRINGS "1.1" "1.2")
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")
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_THREAD_VERSION=OT_THREAD_VERSION_1_1")
elseif(${OT_THREAD_VERSION} EQUAL "1.2")
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_THREAD_VERSION=OT_THREAD_VERSION_1_2")
elseif(${OT_THREAD_VERSION} EQUAL "1.3")
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_THREAD_VERSION=OT_THREAD_VERSION_1_3")
else()
message(FATAL_ERROR "Thread version unknown: ${OT_THREAD_VERSION}")
endif()
@@ -103,6 +121,20 @@ if(NOT OT_PLATFORM IN_LIST OT_PLATFORMS)
message(FATAL_ERROR "Platform unknown: ${OT_PLATFORM}")
endif()
set(OT_LOG_LEVEL "" CACHE STRING "set OpenThread log level")
set(OT_LOG_LEVEL_VALUES
"NONE"
"CRIT"
"WARN"
"NOTE"
"INFO"
"DEBG"
)
set_property(CACHE OT_LOG_LEVEL PROPERTY STRINGS ${OT_LOG_LEVEL_VALUES})
if(OT_LOG_LEVEL)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_LOG_LEVEL=OT_LOG_LEVEL_${OT_LOG_LEVEL}")
endif()
set(OT_LOG_OUTPUT_VALUES
"APP"
"DEBUG_UART"
@@ -123,10 +155,10 @@ if(OT_LOG_OUTPUT)
message(STATUS "Log output: ${OT_LOG_OUTPUT}")
endif()
# OT_CONFIG allows users to specify the path to OpenThread project core
# OT_CONFIG allows users to specify the path to a customized OpenThread
# config header file. The default value of this parameter is empty string.
# When not specified by user (value is ""), a platform cmake file may
# choose to change this variable to provide its own core config header
# choose to change this variable to provide its own OpenThread config header
# file instead.
set(OT_CONFIG "" CACHE STRING "OpenThread project-specific config header file chosen by user at configure time")
@@ -138,14 +170,16 @@ 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)
add_subdirectory("${PROJECT_SOURCE_DIR}/src/posix/platform")
elseif(OT_PLATFORM)
elseif(OT_PLATFORM STREQUAL "external")
# skip in this case
else()
target_include_directories(ot-config INTERFACE ${PROJECT_SOURCE_DIR}/examples/platforms/${OT_PLATFORM})
add_subdirectory("${PROJECT_SOURCE_DIR}/examples/platforms/${OT_PLATFORM}")
endif()
if(OT_CONFIG)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_PROJECT_CORE_CONFIG_FILE=\"${OT_CONFIG}\"")
message(STATUS "Project core config: \"${OT_CONFIG}\"")
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_FILE=\"${OT_CONFIG}\"")
message(STATUS "OpenThread Config File: \"${OT_CONFIG}\"")
endif()
target_compile_definitions(ot-config INTERFACE ${OT_PLATFORM_DEFINES})
@@ -160,12 +194,21 @@ elseif(OT_PLATFORM)
add_subdirectory(examples)
endif()
if (OT_DOC)
add_subdirectory(doc)
endif()
add_subdirectory(src)
add_subdirectory(third_party EXCLUDE_FROM_ALL)
if(OT_PLATFORM STREQUAL "simulation")
enable_testing()
add_subdirectory(tests)
endif()
add_custom_target(print-ot-config ALL COMMAND echo -e "$<JOIN:$<TARGET_PROPERTY:ot-config,INTERFACE_COMPILE_DEFINITIONS>,\"\\n\">")
add_subdirectory(tests)
add_custom_target(print-ot-config ALL
COMMAND ${CMAKE_COMMAND}
-DLIST="$<TARGET_PROPERTY:ot-config,INTERFACE_COMPILE_DEFINITIONS>"
-P ${PROJECT_SOURCE_DIR}/etc/cmake/print.cmake
)
+67 -8
View File
@@ -9,6 +9,7 @@ We would love for you to contribute to OpenThread and help make it even better t
- [4.1 Initial Setup](#initial-setup)
- [4.2 Contributor License Agreement (CLA)](#contributor-license-agreement--cla-)
- [4.3 Submitting a Pull Request](#submitting-a-pull-request)
- [5 Contributing Documentation](#contributing-documentation)
## Code of Conduct
@@ -62,7 +63,7 @@ For each new feature, create a working branch:
```bash
# Create a working branch for your new feature
git branch --track <branch-name> origin/master
git branch --track <branch-name> origin/main
# Checkout the branch
git checkout <branch-name>
@@ -84,16 +85,16 @@ This will open up a text editor where you can craft your commit message.
Prior to submitting your pull request, you might want to do a few things to clean up your branch and make it as simple as possible for the original repo's maintainer to test, accept, and merge your work.
If any commits have been made to the upstream master branch, you should rebase your development branch so that merging it will be a simple fast-forward that won't require any conflict resolution work.
If any commits have been made to the upstream main branch, you should rebase your development branch so that merging it will be a simple fast-forward that won't require any conflict resolution work.
```bash
# Fetch upstream master and merge with your repo's master branch
git checkout master
git pull upstream master
# Fetch upstream main and merge with your repo's main branch
git checkout main
git pull upstream main
# If there were any new commits, rebase your development branch
git checkout <branch-name>
git rebase master
git rebase main
```
Now, it may be desirable to squash some of your smaller commits down into a small number of larger more cohesive commits. You can do this with an interactive rebase:
@@ -101,14 +102,14 @@ Now, it may be desirable to squash some of your smaller commits down into a smal
```bash
# Rebase all commits on your development branch
git checkout
git rebase -i master
git rebase -i main
```
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 v6.0.0](http://releases.llvm.org/download.html#6.0.0) for C/C++ and [yapf v0.29.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 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.
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.
@@ -127,3 +128,61 @@ This will trigger continuous-integration checks using GitHub Actions. You can vi
#### Submit Pull Request
Once you've validated that all continuous-integration checks have passed, go to the page for your fork on GitHub, select your development branch, and click the pull request button. If you need to make any adjustments to your pull request, just push the updates to GitHub. Your pull request will automatically track the changes on your development branch and update.
#### Checks fail
Once you've submitted a pull request, all continuous-integration checks are triggered again. If some of these checks fail, it could be either problems with the pull request or an intermittent failure of some test cases. For more information on the failure, check the output and download artifacts. (After all jobs in one group are completed, an `Artifacts` button appears beside the `Re-run` jobs button.) If the failure is intermittent, the check will usually pass after rerunning once or twice.
We want to eliminate intermittent failures as well, so when you experience such a failure, please log an issue and attach any relevant artifacts. If the artifacts are too big, provide the link of the failed run (do not rerun checks again, or it will be overwritten). Alternatively, upload the artifacts to a file-sharing service like Google Drive and share a link to it.
##### Analyze core dumps in failed checks
For some checks, core dumps for crashed programs are uploaded as artifacts in a failed check. Besides core dumps, binaries and shared libraries are also uploaded so that we can analyze the dumps locally. To analyze the dumps, download the artifact `core-xxx` and unzip it. The package is in the following format:
```
|-- build
| `-- cmake
| `-- openthread-simulation-1.2
| `-- examples
| `-- apps
| `-- cli
| |-- ot-cli-ftd
| `-- ot-cli-mtd
|-- ot-core-dump
| `-- corefile-ot-cli-ftd-11323-1606274703
`-- so-lib
|-- ld-linux-x86-64.so.2
|-- libc.so.6
`-- libgcc_s.so.1
```
Once unzipped:
1. `cd` to the unzipped directory
2. Run `gdb build/cmake/openthread-simulation-1.2/examples/apps/cli/ot-cli-ftd ./ot-core-dump/corefile-ot-cli-ftd-XXX`.
3. Set the absolute path of `so-lib`. In gdb, run `set solib-absolute-prefix /ABSOLUTE/PATH/TO/so-lib/`, then run `set solib-search-path /ABSOLUTE/PATH/TO/so-lib/`.
4. In gdb, run `backtrace` or `bt`. Then you should see the stack of the crashed program. Find and fix the problem!
## Contributing Documentation
Documentation undergoes the same review process as code and contributions may be mirrored on our [openthread.io](https://openthread.io) website.
### Codelabs and Guides
To review and contribute to OpenThread Codelabs and Guides, refer to the following GitHub repositories:
- [Codelabs](https://github.com/openthread/ot-docs/tree/main/site/en/codelabs)
- [Guides](https://github.com/openthread/ot-docs/tree/main/site/en/guides)
For information on how to author and format documentation for contribution, refer to the [Documentation Style Guide](https://github.com/openthread/ot-docs/blob/main/STYLE_GUIDE.md).
### API Reference topics
API Reference topics use [Doxygen comment blocks](https://www.doxygen.nl/manual/docblocks.html) to render the HTML output on [https://openthread.io/reference](https://openthread.io/reference). OpenThread scripts support the following Doxygen [special commands](https://www.doxygen.nl/manual/commands.html):
- @file
- @brief
- @param
- @returns
You can find most of these comments in the [OpenThread header files](https://github.com/openthread/openthread/tree/main/include/openthread). To review an example, refer to [`border_agent.h`](https://github.com/openthread/openthread/tree/main/include/openthread/border_agent.h). The Doxygen comments in `border_agent.h` output the [Border Agent](https://openthread.io/reference/group/api-border-agent) reference topic on openthread.io. For more information, refer to [Comments](https://github.com/openthread/openthread/blob/main/STYLE_GUIDE.md#comments) in the OpenThread Coding Conventions and Style guide.
+1
View File
@@ -37,6 +37,7 @@ AM_DISTCHECK_CONFIGURE_FLAGS = \
--enable-mtd \
--enable-ncp \
--enable-radio-only \
--enable-radio-cli \
--with-examples=simulation \
$(NULL)
+4 -4
View File
@@ -1,5 +1,5 @@
OpenThread is an open source implementation of the Thread 1.1.1 Final Specification.
The Thread 1.1.1 Final Specification is promulgated by the Thread Group. The Thread
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
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.1.1 Final
of this OpenThread code does not assure compliance with the Thread 1.2.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.1.1 Final Specification, ownership and
property rights relating to the Thread 1.2.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
+17 -21
View File
@@ -4,33 +4,32 @@
# What is OpenThread?
OpenThread released by Google is... <a href="http://threadgroup.org/technology/ourtechnology#certifiedproducts"> <img src="https://cdn.rawgit.com/openthread/openthread/ab4c4e1e/doc/images/certified.svg" alt="Thread Certified Component" width="150px" align="right"> </a>
OpenThread released by Google is... <a href="https://www.threadgroup.org/What-is-Thread/Thread-Benefits#certifiedproducts"> <img src="https://cdn.rawgit.com/openthread/openthread/ab4c4e1e/doc/images/certified.svg" alt="Thread Certified Component" width="150px" align="right"> </a>
**...an open-source implementation of the [Thread](http://threadgroup.org/technology/ourtechnology) networking protocol.** Google Nest has released OpenThread to make the technology used in Nest products more broadly available to developers to accelerate the development of products for the connected home.
**...an open-source implementation of the [Thread](https://www.threadgroup.org/What-is-Thread/Overview) networking protocol.** Google Nest has released OpenThread to make the technology used in Nest products more broadly available to developers to accelerate the development of products for the connected home.
**...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.1.1 specification](http://threadgroup.org/technology/ourtechnology#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.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.
More information about Thread can be found at [threadgroup.org](http://threadgroup.org/). Thread is a registered trademark of the Thread Group, Inc.
[thread]: http://threadgroup.org/technology/ourtechnology
[ot-repo]: https://github.com/openthread/openthread
[ot-logo]: doc/images/openthread_logo.png
[ot-gh-action-build]: https://github.com/openthread/openthread/actions?query=workflow%3ABuild+branch%3Amaster+event%3Apush
[ot-gh-action-build-svg]: https://github.com/openthread/openthread/workflows/Build/badge.svg?branch=master&event=push
[ot-gh-action-simulation]: https://github.com/openthread/openthread/actions?query=workflow%3ASimulation+branch%3Amaster+event%3Apush
[ot-gh-action-simulation-svg]: https://github.com/openthread/openthread/workflows/Simulation/badge.svg?branch=master&event=push
[ot-gh-action-docker]: https://github.com/openthread/openthread/actions?query=workflow%3ADocker+branch%3Amaster+event%3Apush
[ot-gh-action-docker-svg]: https://github.com/openthread/openthread/workflows/Docker/badge.svg?branch=master&event=push
[ot-logo]: https://github.com/openthread/openthread/raw/main/doc/images/openthread_logo.png
[ot-gh-action-build]: https://github.com/openthread/openthread/actions?query=workflow%3ABuild+branch%3Amain+event%3Apush
[ot-gh-action-build-svg]: https://github.com/openthread/openthread/workflows/Build/badge.svg?branch=main&event=push
[ot-gh-action-simulation]: https://github.com/openthread/openthread/actions?query=workflow%3ASimulation+branch%3Amain+event%3Apush
[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/master/graph/badge.svg
[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="doc/images/ot-contrib-arm.png" alt="ARM" width="200px"></a><a href="https://www.cascoda.com/"><img src="doc/images/ot-contrib-cascoda.png" alt="Cascoda" width="200px"></a><a href="https://www.google.com/"><img src="doc/images/ot-contrib-google.png" alt="Google" width="200px"></a><a href="http://www.nordicsemi.com/"><img src="doc/images/ot-contrib-nordic.png" alt="Nordic" width="200px"></a><a href="http://www.nxp.com/"><img src="doc/images/ot-contrib-nxp.png" alt="NXP" width="200px"></a><a href="http://www.qorvo.com/"><img src="doc/images/ot-contrib-qorvo.png" alt="Qorvo" width="200px"></a><a href="https://www.qualcomm.com/"><img src="doc/images/ot-contrib-qc.png" alt="Qualcomm" width="200px"></a><a href="https://www.samsung.com/"><img src="doc/images/ot-contrib-samsung.png" alt="Samsung" width="200px"></a><a href="https://www.silabs.com/"><img src="doc/images/ot-contrib-silabs.png" alt="Silicon Labs" width="200px"></a><a href="https://www.st.com/"><img src="doc/images/ot-contrib-stm.png" alt="STMicroelectronics" width="200px"></a><a href="https://www.synopsys.com/"><img src="doc/images/ot-contrib-synopsys.png" alt="Synopsys" width="200px"></a><a href="https://www.ti.com/"><img src="doc/images/ot-contrib-ti.png" alt="Texas Instruments" width="200px"></a><a href="https://www.zephyrproject.org/"><img src="doc/images/ot-contrib-zephyr.png" alt="Zephyr Project" 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.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>
# Getting started
@@ -51,9 +50,9 @@ If you're interested in contributing to OpenThread, read on.
# Contributing
We would love for you to contribute to OpenThread and help make it even better than it is today! See our [Contributing Guidelines](https://github.com/openthread/openthread/blob/master/CONTRIBUTING.md) for more information.
We would love for you to contribute to OpenThread and help make it even better than it is today! See our [Contributing Guidelines](https://github.com/openthread/openthread/blob/main/CONTRIBUTING.md) for more information.
Contributors are required to abide by our [Code of Conduct](https://github.com/openthread/openthread/blob/master/CODE_OF_CONDUCT.md) and [Coding Conventions and Style Guide](https://github.com/openthread/openthread/blob/master/STYLE_GUIDE.md).
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
@@ -61,16 +60,13 @@ OpenThread follows the [Semantic Versioning guidelines](http://semver.org/) for
# License
OpenThread is released under the [BSD 3-Clause license](https://github.com/openthread/openthread/blob/master/LICENSE). See the [`LICENSE`](https://github.com/openthread/openthread/blob/master/LICENSE) file for more information.
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.
Please only use the OpenThread name and marks when accurately referencing this software distribution. Do not use the marks in a way that suggests you are endorsed by or otherwise affiliated with Nest, Google, or The Thread Group.
# Need help?
There are numerous avenues for OpenThread support:
OpenThread support is available on GitHub:
- Bugs and feature requests — [submit to the Issue Tracker](https://github.com/openthread/openthread/issues)
- Stack Overflow — [post questions using the `openthread` tag](http://stackoverflow.com/questions/tagged/openthread)
- Google Groups — [discussion and announcements at openthread-users](https://groups.google.com/forum/#!forum/openthread-users)
The openthread-users Google Group is the recommended place for users to discuss OpenThread and interact directly with the OpenThread team.
- Community Discussion - [ask questions, share ideas, and engage with other community members](https://github.com/openthread/openthread/discussions)
+10 -2
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 v6.0.0](http://releases.llvm.org/download.html#6.0.0) for C/C++ and [yapf v0.29.0](https://github.com/google/yapf) for Python.
- `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.
### File Names
@@ -176,6 +176,14 @@
- Describes the purpose, function, and influence of each parameter as well as whether it is an input, an output, or both.
- Describes the return value, if present, and the expected range or constraints of it.
If your description is longer than 120 characters, continue the comment on the next line:
```
* @brief
* Records the history of different events, for example RX and TX messages or network info changes. All tracked
* entries are timestamped.
```
# Python
## Standards
@@ -188,4 +196,4 @@
## Format and Style
- All code should adhere to [Google Python Style Guide](http://google.github.io/styleguide/pyguide.html) except maximum line length being 119.
- All code should adhere to [Google Python Style Guide](https://google.github.io/styleguide/pyguide.html) except maximum line length being 119.
+37 -71
View File
@@ -248,7 +248,7 @@ if test "${nl_cv_clang}" = "yes"; then
PROSPECTIVE_CXXFLAGS="${PROSPECTIVE_CXXFLAGS} -Wconversion"
fi
function convert_warning_flags_to_positive() {
convert_warning_flags_to_positive() {
flags_to_check=""
warning_flag_backup=""
for option in ${1}; do
@@ -263,7 +263,7 @@ function convert_warning_flags_to_positive() {
done
}
function restore_negative_form_of_warning_flags() {
restore_negative_form_of_warning_flags() {
final_flags=${1}
for positive_option in ${warning_flag_backup}; do
final_flags=$(echo $ECHO_N $final_flags | $SED "s|-W${positive_option}|-Wno-${positive_option}|g")
@@ -272,7 +272,7 @@ function restore_negative_form_of_warning_flags() {
unset warning_flag_backup
}
function check_prospective_CFLAGS() {
check_prospective_CFLAGS() {
if test "${nl_cv_clang}" = "yes"; then
AX_CHECK_COMPILER_OPTIONS([C], ${PROSPECTIVE_CFLAGS})
else
@@ -284,7 +284,7 @@ function check_prospective_CFLAGS() {
fi
}
function check_prospective_CXXFLAGS() {
check_prospective_CXXFLAGS() {
if test "${nl_cv_clang}" = "yes"; then
AX_CHECK_COMPILER_OPTIONS([C++], ${PROSPECTIVE_CXXFLAGS})
else
@@ -542,6 +542,30 @@ AC_ARG_ENABLE(radio-only,
AC_MSG_RESULT(${enable_radio_only})
AM_CONDITIONAL([OPENTHREAD_ENABLE_RADIO_ONLY], [test "${enable_radio_only}" = "yes"])
#
# Radio Cli Library
#
AC_MSG_CHECKING([whether to build radio-cli library])
AC_ARG_ENABLE(radio-cli,
[AS_HELP_STRING([--enable-radio-cli], [Build radio-cli library @<:@default=no@:>@.])],
[
case "${enableval}" in
no|yes)
enable_radio_cli=${enableval}
;;
*)
AC_MSG_ERROR([Invalid value ${enable_radio_cli} for --enable-radio-cli])
;;
esac
],
[enable_radio_cli=no])
AC_MSG_RESULT(${enable_radio_cli})
AM_CONDITIONAL([OPENTHREAD_ENABLE_RADIO_CLI], [test "${enable_radio_cli}" = "yes"])
#
# whether to build executables
#
@@ -780,15 +804,14 @@ AC_MSG_CHECKING([whether to build examples])
AC_ARG_WITH(examples,
[AS_HELP_STRING([--with-examples=TARGET],
[Build example applications for one of: simulation, cc1352, cc2538, cc2650, cc2652, efr32mg1, efr32mg12, efr32mg13, efr32mg21,
gp712, jn5189, k32w061, kw41z, nrf52811, nrf52833, nrf52840, qpg6095, samr21 @<:@default=no@:>@.
[Build example applications for one of: simulation, cc2538 @<:@default=no@:>@.
Note that building example applications also builds the associated OpenThread platform libraries
and any third_party libraries needed to support the examples.])],
[
case "${with_examples}" in
no)
;;
simulation|cc1352|cc2538|cc2650|cc2652|efr32mg1|efr32mg12|efr32mg13|efr32mg21|gp712|jn5189|k32w061|kw41z|nrf52811|nrf52833|nrf52840|qpg6095|samr21)
simulation|cc2538)
;;
*)
AC_MSG_RESULT(ERROR)
@@ -801,28 +824,10 @@ AC_ARG_WITH(examples,
AM_CONDITIONAL([OPENTHREAD_ENABLE_EXAMPLES], [test ${with_examples} != "no"])
AM_CONDITIONAL([OPENTHREAD_EXAMPLES_SIMULATION],[test "${with_examples}" = "simulation"])
AM_CONDITIONAL([OPENTHREAD_EXAMPLES_CC1352], [test "${with_examples}" = "cc1352"])
AM_CONDITIONAL([OPENTHREAD_EXAMPLES_CC2538], [test "${with_examples}" = "cc2538"])
AM_CONDITIONAL([OPENTHREAD_EXAMPLES_CC2650], [test "${with_examples}" = "cc2650"])
AM_CONDITIONAL([OPENTHREAD_EXAMPLES_CC2652], [test "${with_examples}" = "cc2652"])
AM_CONDITIONAL([OPENTHREAD_EXAMPLES_EFR32MG1], [test "${with_examples}" = "efr32mg1"])
AM_CONDITIONAL([OPENTHREAD_EXAMPLES_EFR32MG12], [test "${with_examples}" = "efr32mg12"])
AM_CONDITIONAL([OPENTHREAD_EXAMPLES_EFR32MG13], [test "${with_examples}" = "efr32mg13"])
AM_CONDITIONAL([OPENTHREAD_EXAMPLES_EFR32MG21], [test "${with_examples}" = "efr32mg21"])
AM_CONDITIONAL([OPENTHREAD_EXAMPLES_GP712], [test "${with_examples}" = "gp712"])
AM_CONDITIONAL([OPENTHREAD_EXAMPLES_JN5189], [test "${with_examples}" = "jn5189"])
AM_CONDITIONAL([OPENTHREAD_EXAMPLES_K32W061], [test "${with_examples}" = "k32w061"])
AM_CONDITIONAL([OPENTHREAD_EXAMPLES_KW41Z], [test "${with_examples}" = "kw41z"])
AM_CONDITIONAL([OPENTHREAD_EXAMPLES_NRF52811], [test "${with_examples}" = "nrf52811"])
AM_CONDITIONAL([OPENTHREAD_EXAMPLES_NRF52833], [test "${with_examples}" = "nrf52833"])
AM_CONDITIONAL([OPENTHREAD_EXAMPLES_NRF52840], [test "${with_examples}" = "nrf52840"])
AM_CONDITIONAL([OPENTHREAD_EXAMPLES_QPG6095], [test "${with_examples}" = "qpg6095"])
AM_CONDITIONAL([OPENTHREAD_EXAMPLES_SAMR21], [test "${with_examples}" = "samr21"])
AM_COND_IF([OPENTHREAD_EXAMPLES_SIMULATION], CPPFLAGS="${CPPFLAGS} -DOPENTHREAD_EXAMPLES_SIMULATION=1", CPPFLAGS="${CPPFLAGS} -DOPENTHREAD_EXAMPLES_SIMULATION=0")
AM_CONDITIONAL([OPENTHREAD_EXAMPLES_NRF528XX], [test OPENTHREAD_EXAMPLES_NRF52811 || test OPENTHREAD_EXAMPLES_NRF52833 || test OPENTHREAD_EXAMPLES_NRF52840])
case ${with_examples} in
no)
AC_MSG_RESULT([no])
@@ -840,12 +845,11 @@ AC_MSG_CHECKING([whether to build platform libraries])
AC_ARG_WITH(platform,
[AS_HELP_STRING([--with-platform=TARGET],
[Build OpenThread platform libraries for one of: cc1352, cc2538, cc2650, cc2652,
efr32mg1, efr32mg12, efr32mg13, efr32mg21, gp712, jn5189, kw41z, nrf52811, nrf52833, nrf52840, posix, qpg6095, samr21, simulation @<:@default=simulation@:>@.])],
[Build OpenThread platform libraries for one of: cc2538, posix, simulation @<:@default=simulation@:>@.])],
[
# Make sure the given target is valid.
case "${with_platform}" in
no|cc1352|cc2538|cc2650|cc2652|efr32mg1|efr32mg12|efr32mg13|efr32mg21|gp712|jn5189|kw41z|nrf52811|nrf52833|nrf52840|posix|qpg6095|samr21|simulation)
no|cc2538|posix|simulation)
;;
*)
AC_MSG_RESULT(ERROR)
@@ -876,28 +880,10 @@ AM_CONDITIONAL([OPENTHREAD_ENABLE_PLATFORM], [test ${with_platform} != "no"])
OPENTHREAD_ENABLE_PLATFORM=${with_platform}
AM_CONDITIONAL([OPENTHREAD_PLATFORM_CC1352], [test "${with_platform}" = "cc1352"])
AM_CONDITIONAL([OPENTHREAD_PLATFORM_CC2538], [test "${with_platform}" = "cc2538"])
AM_CONDITIONAL([OPENTHREAD_PLATFORM_CC2650], [test "${with_platform}" = "cc2650"])
AM_CONDITIONAL([OPENTHREAD_PLATFORM_CC2652], [test "${with_platform}" = "cc2652"])
AM_CONDITIONAL([OPENTHREAD_PLATFORM_EFR32MG1], [test "${with_platform}" = "efr32mg1"])
AM_CONDITIONAL([OPENTHREAD_PLATFORM_EFR32MG12], [test "${with_platform}" = "efr32mg12"])
AM_CONDITIONAL([OPENTHREAD_PLATFORM_EFR32MG13], [test "${with_platform}" = "efr32mg13"])
AM_CONDITIONAL([OPENTHREAD_PLATFORM_EFR32MG21], [test "${with_platform}" = "efr32mg21"])
AM_CONDITIONAL([OPENTHREAD_PLATFORM_GP712], [test "${with_platform}" = "gp712"])
AM_CONDITIONAL([OPENTHREAD_PLATFORM_JN5189], [test "${with_platform}" = "jn5189"])
AM_CONDITIONAL([OPENTHREAD_PLATFORM_KW41Z], [test "${with_platform}" = "kw41z"])
AM_CONDITIONAL([OPENTHREAD_PLATFORM_NRF52811], [test "${with_platform}" = "nrf52811"])
AM_CONDITIONAL([OPENTHREAD_PLATFORM_NRF52833], [test "${with_platform}" = "nrf52833"])
AM_CONDITIONAL([OPENTHREAD_PLATFORM_NRF52840], [test "${with_platform}" = "nrf52840"])
AM_CONDITIONAL([OPENTHREAD_PLATFORM_POSIX], [test "${with_platform}" = "posix"])
AM_CONDITIONAL([OPENTHREAD_PLATFORM_QPG6095], [test "${with_platform}" = "qpg6095"])
AM_CONDITIONAL([OPENTHREAD_PLATFORM_SAMR21], [test "${with_platform}" = "samr21"])
AM_CONDITIONAL([OPENTHREAD_PLATFORM_SIMULATION],[test "${with_platform}" = "simulation"])
AM_CONDITIONAL([OPENTHREAD_PLATFORM_NRF528XX], [test OPENTHREAD_PLATFORM_NRF52811 || test OPENTHREAD_PLATFORM_NRF52833 || test OPENTHREAD_PLATFORM_NRF52840])
AM_CONDITIONAL([OPENTHREAD_PLATFORM_K32W], [test OPENTHREAD_PLATFORM_K32W061 || test OPENTHREAD_PLATFORM_JN5189])
AM_COND_IF([OPENTHREAD_PLATFORM_POSIX], CPPFLAGS="${CPPFLAGS} -DOPENTHREAD_PLATFORM_POSIX=1", CPPFLAGS="${CPPFLAGS} -DOPENTHREAD_PLATFORM_POSIX=0")
case ${with_platform} in
@@ -947,6 +933,8 @@ AM_CONDITIONAL(OPENTHREAD_BUILD_DOCS, [test "${nl_cv_build_docs}" = "yes"])
AM_CONDITIONAL(OPENTHREAD_POSIX, [test "${with_platform}" = "posix" -o "${with_examples}" = "simulation"])
AM_CONDITIONAL([OPENTHREAD_ENABLE_SPINEL_RCP], [test OPENTHREAD_PLATFORM_POSIX || test OPENTHREAD_ENABLE_RADIO_ONLY])
#
# Checks for libraries and packages.
#
@@ -1002,6 +990,7 @@ CPPFLAGS="${CPPFLAGS} ${NL_COVERAGE_CPPFLAGS}"
LIBS="${LIBS} ${NL_COVERAGE_LIBS}"
LDFLAGS="${LDFLAGS} ${NL_COVERAGE_LDFLAGS}"
CPPFLAGS="${CPPFLAGS} -DOPENTHREAD_CONFIG_FILE='\"openthread-config-generic.h\"'"
# At this point, we can restore the compiler flags to whatever the
# user passed in, now that we're clear of an -Werror issues by
# transforming -Wno-error back to -Werror.
@@ -1028,36 +1017,13 @@ src/lib/url/Makefile
third_party/Makefile
third_party/jlink/Makefile
third_party/mbedtls/Makefile
third_party/NordicSemiconductor/Makefile
third_party/silabs/Makefile
third_party/tcplp/Makefile
examples/Makefile
examples/apps/Makefile
examples/apps/cli/Makefile
examples/apps/ncp/Makefile
examples/platforms/Makefile
examples/platforms/cc1352/Makefile
examples/platforms/cc2538/Makefile
examples/platforms/cc2650/Makefile
examples/platforms/cc2652/Makefile
examples/platforms/efr32mg1/Makefile
examples/platforms/efr32mg12/Makefile
examples/platforms/efr32mg12/sleepy-demo/Makefile
examples/platforms/efr32mg12/sleepy-demo/sleepy-demo-ftd/Makefile
examples/platforms/efr32mg12/sleepy-demo/sleepy-demo-mtd/Makefile
examples/platforms/efr32mg13/Makefile
examples/platforms/efr32mg13/sleepy-demo/Makefile
examples/platforms/efr32mg13/sleepy-demo/sleepy-demo-ftd/Makefile
examples/platforms/efr32mg13/sleepy-demo/sleepy-demo-mtd/Makefile
examples/platforms/efr32mg21/Makefile
examples/platforms/efr32mg21/sleepy-demo/Makefile
examples/platforms/efr32mg21/sleepy-demo/sleepy-demo-ftd/Makefile
examples/platforms/efr32mg21/sleepy-demo/sleepy-demo-mtd/Makefile
examples/platforms/gp712/Makefile
examples/platforms/k32w/Makefile
examples/platforms/kw41z/Makefile
examples/platforms/nrf528xx/Makefile
examples/platforms/qpg6095/Makefile
examples/platforms/samr21/Makefile
examples/platforms/simulation/Makefile
examples/platforms/utils/Makefile
tools/Makefile
@@ -1087,7 +1053,7 @@ AC_MSG_NOTICE([
---------------------
Package : ${PACKAGE_NAME}
Version : ${PACKAGE_VERSION}
Interface : ${LIBOPENTHREAD_VERSION_INFO//:/.}
Interface : $(echo $LIBOPENTHREAD_VERSION_INFO | $SED 's/:/./g')
Build system : ${build}
Host system : ${host}
Host architecture : ${host_cpu}
+56
View File
@@ -0,0 +1,56 @@
#
# Copyright (c) 2021, 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.
#
find_package(Doxygen)
if (DOXYGEN_FOUND)
set(DOXYGEN_IN ${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in)
set(DOXYGEN_OUT ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile)
set(PACKAGE_VERSION ${OT_PACKAGE_VERSION})
set(abs_srcdir ${CMAKE_CURRENT_SOURCE_DIR})
set(abs_builddir ${CMAKE_CURRENT_BINARY_DIR})
set(abs_top_srcdir ${PROJECT_SOURCE_DIR})
set(abs_top_builddir ${PROJECT_BINARY_DIR})
set(DOXYGEN_USE_DOT ${DOXYGEN_HAVE_DOT})
configure_file(${DOXYGEN_IN} ${DOXYGEN_OUT} @ONLY)
add_custom_target(ot-doc)
add_custom_target(ot-doxygen ALL
COMMAND ${DOXYGEN_EXECUTABLE} ${DOXYGEN_OUT}
COMMAND cmake -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/images ${CMAKE_CURRENT_BINARY_DIR}/html/doc/images
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMENT "Generating documentation with Doxygen"
VERBATIM)
add_dependencies(ot-doc ot-doxygen)
else()
message("Doxygen must be installed to generate doxygen documentation")
endif()
Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.6 KiB

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.5 KiB

After

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 59 KiB

After

Width:  |  Height:  |  Size: 58 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.3 KiB

After

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.9 KiB

After

Width:  |  Height:  |  Size: 7.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.4 KiB

After

Width:  |  Height:  |  Size: 7.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 5.9 KiB

+26 -8
View File
@@ -54,8 +54,21 @@
* @{
*
* @defgroup api-dns DNSv6
* @defgroup api-dnssd-server DNS-SD Server
* @defgroup api-icmp6 ICMPv6
* @defgroup api-ip6 IPv6
* @defgroup api-srp SRP
* @defgroup api-ping-sender Ping Sender
*
* @defgroup api-tcp-group TCP
*
* @{
*
* @defgroup api-tcp TCP
* @defgroup api-tcp-ext TCP Abstractions
*
* @}
*
* @defgroup api-udp-group UDP
*
* @{
@@ -72,12 +85,16 @@
* @{
*
* @defgroup api-link-link Link
* @defgroup api-link-metrics Link Metrics
* @defgroup api-link-raw Raw Link
*
* @}
*
* @defgroup api-message Message
*
* @defgroup api-multi-radio Multi Radio Link
* @defgroup api-trel TREL - Thread Stack
*
* @defgroup api-thread Thread
*
* @{
@@ -89,6 +106,7 @@
* @defgroup api-thread-general General
* @brief This module includes functions for all Thread roles.
* @defgroup api-joiner Joiner
* @defgroup api-operational-dataset Operational Dataset
* @defgroup api-thread-router Router/Leader
* @brief This module includes functions for Thread Routers and Leaders.
* @defgroup api-server Server
@@ -112,12 +130,12 @@
* @}
*
* @defgroup api-cli Command Line Interface
* @defgroup api-crypto Crypto
* @defgroup api-entropy Entropy Source
* @defgroup api-factory-diagnostics Factory Diagnostics
* @defgroup api-crypto Crypto - Thread Stack
* @defgroup api-factory-diagnostics Factory Diagnostics - Thread Stack
* @defgroup api-heap Heap
* @defgroup api-history-tracker History Tracker
* @defgroup api-jam-detection Jam Detection
* @defgroup api-logging Logging
* @defgroup api-logging Logging - Thread Stack
* @defgroup api-ncp Network Co-Processor
* @defgroup api-network-time Network Time Synchronization
* @defgroup api-random-group Random Number Generator
@@ -145,10 +163,10 @@
* @{
*
* @defgroup plat-alarm Alarm
* @defgroup plat-ble BLE Host
* @defgroup plat-crypto Crypto - Platform
* @defgroup plat-entropy Entropy
* @defgroup plat-factory-diagnostics Factory Diagnostics
* @defgroup plat-logging Logging
* @defgroup plat-factory-diagnostics Factory Diagnostics - Platform
* @defgroup plat-logging Logging - Platform
* @defgroup plat-memory Memory
* @defgroup plat-messagepool Message Pool
* @defgroup plat-misc Miscellaneous
@@ -158,7 +176,7 @@
* @defgroup plat-spi-slave SPI Slave
* @defgroup plat-time Time Service
* @defgroup plat-toolchain Toolchain
* @defgroup plat-uart UART
* @defgroup plat-trel TREL - Platform
*
* @}
*
-37
View File
@@ -1,37 +0,0 @@
# What is Thread?
<figure class="attempt-right">
<img src="../images/ot-logo-thread.png" srcset="../images/ot-logo-thread.png 1x, ../images/ot-logo-thread_2x.png 2x" border="0" alt="Thread" />
</figure>
<a href="http://threadgroup.org/">Thread<sup>®</sup></a> is an IPv6-based
networking protocol designed for low-power Internet of Things devices in an IEEE
802.15.4-2006 wireless mesh network, commonly called a Wireless Personal Area
Network (WPAN). Thread is independent of other 802.15 mesh networking
protocols, such a ZigBee, Z-Wave, and Bluetooth LE.
Thread's primary features include:
* Simplicity — Simple installation, start up, and operation
* Security — All devices in a Thread network are authenticated and all
communications are encrypted
* Reliability — Self-healing mesh networking, with no single point of failure,
and spread-spectrum techniques to provide immunity to interference
* Efficiency — Low-power Thread devices can sleep and operate on battery power
for years
* Scalability — Thread networks can scale up to hundreds of devices
If you're new to Thread, understanding the basics are critical to using
OpenThread in your own applications. The goal of this primer is to explain the
concepts behind Thread and how it works, and provide a springboard to OpenThread
development.
It is assumed you have good working knowledge of the following:
* IEEE 802.15.4
* Networking and routing concepts
* IPv6
This primer is based on version 1.1.1 of the Thread Specification. It does not
cover the full specification, which is available at
[threadgroup.org](http://threadgroup.org/ThreadSpec).
@@ -1,276 +0,0 @@
# IPv6 Addressing
Let's take a look at how Thread identifies each device in the network, and what
types of addresses they use to communicate with each other.
Key Term: In this primer, the term "interface" is used to identify an endpoint
of a Thread device within a network. Typically, a single Thread device has
a single Thread interface.
## Scopes
<figure class="attempt-right">
<a href="../images/ot-primer-scopes_2x.png"><img src="../images/ot-primer-scopes.png" srcset="../images/ot-primer-scopes.png 1x, ../images/ot-primer-scopes_2x.png 2x" border="0" alt="OT Scopes" /></a>
</figure>
There are three scopes in a Thread network for unicast addressing:
* Link-Local — all interfaces reachable by a single radio transmission
* Mesh-Local — all interfaces reachable within the same Thread network
* Global — all interfaces reachable from outside a Thread network
The first two scopes correspond to prefixes designated by a Thread network.
Link-Local have prefixes of `fe80::/16`, while Mesh-Local have prefixes of
`fd00::/8`.
<h2 style="clear:right">Unicast</h2>
There are multiple IPv6 unicast addresses that identify a single Thread device.
Each has a different function based on the scope and use case.
Before we detail each type, let's learn more about a common one, called the
Routing Locator (RLOC). The RLOC identifies a Thread interface, based on its
location in the network topology.
### How a Routing Locator is generated
All devices are assigned a Router ID and a Child ID. Each Router maintains a
table of all their Children, the combination of which uniquely identifies a
device within the topology. For example, consider the highlighted nodes in the
following topology, where the number in a Router (pentagon) is the Router ID,
and the number in an End Device (circle) is the Child ID:
<figure>
<a href="../images/ot-primer-rloc-topology_2x.png"><img src="../images/ot-primer-rloc-topology.png" srcset="../images/ot-primer-rloc-topology.png 1x, ../images/ot-primer-rloc-topology_2x.png 2x" border="0" width="600" alt="OT RLOC Topology" /></a>
</figure>
Each Child's Router ID corresponds to their Parent (Router). Because a Router is
not a Child, the Child ID for a Router is always 0. Together, these values are
unique for each device in the Thread network, and are used to create the RLOC16,
which represents the last 16 bits of the RLOC.
For example, here's how the RLOC16 is calculated for the upper-left node (Router
ID = 1 and Child ID = 1):
<figure>
<a href="../images/ot-primer-rloc16_2x.png"><img src="../images/ot-primer-rloc16.png" srcset="../images/ot-primer-rloc16.png 1x, ../images/ot-primer-rloc16_2x.png 2x" border="0" width="400" alt="OT RLOC16" /></a>
</figure>
The RLOC16 is part of the Interface Identifier (IID), which corresponds to the
last 64 bits of the IPv6 address. Some IIDs can be used to identify some types
of Thread interfaces. For example, the IID for RLOCs is always of the form
<code>0000:00ff:fe00:<var>RLOC16</var></code>.
The IID, combined with a Mesh-Local Prefix, results in the RLOC. For example,
using a Mesh-Local Prefix of `fde5:8dba:82e1:1::/64`, the RLOC for a node where
RLOC16 = `0x401` is:
<figure>
<a href="../images/ot-primer-rloc_2x.png"><img src="../images/ot-primer-rloc.png" srcset="../images/ot-primer-rloc.png 1x, ../images/ot-primer-rloc_2x.png 2x" border="0" width="600" alt="OT RLOC" /></a>
</figure>
This same logic can be used to determine the RLOC for all highlighted nodes in the sample topology above:
<figure>
<a href="../images/ot-primer-rloc-topology-address_2x.png"><img src="../images/ot-primer-rloc-topology-address.png" srcset="../images/ot-primer-rloc-topology-address.png 1x, ../images/ot-primer-rloc-topology-address_2x.png 2x" border="0" width="600" alt="OT Topology w/ Address" /></a>
</figure>
However, because the RLOC is based on the location of the node in the topology,
the RLOC of a node can change as the topology changes.
For example, perhaps node `0x400` is removed from the Thread network. Nodes
`0x401` and `0x402` establish new links to different Routers, and as a result
they are each assigned a new RLOC16 and RLOC:
<figure>
<a href="../images/ot-primer-rloc-topology-change_2x.png"><img src="../images/ot-primer-rloc-topology-change.png" srcset="../images/ot-primer-rloc-topology-change.png 1x, ../images/ot-primer-rloc-topology-change_2x.png 2x" border="0" width="600" alt="OT Topology after Change" /></a>
</figure>
## Unicast address types
The RLOC is just one of many IPv6 unicast addresses a Thread device can have.
Another category of addresses are called Endpoint Identifiers (EIDs), which
identify a unique Thread interface within a Thread network partition. EIDs are
independent of Thread network topology.
Common unicast types are detailed below.
<table>
<tbody>
<tr>
<th colspan=2><h3>Link-Local Address (LLA)</h3></th>
</tr>
<tr>
<td colspan=2 style="background-color:rgb(238, 241, 242)">An EID that identifies a Thread interface reachable by a single radio transmission.</td>
</tr>
<tr>
<td width="25%" style="background-color:rgb(238, 241, 242)"><b>Example</b></td><td><code>fe80::54db:881c:3845:57f4</code></td>
</tr>
<tr>
<td width="25%" style="background-color:rgb(238, 241, 242)"><b>IID</b></td><td>Based on 802.15.4 Extended Address</td>
</tr>
<tr>
<td width="25%" style="background-color:rgb(238, 241, 242)"><b>Scope</b></td><td>Link-Local</td>
</tr>
<tr>
<td width="25%" style="background-color:rgb(238, 241, 242)"><b>Details</b></td><td><ul><li>Used to discover neighbors, configure links, and exchange routing information</li><li>Not a routable address</li><li>Always has a prefix of <code>fe80::/16</code></li></ul></td>
</tr>
</tbody>
</table>
<table>
<tbody>
<tr>
<th colspan=2><h3>Mesh-Local EID (ML-EID)</h3></th>
</tr>
<tr>
<td colspan=2 style="background-color:rgb(238, 241, 242)">An EID that identifies a Thread interface, independent of network topology. Used to reach a Thread interface within the same Thread partition. Also called a Unique Local Address (ULA).</td>
</tr>
<tr>
<td width="25%" style="background-color:rgb(238, 241, 242)"><b>Example</b></td><td><code>fde5:8dba:82e1:1:416:993c:8399:35ab</code></td>
</tr>
<tr>
<td width="25%" style="background-color:rgb(238, 241, 242)"><b>IID</b></td><td>Random, chosen after commissioning is complete</td>
</tr>
<tr>
<td width="25%" style="background-color:rgb(238, 241, 242)"><b>Scope</b></td><td>Mesh-Local</td>
</tr>
<tr>
<td width="25%" style="background-color:rgb(238, 241, 242)"><b>Details</b></td><td><ul><li>Does not change as the topology changes</li><li>Should be used by applications</li><li>Always has a prefix <code>fd00::/8</code></li></ul></td>
</tr>
</tbody>
</table>
<table>
<tbody>
<tr>
<th colspan=2><h3>Routing Locator (RLOC)</h3></th>
</tr>
<tr>
<td colspan=2 style="background-color:rgb(238, 241, 242)">Identifies a Thread interface, based on its location in the network topology.</td>
</tr>
<tr>
<td width="25%" style="background-color:rgb(238, 241, 242)"><b>Example</b></td><td><code>fde5:8dba:82e1:1::ff:fe00:1001</code></td>
</tr>
<tr>
<td width="25%" style="background-color:rgb(238, 241, 242)"><b>IID</b></td><td><code>0000:00ff:fe00:<var>RLOC16</var></code></td>
</tr>
<tr>
<td width="25%" style="background-color:rgb(238, 241, 242)"><b>Scope</b></td><td>Mesh-Local</td>
</tr>
<tr>
<td width="25%" style="background-color:rgb(238, 241, 242)"><b>Details</b></td><td><ul><li>Generated once a device attaches to a network</li><li>For delivering IPv6 datagrams within a Thread network</li><li>Changes as the topology changes</li><li>Generally not used by applications</li></ul></td>
</tr>
</tbody>
</table>
<table>
<tbody>
<tr>
<th colspan=2><h3>Anycast Locator (ALOC)</h3></th>
</tr>
<tr>
<td colspan=2 style="background-color:rgb(238, 241, 242)">Identifies a Thread interface via RLOC lookup, when the RLOC of a destination is not known.</td>
</tr>
<tr>
<td width="25%" style="background-color:rgb(238, 241, 242)"><b>Example</b></td><td><code>fde5:8dba:82e1:1::ff:fe00:fc01</code></td>
</tr>
<tr>
<td width="25%" style="background-color:rgb(238, 241, 242)"><b>IID</b></td><td><code>0000:00ff:fe00:fc<var>XX</var></code></td>
</tr>
<tr>
<td width="25%" style="background-color:rgb(238, 241, 242)"><b>Scope</b></td><td>Mesh-Local</td>
</tr>
<tr>
<td width="25%" style="background-color:rgb(238, 241, 242)"><b>Details</b></td><td><ul><li><code>fc<var>XX</var></code> = <a href="#anycast">ALOC destination</a>, which looks up the appropriate RLOC</li><li>Generally not used by applications</li></td>
</tr>
</tbody>
</table>
<table>
<tbody>
<tr>
<th colspan=2><h3>Global Unicast Address (GUA)</h3></th>
</tr>
<tr>
<td colspan=2 style="background-color:rgb(238, 241, 242)">An EID that identifies a Thread interface on a global scope, beyond a Thread network.</td>
</tr>
<tr>
<td width="25%" style="background-color:rgb(238, 241, 242)"><b>Example</b></td><td><code>2000::54db:881c:3845:57f4</code></td>
</tr>
<tr>
<td width="25%" style="background-color:rgb(238, 241, 242)"><b>IID</b></td><td><ul><li>SLAAC — Randomly assigned by the device itself</li><li>DHCP — Assigned by a DHCPv6 server</li><li>Manual — Assigned by the application layer</li></ul></td>
</tr>
<tr>
<td width="25%" style="background-color:rgb(238, 241, 242)"><b>Scope</b></td><td>Global</td>
</tr>
<tr>
<td width="25%" style="background-color:rgb(238, 241, 242)"><b>Details</b></td><td><ul><li>A public IPv6 address</li><li>Always has a prefix of <code>2000::/3</code></li></td>
</tr>
</tbody>
</table>
## Multicast
Multicast is used to communicate information to multiple devices at once. In a
Thread network, specific addresses are reserved for multicast use with different
groups of devices, depending on the scope.
| IPv6 Address | Scope | Delivered to |
| ------------ | ---------- | ----------------- |
| `ff02::1` | Link-Local | All FTDs and MEDs |
| `ff02::2` | Link-Local | All FTDs |
| `ff03::1` | Mesh-Local | All FTDs and MEDs |
| `ff03::2` | Mesh-Local | All FTDs |
Key Point: A major difference between FTDs and MTDs are that FTDs subscribe to
the `ff03::2` multicast address. MTDs do not.
You might notice that Sleepy End Devices (SEDs) are not included as a
recipient in the multicast table above. Instead, Thread defines
link-local and realm-local scope unicast prefix-based IPv6 multicast
address used for All Thread Nodes, including SEDs. These multicast
addresses vary by Thread network, because it is built on the unicast
Mesh-Local prefix (see [RFC 3306](https://tools.ietf.org/html/rfc3306)
for more details on unicast-prefix-based IPv6 multicast addresses).
Arbitrary scopes beyond those already listed are also supported for Thread
devices.
## Anycast
Anycast is used to route traffic to a Thread interface when the RLOC of a
destination is not known. An Anycast Locator (ALOC) identifies the location of
multiple interfaces within a Thread partition. The last 16 bits of an ALOC,
called the ALOC16, is in the format of <code>0xfc<var>XX</var></code>, which
represents the type of ALOC.
For example, an ALOC16 between `0xfc01` and `0xfc0f` is reserved for DHCPv6
Agents. If the specific DHCPv6 Agent RLOC is unknown (perhaps because the
network topology has changed), a message can be sent to a DHCPv6 Agent ALOC to
obtain the RLOC.
Thread defines the following ALOC16 values:
| ALOC16 | Type |
| ------------------------------------------ | ------------------------ |
| `0xfc00` | Leader |
| `0xfc01` `0xfc0f` | DHCPv6 Agent |
| `0xfc10` `0xfc2f` | Service |
| `0xfc30` `0xfc37` | Commissioner |
| `0xfc40` `0xfc4e` | Neighbor Discovery Agent |
| `0xfc38` `0xfc3f`<br>`0xfc4f` `0xfcff` | Reserved |
## Recap
What you've learned:
* A Thread network consists of three scopes: Link-Local, Mesh-Local, and Global
* A Thread device has multiple unicast IPv6 addresses
* An RLOC represents a device's location in the Thread network
* An ML-EID is unique to a Thread device within a partition and should be used by applications
* Thread uses multicast to forward data to groups of nodes and routers
* Thread uses anycast when the RLOC of a destination is unknown
To learn more about Thread's IPv6 addressing, see sections 5.2 and 5.3 of the
[Thread Specification](http://threadgroup.org/ThreadSpec).
@@ -1,292 +0,0 @@
# Network Discovery and Formation
## Thread networks
Thread networks are identified by three unique identifiers:
* 2-byte Personal Area Network ID (PAN ID)
* 8-byte Extended Personal Area Network ID (XPAN ID)
* A human-readable Network Name
For example, a Thread network may have the following identifiers:
Identifier | Value
---- | ----
PAN ID | `0xBEEF`
XPAN ID | `0xBEEF1111CAFE2222`
Network Name | `yourThreadCafe`
<figure class="attempt-right">
<a href="../images/ot-primer-network-active-scan_2x.png"><img src="../images/ot-primer-network-active-scan.png" srcset="../images/ot-primer-network-active-scan.png 1x, ../images/ot-primer-network-active-scan_2x.png 2x" border="0" alt="OT Active Scan" /></a>
</figure>
When creating a new Thread network, or searching for an existing one to join, a
Thread device performs an active scan for 802.15.4 networks within radio range:
1. The device broadcasts an 802.15.4 Beacon Request on a specific Channel.
1. In return, any Routers or Router Eligible End Devices (REEDs) in range
broadcast a Beacon that contains their Thread network PAN ID, XPAN ID, and
Network Name.
1. The device repeats the previous two steps for each Channel.
Once a Thread device has discovered all networks in range, it can either attach
to an existing network, or create a new one if no networks are discovered.
<h2 style="clear:right">Mesh Link Establishment</h2>
Thread uses the Mesh Link Establishment (MLE) protocol to configure links and
disseminate information about the network to Thread devices.
In link configuration, MLE is used to:
* Discover links to neighboring devices
* Determine the quality of links to neighboring devices
* Establish links to neighboring devices
* Negotiate link parameters (device type, frame counters, timeout) with peers
MLE disseminates the following types of information to devices wishing to
establish links:
* Leader data (Leader RLOC, Partition ID, Partition weight)
* Network data (on-mesh prefixes, address autoconfiguration, more-specific
routes)
* Route propagation
Route propagation in Thread works similar to the Routing Information Protocol
(RIP), a distance-vector routing protocol.
Note: MLE only proceeds once a Thread device has obtained Thread network
credentials through Thread Commissioning. Commissioning and Security will be
covered in depth later in this Primer. For now, this page assumes that the
device has already been commissioned.
## Create a new network
If the device elects to create a new network, it selects the least busy Channel
and a PAN ID not in use by other networks, then becomes a Router and elects
itself the Leader. This device sends MLE Advertisement messages to other
802.15.4 devices to inform them of its link state, and responds to Beacon
Requests by other Thread devices performing an active scan.
## Join an existing network
If the device elects to join an existing network, it configures its Channel, PAN
ID, XPAN ID, and Network Name to match that of the target network via Thread
Commissioning, then goes through the MLE Attach process to attach as a Child
(End Device). This process is used for Child-Parent links.
Key Point: Every device, router-capable or not, initially attaches to a Thread
network as a Child (End Device).
1. The Child sends a multicast [Parent Request](#1_parent_request) to all
neighboring Routers and REEDs in the target network.
1. All neighboring Routers and REEDs (if the Parent Request Scan Mask includes
REEDs) send [Parent Responses](#2_parent_response) with information about
themselves.
1. The Child chooses a Parent device and sends a [Child ID
Request](#3_child_id_request) to it.
1. The Parent sends a [Child ID Response](#4_child_id_response) to confirm link
establishment.
### 1. Parent Request
A Parent Request is a multicast request from the attaching device that is used
to discover neighboring Routers and Router Eligible End Devices (REEDs) in the
target network.
<figure>
<a href="../images/ot-primer-network-mle-attach-01_2x.png"><img src="../images/ot-primer-network-mle-attach-01.png" srcset="../images/ot-primer-network-mle-attach-01.png 1x, ../images/ot-primer-network-mle-attach-01_2x.png 2x" width="350" border="0" alt="OT MLE Attach Parent Request" /></a>
</figure>
<table>
<tbody>
<tr>
<th colspan=2>Parent Request Message Contents</th>
</tr>
<tr>
<td width="25%" style="background-color:rgb(238, 241, 242)"><b>Mode</b></td>
<td>Describes the attaching device</td>
</tr>
<tr>
<td width="25%" style="background-color:rgb(238, 241, 242)"><b>Challenge</b></td>
<td>Tests the timeliness of the Parent Response to prevent replay
attacks</td>
</tr>
<tr>
<td width="25%" style="background-color:rgb(238, 241, 242)"><b>Scan Mask</b></td>
<td>Limits the request to only Routers or to both Routers and REEDs</td>
</tr>
</tbody>
</table>
### 2. Parent Response
A Parent Response is a unicast response to a Parent Request that provides
information about a Router or REED to the attaching device.
<figure>
<a href="../images/ot-primer-network-mle-attach-02_2x.png"><img src="../images/ot-primer-network-mle-attach-02.png" srcset="../images/ot-primer-network-mle-attach-02.png 1x, ../images/ot-primer-network-mle-attach-02_2x.png 2x" width="350" border="0" alt="OT MLE Attach Parent Response" /></a>
</figure>
<table>
<tbody>
<tr>
<th colspan=2>Parent Response Message Contents</th>
</tr>
<tr>
<td width="25%" style="background-color:rgb(238, 241, 242)"><b>Version</b></td>
<td>Thread protocol version</td>
</tr>
<tr>
<td width="25%" style="background-color:rgb(238, 241, 242)"><b>Response</b></td>
<td>Copy of the Parent Request Challenge</td>
</tr>
<tr>
<td width="25%" style="background-color:rgb(238, 241, 242)"><b>Link Frame
Counter</b></td>
<td>802.15.4 Frame Counter on the Router/REED</td>
</tr>
<tr>
<td width="25%" style="background-color:rgb(238, 241, 242)"><b>MLE Frame
Counter</b></td>
<td>MLE Frame Counter on the Router/REED</td>
</tr>
<tr>
<td width="25%" style="background-color:rgb(238, 241, 242)"><b>Source
Address</b></td>
<td>RLOC16 of the Router/REED</td>
</tr>
<tr>
<td width="25%" style="background-color:rgb(238, 241, 242)"><b>Link
Margin</b></td>
<td>Receive signal quality of the Router/REED</td>
</tr>
<tr>
<td width="25%" style="background-color:rgb(238, 241, 242)"><b>Connectivity</b></td>
<td>Describes the Router/REEDs level of connectivity</td>
</tr>
<tr>
<td width="25%" style="background-color:rgb(238, 241, 242)"><b>Leader
Data</b></td>
<td>Information about the Router/REEDs Leader</td>
</tr>
<tr>
<td width="25%" style="background-color:rgb(238, 241, 242)"><b>Challenge</b></td>
<td>Tests the timeliness of the Child ID Request to prevent replay
attacks</td>
</tr>
</tbody>
</table>
### 3. Child ID Request
A Child ID Request is a unicast request from the attaching device (Child) that
is sent to the Router or REED (Parent) for the purpose of establishing a
Child-Parent link. If the request is sent to a REED, it [upgrades itself to a
Router](/guides/thread-primer/router-selection#upgrade_to_a_router) before
accepting the request.
<figure>
<a href="../images/ot-primer-network-mle-attach-03_2x.png"><img src="../images/ot-primer-network-mle-attach-03.png" srcset="../images/ot-primer-network-mle-attach-03.png 1x, ../images/ot-primer-network-mle-attach-03_2x.png 2x" width="350" border="0" alt="OT MLE Attach Child ID Request" /></a>
</figure>
<table>
<tbody>
<tr>
<th colspan=2>Child ID Request Message Contents</th>
</tr>
<tr>
<td width="25%" style="background-color:rgb(238, 241, 242)"><b>Version</b></td>
<td>Thread protocol version</td>
</tr>
<tr>
<td width="25%" style="background-color:rgb(238, 241, 242)"><b>Response</b></td>
<td>Copy of the Parent Response Challenge</td>
</tr>
<tr>
<td width="25%" style="background-color:rgb(238, 241, 242)"><b>Link Frame
Counter</b></td>
<td>802.15.4 Frame Counter on the Child</td>
</tr>
<tr>
<td width="25%" style="background-color:rgb(238, 241, 242)"><b>MLE Frame
Counter</b></td><td>MLE Frame Counter on the Child</td>
</tr>
<tr>
<td width="25%" style="background-color:rgb(238, 241, 242)"><b>Mode</b></td>
<td>Describes the Child</td>
</tr>
<tr>
<td width="25%" style="background-color:rgb(238, 241, 242)"><b>Timeout</b></td>
<td>Inactivity duration before the Parent removes the Child</td>
</tr>
<tr>
<td width="25%" style="background-color:rgb(238, 241, 242)"><b>Address
Registration (MEDs and SEDs only)</b></td>
<td>Register IPv6 addresses</td>
</tr>
</tbody>
</table>
### 4. Child ID Response
A Child ID Response is a unicast response from the Parent that is sent to the
Child to confirm that a Child-Parent link has been established.
<figure>
<a href="../images/ot-primer-network-mle-attach-04_2x.png"><img src="../images/ot-primer-network-mle-attach-04.png" srcset="../images/ot-primer-network-mle-attach-04.png 1x, ../images/ot-primer-network-mle-attach-04_2x.png 2x" width="350" border="0" alt="OT MLE Attach Child ID Response" /></a>
</figure>
<table>
<tbody>
<tr>
<th colspan=2>Child ID Response Message Contents</th>
</tr>
<tr>
<td width="25%" style="background-color:rgb(238, 241, 242)"><b>Source
Address</b></td>
<td>Parent's RLOC16</td>
</tr>
<tr>
<td width="25%" style="background-color:rgb(238, 241, 242)"><b>Address16</b></td>
<td>Child's RLOC16</td>
</tr>
<tr>
<td width="25%" style="background-color:rgb(238, 241, 242)"><b>Leader
Data</b></td>
<td>Information about the Parents Leader (RLOC, Partition ID, Partition
weight)</td>
</tr>
<tr>
<td width="25%" style="background-color:rgb(238, 241, 242)"><b>Network
Data</b></td>
<td>Information about the Thread network (on-mesh prefixes, address
autoconfiguration, more-specific routes)</td>
</tr>
<tr>
<td width="25%" style="background-color:rgb(238, 241, 242)"><b>Route
(REED only)</b></td>
<td>Route propagation</td>
</tr>
<tr>
<td width="25%" style="background-color:rgb(238, 241, 242)"><b>Timeout</b></td>
<td>Inactivity duration before the Parent removes the Child</td>
</tr>
<tr>
<td width="25%" style="background-color:rgb(238, 241, 242)"><b>Address
Registration (MEDs and SEDs only)</b></td>
<td>Confirm registered addresses</td>
</tr>
</tbody>
</table>
## Recap
What you've learned:
* A Thread device performs an active scan for existing networks
* Thread uses Mesh Link Establishment to configure links and disseminate
information about network devices
* MLE Advertisement messages inform other Thread devices about a device's
network and link state
* The MLE Attach process establishes Child-Parent links
@@ -1,152 +0,0 @@
# Node Roles and Types
## Forwarding roles
<figure class="attempt-right">
<a href="../images/ot-primer-roles_2x.png"><img src="../images/ot-primer-roles.png" srcset="../images/ot-primer-roles.png 1x, ../images/ot-primer-roles_2x.png 2x" border="0" alt="OT Node Roles" /></a>
</figure>
In a Thread network, nodes are split into two forwarding roles:
### Router
A Router is a node that:
* forwards packets for network devices
* provides secure commissioning services for devices trying to join the network
* keeps its transceiver enabled at all times
### End Device
An End Device (ED) is a node that:
* communicates primarily with a single Router
* does not forward packets for other network devices
* can disable its transceiver to reduce power
Key Point: The relationship between Router and End Device is a Parent-Child
relationship. An End Device attaches to exactly one Router. The Router is always
the Parent, the End Device the Child.
## Device types
Furthermore, nodes comprise a number of types.
<figure class="attempt-right">
<a href="../images/ot-primer-taxonomy_2x.png"><img src="../images/ot-primer-taxonomy.png" srcset="../images/ot-primer-taxonomy.png 1x, ../images/ot-primer-taxonomy.png 2x" border="0" alt="OT Device Taxonomy" /></a>
</figure>
### Full Thread Device
A Full Thread Device (FTD) always has its radio on, subscribes to the
all-routers multicast address, and maintains IPv6 address mappings. There are
three types of FTDs:
* Router
* Router Eligible End Device (REED) — can be promoted to a Router
* Full End Device (FED) — cannot be promoted to a Router
An FTD can operate as a Router (Parent) or an End Device (Child).
### Minimal Thread Device
A Minimal Thread Device does not subscribe to the all-routers
multicast address and forwards all messages to its Parent. There are
two types of MTDs:
* Minimal End Device (MED) — transceiver always on, does not need to poll for
messages from its parent
* Sleepy End Device (SED) — normally disabled, wakes on occasion to poll for
messages from its parent
An MTD can only operate as an End Device (Child).
### Upgrading and downgrading
When a REED is the only node in reach of a new End Device wishing to join the
Thread network, it can upgrade itself and operate as a Router:
<figure>
<a href="../images/ot-primer-router-upgrade_2x.png"><img src="../images/ot-primer-router-upgrade.png" srcset="../images/ot-primer-router-upgrade.png 1x, ../images/ot-primer-router-upgrade_2x.png 2x" border="0" width="400" alt="OT End Device to Router" /></a>
</figure>
Conversely, when a Router has no children, it can downgrade itself and operate
as an End Device:
<figure>
<a href="../images/ot-primer-router-downgrade_2x.png"><img src="../images/ot-primer-router-downgrade.png" srcset="../images/ot-primer-router-downgrade.png 1x, ../images/ot-primer-router-downgrade_2x.png 2x" border="0" width="400" alt="OT Router to End Device" /></a>
</figure>
## Other roles and types
### Thread Leader
<figure class="attempt-right">
<a href="../images/ot-primer-leader_2x.png"><img src="../images/ot-primer-leader.png" srcset="../images/ot-primer-leader.png 1x, ../images/ot-primer-leader_2x.png 2x" border="0" alt="OT Leader and Border Router" /></a>
</figure>
The Thread Leader is a Router that is responsible for managing the set of
Routers in a Thread network. It is dynamically self-elected for fault tolerance,
and aggregates and distributes network-wide configuration information.
Note: There is always a single Leader in each Thread network
[partition](#partitions).
### Border Router
A Border Router is a device that can forward information between a Thread
network and a non-Thread network (for example, Wi-Fi). It also configures a
Thread network for external connectivity.
Any device may serve as a Border Router.
Note: There can be multiple Border Routers in a Thread network.
## Partitions
<figure class="attempt-right">
<a href="../images/ot-primer-partitions_2x.png"><img src="../images/ot-primer-partitions.png" srcset="../images/ot-primer-partitions.png 1x, ../images/ot-primer-partitions_2x.png 2x" border="0" alt="OT Partitions" /></a>
</figure>
A Thread network might be composed of partitions. This occurs when a group of
Thread devices can no longer communicate with another group of Thread devices.
Each partition logically operates as a distinct Thread network with its own
Leader, Router ID assignments, and network data, while retaining the same
security credentials for all devices across all partitions.
Partitions in a Thread network do not have wireless connectivity between each
other, and if partitions regain connectivity, they automatically merge into a
single partition.
Key Point: Security credentials define the Thread network. Physical radio
connectivity defines partitions within that Thread network.
Note that the use of "Thread network" in this primer assumes a single partition.
Where necessary, key concepts and examples are clarified with the term "partition."
Partitions are covered in-depth later in this primer.
## Device limits
There are limits to the number of device types a single Thread network supports.
Role | Limit
----|----
Leader | 1
Router | 32
End Device | 511 per Router
Thread tries to keep the number of Routers between 16 and 23. If a REED attaches
as an End Device and the number of Routers in the network is below 16, it
automatically promotes itself to a Router.
## Recap
What you learned:
* A Thread device is either a Router (Parent) or an End Device (Child)
* A Thread device is either a Full Thread Device (maintains IPv6 address
mappings) or a Minimal Thread Device (forwards all messages to its Parent)
* A Router Eligible End Device can promote itself to a Router, and vice versa
* Every Thread network partition has a Leader to manage Routers
* A Border Router is used to connect Thread and non-Thread networks
* A Thread network might be composed of multiple partitions
@@ -1,176 +0,0 @@
# Router Selection
## Connected Dominating Set
<figure class="attempt-right">
<a href="../images/ot-primer-cds_2x.png"><img src="../images/ot-primer-cds.png" srcset="../images/ot-primer-cds.png 1x, ../images/ot-primer-cds_2x.png 2x" width="350" border="0" alt="OT Connected Dominating Set" /></a><figcaption style="text-align: center"><i>Example of a Connected Dominating Set</i></figcaption>
</figure>
Routers must form a Connected Dominating Set (CDS), which means:
1. There is a Router-only path between any two Routers.
1. Any one Router in a Thread network can reach any other Router by staying
entirely within the set of Routers.
1. Every End Device in a Thread network is directly connected to a Router.
A distributed algorithm maintains the CDS, which ensures a minimum level of
redundancy. Every device initially attaches to the network as an End Device
(Child). As the state of the Thread network changes, the algorithm adds or
removes Routers to maintain the CDS.
Thread adds Routers to:
* Increase coverage if the network is below the Router threshold of 16
* Increase path diversity
* Maintain a minimum level of redundancy
* Extend connectivity and support more Children
Thread removes Routers to:
* Reduce the Routing state below the maximum of 32 Routers
* Allow new Routers in other parts of the network when needed
## Upgrade to a Router
After attaching to a Thread network, the Child device may elect to become a
Router. Before initiating the MLE Link Request process, the Child sends an
Address Solicit message to the Leader, asking for a Router ID. If the Leader
accepts, it responds with a Router ID and the Child upgrades itself to a Router.
The MLE Link Request process is then used to establish bi-directional
Router-Router links with neighboring Routers.
1. The new Router sends a multicast [Link Request](#1_link_request) to
neighboring Routers.
1. Routers respond with [Link Accept and Request](#2_link_accept_and_request)
messages.
1. The new Router responds to each Router with a unicast [Link
Accept](#3_link_accept) to establish the Router-Router link.
### 1. Link Request
A Link Request is a request from the Router to all other Routers in the Thread
network. When first becoming a Router, the device sends a multicast Link Request
to `ff02::2`. Later, after discovering the other Routers via MLE Advertisements,
the devices send unicast Link Requests.
<figure>
<a href="../images/ot-primer-network-mle-link-request-01_2x.png"><img src="../images/ot-primer-network-mle-link-request-01.png" srcset="../images/ot-primer-network-mle-link-request-01.png 1x, ../images/ot-primer-network-mle-link-request-01_2x.png 2x" width="350" border="0" alt="OT MLE Link Request" /></a>
</figure>
<table>
<tbody>
<tr>
<th colspan=2>Link Request Message Contents</th>
</tr>
<tr>
<td width="25%" style="background-color:rgb(238, 241, 242)"><b>Version</b></td>
<td>Thread protocol version</td>
</tr>
<tr>
<td width="25%" style="background-color:rgb(238, 241, 242)"><b>Challenge</b></td>
<td>Tests the timeliness of the Link Response to prevent replay
attacks</td>
</tr>
<tr>
<td width="25%" style="background-color:rgb(238, 241, 242)"><b>Source
Address</b></td>
<td>RLOC16 of the sender</td>
</tr>
<tr>
<td width="25%" style="background-color:rgb(238, 241, 242)"><b>Leader
Data</b></td>
<td>Information about the Router's Leader, as stored on the sender (RLOC,
Partition ID, Partition weight)</td>
</tr>
</tbody>
</table>
### 2. Link Accept and Request
A Link Accept and Request is a combination of the Link Accept and Link Request
messages. Thread uses this optimization in the MLE Link Request process to
reduce the number of messages from four to three.
<figure>
<a href="../images/ot-primer-network-mle-link-request-02_2x.png"><img src="../images/ot-primer-network-mle-link-request-02.png" srcset="../images/ot-primer-network-mle-link-request-02.png 1x, ../images/ot-primer-network-mle-link-request-02_2x.png 2x" width="350" border="0" alt="OT MLE Link Accept and Request" /></a>
</figure>
### 3. Link Accept
A Link Accept is a unicast response to a Link Request from a neighboring Router
that provides information about itself and accepts the link to the neighboring
Router.
<figure>
<a href="../images/ot-primer-network-mle-link-request-03_2x.png"><img src="../images/ot-primer-network-mle-link-request-03.png" srcset="../images/ot-primer-network-mle-link-request-03.png 1x, ../images/ot-primer-network-mle-link-request-03_2x.png 2x" width="350" border="0" alt="OT MLE Link Accept" /></a>
</figure>
<table>
<tbody>
<tr>
<th colspan=2>Link Accept Message Contents</th>
</tr>
<tr>
<td width="25%" style="background-color:rgb(238, 241, 242)"><b>Version</b></td>
<td>Thread protocol version</td>
</tr>
<tr>
<td width="25%" style="background-color:rgb(238, 241, 242)"><b>Response</b></td>
<td>Tests the timeliness of the Link Response to prevent replay
attacks</td>
</tr>
<tr>
<td width="25%" style="background-color:rgb(238, 241, 242)"><b>Link Frame
Counter</b></td>
<td>802.15.4 Frame Counter on the sender</td>
</tr>
<tr>
<td width="25%" style="background-color:rgb(238, 241, 242)"><b>MLE Frame
Counter</b></td>
<td>MLE Frame Counter on the sender</td>
</tr>
<tr>
<td width="25%" style="background-color:rgb(238, 241, 242)"><b>Source
Address</b></td>
<td>RLOC16 of the sender</td>
</tr>
<tr>
<td width="25%" style="background-color:rgb(238, 241, 242)"><b>Leader
Data</b></td>
<td>Information about the Router's Leader, as stored on the sender (RLOC,
Partition ID, Partition weight)</td>
</tr>
</tbody>
</table>
## Downgrade to a REED
When a Router downgrades to a REED, its Router-Router links are disconnected,
and the device initiates the MLE Attach process to establish a Child-Parent
link.
See [Join an existing
network](/guides/thread-primer/network-discovery#join_an_existing_network)
for more information on the MLE Attach process.
## One-way receive links
In some scenarios, it may be necessary to establish a one-way receive link.
After a Router reset, neighboring Routers may still have a valid receive link
with the reset Router. In this case, the reset Router sends a Link Request
message to re-establish the Router-Router link.
An End Device may also wish to establish a receive link with neighboring
non-Parent Routers to improve multicast reliability. We'll learn more about this
when we get to Multicast Routing.
## Recap
What you've learned:
* Routers in a Thread network must form a Connected Dominating Set (CDS)
* Thread devices are upgraded to Routers or downgraded to End Devices to
maintain the CDS
* The MLE Link Request process is used to establish Router-Router links
@@ -1,25 +0,0 @@
# 什么是 Thread
<figure class="attempt-right">
<img src="../images/ot-logo-thread.png" srcset="../images/ot-logo-thread.png 1x, ../images/ot-logo-thread_2x.png 2x" border="0" alt="Thread" />
</figure>
<a href="http://threadgroup.org/">Thread<sup>®</sup></a> 是一个为低功耗物联网(IEEE 802.15.4-2006 WPAN)设备设计的基于 IPv6 的网络协议。Thread 是一个新的网状网络协议,它并不依赖其它的 802.15 网状网络协议(如 ZigBee、Z-Wave 和 Bluetooth LE)。
Thread 的主要特性包括:
* 易于部署和维护 — 安装、启动和操作相对简单
* 通信安全 — Thread 网络中的设备都必须通过身份验证,并且所有的通信都经过了加密
* 稳定可靠 — 具有自愈能力的网状网络,无单点故障,并且采用扩频技术以提高抗干扰能力
* 低功耗 — Thread 低功耗设备可以进入休眠并使用电池供电,通常使用一块电池便能工作数年
* 规模可扩展 — Thread 网络的规模可以扩展达数百个设备
如果你不熟悉 Thread,那么了解基本的 Thread 知识对于你在应用中使用 OpenThread 是至关重要的。本入门教程的目的是解释 Thread 的基本概念和工作原理,并为你提供了 OpenThread 开发的起点。
本教程假定读者已具备如下的基本知识:
* IEEE 802.15.4
* 网络及路由概念
* IPv6
本入门教程基于 Thread Specification V1.1.1。Thread Specification 可以在 [threadgroup.org](http://threadgroup.org/ThreadSpec) 中获取。
@@ -1,231 +0,0 @@
# IPv6 寻址
让我们来看一下 Thread 如何识别网络中的每个设备,以及设备间用何种类型的地址进行相互通信。
Key Term: 在本入门教程中,术语“接口(interface)”用于标识网络内 Thread 设备的端点。通常,单个 Thread 设备具有单个 Thread 接口。
## 域
<figure class="attempt-right">
<a href="../images/ot-primer-scopes_2x.png"><img src="../images/ot-primer-scopes.png" srcset="../images/ot-primer-scopes.png 1x, ../images/ot-primer-scopes_2x.png 2x" border="0" alt="OT Scopes" /></a>
</figure>
Thread 网络中有三种域用于单播寻址:
* Link-Local — 所有通过单次射频传输可访问的接口
* Mesh-Local — 所有在同一 Thread 网络中可访问的接口
* Global — 所有从 Thread 网络外部可以访问的接口
前两个域与 Thread 网络指定的 Prefix(前缀)相对应。Link-Local 的 Prefix 为 `fe80::/16`Mesh-Local 的 Prefix 为 `fd00::/8`
<h2 style="clear:right">单播</h2>
单个 Thread 设备可以通过多种 IPv6 单播地址来进行标识。每种地址都有不同的功能(基于域和用例)。
在介绍每种类型之前,让我们先了解一个共同的概念,它叫作 RLOCRouting Locator)。RLOC 根据 Thread 接口在网络拓扑中的位置来对其进行标识。
### 如何生成 RLOC
所有设备都获得一个 Router ID 和一个 Child ID。每个 Router 维护一个包含其所有子节点的表,两个 ID 的组合唯一地标识拓扑中的设备。例如,请参考以下拓扑中高亮的节点,其中 Router(五边形)中的数字是 Router ID,End Device(圆形)中的数字是 Child ID:
<figure>
<a href="../images/ot-primer-rloc-topology_2x.png"><img src="../images/ot-primer-rloc-topology.png" srcset="../images/ot-primer-rloc-topology.png 1x, ../images/ot-primer-rloc-topology_2x.png 2x" border="0" width="600" alt="OT RLOC Topology" /></a>
</figure>
每个子节点的 Router ID 对应于它的父节点(Router)。因为 Router 不会是子节点,所以 Router 的 Child ID 始终为 0。这些值对于 Thread 网络中的每个设备都是唯一的,并用于创建 RLOC16(代表 RLOC 的后 16 位)。
例如,以下是左上节点(Router ID = 1Child ID = 1)的 RLOC16 的计算方法:
<figure>
<a href="../images/ot-primer-rloc16_2x.png"><img src="../images/ot-primer-rloc16.png" srcset="../images/ot-primer-rloc16.png 1x, ../images/ot-primer-rloc16_2x.png 2x" border="0" width="400" alt="OT RLOC16" /></a>
</figure>
RLOC16 是 IIDInterface Identifier)的一部分,IID 对应的是 IPv6 地址的后 64 位。一些 IID 可用于标识某些类型的 Thread 接口。例如,RLOC 的 IID 始终为 <code>0000:00ff:fe00:<var>RLOC16</var></code> 的形式。
RLOC 由 Mesh-Local Prefix 和 IID 组成。例如,如果 Mesh-Local Prefix 是 `fde5:8dba:82e1:1::/64`RLOC16 = `0x401`,那么该节点的 RLOC 就是:
<figure>
<a href="../images/ot-primer-rloc_2x.png"><img src="../images/ot-primer-rloc.png" srcset="../images/ot-primer-rloc.png 1x, ../images/ot-primer-rloc_2x.png 2x" border="0" width="600" alt="OT RLOC" /></a>
</figure>
可以使用相同的逻辑来确定以上示例拓扑中所有高亮的节点的 RLOC:
<figure>
<a href="../images/ot-primer-rloc-topology-address_2x.png"><img src="../images/ot-primer-rloc-topology-address.png" srcset="../images/ot-primer-rloc-topology-address.png 1x, ../images/ot-primer-rloc-topology-address_2x.png 2x" border="0" width="600" alt="OT Topology w/ Address" /></a>
</figure>
但是,因为 RLOC 是基于节点在拓扑中的位置的,所以节点的 RLOC 会随着拓扑的变化而改变。
例如,如果 Thread 网络中的 `0x400` 节点离开了网络,那么它的子节点 `0x401``0x402` 会与其它的 Router 建立新连接,从而获得新的 RLOC16 和 RLOC
<figure>
<a href="../images/ot-primer-rloc-topology-change_2x.png"><img src="../images/ot-primer-rloc-topology-change.png" srcset="../images/ot-primer-rloc-topology-change.png 1x, ../images/ot-primer-rloc-topology-change_2x.png 2x" border="0" width="600" alt="OT Topology after Change" /></a>
</figure>
## 单播地址类型
RLOC 只是 Thread 设备可以获得的多种 IPv6 单播地址之一。另一类用于在 Thread 网络分区内标识唯一的 Thread 接口的地址称为 EIDEndpoint Identifier)。EID 与 Thread 网络拓扑无关。
常见的单播类型如下。
<table>
<tbody>
<tr>
<th colspan=2><h3>Link-Local Address (LLA)</h3></th>
</tr>
<tr>
<td colspan=2 style="background-color:rgb(238, 241, 242)">一种用于标识单次射频传输可访问的 Thread 接口的 EID。</td>
</tr>
<tr>
<td width="25%" style="background-color:rgb(238, 241, 242)"><b>示例</b></td><td><code>fe80::54db:881c:3845:57f4</code></td>
</tr>
<tr>
<td width="25%" style="background-color:rgb(238, 241, 242)"><b>IID</b></td><td>基于 802.15.4 Extended Address</td>
</tr>
<tr>
<td width="25%" style="background-color:rgb(238, 241, 242)"><b>域</b></td><td>Link-Local</td>
</tr>
<tr>
<td width="25%" style="background-color:rgb(238, 241, 242)"><b>详情</b></td><td><ul><li>用于发现邻居、配置链路和交换路由信息</li><li>非可路由地址</li><li>总是带 <code>fe80::/16</code> Prefix</li></ul></td>
</tr>
</tbody>
</table>
<table>
<tbody>
<tr>
<th colspan=2><h3>Mesh-Local EID (ML-EID)</h3></th>
</tr>
<tr>
<td colspan=2 style="background-color:rgb(238, 241, 242)">一种用于标识 Thread 接口的 EID,其与网络拓扑无关。用于访问同一 Thread 分区内的 Thread 接口。也称为 ULAUnique Local Address)。</td>
</tr>
<tr>
<td width="25%" style="background-color:rgb(238, 241, 242)"><b>示例</b></td><td><code>fde5:8dba:82e1:1:416:993c:8399:35ab</code></td>
</tr>
<tr>
<td width="25%" style="background-color:rgb(238, 241, 242)"><b>IID</b></td><td>在 commissioning 完成后随机生成</td>
</tr>
<tr>
<td width="25%" style="background-color:rgb(238, 241, 242)"><b>域</b></td><td>Mesh-Local</td>
</tr>
<tr>
<td width="25%" style="background-color:rgb(238, 241, 242)"><b>详情</b></td><td><ul><li>不会随拓扑变化而变化</li><li>应由应用程序使用</li><li>总是带 <code>fd00::/8</code> Prefix</li></ul></td>
</tr>
</tbody>
</table>
<table>
<tbody>
<tr>
<th colspan=2><h3>Routing Locator (RLOC)</h3></th>
</tr>
<tr>
<td colspan=2 style="background-color:rgb(238, 241, 242)">根据 Thread 接口在网络拓扑中的位置来对其进行标识。</td>
</tr>
<tr>
<td width="25%" style="background-color:rgb(238, 241, 242)"><b>示例</b></td><td><code>fde5:8dba:82e1:1::ff:fe00:1001</code></td>
</tr>
<tr>
<td width="25%" style="background-color:rgb(238, 241, 242)"><b>IID</b></td><td><code>0000:00ff:fe00:<var>RLOC16</var></code></td>
</tr>
<tr>
<td width="25%" style="background-color:rgb(238, 241, 242)"><b>域</b></td><td>Mesh-Local</td>
</tr>
<tr>
<td width="25%" style="background-color:rgb(238, 241, 242)"><b>详情</b></td><td><ul><li>在设备连接到网络后生成</li><li>用于在 Thread 网络中传递 IPv6 数据报</li><li>随拓扑变化而变化</li><li>通常不会由应用程序使用</li></ul></td>
</tr>
</tbody>
</table>
<table>
<tbody>
<tr>
<th colspan=2><h3>Anycast Locator (ALOC)</h3></th>
</tr>
<tr>
<td colspan=2 style="background-color:rgb(238, 241, 242)">用于标识 Thread 网络分区中一个或多个 Thread 接口的位置。如果始发者不知道目的地的 RLOC,则使用 ALOC 进行查找。</td>
</tr>
<tr>
<td width="25%" style="background-color:rgb(238, 241, 242)"><b>示例</b></td><td><code>fde5:8dba:82e1:1::ff:fe00:fc01</code></td>
</tr>
<tr>
<td width="25%" style="background-color:rgb(238, 241, 242)"><b>IID</b></td><td><code>0000:00ff:fe00:fc<var>XX</var></code></td>
</tr>
<tr>
<td width="25%" style="background-color:rgb(238, 241, 242)"><b>域</b></td><td>Mesh-Local</td>
</tr>
<tr>
<td width="25%" style="background-color:rgb(238, 241, 242)"><b>详情</b></td><td><ul><li><code>fc<var>XX</var></code> = <a href="#anycast">ALOC 目的地址</a>,用于查询对应的 RLOC</li><li>通常不会由应用程序使用</li></td>
</tr>
</tbody>
</table>
<table>
<tbody>
<tr>
<th colspan=2><h3>Global Unicast Address (GUA)</h3></th>
</tr>
<tr>
<td colspan=2 style="background-color:rgb(238, 241, 242)">一个EID,用于标识除 Thread 网络外的全局范围内的 Thread 接口。</td>
</tr>
<tr>
<td width="25%" style="background-color:rgb(238, 241, 242)"><b>示例</b></td><td><code>2000::54db:881c:3845:57f4</code></td>
</tr>
<tr>
<td width="25%" style="background-color:rgb(238, 241, 242)"><b>IID</b></td><td><ul><li>SLAAC — 由设备自身随机分配</li><li>DHCP — 由 DHCPv6 服务器分配</li><li>Manual — 由应用层分配</li></ul></td>
</tr>
<tr>
<td width="25%" style="background-color:rgb(238, 241, 242)"><b>域</b></td><td>Global</td>
</tr>
<tr>
<td width="25%" style="background-color:rgb(238, 241, 242)"><b>详情</b></td><td><ul><li>一个公开的 IPv6 地址</li><li>总是带 <code>2000::/3</code> Prefix</li></td>
</tr>
</tbody>
</table>
## 多播
多播用于一次将信息传达给多个设备。Thread 网络中保留了特定的地址,以提供给不同分组的设备在多播时使用。
| IPv6 地址 | 域 | 传递给 |
| --------- | ---------- | --------------- |
| `ff02::1` | Link-Local | 所有 FTD 和 MED |
| `ff02::2` | Link-Local | 所有 FTD |
| `ff03::1` | Mesh-Local | 所有 FTD 和 MED |
| `ff03::2` | Mesh-Local | 所有 FTD |
Key Point: FTD 和 MTD 之间的主要区别在于 FTD 订阅了 `ff03::2` 多播地址。而 MTD 没有订阅。
你可能会注意到,上面的多播表中没有将 SED 作为接收者包括在内。Thread 为所有 Thread 节点(包括 SED)定义了(link-local 和 realm-local 域)基于单播 prefix 的 IPv6 多播地址。这些多播地址基于单播 Mesh-Local prefix 构成,因 Thread 网络而异。(有关基于单播 prefix 的 IPv6 多播地址的详情,请参阅 [RFC 3306](https://tools.ietf.org/html/rfc3306))。
Thread 设备还支持除表中所列举域之外的任意域。
## 任播
当目的地的 RLOC 未知时,可以使用任播将流量路由到 Thread 接口。ALOCAnycast Locator)标识 Thread 分区内多个接口的位置。ALOC 的后 16 位,称为 ALOC16,其格式为 <code>0xfc<var>XX</var></code>,表示 ALOC 的类型。
例如,`0xfc01``0xfc0f` 之间的 ALOC16 保留给了 DHCPv6 Agent。如果特定的 DHCPv6 Agent RLOC 是未知的(可能是因为网络拓扑已更改),则可以将消息发送到 DHCPv6 Agent ALOC 以获取 RLOC。
Thread 定义了以下 ALOC16 值:
| ALOC16 | 类型 |
| ------------------------------------------ | ------------------------ |
| `0xfc00` | Leader |
| `0xfc01` `0xfc0f` | DHCPv6 Agent |
| `0xfc10` `0xfc2f` | Service |
| `0xfc30` `0xfc37` | Commissioner |
| `0xfc40` `0xfc4e` | Neighbor Discovery Agent |
| `0xfc38` `0xfc3f`<br>`0xfc4f` `0xfcff` | Reserved |
## 回顾
你应该学到了:
* Thread 网络包含三个域:Link-Local、Mesh-Local 和 Global
* Thread 设备具有多种单播 IPv6 地址
* RLOC 表示设备在 Thread 网络中的位置
* ML-EID 对于分区内的 Thread 设备是唯一的,并且应由应用程序使用
* Thread 使用多播将数据转发到节点组和 Router 组
* 当目的地的 RLOC 未知时,Thread 可以使用任播
要了解有关 Thread 的 IPv6 寻址的更多信息,请参阅 [Thread Specification](http://threadgroup.org/ThreadSpec) 的 5.2 和 5.3 节。
@@ -1,254 +0,0 @@
# 网络发现与形成
## Thread 网络
Thread 网络由三个唯一的标识符标识:
* 2 字节的 PAN IDPersonal Area Network ID,个域网标识符)
* 8 字节的 XPAN IDExtended Personal Area Network ID,扩展个域网标识符)
* 方便人类阅读的 Network Name(网络名称)
例如,一个 Thread 网络可能具有以下标识符:
| 标识符 | 值 |
| ------------ | -------------------- |
| PAN ID | `0xBEEF` |
| XPAN ID | `0xBEEF1111CAFE2222` |
| Network Name | `yourThreadCafe` |
<figure class="attempt-right">
<a href="../images/ot-primer-network-active-scan_2x.png"><img src="../images/ot-primer-network-active-scan.png" srcset="../images/ot-primer-network-active-scan.png 1x, ../images/ot-primer-network-active-scan_2x.png 2x" border="0" alt="OT Active Scan" /></a>
</figure>
在创建新的 Thread 网络或搜索现有的网络时,Thread 设备会主动扫描射频范围内的 802.15.4 网络:
1. 设备在特定 Channel 上广播 802.15.4 信标请求(Beacon Request)。
2. 范围内的所有 Router 或 REED 都会广播包含其 Thread 网络 PAN ID、XPAN ID 和 Network Name 的信标(Beacon),以作为回应。
3. 设备为每个 Channel 重复前两个步骤。
Thread 设备发现范围内的所有网络后,可以选择连接到现有的网络,也可以在未发现任何网络的情况下创建新的网络。
<h2 style="clear:right">Mesh Link Establishment</h2>
Thread 使用 MLEMesh Link Establishment)协议来配置链路并将网络的相关信息传播到 Thread 设备。
在链路配置中,MLE 用于:
* 发现相邻设备的链路
* 确认到相邻设备的链路质量
* 建立到相邻设备的链路
* 与对端协商链路参数(设备类型、帧计数器、超时)
MLE 将以下类型的信息传播给希望建立链路的设备:
* Leader dataLeader RLOC, Partition ID(分区标识符), Partition weight(分区权重))
* Network dataon-mesh prefixes, address autoconfiguration(地址自动配置), more-specific routes(具体路由))
* Route propagation(路由传播)
Thread 中路由传播的工作原理类似于 RIPRouting Information Protocol,路由信息协议),RIP 是一种距离矢量路由协议。
Note: 仅当 Thread 设备通过 Thread Commissioning 获得 Thread 网络凭据后,才会继续进行 MLE 过程。Commissioning 和安全性将在本教程的后续部分中深入介绍。目前,假定设备已通过 Commissioning。
## 创建新网络
如果设备选择创建新网络,它将选择最不繁忙的 Channel 和其他网络未使用的 PAN ID,然后成为 Router 并选举自己为 Leader。该设备将 MLE Advertisement 消息发送到其他 802.15.4 设备,以通知其链路状态,并响应其他执行主动扫描的 Thread 设备所发出的信标请求。
## 加入现有网络
如果设备选择加入到现有的网络,则会通过 Thread Commissioning 将其 Channel、PAN ID、XPAN ID 和 Network Name 配置为与目标网络相同,然后进行 MLE Attach 过程以作为子节点(End Device)进行加入。此过程用于“父子链路(Child-Parent link)”。
Key Point: 每个设备(无论是否具有充当 Router 的能力),最初都作为子设备(End Device)连接到 Thread 网络。
1. 子节点向目标网络中的所有相邻的 Router 和 REED 发送多播 [Parent Request](#1-Parent-Request)。
2. 所有相邻的 Router 和 REED(如果 Parent Request Scan Mask(父节点请求扫描掩码)包括了 REED)都应发送 [Parent Response](#2-Parent-Response) 以将其自身的信息告诉给子节点。
3. 子节点选择一个父节点,并向其发送 [Child ID Request](#3-Child-ID-Request)。
4. 父节点发送 [Child ID Response](#4-Child-ID-Response) 以确认链路建立。
### 1. Parent Request
Parent Request 是来自待连接设备的多播请求,用于发现目标网络中的相邻的 Router 和 REED。
<figure>
<a href="../images/ot-primer-network-mle-attach-01_2x.png"><img src="../images/ot-primer-network-mle-attach-01.png" srcset="../images/ot-primer-network-mle-attach-01.png 1x, ../images/ot-primer-network-mle-attach-01_2x.png 2x" width="350" border="0" alt="OT MLE Attach Parent Request" /></a>
</figure>
<table>
<tbody>
<tr>
<th colspan=2>Parent Request Message Contents</th>
</tr>
<tr>
<td width="25%" style="background-color:rgb(238, 241, 242)"><b>Mode</b></td>
<td>描述待连接设备</td>
</tr>
<tr>
<td width="25%" style="background-color:rgb(238, 241, 242)"><b>Challenge</b></td>
<td>测试 Parent Response 的时效性,以防止重放攻击</td>
</tr>
<tr>
<td width="25%" style="background-color:rgb(238, 241, 242)"><b>Scan Mask</b></td>
<td>将请求限制为仅 Router 或 Router 和 REED</td>
</tr>
</tbody>
</table>
### 2. Parent Response
Parent Response 是对 Parent Request 的单播响应,它向待连接设备提供有关 Router 或 REED 的信息。
<figure>
<a href="../images/ot-primer-network-mle-attach-02_2x.png"><img src="../images/ot-primer-network-mle-attach-02.png" srcset="../images/ot-primer-network-mle-attach-02.png 1x, ../images/ot-primer-network-mle-attach-02_2x.png 2x" width="350" border="0" alt="OT MLE Attach Parent Response" /></a>
</figure>
<table>
<tbody>
<tr>
<th colspan=2>Parent Response Message Contents</th>
</tr>
<tr>
<td width="25%" style="background-color:rgb(238, 241, 242)"><b>Version</b></td>
<td>Thread 协议版本</td>
</tr>
<tr>
<td width="25%" style="background-color:rgb(238, 241, 242)"><b>Response</b></td>
<td>Parent Request Challenge 的副本</td>
</tr>
<tr>
<td width="25%" style="background-color:rgb(238, 241, 242)"><b>Link Frame
Counter</b></td>
<td>Router/REED 上的 802.15.4 帧计数器</td>
</tr>
<tr>
<td width="25%" style="background-color:rgb(238, 241, 242)"><b>MLE Frame
Counter</b></td>
<td>Router/REED 上的 MLE 帧计数器</td>
</tr>
<tr>
<td width="25%" style="background-color:rgb(238, 241, 242)"><b>Source
Address</b></td>
<td>Router/REED 的 RLOC16</td>
</tr>
<tr>
<td width="25%" style="background-color:rgb(238, 241, 242)"><b>Link
Margin</b></td>
<td>Router/REED 的接收信号质量</td>
</tr>
<tr>
<td width="25%" style="background-color:rgb(238, 241, 242)"><b>Connectivity</b></td>
<td>描述 Router/REED 的连通性</td>
</tr>
<tr>
<td width="25%" style="background-color:rgb(238, 241, 242)"><b>Leader
Data</b></td>
<td>有关 Router/REED 的 Leader 的信息</td>
</tr>
<tr>
<td width="25%" style="background-color:rgb(238, 241, 242)"><b>Challenge</b></td>
<td>测试 Child ID Request 的时效性,以防止重放攻击</td>
</tr>
</tbody>
</table>
### 3. Child ID Request
Child ID Request 是来自待连接设备(子)的单播请求,该单播请求被发送到 Router(父)或 REED(父),目的是建立父子链路。如果将请求发送到 REED,则 REED 会在接受请求之前将自身升级为 Router。
<figure>
<a href="../images/ot-primer-network-mle-attach-03_2x.png"><img src="../images/ot-primer-network-mle-attach-03.png" srcset="../images/ot-primer-network-mle-attach-03.png 1x, ../images/ot-primer-network-mle-attach-03_2x.png 2x" width="350" border="0" alt="OT MLE Attach Child ID Request" /></a>
</figure>
<table>
<tbody>
<tr>
<th colspan=2>Child ID Request Message Contents</th>
</tr>
<tr>
<td width="25%" style="background-color:rgb(238, 241, 242)"><b>Version</b></td>
<td>Thread 协议版本</td>
</tr>
<tr>
<td width="25%" style="background-color:rgb(238, 241, 242)"><b>Response</b></td>
<td>Parent Response Challenge 的副本</td>
</tr>
<tr>
<td width="25%" style="background-color:rgb(238, 241, 242)"><b>Link Frame
Counter</b></td>
<td>Child 上的 802.15.4 帧计数器</td>
</tr>
<tr>
<td width="25%" style="background-color:rgb(238, 241, 242)"><b>MLE Frame
Counter</b></td><td>Child 上的 MLE 帧计数器</td>
</tr>
<tr>
<td width="25%" style="background-color:rgb(238, 241, 242)"><b>Mode</b></td>
<td>描述子节点</td>
</tr>
<tr>
<td width="25%" style="background-color:rgb(238, 241, 242)"><b>Timeout</b></td>
<td>父节点移除子节点之前的闲置时间</td>
</tr>
<tr>
<td width="25%" style="background-color:rgb(238, 241, 242)"><b>Address
Registration (MEDs and SEDs only)</b></td>
<td>注册 IPv6 地址</td>
</tr>
</tbody>
</table>
### 4. Child ID Response
Child ID Response 是父节点对 Child ID Request 的单播响应,该响应发送给对应的子节点以确认父子链路的建立。
<figure>
<a href="../images/ot-primer-network-mle-attach-04_2x.png"><img src="../images/ot-primer-network-mle-attach-04.png" srcset="../images/ot-primer-network-mle-attach-04.png 1x, ../images/ot-primer-network-mle-attach-04_2x.png 2x" width="350" border="0" alt="OT MLE Attach Child ID Response" /></a>
</figure>
<table>
<tbody>
<tr>
<th colspan=2>Child ID Response Message Contents</th>
</tr>
<tr>
<td width="25%" style="background-color:rgb(238, 241, 242)"><b>Source
Address</b></td>
<td>父节点的 RLOC16</td>
</tr>
<tr>
<td width="25%" style="background-color:rgb(238, 241, 242)"><b>Address16</b></td>
<td>子节点的 RLOC16</td>
</tr>
<tr>
<td width="25%" style="background-color:rgb(238, 241, 242)"><b>Leader
Data</b></td>
<td>父节点的 Leader 的相关信息(RLOC, Partition ID, Partition weight</td>
</tr>
<tr>
<td width="25%" style="background-color:rgb(238, 241, 242)"><b>Network
Data</b></td>
<td>Thread 网络的相关信息(on-mesh prefixes, address autoconfiguration, more-specific routes</td>
</tr>
<tr>
<td width="25%" style="background-color:rgb(238, 241, 242)"><b>Route
(REED only)</b></td>
<td>路由传播</td>
</tr>
<tr>
<td width="25%" style="background-color:rgb(238, 241, 242)"><b>Timeout</b></td>
<td>父节点移除子节点之前的闲置时间</td>
</tr>
<tr>
<td width="25%" style="background-color:rgb(238, 241, 242)"><b>Address
Registration (MEDs and SEDs only)</b></td>
<td>确认已注册地址</td>
</tr>
</tbody>
</table>
## 回顾
你应该学到了:
* Thread 设备通过主动扫描发现现有网络
* Thread 使用 MLE 来配置链路并分发有关网络设备的信息
* MLE Advertisement 消息通知其他 Thread 设备有关设备的网络和链路状态
* MLE Attach 过程建立了父子链路
@@ -1,125 +0,0 @@
# 节点角色和类型
## 转发角色
<figure class="attempt-right">
<a href="../images/ot-primer-roles_2x.png"><img src="../images/ot-primer-roles.png" srcset="../images/ot-primer-roles.png 1x, ../images/ot-primer-roles_2x.png 2x" border="0" alt="OT Node Roles" /></a>
</figure>
在 Thread 网络中,节点分成两种转发角色:Router 和 End Device。
### Router
Router 节点的行为如下:
* 为网络设备转发数据包
* 为尝试加入网络的设备提供安全的 commissioning 服务
* 始终打开它的收发器
### End Device
End Device 节点的行为如下:
* 主要与单个 Router 进行通信
* 不会为其他网络设备转发数据包
* 可以关闭它的收发器来降低功耗
Key Point: Router 和 End Device 之间的关系称为父子关系。End Device 正确地依附到一个 Router 上,其中 Router 始终作为父节点,End Device 则始终是子节点。
## 设备类型
此外,节点有许多种类型。
<figure class="attempt-right">
<a href="../images/ot-primer-taxonomy_2x.png"><img src="../images/ot-primer-taxonomy.png" srcset="../images/ot-primer-taxonomy.png 1x, ../images/ot-primer-taxonomy.png 2x" border="0" alt="OT Device Taxonomy" /></a>
</figure>
### Full Thread Device
一个 FTDFull Thread Device)总是打开它的射频收发器,它订阅所有 Router 的多播地址,并维护 IPv6 地址映射。FTD 有三种类型:
* Router
* REEDRouter Eligible End Device)— 可以升级为 Router
* FEDFull End Device)— 无法升级为 Router
FTD 可以作为 Router(父)或 End Device(子)。
### Minimal Thread Device
MTDMinimal Thread Device)不会订阅 all-routers 多播地址,并且它会将它的所有消息发送给它的父节点。MTD 有两种类型:
* MEDMinimal End Device)— 始终打开自身的收发器,无需从父节点中轮询消息
* SEDSleepy End Device)— 通常会关闭自身的收发器(睡眠),偶然会打开收发器(唤醒)以从父节点中轮询消息
MTD 只能作为 End Device(子)。
### 升级和降级
当待加入设备仅能与某个 REED 通信时, 则该 REED 可以升级成为 Router
<figure>
<a href="../images/ot-primer-router-upgrade_2x.png"><img src="../images/ot-primer-router-upgrade.png" srcset="../images/ot-primer-router-upgrade.png 1x, ../images/ot-primer-router-upgrade_2x.png 2x" border="0" width="400" alt="OT End Device to Router" /></a>
</figure>
相反,当一个 Router 没有子节点时,它可以降级成 End Device:
<figure>
<a href="../images/ot-primer-router-downgrade_2x.png"><img src="../images/ot-primer-router-downgrade.png" srcset="../images/ot-primer-router-downgrade.png 1x, ../images/ot-primer-router-downgrade_2x.png 2x" border="0" width="400" alt="OT Router to End Device" /></a>
</figure>
## 其他角色和类型
### Thread Leader
<figure class="attempt-right">
<a href="../images/ot-primer-leader_2x.png"><img src="../images/ot-primer-leader.png" srcset="../images/ot-primer-leader.png 1x, ../images/ot-primer-leader_2x.png 2x" border="0" alt="OT Leader and Border Router" /></a>
</figure>
Thread Leader 是一个 Router,它负责管理 Thread 网络中的 Router。Thread Leader 是动态自选的(提高容错率),它负责汇总和分发全网络的配置信息。
Note: 每个 Thread 网络[分区](#分区)中总是只有一个 Leader。
### Border Router
Border Router 是一种可以在 Thread 网络和其他网络(如 Wi-Fi)之间转发信息的设备。它还为外部连接配置 Thread 网络。
任何设备都可以充当 Border Router。
Note: 一个 Thread 网络中可以有多个 Border Router。
## 分区
<figure class="attempt-right">
<a href="../images/ot-primer-partitions_2x.png"><img src="../images/ot-primer-partitions.png" srcset="../images/ot-primer-partitions.png 1x, ../images/ot-primer-partitions_2x.png 2x" border="0" alt="OT Partitions" /></a>
</figure>
一个 Thread 网络可能由多个分区组成。当一组 Thread 设备不能再与另一组 Thread 设备通信时,会发生这种情况。每个分区在逻辑上均作为独立的 Thread 网络来运行,它们具有各自的 Leader、Router ID 分配和网络数据,同时分区前相同的安全凭证都将被保留下来。
当分区之间可以连通时,它们会自动合并。
Key Point: 安全凭证(security credentials)定义了 Thread 网络。物理无线电的连通性定义了该 Thread 网络中的分区。
请注意,在本入门教程中一般将 Thread 网络假定成单个分区。在必要时,将使用“分区”一词来阐明关键概念和示例。本教程稍后将详细介绍分区。
## 设备限制
单个 Thread 网络所支持的设备类型数量是有限制的。
| 角色 | 限制 |
| ---------- | ------------------ |
| Leader | 1 |
| Router | 32 |
| End Device | 511(每个 Router |
Thread 会尝试将 Router 的数量保持在 16 ~ 23 之间。如果一个 REED 作为 End Device 加入,并且网络中的 Router 数量低于 16,那么它将自动升级为 Router。
## 回顾
你应该学到了:
* Thread 设备可以是 Router(父)或 End Device(子)
* Thread 设备可以是 FTD(维护 IPv6 地址映射),也可以是 MTD(将所有消息发送给其父节点)
* REED 可以升级为 RouterRouter 也可以降级为 REED
* 每个 Thread 网络分区都有一个 Leader 来管理 Router
* Border Router 用于连接 Thread 和其他网络
* 一个 Thread 网络可能由多个分区组成
@@ -1,145 +0,0 @@
# Router 选择
## Connected Dominating Set
<figure class="attempt-right">
<a href="../images/ot-primer-cds_2x.png"><img src="../images/ot-primer-cds.png" srcset="../images/ot-primer-cds.png 1x, ../images/ot-primer-cds_2x.png 2x" width="350" border="0" alt="OT Connected Dominating Set" /></a><figcaption style="text-align: center"><i>Example of a Connected Dominating Set</i></figcaption>
</figure>
Router 必须形成一个 CDSConnected Dominating Set,连接支配集),这意味着:
1. 在任何两个 Router 之间都有一个 Router-only 的路径。
2. Thread 网络中的任何一个 Router 都可以通过完全位于 Router 集中而到达其他任何 Router。
3. Thread 网络中的每个 End Device 都直接连接到 Router。
Thread 使用分布式算法维护 CDS,从而确保最低程度的冗余。每个设备最初都作为 End Device(子)连接到网络。随着 Thread 网络状态的更改,算法会增添或移除 Router 以维护 CDS。
Thread 在下列情况下将会增添 Router:
* 如果网络低于 Router 阈值(16) —— 为了增加覆盖范围
* 增加路径多样性
* 保持最低程度的冗余
* 扩展连接并支持更多子节点
Thread 在下列情况下将会移除 Router:
* 将路由状态减少到最多 32 个 Router 以下
* 必要时允许在网络的其他部分使用新 Router
## 升级成 Router
子设备连接到 Thread 网络后,可以选择成为 Router。在开始 MLE Link Request 过程之前,子设备会向 Leader 发送 Address Solicit 消息,以请求一个 Router ID。如果 Leader 同意该请求,则它将响应一个 Router ID 给子设备,并且子设备会将自身升级为 Router。
然后,MLE Link Request 过程用于与相邻的 Router 建立双向 Router-Router 链路。
1. 新 Router 将发送一个多播 [Link Request](#1-Link-Request) 到相邻的 Router。
2. Router 使用 [Link Accept and Request](#2-Link-Accept-and-Request) 消息进行响应。
3. 新 Router 使用单播的 [Link Accept](#3-Link-Accept) 响应每个 Router,以建立 Router-Router 链路。
### 1. Link Request
Link Request 是从 Router 到 Thread 网络中所有其他 Router 的请求。首次成为 Router 时,设备会发送一个多播 Link Request 到 `ff02::2`。稍后,在通过 MLE Advertisement 发现其他 Router 后,设备将发送单播的 Link Request。
<figure>
<a href="../images/ot-primer-network-mle-link-request-01_2x.png"><img src="../images/ot-primer-network-mle-link-request-01.png" srcset="../images/ot-primer-network-mle-link-request-01.png 1x, ../images/ot-primer-network-mle-link-request-01_2x.png 2x" width="350" border="0" alt="OT MLE Link Request" /></a>
</figure>
<table>
<tbody>
<tr>
<th colspan=2>Link Request Message Contents</th>
</tr>
<tr>
<td width="25%" style="background-color:rgb(238, 241, 242)"><b>Version</b></td>
<td>Thread 协议版本</td>
</tr>
<tr>
<td width="25%" style="background-color:rgb(238, 241, 242)"><b>Challenge</b></td>
<td>测试 Link Response 的及时性,以防止重放攻击</td>
</tr>
<tr>
<td width="25%" style="background-color:rgb(238, 241, 242)"><b>Source
Address</b></td>
<td>发送者的 RLOC16</td>
</tr>
<tr>
<td width="25%" style="background-color:rgb(238, 241, 242)"><b>Leader
Data</b></td>
<td>Router 的 Leader 的相关信息(RLOC, Partition ID, Partition weight</td>
</tr>
</tbody>
</table>
### 2. Link Accept and Request
Link Accept and Request 是 Link Accept 和 Link Request 消息的组合。Thread 在 MLE Link Request 过程中使用此优化将消息的数量从四减少到三。
<figure>
<a href="../images/ot-primer-network-mle-link-request-02_2x.png"><img src="../images/ot-primer-network-mle-link-request-02.png" srcset="../images/ot-primer-network-mle-link-request-02.png 1x, ../images/ot-primer-network-mle-link-request-02_2x.png 2x" width="350" border="0" alt="OT MLE Link Accept and Request" /></a>
</figure>
### 3. Link Accept
Link Accept 是对来自相邻 Router 的 Link Request 的单播响应,该响应提供有关自身的信息并接受到相邻 Router 的链路。
<figure>
<a href="../images/ot-primer-network-mle-link-request-03_2x.png"><img src="../images/ot-primer-network-mle-link-request-03.png" srcset="../images/ot-primer-network-mle-link-request-03.png 1x, ../images/ot-primer-network-mle-link-request-03_2x.png 2x" width="350" border="0" alt="OT MLE Link Accept" /></a>
</figure>
<table>
<tbody>
<tr>
<th colspan=2>Link Accept Message Contents</th>
</tr>
<tr>
<td width="25%" style="background-color:rgb(238, 241, 242)"><b>Version</b></td>
<td>Thread 协议版本</td>
</tr>
<tr>
<td width="25%" style="background-color:rgb(238, 241, 242)"><b>Response</b></td>
<td>测试 Link Response 的及时性,以防止重放攻击</td>
</tr>
<tr>
<td width="25%" style="background-color:rgb(238, 241, 242)"><b>Link Frame
Counter</b></td>
<td>发送者上的 802.15.4 帧计数器</td>
</tr>
<tr>
<td width="25%" style="background-color:rgb(238, 241, 242)"><b>MLE Frame
Counter</b></td>
<td>发送者上的 MLE 帧计数器</td>
</tr>
<tr>
<td width="25%" style="background-color:rgb(238, 241, 242)"><b>Source
Address</b></td>
<td>发送者的 RLOC16</td>
</tr>
<tr>
<td width="25%" style="background-color:rgb(238, 241, 242)"><b>Leader
Data</b></td>
<td>Router 的 Leader 的相关信息(RLOC, Partition ID, Partition weight</td>
</tr>
</tbody>
</table>
## 降级成 REED
当 Router 降级成 REED 时,其 Router-Router 链路断开,并且设备开始 MLE Attach 过程以建立父子链路。
有关 MLE Attach 过程的更多信息,请参阅 [加入现有网络](/guides/thread-primer/network-discovery#加入现有网络)。
## 单向接收链路
在某些情况下,建立单向接收链路是有必要的。
在 Router 重置后,相邻 Router 可能仍具有与重置的 Router 的有效接收链路。在这种情况下,重置的 Router 发送 Link Request 消息以重新建立 Router-Router 链路。
End Device 也可能希望与相邻的 Router(非父节点)建立接收链路,以提高多播可靠性。当我们进入多播路由时,我们将学习更多与此相关的内容。
## 回顾
你应该学到了:
* Thread 网络中的 Router 必须形成 CDS
* Thread 设备将升级成 Router 或降级成 REED 以维护 CDS
* MLE Link Request 过程用于建立 Router-Router 链路
-29
View File
@@ -1,29 +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.
#
configure_file(${PROJECT_SOURCE_DIR}/etc/cmake/openthread-config-generic.h.in ${PROJECT_BINARY_DIR}/etc/cmake/openthread-config-generic.h)
+11 -1
View File
@@ -28,7 +28,7 @@
# Get a list of the available platforms and output as a list to the 'arg_platforms' argument
function(ot_get_platforms arg_platforms)
list(APPEND result "NO" "posix")
list(APPEND result "NO" "posix" "external")
set(platforms_dir "${PROJECT_SOURCE_DIR}/examples/platforms")
file(GLOB platforms RELATIVE "${platforms_dir}" "${platforms_dir}/*")
foreach(platform IN LISTS platforms)
@@ -41,3 +41,13 @@ function(ot_get_platforms arg_platforms)
list(SORT result)
set(${arg_platforms} "${result}" PARENT_SCOPE)
endfunction()
function(ot_git_version git_version)
execute_process(
COMMAND git describe --dirty --always
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
OUTPUT_VARIABLE GIT_REV OUTPUT_STRIP_TRAILING_WHITESPACE
ERROR_QUIET
)
set(${git_version} "${GIT_REV}" PARENT_SCOPE)
endfunction()
-27
View File
@@ -1,27 +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.
*/
+150 -19
View File
@@ -30,6 +30,15 @@ option(OT_APP_CLI "enable CLI app" ON)
option(OT_APP_NCP "enable NCP app" ON)
option(OT_APP_RCP "enable RCP app" ON)
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")
endif()
option(OT_ASSERT "enable assert function OT_ASSERT()" ON)
if(OT_ASSERT)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_ASSERT_ENABLE=1")
@@ -40,6 +49,22 @@ 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")
else()
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_BACKBONE_ROUTER_DUA_NDPROXYING_ENABLE=0")
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")
else()
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_BACKBONE_ROUTER_MULTICAST_ROUTING_ENABLE=0")
endif()
option(OT_BORDER_AGENT "enable border agent support")
@@ -52,6 +77,16 @@ if(OT_BORDER_ROUTER)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_BORDER_ROUTER_ENABLE=1")
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")
endif()
if(NOT OT_EXTERNAL_MBEDTLS)
set(OT_MBEDTLS mbedtls)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_ENABLE_BUILTIN_MBEDTLS=1")
@@ -92,6 +127,11 @@ 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")
@@ -107,6 +147,23 @@ 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")
@@ -127,16 +184,38 @@ 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")
@@ -147,6 +226,11 @@ 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")
@@ -172,6 +256,16 @@ 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")
@@ -197,6 +291,21 @@ 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")
@@ -207,6 +316,10 @@ 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")
@@ -232,38 +345,47 @@ 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)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_LOG_LEVEL=OT_LOG_LEVEL_DEBG")
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_LOG_API=1")
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_LOG_ARP=1")
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_LOG_BBR=1")
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_LOG_CLI=1")
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_LOG_COAP=1")
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_LOG_DUA=1")
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_LOG_ICMP=1")
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_LOG_IP6=1")
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_LOG_MAC=1")
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_LOG_MEM=1")
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_LOG_MESHCOP=1")
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_LOG_MLE=1")
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_LOG_MLR=1")
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_LOG_NETDATA=1")
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_LOG_NETDIAG=1")
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_LOG_PKT_DUMP=1")
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_LOG_PLATFORM=1")
if(NOT OT_LOG_LEVEL)
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")
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_LOG_PREPEND_REGION=1")
endif()
option(OT_OTNS "enable OTNS support")
@@ -271,6 +393,15 @@ 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")
+42
View File
@@ -0,0 +1,42 @@
#
# Copyright (c) 2021, 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.
#
# Purpose of this CMake script is to support printing of properties fetched
# using a generator expression.
#
# Depending on the generator in use, Ninja, Makefile, other, it is not possible
# to always ensure proper new line on all platforms when calling echo.
# The print.cmake handles this issue by taking a CMake list and prints each item
# in the list on a new line.
#
# This script can be invoked as: `cmake -DLIST="itemA;itemB;..." -P print.cmake`
foreach(item ${LIST})
execute_process(COMMAND ${CMAKE_COMMAND} -E echo ${item})
endforeach()
-24
View File
@@ -1,24 +0,0 @@
# Ubuntu image with tools required to build OpenThread
FROM ubuntu:18.04
ENV DEBIAN_FRONTEND noninteractive
# Install dependencies:
RUN apt-get update -qq
# Install packages needed for build and runtime:
RUN apt-get --no-install-recommends install -y git sudo software-properties-common \
ca-certificates \
&& update-ca-certificates
# Install OpenThread
RUN mkdir -p ~/src && \
cd ~/src && \
git clone --recursive https://github.com/openthread/openthread.git && \
cd openthread && \
./script/bootstrap && \
./bootstrap && \
make -f examples/Makefile-simulation
# Install OpenThread Daemon and ot-ctl
RUN cd ~/src/openthread && make -f src/posix/Makefile-posix DAEMON=1
+12 -2
View File
@@ -16,10 +16,14 @@ RUN set -x \
python3-setuptools \
software-properties-common \
sudo \
netbase \
inetutils-ping \
ca-certificates \
&& update-ca-certificates \
&& python3 -m pip install -U cmake \
&& python3 -m pip install wheel
# setup openthread
# set up openthread simulation cli example apps
WORKDIR /
COPY . openthread
RUN set -x \
@@ -27,5 +31,11 @@ RUN set -x \
&& ./script/bootstrap \
&& mkdir build \
&& cd build \
&& cmake -GNinja -DOT_PLATFORM=simulation .. \
&& cmake -GNinja -DOT_COMMISSIONER=ON -DOT_JOINER=ON -DOT_PLATFORM=simulation .. \
&& ninja
# set up ot-daemon
WORKDIR /
RUN set -x \
&& cd openthread \
&& ./script/cmake-build posix -DOT_DAEMON=ON
+32 -5
View File
@@ -26,9 +26,6 @@
#
_openthread_config_file = ""
if (current_os == "fuchsia") {
_openthread_config_file = "<openthread-config-android.h>"
}
declare_args() {
# OpenThread config header.
@@ -78,6 +75,9 @@ if (openthread_enable_core_config_args) {
# Enable assertions.
openthread_config_assert_enable = true
# Enable anycast locator functionality
openthread_config_anycast_locator_enable = false
# Enable backbone router functionality
openthread_config_backbone_router_enable = false
@@ -87,6 +87,9 @@ if (openthread_enable_core_config_args) {
# Enable border router support
openthread_config_border_router_enable = false
# Enable border routing support
openthread_config_border_routing_enable = false
# Enable channel manager support
openthread_config_channel_manager_enable = false
@@ -123,6 +126,9 @@ if (openthread_enable_core_config_args) {
# Enable DNS client support
openthread_config_dns_client_enable = false
# Enable DNS-SD server support
openthread_config_dnssd_server_enable = false
# Enable ECDSA support
openthread_config_ecdsa_enable = false
@@ -147,6 +153,12 @@ if (openthread_enable_core_config_args) {
# Enable legacy network support
openthread_config_legacy_enable = false
# Enable link metrics initiator
openthread_config_link_metrics_initiator_enable = false
# Enable link metrics subject
openthread_config_link_metrics_subject_enable = false
# Enable link raw service
openthread_config_link_raw_enable = false
@@ -156,6 +168,9 @@ if (openthread_enable_core_config_args) {
# Enable mac filter support
openthread_config_mac_filter_enable = false
# Enable use built-in heap for message buffers
openthread_config_message_use_heap = false
# Enable MLE long routes extension (experimental, breaks Thread conformance]
openthread_config_mle_long_routes_enable = false
@@ -186,6 +201,15 @@ if (openthread_enable_core_config_args) {
# Enable SNTP Client support
openthread_config_sntp_client_enable = false
# Enable SRP Client support
openthread_config_srp_client_enable = false
# Enable SRP Server support
openthread_config_srp_server_enable = false
# Enable ping sender support
openthread_config_ping_sender = false
# Enable the time synchronization service feature
openthread_config_time_sync_enable = false
@@ -201,12 +225,15 @@ if (openthread_enable_core_config_args) {
# Enable NCP SPI support
openthread_config_ncp_spi_enable = false
# Enable NCP UART support
openthread_config_ncp_uart_enable = false
# Enable NCP HDLC support
openthread_config_ncp_hdlc_enable = false
# Enable builtin mbedtls management
openthread_config_enable_builtin_mbedtls_management =
openthread_external_mbedtls == ""
# Enable radio coexistence
openthread_config_coexistence_enable = false
}
}
-298
View File
@@ -1,298 +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.
#
.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 \
--with-examples=cc1352 \
MBEDTLS_CPPFLAGS="$(CC1352_MBEDTLS_CPPFLAGS)" \
$(NULL)
ifneq ($(DISABLE_BUILTIN_MBEDTLS), 1)
configure_OPTIONS += MBEDTLS_CPPFLAGS="$(CC1352_MBEDTLS_CPPFLAGS)"
endif
DEFAULT_LOGGING ?= 1
CC1352_MBEDTLS_CPPFLAGS = \
-DMBEDTLS_CONFIG_FILE='\"mbedtls-config.h\"' \
-DMBEDTLS_USER_CONFIG_FILE='\"cc1352-mbedtls-config.h\"' \
-I$(PWD)/examples/platforms/cc1352/crypto \
-I$(PWD)/third_party/ti/devices/cc13x2_cc26x2 \
-I$(PWD)/third_party/mbedtls \
-I$(PWD)/third_party/mbedtls/repo/include \
$(NULL)
CC1352_CONFIG_FILE_CPPFLAGS = -DOPENTHREAD_PROJECT_CORE_CONFIG_FILE='\"openthread-core-cc1352-config.h\"'
CC1352_CONFIG_FILE_CPPFLAGS += -DOPENTHREAD_CORE_CONFIG_PLATFORM_CHECK_FILE='\"openthread-core-cc1352-config-check.h\"'
CC1352_CONFIG_FILE_CPPFLAGS += -I$(PWD)/examples/platforms/cc1352/
COMMONCFLAGS := \
-fdata-sections \
-ffunction-sections \
-Os \
-g \
$(CC1352_CONFIG_FILE_CPPFLAGS) \
$(NULL)
include $(dir $(abspath $(lastword $(MAKEFILE_LIST))))/common-switches.mk
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 \
-Wl,-Map=map.map \
$(NULL)
ECHO := @echo
MAKE := make
MKDIR_P := mkdir -p
LN_S := ln -s
RM_F := rm -f
INSTALL := /usr/bin/install
INSTALLFLAGS := -p
TopSourceDir := $(dir $(shell readlink $(firstword $(MAKEFILE_LIST))))..
AbsTopSourceDir := $(dir $(realpath $(firstword $(MAKEFILE_LIST))))..
BuildPath = build
TopBuildDir = $(BuildPath)
AbsTopBuildDir = $(PWD)/$(TopBuildDir)
ResultPath = output
TopResultDir = $(ResultPath)
AbsTopResultDir = $(PWD)/$(TopResultDir)
TargetTuple = cc1352
ARCHS = cortex-m4f
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-m4f
#
cortex-m4f_target_ABI = cortex-m4f
cortex-m4f_target_CPPFLAGS = -mcpu=cortex-m4 -march=armv7e-m -mfloat-abi=hard -mfpu=fpv4-sp-d16 -mthumb
cortex-m4f_target_CFLAGS = -mcpu=cortex-m4 -march=armv7e-m -mfloat-abi=hard -mfpu=fpv4-sp-d16 -mthumb
cortex-m4f_target_CXXFLAGS = -mcpu=cortex-m4 -march=armv7e-m -mfloat-abi=hard -mfpu=fpv4-sp-d16 -mthumb
cortex-m4f_target_LDFLAGS = -mcpu=cortex-m4 -march=armv7e-m -mfloat-abi=hard -mfpu=fpv4-sp-d16 -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) ""
-269
View File
@@ -1,269 +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.
#
.NOTPARALLEL:
AR = arm-none-eabi-ar
AS = 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-mtd \
--enable-ncp \
--enable-radio-only \
--enable-linker-map \
--with-examples=cc2650 \
MBEDTLS_CPPFLAGS="$(CC2650_MBEDTLS_CPPFLAGS)" \
$(NULL)
CC2650_MBEDTLS_CPPFLAGS = -DMBEDTLS_CONFIG_FILE='\"mbedtls-config.h\"'
CC2650_MBEDTLS_CPPFLAGS += -DMBEDTLS_USER_CONFIG_FILE='\"cc2650-mbedtls-config.h\"'
CC2650_MBEDTLS_CPPFLAGS += -I$(PWD)/examples/platforms/cc2650/crypto
CC2650_MBEDTLS_CPPFLAGS += -I$(PWD)/third_party/ti/devices/cc26x0
CC2650_MBEDTLS_CPPFLAGS += -I$(PWD)/third_party/mbedtls
CC2650_MBEDTLS_CPPFLAGS += -I$(PWD)/third_party/mbedtls/repo/include
CC2650_CONFIG_FILE_CPPFLAGS = -DOPENTHREAD_PROJECT_CORE_CONFIG_FILE='\"openthread-core-cc2650-config.h\"'
CC2650_CONFIG_FILE_CPPFLAGS += -DOPENTHREAD_CORE_CONFIG_PLATFORM_CHECK_FILE='\"openthread-core-cc2650-config-check.h\"'
CC2650_CONFIG_FILE_CPPFLAGS += -I$(PWD)/examples/platforms/cc2650/
COMMONCFLAGS := \
-fdata-sections \
-ffunction-sections \
-Os \
-g \
$(CC2650_CONFIG_FILE_CPPFLAGS)\
$(NULL)
include $(dir $(abspath $(lastword $(MAKEFILE_LIST))))/common-switches.mk
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
TopSourceDir := $(dir $(shell readlink $(firstword $(MAKEFILE_LIST))))..
AbsTopSourceDir := $(dir $(realpath $(firstword $(MAKEFILE_LIST))))..
BuildPath = build
TopBuildDir = $(BuildPath)
AbsTopBuildDir = $(PWD)/$(TopBuildDir)
ResultPath = output
TopResultDir = $(ResultPath)
AbsTopResultDir = $(PWD)/$(TopResultDir)
TargetTuple = cc2650
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) ""
-298
View File
@@ -1,298 +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.
#
.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 \
--with-examples=cc2652 \
MBEDTLS_CPPFLAGS="$(CC2652_MBEDTLS_CPPFLAGS)" \
$(NULL)
ifneq ($(DISABLE_BUILTIN_MBEDTLS), 1)
configure_OPTIONS += MBEDTLS_CPPFLAGS="$(CC2652_MBEDTLS_CPPFLAGS)"
endif
DEFAULT_LOGGING ?= 1
CC2652_MBEDTLS_CPPFLAGS = \
-DMBEDTLS_CONFIG_FILE='\"mbedtls-config.h\"' \
-DMBEDTLS_USER_CONFIG_FILE='\"cc2652-mbedtls-config.h\"' \
-I$(PWD)/examples/platforms/cc2652/crypto \
-I$(PWD)/third_party/ti/devices/cc13x2_cc26x2 \
-I$(PWD)/third_party/mbedtls \
-I$(PWD)/third_party/mbedtls/repo/include \
$(NULL)
CC2652_CONFIG_FILE_CPPFLAGS = -DOPENTHREAD_PROJECT_CORE_CONFIG_FILE='\"openthread-core-cc2652-config.h\"'
CC2652_CONFIG_FILE_CPPFLAGS += -DOPENTHREAD_CORE_CONFIG_PLATFORM_CHECK_FILE='\"openthread-core-cc2652-config-check.h\"'
CC2652_CONFIG_FILE_CPPFLAGS += -I$(PWD)/examples/platforms/cc2652/
COMMONCFLAGS := \
-fdata-sections \
-ffunction-sections \
-Os \
-g \
$(CC2652_CONFIG_FILE_CPPFLAGS) \
$(NULL)
include $(dir $(abspath $(lastword $(MAKEFILE_LIST))))/common-switches.mk
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 \
-Wl,-Map=map.map \
$(NULL)
ECHO := @echo
MAKE := make
MKDIR_P := mkdir -p
LN_S := ln -s
RM_F := rm -f
INSTALL := /usr/bin/install
INSTALLFLAGS := -p
TopSourceDir := $(dir $(shell readlink $(firstword $(MAKEFILE_LIST))))..
AbsTopSourceDir := $(dir $(realpath $(firstword $(MAKEFILE_LIST))))..
BuildPath = build
TopBuildDir = $(BuildPath)
AbsTopBuildDir = $(PWD)/$(TopBuildDir)
ResultPath = output
TopResultDir = $(ResultPath)
AbsTopResultDir = $(PWD)/$(TopResultDir)
TargetTuple = cc2652
ARCHS = cortex-m4f
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-m4f
#
cortex-m4f_target_ABI = cortex-m4f
cortex-m4f_target_CPPFLAGS = -mcpu=cortex-m4 -march=armv7e-m -mfloat-abi=hard -mfpu=fpv4-sp-d16 -mthumb
cortex-m4f_target_CFLAGS = -mcpu=cortex-m4 -march=armv7e-m -mfloat-abi=hard -mfpu=fpv4-sp-d16 -mthumb
cortex-m4f_target_CXXFLAGS = -mcpu=cortex-m4 -march=armv7e-m -mfloat-abi=hard -mfpu=fpv4-sp-d16 -mthumb
cortex-m4f_target_LDFLAGS = -mcpu=cortex-m4 -march=armv7e-m -mfloat-abi=hard -mfpu=fpv4-sp-d16 -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) ""
-309
View File
@@ -1,309 +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.
#
.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-ncp \
--enable-radio-only \
--enable-linker-map \
--with-examples=efr32mg1 \
MBEDTLS_CPPFLAGS="$(EFR32_MBEDTLS_CPPFLAGS)" \
$(NULL)
ifneq ($(DISABLE_BUILTIN_MBEDTLS), 1)
configure_OPTIONS += MBEDTLS_CPPFLAGS="$(EFR32_MBEDTLS_CPPFLAGS)"
endif
TopSourceDir := $(dir $(shell readlink $(firstword $(MAKEFILE_LIST))))..
AbsTopSourceDir := $(dir $(realpath $(firstword $(MAKEFILE_LIST))))..
#
# Differentiate between boards
#
ifeq ($(BOARD),BRD4151A)
MCU = EFR32MG1P232F256GM48
else
$(error Please provide a value for BOARD variable e.g BOARD= BRD4151A (currently supported BRD4151A))
endif
EFR32_MBEDTLS_CPPFLAGS = -DMBEDTLS_CONFIG_FILE='\"mbedtls-config.h\"'
EFR32_MBEDTLS_CPPFLAGS += -DMBEDTLS_USER_CONFIG_FILE='\"efr32-mbedtls-config.h\"'
EFR32_MBEDTLS_CPPFLAGS += -D$(MCU)
EFR32_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/examples/platforms/efr32mg1/crypto
EFR32_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/third_party/silabs/gecko_sdk_suite/v2.7/util/third_party/mbedtls/configs
EFR32_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/third_party/silabs/gecko_sdk_suite/v2.7/platform/CMSIS/Include
EFR32_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/third_party/silabs/gecko_sdk_suite/v2.7/util/third_party/mbedtls/sl_crypto/include
EFR32_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/third_party/silabs/gecko_sdk_suite/v2.7/platform/Device/SiliconLabs/EFR32MG1P/Include
EFR32_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/third_party/silabs/gecko_sdk_suite/v2.7/platform/emlib/inc
EFR32_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/third_party/silabs/gecko_sdk_suite/v2.7/platform/radio/rail_lib/chip/efr32/efr32xg1x
EFR32_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/third_party/mbedtls
EFR32_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/third_party/mbedtls/repo/include
EFR32_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/third_party/mbedtls/repo/include/mbedtls
CONFIG_FILE_PATH = $(AbsTopSourceDir)/examples/platforms/efr32mg1/
HAL_CONF_DIR = $(CONFIG_FILE_PATH)/$(shell echo $(BOARD) | tr A-Z a-z)
EFR32MG1_CONFIG_FILE_CPPFLAGS = -DOPENTHREAD_PROJECT_CORE_CONFIG_FILE='\"openthread-core-efr32-config.h\"'
EFR32MG1_CONFIG_FILE_CPPFLAGS += -DOPENTHREAD_CORE_CONFIG_PLATFORM_CHECK_FILE='\"openthread-core-efr32-config-check.h\"'
EFR32MG1_CONFIG_FILE_CPPFLAGS += -I$(CONFIG_FILE_PATH)
COMMONCFLAGS := \
-fdata-sections \
-ffunction-sections \
-Os \
-g \
-I$(HAL_CONF_DIR) \
-D__START=main \
-D$(MCU) \
$(EFR32MG1_CONFIG_FILE_CPPFLAGS) \
$(NULL)
include $(dir $(abspath $(lastword $(MAKEFILE_LIST))))/common-switches.mk
#
# Platform-Specific switches
#
DMP ?= 0
RADIODEBUG ?= 0
ifeq ($(DMP),1)
COMMONCFLAGS += -DRADIO_CONFIG_DMP_SUPPORT=1
endif
ifeq ($(RADIODEBUG),1)
COMMONCFLAGS += -DRADIO_CONFIG_DEBUG_COUNTERS_SUPPORT=1
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 = efr32mg1
ARCHS = cortex-m4
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-m4
#
cortex-m4_target_ABI = cortex-m4
cortex-m4_target_CPPFLAGS = -mcpu=cortex-m4 -mfloat-abi=soft -mthumb
cortex-m4_target_CFLAGS = -mcpu=cortex-m4 -mfloat-abi=soft -mthumb
cortex-m4_target_CXXFLAGS = -mcpu=cortex-m4 -mfloat-abi=soft -mthumb
cortex-m4_target_LDFLAGS = -mcpu=cortex-m4 -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) ""
-328
View File
@@ -1,328 +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.
#
.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=efr32mg12 \
MBEDTLS_CPPFLAGS="$(EFR32_MBEDTLS_CPPFLAGS)" \
$(NULL)
ifneq ($(DISABLE_BUILTIN_MBEDTLS), 1)
configure_OPTIONS += MBEDTLS_CPPFLAGS="$(EFR32_MBEDTLS_CPPFLAGS)"
endif
TopSourceDir := $(dir $(shell readlink $(firstword $(MAKEFILE_LIST))))..
AbsTopSourceDir := $(dir $(realpath $(firstword $(MAKEFILE_LIST))))..
#
# Differentiate between boards
# - BRD4304A / SLWSTK6000B / MGM12P Module / 2.4GHz@19dBm
# - BRD4161A / SLWSTK6000B / Wireless Starter Kit / 2.4GHz@19dBm
# - BRD4166A / SLTB004A / Thunderboard Sense 2 / 2.4GHz@10dBm
# - BRD4170A / SLWSTK6000B / Multiband Wireless Starter Kit / 2.4GHz@19dBm, 915MHz@19dBm, 868MHz@19dBm
#
ifeq ($(BOARD),BRD4304A)
MCU = EFR32MG12P432F1024GM48
else
ifeq ($(BOARD),BRD4161A)
MCU = EFR32MG12P432F1024GL125
else
ifeq ($(BOARD),BRD4166A)
MCU = EFR32MG12P332F1024GL125
else
ifeq ($(BOARD),BRD4170A)
MCU = EFR32MG12P433F1024GM68
else
$(error Please provide a value for BOARD variable e.g BOARD=BRD4161A (currently supported BRD4304A, BRD4161A, BRD4166A or BRD4170A))
endif
endif
endif
endif
EFR32_MBEDTLS_CPPFLAGS = -DMBEDTLS_CONFIG_FILE='\"mbedtls-config.h\"'
EFR32_MBEDTLS_CPPFLAGS += -DMBEDTLS_USER_CONFIG_FILE='\"efr32-mbedtls-config.h\"'
EFR32_MBEDTLS_CPPFLAGS += -D$(MCU)
EFR32_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/examples/platforms/efr32mg12/crypto
EFR32_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/third_party/silabs/gecko_sdk_suite/v2.7/util/third_party/mbedtls/configs
EFR32_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/third_party/silabs/gecko_sdk_suite/v2.7/platform/CMSIS/Include
EFR32_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/third_party/silabs/gecko_sdk_suite/v2.7/util/third_party/mbedtls/sl_crypto/include
EFR32_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/third_party/silabs/gecko_sdk_suite/v2.7/platform/Device/SiliconLabs/EFR32MG12P/Include
EFR32_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/third_party/silabs/gecko_sdk_suite/v2.7/platform/emlib/inc
EFR32_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/third_party/silabs/gecko_sdk_suite/v2.7/platform/radio/rail_lib/chip/efr32/efr32xg1x
EFR32_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/third_party/mbedtls
EFR32_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/third_party/mbedtls/repo/include
EFR32_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/third_party/mbedtls/repo/include/mbedtls
CONFIG_FILE_PATH = $(AbsTopSourceDir)/examples/platforms/efr32mg12/
HAL_CONF_DIR = $(CONFIG_FILE_PATH)/$(shell echo $(BOARD) | tr A-Z a-z)
EFR32MG12_CONFIG_FILE_CPPFLAGS = -DOPENTHREAD_PROJECT_CORE_CONFIG_FILE='\"openthread-core-efr32-config.h\"'
EFR32MG12_CONFIG_FILE_CPPFLAGS += -DOPENTHREAD_CORE_CONFIG_PLATFORM_CHECK_FILE='\"openthread-core-efr32-config-check.h\"'
EFR32MG12_CONFIG_FILE_CPPFLAGS += -I$(CONFIG_FILE_PATH)
COMMONCFLAGS := \
-fdata-sections \
-ffunction-sections \
-Os \
-g \
-I$(HAL_CONF_DIR) \
-D__START=main \
-D$(MCU) \
$(EFR32MG12_CONFIG_FILE_CPPFLAGS) \
$(NULL)
include $(dir $(abspath $(lastword $(MAKEFILE_LIST))))/common-switches.mk
#
# Platform-Specific switches
#
DMP ?= 0
RADIODEBUG ?= 0
ifeq ($(DMP),1)
COMMONCFLAGS += -DRADIO_CONFIG_DMP_SUPPORT=1
endif
ifeq ($(RADIODEBUG),1)
COMMONCFLAGS += -DRADIO_CONFIG_DEBUG_COUNTERS_SUPPORT=1
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 = efr32mg12
ARCHS = cortex-m4
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-m4
#
cortex-m4_target_ABI = cortex-m4
cortex-m4_target_CPPFLAGS = -mcpu=cortex-m4 -mfloat-abi=soft -mthumb
cortex-m4_target_CFLAGS = -mcpu=cortex-m4 -mfloat-abi=soft -mthumb
cortex-m4_target_CXXFLAGS = -mcpu=cortex-m4 -mfloat-abi=soft -mthumb
cortex-m4_target_LDFLAGS = -mcpu=cortex-m4 -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) ""
-313
View File
@@ -1,313 +0,0 @@
#
# Copyright (c) 2020, 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=efr32mg13 \
MBEDTLS_CPPFLAGS="$(EFR32_MBEDTLS_CPPFLAGS)" \
$(NULL)
ifneq ($(DISABLE_BUILTIN_MBEDTLS), 1)
configure_OPTIONS += MBEDTLS_CPPFLAGS="$(EFR32_MBEDTLS_CPPFLAGS)"
endif
TopSourceDir := $(dir $(shell readlink $(firstword $(MAKEFILE_LIST))))..
AbsTopSourceDir := $(dir $(realpath $(firstword $(MAKEFILE_LIST))))..
#
# Differentiate between boards
# - BRD4168A / SLWSTK6000B / MGM13P Module / 2.4GHz@19dBm
#
ifeq ($(BOARD),BRD4168A)
MCU = EFR32MG13P732F512GM48
else
$(error Please provide a value for BOARD variable e.g BOARD=BRD4168A (currently supported BRD4168A))
endif
EFR32_MBEDTLS_CPPFLAGS = -DMBEDTLS_CONFIG_FILE='\"mbedtls-config.h\"'
EFR32_MBEDTLS_CPPFLAGS += -DMBEDTLS_USER_CONFIG_FILE='\"efr32-mbedtls-config.h\"'
EFR32_MBEDTLS_CPPFLAGS += -D$(MCU)
EFR32_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/examples/platforms/efr32mg13/crypto
EFR32_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/third_party/silabs/gecko_sdk_suite/v2.7/util/third_party/mbedtls/configs
EFR32_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/third_party/silabs/gecko_sdk_suite/v2.7/platform/CMSIS/Include
EFR32_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/third_party/silabs/gecko_sdk_suite/v2.7/util/third_party/mbedtls/sl_crypto/include
EFR32_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/third_party/silabs/gecko_sdk_suite/v2.7/platform/Device/SiliconLabs/EFR32MG13P/Include
EFR32_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/third_party/silabs/gecko_sdk_suite/v2.7/platform/emlib/inc
EFR32_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/third_party/silabs/gecko_sdk_suite/v2.7/platform/radio/rail_lib/chip/efr32/efr32xg1x
EFR32_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/third_party/mbedtls
EFR32_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/third_party/mbedtls/repo/include
EFR32_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/third_party/mbedtls/repo/include/mbedtls
CONFIG_FILE_PATH = $(AbsTopSourceDir)/examples/platforms/efr32mg13/
HAL_CONF_DIR = $(CONFIG_FILE_PATH)/$(shell echo $(BOARD) | tr A-Z a-z)
EFR32MG13_CONFIG_FILE_CPPFLAGS = -DOPENTHREAD_PROJECT_CORE_CONFIG_FILE='\"openthread-core-efr32-config.h\"'
EFR32MG13_CONFIG_FILE_CPPFLAGS += -DOPENTHREAD_CORE_CONFIG_PLATFORM_CHECK_FILE='\"openthread-core-efr32-config-check.h\"'
EFR32MG13_CONFIG_FILE_CPPFLAGS += -I$(CONFIG_FILE_PATH)
COMMONCFLAGS := \
-fdata-sections \
-ffunction-sections \
-Os \
-g \
-I$(HAL_CONF_DIR) \
-D__START=main \
-D$(MCU) \
$(EFR32MG13_CONFIG_FILE_CPPFLAGS) \
$(NULL)
include $(dir $(abspath $(lastword $(MAKEFILE_LIST))))/common-switches.mk
#
# Platform-Specific switches
#
DMP ?= 0
RADIODEBUG ?= 0
ifeq ($(DMP),1)
COMMONCFLAGS += -DRADIO_CONFIG_DMP_SUPPORT=1
endif
ifeq ($(RADIODEBUG),1)
COMMONCFLAGS += -DRADIO_CONFIG_DEBUG_COUNTERS_SUPPORT=1
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 = efr32mg13
ARCHS = cortex-m4
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-m4
#
cortex-m4_target_ABI = cortex-m4
cortex-m4_target_CPPFLAGS = -mcpu=cortex-m4 -mfloat-abi=soft -mthumb
cortex-m4_target_CFLAGS = -mcpu=cortex-m4 -mfloat-abi=soft -mthumb
cortex-m4_target_CXXFLAGS = -mcpu=cortex-m4 -mfloat-abi=soft -mthumb
cortex-m4_target_LDFLAGS = -mcpu=cortex-m4 -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) ""
-316
View File
@@ -1,316 +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.
#
.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=efr32mg21 \
MBEDTLS_CPPFLAGS="$(EFR32_MBEDTLS_CPPFLAGS)" \
$(NULL)
ifneq ($(DISABLE_BUILTIN_MBEDTLS), 1)
configure_OPTIONS += MBEDTLS_CPPFLAGS="$(EFR32_MBEDTLS_CPPFLAGS)"
endif
TopSourceDir := $(dir $(shell readlink $(firstword $(MAKEFILE_LIST))))..
AbsTopSourceDir := $(dir $(realpath $(firstword $(MAKEFILE_LIST))))..
#
# Differentiate between boards
# - BRD4180A / SLWSTK6000B / Wireless Starter Kit / 2.4GHz@20dBm
#
ifeq ($(BOARD),BRD4180A)
MCU = EFR32MG21A020F1024IM32
else
$(error Please provide a value for BOARD variable e.g BOARD=BRD4180A (currently supported BRD4180A))
endif
EFR32_MBEDTLS_CPPFLAGS = -DMBEDTLS_CONFIG_FILE='\"mbedtls-config.h\"'
EFR32_MBEDTLS_CPPFLAGS += -DMBEDTLS_USER_CONFIG_FILE='\"efr32-mbedtls-config.h\"'
EFR32_MBEDTLS_CPPFLAGS += -D$(MCU)
EFR32_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/examples/platforms/efr32mg21/crypto
EFR32_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/third_party/silabs/gecko_sdk_suite/v2.7/util/third_party/mbedtls/configs
EFR32_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/third_party/silabs/gecko_sdk_suite/v2.7/platform/CMSIS/Include
EFR32_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/third_party/silabs/gecko_sdk_suite/v2.7/util/third_party/mbedtls/sl_crypto/include
EFR32_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/third_party/silabs/gecko_sdk_suite/v2.7/platform/Device/SiliconLabs/EFR32MG21/Include
EFR32_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/third_party/silabs/gecko_sdk_suite/v2.7/platform/emlib/inc
EFR32_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/third_party/silabs/gecko_sdk_suite/v2.7/platform/radio/rail_lib/chip/efr32/efr32xg2x
EFR32_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/third_party/silabs/gecko_sdk_suite/v2.7/hardware/kit/common/drivers
EFR32_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/third_party/mbedtls
EFR32_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/third_party/mbedtls/repo/include
EFR32_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/third_party/mbedtls/repo/include/mbedtls
EFR32_MBEDTLS_CPPFLAGS += -Wno-unused-function
EFR32_MBEDTLS_CPPFLAGS += -Wno-unused-parameter
CONFIG_FILE_PATH = $(AbsTopSourceDir)/examples/platforms/efr32mg21/
HAL_CONF_DIR = $(CONFIG_FILE_PATH)/$(shell echo $(BOARD) | tr A-Z a-z)
EFR32MG21_CONFIG_FILE_CPPFLAGS = -DOPENTHREAD_PROJECT_CORE_CONFIG_FILE='\"openthread-core-efr32-config.h\"'
EFR32MG21_CONFIG_FILE_CPPFLAGS += -DOPENTHREAD_CORE_CONFIG_PLATFORM_CHECK_FILE='\"openthread-core-efr32-config-check.h\"'
EFR32MG21_CONFIG_FILE_CPPFLAGS += -I$(CONFIG_FILE_PATH)
COMMONCFLAGS := \
-fdata-sections \
-ffunction-sections \
-Os \
-g \
-I$(HAL_CONF_DIR) \
-D__START=main \
-D$(MCU) \
$(EFR32MG21_CONFIG_FILE_CPPFLAGS) \
$(NULL)
include $(dir $(abspath $(lastword $(MAKEFILE_LIST))))/common-switches.mk
#
# Platform-Specific switches
#
DMP ?= 0
RADIODEBUG ?= 0
ifeq ($(DMP),1)
COMMONCFLAGS += -DRADIO_CONFIG_DMP_SUPPORT=1
endif
ifeq ($(RADIODEBUG),1)
COMMONCFLAGS += -DRADIO_CONFIG_DEBUG_COUNTERS_SUPPORT=1
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 = efr32mg21
ARCHS = cortex-m33
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-m33
#
cortex-m33_target_ABI = cortex-m33
cortex-m33_target_CPPFLAGS = -mcpu=cortex-m33 -mthumb -fmessage-length=0 -ffunction-sections -fdata-sections -mfpu=fpv5-sp-d16 -mfloat-abi=hard
cortex-m33_target_CFLAGS = -mcpu=cortex-m33 -mthumb -fmessage-length=0 -ffunction-sections -fdata-sections -mfpu=fpv5-sp-d16 -mfloat-abi=hard
cortex-m33_target_CXXFLAGS = -mcpu=cortex-m33 -mthumb -fmessage-length=0 -ffunction-sections -fdata-sections -mfpu=fpv5-sp-d16 -mfloat-abi=hard
cortex-m33_target_LDFLAGS = -mcpu=cortex-m33 -mthumb -fmessage-length=0 -ffunction-sections -fdata-sections -mfpu=fpv5-sp-d16 -mfloat-abi=hard
# 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) ""
-273
View File
@@ -1,273 +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.
#
.NOTPARALLEL:
TARGET ?= arm-bcm2708hardfp-linux-gnueabi
PPREFIX = gp712
CROSS_COMPILE ?= $(TARGET)-
AR = $(CROSS_COMPILE)ar
AS = $(CROSS_COMPILE)as
CPP = $(CROSS_COMPILE)cpp
CC = $(CROSS_COMPILE)gcc
CXX = $(CROSS_COMPILE)g++
LD = $(CROSS_COMPILE)ld
STRIP = $(CROSS_COMPILE)strip
NM = $(CROSS_COMPILE)nm
RANLIB = $(CROSS_COMPILE)ranlib
OBJCOPY = $(CROSS_COMPILE)objcopy
BuildJobs ?= 9
configure_OPTIONS = \
--enable-cli \
--enable-ftd \
--enable-mtd \
--with-examples=$(PPREFIX) \
$(NULL)
DEFAULT_LOGGING ?= 1
ifeq ($(CLI_LOGGING),1)
configure_OPTIONS += --enable-cli-logging
endif
GP712_CONFIG_FILE_CPPFLAGS = -DOPENTHREAD_PROJECT_CORE_CONFIG_FILE='\"openthread-core-gp712-config.h\"'
GP712_CONFIG_FILE_CPPFLAGS += -DOPENTHREAD_CORE_CONFIG_PLATFORM_CHECK_FILE='\"openthread-core-gp712-config-check.h\"'
GP712_CONFIG_FILE_CPPFLAGS += -I$(PWD)/examples/platforms/gp712/
COMMONCFLAGS := \
-fdata-sections \
-ffunction-sections \
-Os \
-g \
$(GP712_CONFIG_FILE_CPPFLAGS) \
-W \
-Wall \
$(NULL)
include $(dir $(abspath $(lastword $(MAKEFILE_LIST))))/common-switches.mk
CPPFLAGS += \
$(COMMONCFLAGS) \
$(target_CPPFLAGS) \
$(NULL)
CFLAGS += \
$(COMMONCFLAGS) \
-D_BSD_SOURCE=1 \
-D_DEFAULT_SOURCE=1 \
$(target_CFLAGS) \
$(NULL)
CXXFLAGS += \
$(COMMONCFLAGS) \
$(target_CXXFLAGS) \
-fno-exceptions \
-fno-rtti \
$(NULL)
LDFLAGS += \
$(COMMONCFLAGS) \
$(target_LDFLAGS) \
-Wl,--gc-sections \
-lrt \
-lpthread \
$(NULL)
ECHO := @echo
MAKE := make
MKDIR_P := mkdir -p
LN_S := ln -s
RM_F := rm -f
INSTALL := /usr/bin/install
INSTALLFLAGS := -p
TopSourceDir := $(dir $(shell readlink $(firstword $(MAKEFILE_LIST))))..
AbsTopSourceDir := $(dir $(realpath $(firstword $(MAKEFILE_LIST))))..
BuildPath = build
TopBuildDir = $(BuildPath)
AbsTopBuildDir = $(PWD)/$(TopBuildDir)
ResultPath = output
TopResultDir = $(ResultPath)
AbsTopResultDir = $(PWD)/$(TopResultDir)
TargetTuple = $(PPREFIX)
ifndef BuildJobs
BuildJobs := $(shell getconf _NPROCESSORS_ONLN)
endif
JOBSFLAG := -j$(BuildJobs)
PREFIX = $(PPREFIX)
#
# configure-arch <arch>
#
# Configure OpenThread for the specified architecture.
#
# arch - The architecture to configure.
#
define configure-arch
$(ECHO) " CONFIG $(1)..."
(cd $(BuildPath)/$(1) && $(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)" \
--prefix=/$(PREFIX) \
--host=$(TARGET) \
--target=$(TARGET) \
--exec-prefix=/$(PREFIX) \
--program-prefix=$(PREFIX)- \
$(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 $(1)"
$(MAKE) $(JOBSFLAG) -C $(BuildPath)/$(1) -w \
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 $(1)"
$(MAKE) $(JOBSFLAG) -C $(BuildPath)/$(1) -w \
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)/$(1)
DIRECTORIES += $(BuildPath)/$(1)
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)/$(1)/config.status
$(BuildPath)/$(1)/config.status: | $(BuildPath)/$(1)
$$(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
#
# rpi_bcm2708
#
rpi_bcm2708_target_ABI = rpi_bcm2708
rpi_bcm2708_target_CPPFLAGS = -march=armv6j -fomit-frame-pointer -fno-strict-aliasing -fno-pic -ffreestanding -mfloat-abi=hard -mfpu=vfp -pipe
rpi_bcm2708_target_CFLAGS = -march=armv6j -fomit-frame-pointer -fno-strict-aliasing -fno-pic -ffreestanding -mfloat-abi=hard -mfpu=vfp -pipe
rpi_bcm2708_target_CXXFLAGS = -march=armv6j -fomit-frame-pointer -fno-strict-aliasing -fno-pic -ffreestanding -mfloat-abi=hard -mfpu=vfp -pipe
rpi_bcm2708_target_LDFLAGS = -march=armv6j -fomit-frame-pointer -fno-strict-aliasing -fno-pic -ffreestanding -mfloat-abi=hard -mfpu=vfp -pipe
# Instantiate an architecture-specific build template for each target
# architecture.
$(foreach arch,$(TargetTuple),$(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) " $(TargetTuple)"
$(ECHO) ""
$(ECHO) "To build only a particular architecture, specify: "
$(ECHO) ""
$(ECHO) " make -f $(firstword $(MAKEFILE_LIST)) <architecture>"
$(ECHO) ""
-295
View File
@@ -1,295 +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.
#
.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 \
--with-ncp-bus=uart \
--enable-radio-only \
--enable-linker-map \
--with-examples=jn5189 \
$(NULL)
ifneq ($(DISABLE_BUILTIN_MBEDTLS), 1)
configure_OPTIONS += MBEDTLS_CPPFLAGS="$(JN5189_MBEDTLS_CPPFLAGS)"
endif
JN5189_MBEDTLS_CPPFLAGS = -DMBEDTLS_CONFIG_FILE='\"mbedtls-config.h\"'
JN5189_MBEDTLS_CPPFLAGS += -DMBEDTLS_USER_CONFIG_FILE='\"jn5189-mbedtls-config.h\"'
JN5189_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/include/
JN5189_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/third_party/nxp/
JN5189_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/third_party/nxp/JN5189DK6/
JN5189_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/third_party/nxp/JN5189DK6/devices/JN5189
JN5189_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/third_party/nxp/JN5189DK6/middleware/mbedtls/port/ksdk/
JN5189_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/third_party/nxp/JN5189DK6/devices/JN5189/drivers/
JN5189_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/third_party/nxp/JN5189DK6/devices/JN5189/utilities/
JN5189_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/third_party/nxp/JN5189DK6/devices/JN5189/utilities/debug-console/
JN5189_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/third_party/nxp/JN5189DK6/devices/JN5189/utilities/str/
JN5189_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/third_party/nxp/JN5189DK6/drivers/components/serial_manager/
JN5189_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/third_party/nxp/JN5189DK6/drivers/components/uart/
JN5189_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/third_party/nxp/JN5189DK6/CMSIS/Include/
JN5189_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/third_party/mbedtls/
JN5189_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/third_party/mbedtls/repo/include/
JN5189_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/third_party/mbedtls/repo/include/mbedtls/
TopSourceDir := $(dir $(shell readlink $(firstword $(MAKEFILE_LIST))))..
AbsTopSourceDir := $(dir $(realpath $(firstword $(MAKEFILE_LIST))))..
CONFIG_FILE = OPENTHREAD_PROJECT_CORE_CONFIG_FILE='\"openthread-core-jn5189-config.h\"'
CONFIG_FILE_PATH = $(AbsTopSourceDir)/examples/platforms/k32w/jn5189/
SIGN_IMAGE_PATH = $(AbsTopSourceDir)/third_party/nxp/JN5189DK6/tools/imagetool/
COMMONCFLAGS := \
-fdata-sections \
-ffunction-sections \
-Os \
-g \
-DCPU_JN518X \
-DCPU_JN518X_REV=2 \
-DJENNIC_CHIP_FAMILY_JN518x \
-DJENNIC_CHIP_FAMILY_NAME=_JN518x \
-DSDK_DEBUGCONSOLE=0 \
-D$(CONFIG_FILE) \
-DUSE_RTOS=0 \
-I$(CONFIG_FILE_PATH) \
$(NULL)
include $(dir $(abspath $(lastword $(MAKEFILE_LIST))))/common-switches.mk
CPPFLAGS += \
$(COMMONCFLAGS) \
$(target_CPPFLAGS) \
$(NULL)
CFLAGS += \
$(COMMONCFLAGS) \
$(target_CFLAGS) \
$(NULL)
CXXFLAGS += \
$(COMMONCFLAGS) \
$(target_CXXFLAGS) \
-fno-exceptions \
-fno-rtti \
$(NULL)
LDFLAGS += \
$(COMMONCFLAGS) \
$(target_LDFLAGS) \
-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 = jn5189
ARCHS = cortex-m4
TopTargetLibDir = $(TopResultDir)/$(TargetTuple)/lib
TopTargetBinDir = $(TopResultDir)/$(TargetTuple)/bin
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-m4
#
cortex-m4_target_ABI = cortex-m4
cortex-m4_target_CPPFLAGS = -mcpu=cortex-m4 -mfloat-abi=soft -mthumb
cortex-m4_target_CFLAGS = -mcpu=cortex-m4 -mfloat-abi=soft -mthumb
cortex-m4_target_CXXFLAGS = -mcpu=cortex-m4 -mfloat-abi=soft -mthumb
cortex-m4_target_LDFLAGS = -mcpu=cortex-m4 -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 post-build-step
$(DIRECTORIES):
$(ECHO) " MKDIR $@"
@$(MKDIR_P) "$@"
post-build-step:
$(SIGN_IMAGE_PATH)/sign_images.sh $(TopTargetBinDir)
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) ""
-298
View File
@@ -1,298 +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.
#
.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-diag \
--enable-ftd \
--enable-mtd \
--enable-ncp \
--with-ncp-bus=uart \
--enable-radio-only \
--enable-linker-map \
--with-examples=k32w061 \
$(NULL)
ifneq ($(DISABLE_BUILTIN_MBEDTLS), 1)
configure_OPTIONS += MBEDTLS_CPPFLAGS="$(K32W061_MBEDTLS_CPPFLAGS)"
endif
K32W061_MBEDTLS_CPPFLAGS = -DMBEDTLS_CONFIG_FILE='\"mbedtls-config.h\"'
K32W061_MBEDTLS_CPPFLAGS += -DMBEDTLS_USER_CONFIG_FILE='\"k32w061-mbedtls-config.h\"'
K32W061_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/include/
K32W061_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/third_party/nxp/
K32W061_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/third_party/nxp/K32W061DK6/
K32W061_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/third_party/nxp/K32W061DK6/devices/K32W061
K32W061_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/third_party/nxp/K32W061DK6/middleware/mbedtls/port/ksdk/
K32W061_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/third_party/nxp/K32W061DK6/devices/K32W061/drivers/
K32W061_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/third_party/nxp/K32W061DK6/devices/K32W061/utilities/
K32W061_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/third_party/nxp/K32W061DK6/devices/K32W061/utilities/debug-console/
K32W061_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/third_party/nxp/K32W061DK6/devices/K32W061/utilities/str/
K32W061_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/third_party/nxp/K32W061DK6/drivers/components/serial_manager/
K32W061_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/third_party/nxp/K32W061DK6/drivers/components/uart/
K32W061_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/third_party/nxp/K32W061DK6/CMSIS/Include/
K32W061_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/third_party/mbedtls/
K32W061_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/third_party/mbedtls/repo/include/
K32W061_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/third_party/mbedtls/repo/include/mbedtls/
TopSourceDir := $(dir $(shell readlink $(firstword $(MAKEFILE_LIST))))..
AbsTopSourceDir := $(dir $(realpath $(firstword $(MAKEFILE_LIST))))..
CONFIG_FILE = OPENTHREAD_PROJECT_CORE_CONFIG_FILE='\"openthread-core-k32w061-config.h\"'
CONFIG_FILE_PATH = $(AbsTopSourceDir)/examples/platforms/k32w/k32w061/
SIGN_IMAGE_PATH = $(AbsTopSourceDir)/third_party/nxp/K32W061DK6/tools/imagetool/
COMMONCFLAGS := \
-fdata-sections \
-ffunction-sections \
-Os \
-g \
-DCPU_K32W061HN \
-DCPU_JN518X \
-DCPU_JN518X_REV=2 \
-DJENNIC_CHIP_FAMILY_JN518x \
-DJENNIC_CHIP_FAMILY_NAME=_JN518x \
-DSDK_DEBUGCONSOLE=0 \
-D$(CONFIG_FILE) \
-DUSE_RTOS=0 \
-I$(CONFIG_FILE_PATH) \
$(NULL)
include $(dir $(abspath $(lastword $(MAKEFILE_LIST))))/common-switches.mk
CPPFLAGS += \
$(COMMONCFLAGS) \
$(target_CPPFLAGS) \
$(NULL)
CFLAGS += \
$(COMMONCFLAGS) \
$(target_CFLAGS) \
$(NULL)
CXXFLAGS += \
$(COMMONCFLAGS) \
$(target_CXXFLAGS) \
-fno-exceptions \
-fno-rtti \
$(NULL)
LDFLAGS += \
$(COMMONCFLAGS) \
$(target_LDFLAGS) \
-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 = k32w061
ARCHS = cortex-m4
TopTargetLibDir = $(TopResultDir)/$(TargetTuple)/lib
TopTargetBinDir = $(TopResultDir)/$(TargetTuple)/bin
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-m4
#
cortex-m4_target_ABI = cortex-m4
cortex-m4_target_CPPFLAGS = -mcpu=cortex-m4 -mfloat-abi=soft -mthumb
cortex-m4_target_CFLAGS = -mcpu=cortex-m4 -mfloat-abi=soft -mthumb
cortex-m4_target_CXXFLAGS = -mcpu=cortex-m4 -mfloat-abi=soft -mthumb
cortex-m4_target_LDFLAGS = -mcpu=cortex-m4 -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 post-build-step
$(DIRECTORIES):
$(ECHO) " MKDIR $@"
@$(MKDIR_P) "$@"
post-build-step:
$(SIGN_IMAGE_PATH)/sign_images.sh $(TopTargetBinDir)
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) ""
-261
View File
@@ -1,261 +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.
#
.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=kw41z \
$(NULL)
TopSourceDir := $(dir $(shell readlink $(firstword $(MAKEFILE_LIST))))..
AbsTopSourceDir := $(dir $(realpath $(firstword $(MAKEFILE_LIST))))..
KW41Z_CONFIG_FILE_CPPFLAGS = -DOPENTHREAD_PROJECT_CORE_CONFIG_FILE='\"openthread-core-kw41z-config.h\"'
KW41Z_CONFIG_FILE_CPPFLAGS += -DOPENTHREAD_CORE_CONFIG_PLATFORM_CHECK_FILE='\"openthread-core-kw41z-config-check.h\"'
KW41Z_CONFIG_FILE_CPPFLAGS += -I$(AbsTopSourceDir)/examples/platforms/kw41z/
COMMONCFLAGS := \
-fdata-sections \
-ffunction-sections \
-Os \
-g \
$(KW41Z_CONFIG_FILE_CPPFLAGS) \
$(NULL)
include $(dir $(abspath $(lastword $(MAKEFILE_LIST))))/common-switches.mk
CPPFLAGS += \
$(COMMONCFLAGS) \
$(target_CPPFLAGS) \
$(NULL)
CFLAGS += \
$(COMMONCFLAGS) \
$(target_CFLAGS) \
$(NULL)
CXXFLAGS += \
$(COMMONCFLAGS) \
$(target_CXXFLAGS) \
-fno-exceptions \
-fno-rtti \
$(NULL)
LDFLAGS += \
$(COMMONCFLAGS) \
$(target_LDFLAGS) \
-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 = kw41z
ARCHS = cortex-m0plus
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-m0plus
#
cortex-m0plus_target_ABI = cortex-m0plus
cortex-m0plus_target_CPPFLAGS = -mcpu=cortex-m0plus -mfloat-abi=soft -mthumb
cortex-m0plus_target_CFLAGS = -mcpu=cortex-m0plus -mfloat-abi=soft -mthumb
cortex-m0plus_target_CXXFLAGS = -mcpu=cortex-m0plus -mfloat-abi=soft -mthumb
cortex-m0plus_target_LDFLAGS = -mcpu=cortex-m0plus -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) ""
-310
View File
@@ -1,310 +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.
#
.NOTPARALLEL:
AR = arm-none-eabi-ar
CCAS = $(CCPREFIX) arm-none-eabi-gcc
CPP = arm-none-eabi-cpp
CC = $(CCPREFIX) arm-none-eabi-gcc
CXX = $(CCPREFIX) 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
GCCVersion = $(shell expr `$(CC) -dumpversion | cut -f1 -d.`)
configure_OPTIONS = \
--enable-mtd \
--enable-linker-map \
--with-examples=nrf52811 \
MBEDTLS_CPPFLAGS="$(NRF52811_MBEDTLS_CPPFLAGS)" \
$(NULL)
ifdef SRC_PATH
configure_OPTIONS += --srcdir="$(SRC_PATH)"
endif
TopSourceDir := $(dir $(shell readlink $(firstword $(MAKEFILE_LIST))))..
AbsTopSourceDir := $(dir $(realpath $(firstword $(MAKEFILE_LIST))))..
NRF52811_MBEDTLS_CPPFLAGS = -DMBEDTLS_CONFIG_FILE='\"mbedtls-config.h\"'
NRF52811_MBEDTLS_CPPFLAGS += -DMBEDTLS_USER_CONFIG_FILE='\"nrf52811-mbedtls-config.h\"'
NRF52811_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/third_party/mbedtls
NRF52811_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/third_party/mbedtls/repo/include
NRF52811_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/third_party/mbedtls/repo/include/mbedtls
NRF52811_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/third_party/NordicSemiconductor/libraries/nrf_security/mbedtls_plat_config
NRF52811_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/third_party/NordicSemiconductor/nrfx/mdk
NRF52811_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/third_party/NordicSemiconductor/cmsis
NRF52811_MBEDTLS_CPPFLAGS += -DNRF52811_XXAA
NRF52811_CONFIG_FILE_CPPFLAGS = -DOPENTHREAD_PROJECT_CORE_CONFIG_FILE='\"openthread-core-nrf52811-config.h\"'
NRF52811_CONFIG_FILE_CPPFLAGS += -DOPENTHREAD_CORE_CONFIG_PLATFORM_CHECK_FILE='\"openthread-core-nrf52811-config-check.h\"'
NRF52811_CONFIG_FILE_CPPFLAGS += -I$(AbsTopSourceDir)/examples/platforms/nrf528xx/nrf52811
COMMONCFLAGS := \
-fdata-sections \
-ffunction-sections \
-Os \
-g \
$(NRF52811_CONFIG_FILE_CPPFLAGS) \
$(NULL)
include $(dir $(abspath $(lastword $(MAKEFILE_LIST))))/common-switches.mk
ifeq ($(DCDC),1)
COMMONCFLAGS += -DDCDC_ENABLE
endif
#
# Select transport which CLI, NCP and RCP examples will use to communicate.
# To disable all transports use the DISABLE_TRANSPORTS switch. This will disable
# the build of all above examples.
# If NCP_SPI switch is set, only NCP and RCP examples will be built.
# Otherwise, the default serial transport is UART.
#
ifndef DISABLE_TRANSPORTS
configure_OPTIONS += --enable-ncp
configure_OPTIONS += --enable-radio-only
ifeq ($(NCP_SPI),1)
COMMONCFLAGS += -DSPIS_AS_SERIAL_TRANSPORT=1
COMMONCFLAGS += -DOPENTHREAD_CONFIG_NCP_SPI_ENABLE=1
else
COMMONCFLAGS += -DUART_AS_SERIAL_TRANSPORT=1
COMMONCFLAGS += -DOPENTHREAD_CONFIG_NCP_UART_ENABLE=1
configure_OPTIONS += --enable-cli
endif # NCP_SPI == 1
endif # DISABLE_TRANSPORTS
NRF52811_MBEDTLS_CPPFLAGS += -DDISABLE_CC310=1
ifeq ($(shell expr $(GCCVersion) \>= 7), 1)
COMMONCFLAGS += -Wno-expansion-to-defined
endif
CPPFLAGS += \
$(COMMONCFLAGS) \
$(target_CPPFLAGS) \
$(NULL)
CFLAGS += \
$(COMMONCFLAGS) \
$(target_CFLAGS) \
$(NULL)
CXXFLAGS += \
$(COMMONCFLAGS) \
$(target_CXXFLAGS) \
-fno-exceptions \
-fno-rtti \
$(NULL)
LDFLAGS += \
$(COMMONCFLAGS) \
$(target_LDFLAGS) \
-specs=nano.specs \
-specs=nosys.specs \
-Wl,--gc-sections \
$(NULL)
CCASFLAGS += \
$(COMMONCCASFLAGS) \
$(target_CCASFLAGS) \
-x \
assembler-with-cpp \
$(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 = nrf52811
ARCHS = cortex-m4
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)" CCAS="$(CCAS)" OBJC="$(OBJC)" OBJCXX="$(OBJCXX)" AR="$(AR)" RANLIB="$(RANLIB)" NM="$(NM)" STRIP="$(STRIP)" CPPFLAGS="$(CPPFLAGS)" CFLAGS="$(CFLAGS)" CXXFLAGS="$(CXXFLAGS)" CCASFLAGS="$(CCASFLAGS)" 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): target_CCASFLAGS=$($(1)_target_CCASFLAGS)
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-m4
#
cortex-m4_target_ABI = cortex-m4
cortex-m4_target_CPPFLAGS = -mcpu=cortex-m4 -mfloat-abi=soft -mthumb -mabi=aapcs
cortex-m4_target_CFLAGS = -mcpu=cortex-m4 -mfloat-abi=soft -mthumb -mabi=aapcs
cortex-m4_target_CXXFLAGS = -mcpu=cortex-m4 -mfloat-abi=soft -mthumb -mabi=aapcs
cortex-m4_target_LDFLAGS = -mcpu=cortex-m4 -mfloat-abi=soft -mthumb -mabi=aapcs
# 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) ""
-342
View File
@@ -1,342 +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.
#
.NOTPARALLEL:
AR = arm-none-eabi-ar
CCAS = $(CCPREFIX) arm-none-eabi-gcc
CPP = arm-none-eabi-cpp
CC = $(CCPREFIX) arm-none-eabi-gcc
CXX = $(CCPREFIX) 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
GCCVersion = $(shell expr `$(CC) -dumpversion | cut -f1 -d.`)
configure_OPTIONS = \
--enable-ftd \
--enable-mtd \
--enable-linker-map \
--with-examples=nrf52833 \
MBEDTLS_CPPFLAGS="$(NRF52833_MBEDTLS_CPPFLAGS)" \
$(NULL)
ifdef SRC_PATH
configure_OPTIONS += --srcdir="$(SRC_PATH)"
endif
TopSourceDir := $(dir $(shell readlink $(firstword $(MAKEFILE_LIST))))..
AbsTopSourceDir := $(dir $(realpath $(firstword $(MAKEFILE_LIST))))..
NRF52833_MBEDTLS_CPPFLAGS = -DMBEDTLS_CONFIG_FILE='\"mbedtls-config.h\"'
NRF52833_MBEDTLS_CPPFLAGS += -DMBEDTLS_USER_CONFIG_FILE='\"nrf52833-mbedtls-config.h\"'
NRF52833_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/third_party/mbedtls
NRF52833_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/third_party/mbedtls/repo/include
NRF52833_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/third_party/mbedtls/repo/include/mbedtls
NRF52833_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/third_party/NordicSemiconductor/libraries/nrf_security/mbedtls_plat_config
NRF52833_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/third_party/NordicSemiconductor/nrfx/mdk
NRF52833_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/third_party/NordicSemiconductor/cmsis
NRF52833_MBEDTLS_CPPFLAGS += -DNRF52833_XXAA
NRF52833_CONFIG_FILE_CPPFLAGS = -DOPENTHREAD_PROJECT_CORE_CONFIG_FILE='\"openthread-core-nrf52833-config.h\"'
NRF52833_CONFIG_FILE_CPPFLAGS += -DOPENTHREAD_CORE_CONFIG_PLATFORM_CHECK_FILE='\"openthread-core-nrf52833-config-check.h\"'
NRF52833_CONFIG_FILE_CPPFLAGS += -I$(AbsTopSourceDir)/examples/platforms/nrf528xx/nrf52833
COMMONCFLAGS := \
-fdata-sections \
-ffunction-sections \
-Os \
-g \
$(NRF52833_CONFIG_FILE_CPPFLAGS) \
$(NULL)
include $(dir $(abspath $(lastword $(MAKEFILE_LIST))))/common-switches.mk
ifeq ($(BOOTLOADER),1)
$(info Warning: BOOTLOADER=1 switch is deprecated. Defaulting to BOOTLOADER=USB.)
override BOOTLOADER = USB
endif
ifeq ($(BOOTLOADER),USB)
configure_OPTIONS += --with-custom-linker-file=$(AbsTopSourceDir)/examples/platforms/nrf528xx/nrf52833/nrf52833_bootloader_usb.ld
COMMONCFLAGS += -DAPP_USBD_NRF_DFU_TRIGGER_ENABLED=1
endif
ifeq ($(BOOTLOADER),UART)
configure_OPTIONS += --with-custom-linker-file=$(AbsTopSourceDir)/examples/platforms/nrf528xx/nrf52833/nrf52833_bootloader_uart.ld
endif
ifeq ($(BOOTLOADER),BLE)
configure_OPTIONS += --with-custom-linker-file=$(AbsTopSourceDir)/examples/platforms/nrf528xx/nrf52833/nrf52833_bootloader_ble.ld
endif
#
# Select transport which CLI, NCP and RCP examples will use to communicate.
# To disable all transports use the DISABLE_TRANSPORTS switch. This will disable
# the build of all above examples.
# If NCP_SPI switch is set, only NCP and RCP examples will be built.
# Otherwise the user can select USB transport. If no transports were selected,
# the default serial transport is UART.
#
ifndef DISABLE_TRANSPORTS
configure_OPTIONS += --enable-ncp
configure_OPTIONS += --enable-radio-only
ifeq ($(NCP_SPI),1)
COMMONCFLAGS += -DSPIS_AS_SERIAL_TRANSPORT=1
COMMONCFLAGS += -DOPENTHREAD_CONFIG_NCP_SPI_ENABLE=1
else
COMMONCFLAGS += -DOPENTHREAD_CONFIG_NCP_UART_ENABLE=1
configure_OPTIONS += --enable-cli
ifeq ($(USB),1)
COMMONCFLAGS += -DUSB_CDC_AS_SERIAL_TRANSPORT=1
else
COMMONCFLAGS += -DUART_AS_SERIAL_TRANSPORT=1
endif # USB == 1
endif # NCP_SPI == 1
endif # DISABLE_TRANSPORTS
NRF52833_MBEDTLS_CPPFLAGS += -DDISABLE_CC310=1
ifeq ($(shell expr $(GCCVersion) \>= 7), 1)
COMMONCFLAGS += -Wno-expansion-to-defined
endif
CPPFLAGS += \
$(COMMONCFLAGS) \
$(target_CPPFLAGS) \
$(NULL)
CFLAGS += \
$(COMMONCFLAGS) \
$(target_CFLAGS) \
$(NULL)
CXXFLAGS += \
$(COMMONCFLAGS) \
$(target_CXXFLAGS) \
-fno-exceptions \
-fno-rtti \
$(NULL)
LDFLAGS += \
$(COMMONCFLAGS) \
$(target_LDFLAGS) \
-specs=nano.specs \
-specs=nosys.specs \
-Wl,--gc-sections \
$(NULL)
CCASFLAGS += \
$(COMMONCCASFLAGS) \
$(target_CCASFLAGS) \
-x \
assembler-with-cpp \
$(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 = nrf52833
ARCHS = cortex-m4
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)" CCAS="$(CCAS)" OBJC="$(OBJC)" OBJCXX="$(OBJCXX)" AR="$(AR)" RANLIB="$(RANLIB)" NM="$(NM)" STRIP="$(STRIP)" CPPFLAGS="$(CPPFLAGS)" CFLAGS="$(CFLAGS)" CXXFLAGS="$(CXXFLAGS)" CCASFLAGS="$(CCASFLAGS)" 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): target_CCASFLAGS=$($(1)_target_CCASFLAGS)
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-m4
#
cortex-m4_target_ABI = cortex-m4
cortex-m4_target_CPPFLAGS = -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -mthumb -mabi=aapcs
cortex-m4_target_CFLAGS = -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -mthumb -mabi=aapcs
cortex-m4_target_CXXFLAGS = -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -mthumb -mabi=aapcs
cortex-m4_target_LDFLAGS = -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -mthumb -mabi=aapcs
# Instantiate an architecture-specific build template for each target
# architecture.
$(foreach arch,$(ARCHS),$(eval $(call ARCH_template,$(arch))))
#
# Flashing / Debugging
#
TARGET_APP ?= ot-cli-ftd
APP_FILE_NAME = $(TopResultDir)/$(TargetTuple)/bin/$(TARGET_APP)
APP_FILE_HEX = $(TopResultDir)/$(TargetTuple)/bin/$(TARGET_APP).hex
nrfjprog: $(APP_FILE_NAME)
arm-none-eabi-objcopy -O ihex $(<) $(APP_FILE_HEX)
nrfjprog -f NRF52 --sectorerase --reset --program $(APP_FILE_HEX)
#
# 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) ""
-376
View File
@@ -1,376 +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 = $(CCPREFIX) arm-none-eabi-gcc
CPP = arm-none-eabi-cpp
CC = $(CCPREFIX) arm-none-eabi-gcc
CXX = $(CCPREFIX) 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
GCCVersion = $(shell expr `$(CC) -dumpversion | cut -f1 -d.`)
# Disable built-in mbedTLS by default allowing for nrf_security implementation with hardware acceleration.
# When set to 0 built-in, software implementation would be used.
DISABLE_BUILTIN_MBEDTLS ?= 1
ifeq ($(DISABLE_CC310), 1)
$(error DISABLE_CC310=1 is deprecated, please use DISABLE_BUILTIN_MBEDTLS=0)
endif
configure_OPTIONS = \
--enable-ftd \
--enable-mtd \
--enable-linker-map \
--with-examples=nrf52840 \
$(NULL)
ifdef SRC_PATH
configure_OPTIONS += --srcdir="$(SRC_PATH)"
endif
TopSourceDir := $(dir $(shell readlink $(firstword $(MAKEFILE_LIST))))..
AbsTopSourceDir := $(dir $(realpath $(firstword $(MAKEFILE_LIST))))..
NRF52840_MBEDTLS_CPPFLAGS += -DMBEDTLS_USER_CONFIG_FILE='\"nrf52840-mbedtls-config.h\"'
NRF52840_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/third_party/NordicSemiconductor/libraries/nrf_security/mbedtls_plat_config
ifeq ($(DISABLE_BUILTIN_MBEDTLS), 1)
NRF52840_MBEDTLS_CPPFLAGS += -DMBEDTLS_CONFIG_FILE='\"nrf-config.h\"'
NRF52840_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/third_party/NordicSemiconductor/libraries/nrf_security/include
NRF52840_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/third_party/NordicSemiconductor/libraries/nrf_security/config
NRF52840_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/third_party/NordicSemiconductor/libraries/nrf_security/nrf_cc310_plat/include
else
NRF52840_MBEDTLS_CPPFLAGS += -DMBEDTLS_CONFIG_FILE='\"mbedtls-config.h\"'
NRF52840_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/third_party/mbedtls
NRF52840_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/third_party/mbedtls/repo/include
NRF52840_MBEDTLS_CPPFLAGS += -DNRF52840_XXAA
endif
ifeq ($(MBEDTLS_THREADING), 1)
ifeq ($(DISABLE_BUILTIN_MBEDTLS), 1)
$(error Cannot use MBEDTLS_THREADING with CC310 support. CC310 library comes with built-in threading support. To disable CC310 please use DISABLE_BUILTIN_MBEDTLS=0)
else
NRF52840_MBEDTLS_CPPFLAGS += -DMBEDTLS_THREADING_C
NRF52840_MBEDTLS_CPPFLAGS += -DMBEDTLS_THREADING_ALT
NRF52840_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/third_party/NordicSemiconductor/libraries/nrf_security/include/software-only-threading
endif
endif
ifdef MBEDTLS_THREADING_MUTEX_DEF
ifneq ($(MBEDTLS_THREADING), 1)
$(error Cannot use MBEDTLS_THREADING_MUTEX_DEF without MBEDTLS_THREADING=1)
else
NRF52840_MBEDTLS_CPPFLAGS += -DMBEDTLS_THREADING_MUTEX_DEF='\"$(MBEDTLS_THREADING_MUTEX_DEF)\"'
endif
endif
NRF52840_CONFIG_FILE_CPPFLAGS = -DOPENTHREAD_PROJECT_CORE_CONFIG_FILE='\"openthread-core-nrf52840-config.h\"'
NRF52840_CONFIG_FILE_CPPFLAGS += -DOPENTHREAD_CORE_CONFIG_PLATFORM_CHECK_FILE='\"openthread-core-nrf52840-config-check.h\"'
NRF52840_CONFIG_FILE_CPPFLAGS += -I$(AbsTopSourceDir)/examples/platforms/nrf528xx/nrf52840
COMMONCFLAGS := \
-fdata-sections \
-ffunction-sections \
-Os \
-g \
$(NRF52840_CONFIG_FILE_CPPFLAGS) \
$(NULL)
include $(dir $(abspath $(lastword $(MAKEFILE_LIST))))/common-switches.mk
ifeq ($(DISABLE_BUILTIN_MBEDTLS),1)
COMMONCFLAGS += $(NRF52840_MBEDTLS_CPPFLAGS)
else
configure_OPTIONS += MBEDTLS_CPPFLAGS="$(NRF52840_MBEDTLS_CPPFLAGS)"
endif
ifeq ($(BOOTLOADER),1)
$(info Warning: BOOTLOADER=1 switch is deprecated. Defaulting to BOOTLOADER=USB.)
override BOOTLOADER = USB
endif
ifeq ($(BOOTLOADER),USB)
configure_OPTIONS += --with-custom-linker-file=$(AbsTopSourceDir)/examples/platforms/nrf528xx/nrf52840/nrf52840_bootloader_usb.ld
COMMONCFLAGS += -DAPP_USBD_NRF_DFU_TRIGGER_ENABLED=1
endif
ifeq ($(BOOTLOADER),UART)
configure_OPTIONS += --with-custom-linker-file=$(AbsTopSourceDir)/examples/platforms/nrf528xx/nrf52840/nrf52840_bootloader_uart.ld
endif
ifeq ($(BOOTLOADER),BLE)
configure_OPTIONS += --with-custom-linker-file=$(AbsTopSourceDir)/examples/platforms/nrf528xx/nrf52840/nrf52840_bootloader_ble.ld
endif
#
# Select transport which CLI, NCP and RCP examples will use to communicate.
# To disable all transports use the DISABLE_TRANSPORTS switch. This will disable
# the build of all above examples.
# If NCP_SPI switch is set, only NCP and RCP examples will be built.
# Otherwise the user can select USB transport. If no transports were selected,
# the default serial transport is UART.
#
ifndef DISABLE_TRANSPORTS
configure_OPTIONS += --enable-ncp
configure_OPTIONS += --enable-radio-only
ifeq ($(NCP_SPI),1)
COMMONCFLAGS += -DSPIS_AS_SERIAL_TRANSPORT=1
COMMONCFLAGS += -DOPENTHREAD_CONFIG_NCP_SPI_ENABLE=1
else
COMMONCFLAGS += -DOPENTHREAD_CONFIG_NCP_UART_ENABLE=1
configure_OPTIONS += --enable-cli
ifeq ($(USB),1)
COMMONCFLAGS += -DUSB_CDC_AS_SERIAL_TRANSPORT=1
else
COMMONCFLAGS += -DUART_AS_SERIAL_TRANSPORT=1
endif # USB == 1
endif # NCP_SPI == 1
endif # DISABLE_TRANSPORTS
ifeq ($(shell expr $(GCCVersion) \>= 7), 1)
COMMONCFLAGS += -Wno-expansion-to-defined
endif
CPPFLAGS += \
$(COMMONCFLAGS) \
$(target_CPPFLAGS) \
$(NULL)
CFLAGS += \
$(COMMONCFLAGS) \
$(target_CFLAGS) \
$(NULL)
CXXFLAGS += \
$(COMMONCFLAGS) \
$(target_CXXFLAGS) \
-fno-exceptions \
-fno-rtti \
$(NULL)
LDFLAGS += \
$(COMMONCFLAGS) \
$(target_LDFLAGS) \
-specs=nano.specs \
-specs=nosys.specs \
-Wl,--gc-sections \
$(NULL)
CCASFLAGS += \
$(COMMONCCASFLAGS) \
$(target_CCASFLAGS) \
-x \
assembler-with-cpp \
$(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 = nrf52840
ARCHS = cortex-m4
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)" CCAS="$(CCAS)" OBJC="$(OBJC)" OBJCXX="$(OBJCXX)" AR="$(AR)" RANLIB="$(RANLIB)" NM="$(NM)" STRIP="$(STRIP)" CPPFLAGS="$(CPPFLAGS)" CFLAGS="$(CFLAGS)" CXXFLAGS="$(CXXFLAGS)" CCASFLAGS="$(CCASFLAGS)" 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): target_CCASFLAGS=$($(1)_target_CCASFLAGS)
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-m4
#
cortex-m4_target_ABI = cortex-m4
cortex-m4_target_CPPFLAGS = -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -mthumb -mabi=aapcs
cortex-m4_target_CFLAGS = -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -mthumb -mabi=aapcs
cortex-m4_target_CXXFLAGS = -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -mthumb -mabi=aapcs
cortex-m4_target_LDFLAGS = -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -mthumb -mabi=aapcs
# Instantiate an architecture-specific build template for each target
# architecture.
$(foreach arch,$(ARCHS),$(eval $(call ARCH_template,$(arch))))
#
# Flashing / Debugging
#
TARGET_APP ?= ot-cli-ftd
APP_FILE_NAME = $(TopResultDir)/$(TargetTuple)/bin/$(TARGET_APP)
APP_FILE_HEX = $(TopResultDir)/$(TargetTuple)/bin/$(TARGET_APP).hex
nrfjprog: $(APP_FILE_NAME)
arm-none-eabi-objcopy -O ihex $(<) $(APP_FILE_HEX)
nrfjprog -f NRF52 --sectorerase --reset --program $(APP_FILE_HEX)
#
# 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) ""
-285
View File
@@ -1,285 +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.
#
.NOTPARALLEL:
AR = arm-none-eabi-ar
CCAS = $(CCPREFIX) arm-none-eabi-gcc
CPP = arm-none-eabi-cpp
CC = $(CCPREFIX) arm-none-eabi-gcc
CXX = $(CCPREFIX) 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
GCCVersion = $(shell expr `$(CC) -dumpversion | cut -f1 -d.`)
configure_OPTIONS = \
--enable-cli \
--enable-ftd \
--enable-mtd \
--enable-ncp \
--enable-radio-only \
--enable-linker-map \
--with-examples=qpg6095 \
MBEDTLS_CPPFLAGS="$(QPG6095_MBEDTLS_CPPFLAGS)" \
$(NULL)
TopSourceDir := $(dir $(shell readlink $(firstword $(MAKEFILE_LIST))))..
AbsTopSourceDir := $(dir $(realpath $(firstword $(MAKEFILE_LIST))))..
QPG6095_CONFIG_FILE_CPPFLAGS = -DOPENTHREAD_PROJECT_CORE_CONFIG_FILE='\"openthread-core-qpg6095-config.h\"'
QPG6095_CONFIG_FILE_CPPFLAGS += -DOPENTHREAD_CORE_CONFIG_PLATFORM_CHECK_FILE='\"openthread-core-qpg6095-config-check.h\"'
QPG6095_CONFIG_FILE_CPPFLAGS += -I$(PWD)/examples/platforms/qpg6095/
QPG6095_MBEDTLS_CPPFLAGS = -DMBEDTLS_CONFIG_FILE='\"mbedtls-config.h\"'
QPG6095_MBEDTLS_CPPFLAGS += -DMBEDTLS_USER_CONFIG_FILE='\"qpg6095-mbedtls-config.h\"'
QPG6095_MBEDTLS_CPPFLAGS += -I$(PWD)/examples/platforms/qpg6095/crypto
QPG6095_MBEDTLS_CPPFLAGS += -I$(PWD)/third_party/mbedtls
QPG6095_MBEDTLS_CPPFLAGS += -I$(PWD)/third_party/mbedtls/repo/include
QPG6095_MBEDTLS_CPPFLAGS += -I$(PWD)/third_party/mbedtls/repo/include/mbedtls
COMMONCFLAGS := \
-fdata-sections \
-ffunction-sections \
-Os \
-g \
$(QPG6095_CONFIG_FILE_CPPFLAGS) \
$(NULL)
include $(dir $(abspath $(lastword $(MAKEFILE_LIST))))/common-switches.mk
CPPFLAGS += \
$(COMMONCFLAGS) \
$(target_CPPFLAGS) \
$(NULL)
CFLAGS += \
$(COMMONCFLAGS) \
$(target_CFLAGS) \
$(NULL)
CXXFLAGS += \
$(COMMONCFLAGS) \
$(target_CXXFLAGS) \
-fno-exceptions \
-fno-rtti \
$(NULL)
LDFLAGS += \
$(COMMONCFLAGS) \
$(target_LDFLAGS) \
-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 = qpg6095
ARCHS = cortex-m4
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)" CCAS="$(CCAS)" OBJC="$(OBJC)" OBJCXX="$(OBJCXX)" AR="$(AR)" RANLIB="$(RANLIB)" NM="$(NM)" STRIP="$(STRIP)" CPPFLAGS="$(CPPFLAGS)" CFLAGS="$(CFLAGS)" CXXFLAGS="$(CXXFLAGS)" CCASFLAGS="$(CCASFLAGS)" 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
# @FIXME: get the filenames of the targets of OBJCOPY (now they are hardcoded)
define hex-arch
$(ECHO) " HEX $(TargetTuple)"
$(OBJCOPY) -O ihex $(AbsTopResultDir)/$(TargetTuple)/bin/ot-cli-mtd $(AbsTopResultDir)/$(TargetTuple)/bin/ot-cli-mtd.hex
$(OBJCOPY) -O ihex $(AbsTopResultDir)/$(TargetTuple)/bin/ot-cli-ftd $(AbsTopResultDir)/$(TargetTuple)/bin/ot-cli-ftd.hex
endef # hex-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)
HEX_TARGETS += hex-$(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): target_CCASFLAGS=$($(1)_target_CCASFLAGS)
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))
hex-$(1): stage-$(1)
hex-$(1):
$$(call hex-arch,$(1))
$(1): hex-$(1)
stage-$(1): do-build-$(1)
stage-$(1): | $(TopResultDir)
$$(call stage-arch,$(1))
endef # ARCH_template
.DEFAULT_GOAL := all
all: hex
#
# cortex-m4
#
cortex-m4_target_ABI = cortex-m4
cortex-m4_target_CPPFLAGS = -mcpu=cortex-m4 -mthumb -ffunction-sections
cortex-m4_target_CFLAGS = -mcpu=cortex-m4 -mthumb -ffunction-sections
cortex-m4_target_CXXFLAGS = -mcpu=cortex-m4 -mthumb -ffunction-sections
cortex-m4_target_LDFLAGS = -mcpu=cortex-m4 -mthumb -ffunction-sections
# 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)
hex: $(HEX_TARGETS)
DIRECTORIES = $(TopResultDir) $(TopResultDir)/$(TargetTuple)/lib $(BUILD_DIRS)
CLEAN_DIRS = $(TopResultDir) $(BUILD_DIRS)
all: hex
$(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) ""
-286
View File
@@ -1,286 +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.
#
.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
# Board setup
BOARD ?= SAMR21_XPLAINED_PRO
ifeq ($(BOARD), SAMR21_XPLAINED_PRO)
CPU = __SAMR21G18A__
else ifeq ($(BOARD), SAMR21G18_MODULE)
CPU = __SAMR21G18A__
else ifeq ($(BOARD), SAMR21B18_MODULE)
CPU=__SAMR21G18A__
else
$(error Invalid BOARD=$(BOARD) (currently supported SAMR21_XPLAINED_PRO, SAMR21G18_MODULE, SAMR21B18_MODULE))
endif
configure_OPTIONS = \
--enable-cli \
--enable-ftd \
--enable-mtd \
--enable-ncp \
--enable-radio-only \
--enable-linker-map \
--with-examples=samr21 \
MBEDTLS_CPPFLAGS="$(SAMR21_MBEDTLS_CPPFLAGS)" \
$(NULL)
TopSourceDir := $(dir $(shell readlink $(firstword $(MAKEFILE_LIST))))..
AbsTopSourceDir := $(dir $(realpath $(firstword $(MAKEFILE_LIST))))..
SAMR21_MBEDTLS_CPPFLAGS = -DMBEDTLS_CONFIG_FILE='\"mbedtls-config.h\"'
SAMR21_MBEDTLS_CPPFLAGS += -DMBEDTLS_USER_CONFIG_FILE='\"samr21-mbedtls-config.h\"'
SAMR21_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/examples/platforms/samr21/crypto
SAMR21_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/third_party/mbedtls
SAMR21_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/third_party/mbedtls/repo/include
SAMR21_CONFIG_FILE_CPPFLAGS = -DOPENTHREAD_PROJECT_CORE_CONFIG_FILE='\"openthread-core-samr21-config.h\"'
SAMR21_CONFIG_FILE_CPPFLAGS += -DOPENTHREAD_CORE_CONFIG_PLATFORM_CHECK_FILE='\"openthread-core-samr21-config-check.h\"'
SAMR21_CONFIG_FILE_CPPFLAGS += -I$(AbsTopSourceDir)/examples/platforms/samr21/
COMMONCFLAGS := \
-DBOARD=$(BOARD) \
-D$(CPU) \
-fdata-sections \
-ffunction-sections \
-Os \
-g \
$(SAMR21_CONFIG_FILE_CPPFLAGS) \
$(NULL)
include $(dir $(abspath $(lastword $(MAKEFILE_LIST))))/common-switches.mk
CPPFLAGS += \
$(COMMONCFLAGS) \
$(target_CPPFLAGS) \
$(NULL)
CFLAGS += \
$(COMMONCFLAGS) \
$(target_CFLAGS) \
$(NULL)
CXXFLAGS += \
$(COMMONCFLAGS) \
$(target_CXXFLAGS) \
-fno-exceptions \
-fno-rtti \
$(NULL)
LDFLAGS += \
$(COMMONCFLAGS) \
$(target_LDFLAGS) \
-specs=nano.specs \
-specs=nosys.specs \
-Wl,--gc-sections \
-Wl,--entry=Reset_Handler \
$(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 = samr21
ARCHS = cortex-m0plus
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-m0plus
#
cortex-m0plus_target_ABI = cortex-m0plus
cortex-m0plus_target_CPPFLAGS = -mcpu=cortex-m0plus -mfloat-abi=soft -mthumb
cortex-m0plus_target_CFLAGS = -mcpu=cortex-m0plus -mfloat-abi=soft -mthumb
cortex-m0plus_target_CXXFLAGS = -mcpu=cortex-m0plus -mfloat-abi=soft -mthumb
cortex-m0plus_target_LDFLAGS = -mcpu=cortex-m0plus -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) ""
+17 -2
View File
@@ -35,20 +35,26 @@ 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
@@ -56,9 +62,14 @@ 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 := \
@@ -88,7 +99,7 @@ endif
ifeq ($(NCP_SPI),1)
COMMONCFLAGS += -DOPENTHREAD_CONFIG_NCP_SPI_ENABLE=1
else
COMMONCFLAGS += -DOPENTHREAD_CONFIG_NCP_UART_ENABLE=1
COMMONCFLAGS += -DOPENTHREAD_CONFIG_NCP_HDLC_ENABLE=1
endif # NCP_SPI == 1
ifeq ($(OTNS),1)
@@ -103,6 +114,10 @@ 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))))..
@@ -147,7 +162,7 @@ ResultPath = output
TopResultDir = $(ResultPath)
AbsTopResultDir = $(PWD)/$(TopResultDir)
TargetTuple = $(shell ${AbsTopSourceDir}/third_party/nlbuild-autotools/repo/third_party/autoconf/config.guess | sed -e 's/[[:digit:].]*$$//g')
TargetTuple = simulation
ifndef BuildJobs
BuildJobs := $(shell getconf _NPROCESSORS_ONLN)
+73
View File
@@ -0,0 +1,73 @@
# 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. |
+4
View File
@@ -47,6 +47,10 @@ endif
if OPENTHREAD_ENABLE_NCP
SUBDIRS += ncp
else
if OPENTHREAD_ENABLE_RADIO_ONLY
SUBDIRS += ncp
endif
endif
endif
+9 -29
View File
@@ -26,40 +26,20 @@
# POSSIBILITY OF SUCH DAMAGE.
#
add_executable(ot-cli-ftd
main.c
)
add_executable(ot-cli-mtd
main.c
)
set(COMMON_INCLUDES
${OT_PUBLIC_INCLUDES}
${PROJECT_SOURCE_DIR}/examples/platforms
${PROJECT_SOURCE_DIR}/src/core
)
target_include_directories(ot-cli-ftd PRIVATE ${COMMON_INCLUDES})
target_include_directories(ot-cli-mtd PRIVATE ${COMMON_INCLUDES})
if(OT_FTD)
include(ftd.cmake)
endif()
target_link_libraries(ot-cli-ftd PRIVATE
openthread-cli-ftd
${OT_PLATFORM_LIB}
openthread-ftd
${OT_PLATFORM_LIB}
mbedcrypto
ot-config
)
if(OT_MTD)
include(mtd.cmake)
endif()
target_link_libraries(ot-cli-mtd PRIVATE
openthread-cli-mtd
${OT_PLATFORM_LIB}
openthread-mtd
${OT_PLATFORM_LIB}
mbedcrypto
ot-config
)
install(TARGETS ot-cli-ftd ot-cli-mtd
DESTINATION bin)
if(OT_RCP)
include(radio.cmake)
endif()
+33
View File
@@ -40,6 +40,7 @@ CPPFLAGS_COMMON += \
$(NULL)
LDADD_COMMON += \
$(top_builddir)/third_party/tcplp/libtcplp.a \
$(NULL)
LDFLAGS_COMMON += \
@@ -49,6 +50,7 @@ LIBTOOLFLAGS_COMMON += \
$(NULL)
SOURCES_COMMON += \
cli_uart.cpp \
main.c \
$(NULL)
@@ -118,9 +120,40 @@ 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
+4 -4
View File
@@ -30,11 +30,11 @@ Channel: 13
Channel Mask: 0x07fff800
Ext PAN ID: d63e8e3e495ebbc3
Mesh Local Prefix: fd3d:b50b:f96d:722d::/64
Master Key: dfd34f0f05cad978ec4e32b0413038ff
Network Key: dfd34f0f05cad978ec4e32b0413038ff
Network Name: OpenThread-8f28
PAN ID: 0x8f28
PSKc: c23a76e98f1a6483639b1ac1271e2e27
Security Policy: 0, onrcb
Security Policy: 0, onrc
Done
> dataset commit active
Done
@@ -82,10 +82,10 @@ $ cd <path-to-openthread>/output/<platform>/bin
$ ./ot-cli-ftd 2
```
Configure Thread Master Key from Node 1's Active Operational Dataset:
Configure Thread Network Key from Node 1's Active Operational Dataset:
```bash
> dataset masterkey dfd34f0f05cad978ec4e32b0413038ff
> dataset networkkey dfd34f0f05cad978ec4e32b0413038ff
Done
> dataset commit active
Done
+391
View File
@@ -0,0 +1,391 @@
/*
* 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 "openthread-core-config.h"
#include <stdarg.h>
#include <stdio.h>
#include <string.h>
#include <openthread-system.h>
#include <openthread/cli.h>
#include <openthread/logging.h>
#include "cli/cli_config.h"
#include "common/code_utils.hpp"
#include "common/debug.hpp"
#include "utils/uart.h"
#if OPENTHREAD_POSIX
#include <signal.h>
#include <sys/types.h>
#endif
/**
* @def OPENTHREAD_CONFIG_CLI_UART_RX_BUFFER_SIZE
*
* The size of CLI UART RX buffer in bytes.
*
*/
#ifndef OPENTHREAD_CONFIG_CLI_UART_RX_BUFFER_SIZE
#if OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE
#define OPENTHREAD_CONFIG_CLI_UART_RX_BUFFER_SIZE 640
#else
#define OPENTHREAD_CONFIG_CLI_UART_RX_BUFFER_SIZE 512
#endif
#endif
/**
* @def OPENTHREAD_CONFIG_CLI_TX_BUFFER_SIZE
*
* The size of CLI message buffer in bytes.
*
*/
#ifndef OPENTHREAD_CONFIG_CLI_UART_TX_BUFFER_SIZE
#define OPENTHREAD_CONFIG_CLI_UART_TX_BUFFER_SIZE 1024
#endif
#if OPENTHREAD_CONFIG_DIAG_ENABLE
#if OPENTHREAD_CONFIG_DIAG_OUTPUT_BUFFER_SIZE > OPENTHREAD_CONFIG_CLI_UART_TX_BUFFER_SIZE
#error "diag output buffer should be smaller than CLI UART tx buffer"
#endif
#if OPENTHREAD_CONFIG_DIAG_CMD_LINE_BUFFER_SIZE > OPENTHREAD_CONFIG_CLI_UART_RX_BUFFER_SIZE
#error "diag command line should be smaller than CLI UART rx buffer"
#endif
#endif
#if OPENTHREAD_CONFIG_CLI_MAX_LINE_LENGTH > OPENTHREAD_CONFIG_CLI_UART_RX_BUFFER_SIZE
#error "command line should be should be smaller than CLI rx buffer"
#endif
enum
{
kRxBufferSize = OPENTHREAD_CONFIG_CLI_UART_RX_BUFFER_SIZE,
kTxBufferSize = OPENTHREAD_CONFIG_CLI_UART_TX_BUFFER_SIZE,
};
char sRxBuffer[kRxBufferSize];
uint16_t sRxLength;
char sTxBuffer[kTxBufferSize];
uint16_t sTxHead;
uint16_t sTxLength;
uint16_t sSendLength;
#ifdef OT_CLI_UART_LOCK_HDR_FILE
#include OT_CLI_UART_LOCK_HDR_FILE
#else
/**
* Macro to acquire an exclusive lock of uart cli output
* Default implementation does nothing
*
*/
#ifndef OT_CLI_UART_OUTPUT_LOCK
#define OT_CLI_UART_OUTPUT_LOCK() \
do \
{ \
} while (0)
#endif
/**
* Macro to release the exclusive lock of uart cli output
* Default implementation does nothing
*
*/
#ifndef OT_CLI_UART_OUTPUT_UNLOCK
#define OT_CLI_UART_OUTPUT_UNLOCK() \
do \
{ \
} while (0)
#endif
#endif // OT_CLI_UART_LOCK_HDR_FILE
static int Output(const char *aBuf, uint16_t aBufLength);
static otError ProcessCommand(void);
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;
end = aBuf + aBufLength;
for (; aBuf < end; aBuf++)
{
switch (*aBuf)
{
case '\n':
if (sLastChar == '\r')
{
break;
}
OT_FALL_THROUGH;
case '\r':
Output(CRNL, sizeof(CRNL));
sRxBuffer[sRxLength] = '\0';
IgnoreError(ProcessCommand());
break;
#if OPENTHREAD_POSIX && !defined(FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION)
case 0x03: // ASCII for Ctrl-C
kill(0, SIGINT);
break;
case 0x04: // ASCII for Ctrl-D
exit(EXIT_SUCCESS);
break;
#endif
case '\b':
case 127:
if (sRxLength > 0)
{
Output(sEraseString, sizeof(sEraseString));
sRxBuffer[--sRxLength] = '\0';
}
break;
default:
if (sRxLength < kRxBufferSize - 1)
{
Output(reinterpret_cast<const char *>(aBuf), 1);
sRxBuffer[sRxLength++] = static_cast<char>(*aBuf);
}
break;
}
sLastChar = *aBuf;
}
}
static otError ProcessCommand(void)
{
otError error = OT_ERROR_NONE;
while (sRxLength > 0 && (sRxBuffer[sRxLength - 1] == '\n' || sRxBuffer[sRxLength - 1] == '\r'))
{
sRxBuffer[--sRxLength] = '\0';
}
otCliInputLine(sRxBuffer);
sRxLength = 0;
return error;
}
static void Send(void)
{
VerifyOrExit(sSendLength == 0);
if (sTxLength > kTxBufferSize - sTxHead)
{
sSendLength = kTxBufferSize - sTxHead;
}
else
{
sSendLength = sTxLength;
}
if (sSendLength > 0)
{
#if OPENTHREAD_CONFIG_ENABLE_DEBUG_UART
/* duplicate the output to the debug uart */
otSysDebugUart_write_bytes(reinterpret_cast<uint8_t *>(sTxBuffer + sTxHead), sSendLength);
#endif
IgnoreError(otPlatUartSend(reinterpret_cast<uint8_t *>(sTxBuffer + sTxHead), sSendLength));
}
exit:
return;
}
static void SendDoneTask(void)
{
sTxHead = (sTxHead + sSendLength) % kTxBufferSize;
sTxLength -= sSendLength;
sSendLength = 0;
Send();
}
static int Output(const char *aBuf, uint16_t aBufLength)
{
OT_CLI_UART_OUTPUT_LOCK();
uint16_t sent = 0;
while (aBufLength > 0)
{
uint16_t remaining = kTxBufferSize - sTxLength;
uint16_t tail;
uint16_t sendLength = aBufLength;
if (sendLength > remaining)
{
sendLength = remaining;
}
for (uint16_t i = 0; i < sendLength; i++)
{
tail = (sTxHead + sTxLength) % kTxBufferSize;
sTxBuffer[tail] = *aBuf++;
aBufLength--;
sTxLength++;
}
Send();
sent += sendLength;
if (aBufLength > 0)
{
// More to send, so flush what's waiting now
otError err = otPlatUartFlush();
if (err == OT_ERROR_NONE)
{
// Flush successful, reset the pointers
SendDoneTask();
}
else
{
// Flush did not succeed, so abort here.
break;
}
}
}
OT_CLI_UART_OUTPUT_UNLOCK();
return sent;
}
static int CliUartOutput(void *aContext, const char *aFormat, va_list aArguments)
{
OT_UNUSED_VARIABLE(aContext);
int rval;
if (sTxLength == 0)
{
rval = vsnprintf(sTxBuffer, kTxBufferSize, aFormat, aArguments);
VerifyOrExit(rval >= 0 && rval < kTxBufferSize, otLogWarnPlat("Failed to format CLI output `%s`", aFormat));
sTxHead = 0;
sTxLength = static_cast<uint16_t>(rval);
sSendLength = 0;
}
else
{
va_list retryArguments;
uint16_t tail = (sTxHead + sTxLength) % kTxBufferSize;
uint16_t remaining = (sTxHead > tail ? (sTxHead - tail) : (kTxBufferSize - tail));
va_copy(retryArguments, aArguments);
rval = vsnprintf(&sTxBuffer[tail], remaining, aFormat, aArguments);
if (rval < 0)
{
otLogWarnPlat("Failed to format CLI output `%s`", aFormat);
}
else if (rval < remaining)
{
sTxLength += rval;
}
else if (rval < kTxBufferSize)
{
while (sTxLength != 0)
{
otError error;
Send();
error = otPlatUartFlush();
if (error == OT_ERROR_NONE)
{
// Flush successful, reset the pointers
SendDoneTask();
}
else
{
// Flush did not succeed, so abandon buffered output.
otLogWarnPlat("Failed to output CLI: %s", otThreadErrorToString(error));
break;
}
}
rval = vsnprintf(sTxBuffer, kTxBufferSize, aFormat, retryArguments);
OT_ASSERT(rval > 0);
sTxLength = static_cast<uint16_t>(rval);
sTxHead = 0;
sSendLength = 0;
}
else
{
otLogWarnPlat("CLI output `%s` truncated", aFormat);
}
va_end(retryArguments);
}
Send();
exit:
return rval;
}
void otPlatUartReceived(const uint8_t *aBuf, uint16_t aBufLength)
{
ReceiveTask(aBuf, aBufLength);
}
void otPlatUartSendDone(void)
{
SendDoneTask();
}
extern "C" void otAppCliInit(otInstance *aInstance)
{
sRxLength = 0;
sTxHead = 0;
sTxLength = 0;
sSendLength = 0;
IgnoreError(otPlatUartEnable());
otCliInit(aInstance, CliUartOutput, aInstance);
}
+51
View File
@@ -0,0 +1,51 @@
#
# Copyright (c) 2020, 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.
#
add_executable(ot-cli-ftd
cli_uart.cpp
main.c
)
target_include_directories(ot-cli-ftd PRIVATE ${COMMON_INCLUDES})
if(NOT DEFINED OT_PLATFORM_LIB_FTD)
set(OT_PLATFORM_LIB_FTD ${OT_PLATFORM_LIB})
endif()
target_link_libraries(ot-cli-ftd PRIVATE
openthread-cli-ftd
${OT_PLATFORM_LIB_FTD}
openthread-ftd
${OT_PLATFORM_LIB_FTD}
openthread-cli-ftd
${OT_MBEDTLS}
ot-config
)
install(TARGETS ot-cli-ftd
DESTINATION bin)
+28 -31
View File
@@ -37,21 +37,19 @@
#include "openthread-system.h"
#include "cli/cli_config.h"
#include "common/code_utils.hpp"
#if OPENTHREAD_EXAMPLES_SIMULATION
#include <setjmp.h>
#include <unistd.h>
#include "lib/platform/reset_util.h"
jmp_buf gResetJump;
/**
* This function initializes the CLI app.
*
* @param[in] aInstance The OpenThread instance structure.
*
*/
extern void otAppCliInit(otInstance *aInstance);
void __gcov_flush();
#endif
#ifndef OPENTHREAD_ENABLE_COVERAGE
#define OPENTHREAD_ENABLE_COVERAGE 0
#endif
#if OPENTHREAD_CONFIG_MULTIPLE_INSTANCE_ENABLE
#if OPENTHREAD_CONFIG_HEAP_EXTERNAL_ENABLE
void *otPlatCAlloc(size_t aNum, size_t aSize)
{
return calloc(aNum, aSize);
@@ -68,20 +66,23 @@ 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[])
{
OT_UNUSED_VARIABLE(aContext);
OT_UNUSED_VARIABLE(aArgsLength);
OT_UNUSED_VARIABLE(aArgs);
exit(EXIT_SUCCESS);
}
static const otCliCommand kCommands[] = {{"exit", ProcessExit}};
#endif
int main(int argc, char *argv[])
{
otInstance *instance;
#if OPENTHREAD_EXAMPLES_SIMULATION
if (setjmp(gResetJump))
{
alarm(0);
#if OPENTHREAD_ENABLE_COVERAGE
__gcov_flush();
#endif
execvp(argv[0], argv);
}
#endif
OT_SETUP_RESET_JUMP(argv);
#if OPENTHREAD_CONFIG_MULTIPLE_INSTANCE_ENABLE
size_t otInstanceBufferLength = 0;
@@ -107,8 +108,10 @@ pseudo_reset:
#endif
assert(instance);
#if OPENTHREAD_CONFIG_CLI_TRANSPORT == OT_CLI_TRANSPORT_UART
otCliUartInit(instance);
otAppCliInit(instance);
#if OPENTHREAD_POSIX && !defined(FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION)
otCliSetUserCommands(kCommands, OT_ARRAY_LENGTH(kCommands), instance);
#endif
while (!otSysPseudoResetWasRequested())
@@ -127,17 +130,11 @@ pseudo_reset:
return 0;
}
/*
* Provide, if required an "otPlatLog()" function
*/
#if OPENTHREAD_CONFIG_LOG_OUTPUT == OPENTHREAD_CONFIG_LOG_OUTPUT_APP
void otPlatLog(otLogLevel aLogLevel, otLogRegion aLogRegion, const char *aFormat, ...)
{
OT_UNUSED_VARIABLE(aLogLevel);
OT_UNUSED_VARIABLE(aLogRegion);
OT_UNUSED_VARIABLE(aFormat);
va_list ap;
va_start(ap, aFormat);
otCliPlatLogv(aLogLevel, aLogRegion, aFormat, ap);
va_end(ap);
+51
View File
@@ -0,0 +1,51 @@
#
# Copyright (c) 2020, 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.
#
add_executable(ot-cli-mtd
cli_uart.cpp
main.c
)
target_include_directories(ot-cli-mtd PRIVATE ${COMMON_INCLUDES})
if(NOT DEFINED OT_PLATFORM_LIB_MTD)
set(OT_PLATFORM_LIB_MTD ${OT_PLATFORM_LIB})
endif()
target_link_libraries(ot-cli-mtd PRIVATE
openthread-cli-mtd
${OT_PLATFORM_LIB_MTD}
openthread-mtd
${OT_PLATFORM_LIB_MTD}
openthread-cli-mtd
${OT_MBEDTLS}
ot-config
)
install(TARGETS ot-cli-mtd
DESTINATION bin)
+56
View File
@@ -0,0 +1,56 @@
#
# Copyright (c) 2021, 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.
#
add_executable(ot-cli-radio
cli_uart.cpp
main.c
)
target_include_directories(ot-cli-radio PRIVATE ${COMMON_INCLUDES})
if(NOT DEFINED OT_PLATFORM_LIB_RCP)
set(OT_PLATFORM_LIB_RCP ${OT_PLATFORM_LIB})
endif()
if(NOT DEFINED OT_MBEDTLS_RCP)
set(OT_MBEDTLS_RCP ${OT_MBEDTLS})
endif()
target_link_libraries(ot-cli-radio PRIVATE
openthread-cli-radio
${OT_PLATFORM_LIB_RCP}
openthread-radio-cli
${OT_PLATFORM_LIB_RCP}
openthread-cli-radio
${OT_MBEDTLS_RCP}
ot-config
)
install(TARGETS ot-cli-radio
DESTINATION bin
)
+11 -2
View File
@@ -33,9 +33,18 @@ set(COMMON_INCLUDES
)
if(OT_APP_NCP)
include(ncp.cmake)
if(OT_FTD)
include(ftd.cmake)
endif()
if(OT_MTD)
include(mtd.cmake)
endif()
endif()
if(OT_APP_RCP)
include(rcp.cmake)
if(OT_RCP)
include(rcp.cmake)
else()
message(FATAL_ERROR "OT_RCP is not enabled")
endif()
endif()
+7
View File
@@ -34,11 +34,13 @@ bin_PROGRAMS = \
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 += \
@@ -49,6 +51,7 @@ LIBTOOLFLAGS_COMMON += \
SOURCES_COMMON += \
main.c \
ncp.c \
$(NULL)
LDADD_MBEDTLS = \
@@ -76,11 +79,13 @@ LDADD_COMMON += \
$(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) \
@@ -110,11 +115,13 @@ 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) \
+50
View File
@@ -0,0 +1,50 @@
#
# Copyright (c) 2020, 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.
#
add_executable(ot-ncp-ftd
main.c
ncp.c
)
target_include_directories(ot-ncp-ftd PRIVATE ${COMMON_INCLUDES})
if(NOT DEFINED OT_PLATFORM_LIB_FTD)
set(OT_PLATFORM_LIB_FTD ${OT_PLATFORM_LIB})
endif()
target_link_libraries(ot-ncp-ftd PRIVATE
openthread-ncp-ftd
${OT_PLATFORM_LIB_FTD}
openthread-ftd
${OT_PLATFORM_LIB_FTD}
openthread-ncp-ftd
${OT_MBEDTLS}
ot-config
)
install(TARGETS ot-ncp-ftd DESTINATION bin)
+11 -24
View File
@@ -36,20 +36,16 @@
#include "openthread-system.h"
#if OPENTHREAD_EXAMPLES_SIMULATION
#include <setjmp.h>
#include <unistd.h>
#include "lib/platform/reset_util.h"
/**
* This function initializes the NCP app.
*
* @param[in] aInstance The OpenThread instance structure.
*
*/
extern void otAppNcpInit(otInstance *aInstance);
jmp_buf gResetJump;
void __gcov_flush();
#endif
#ifndef OPENTHREAD_ENABLE_COVERAGE
#define OPENTHREAD_ENABLE_COVERAGE 0
#endif
#if OPENTHREAD_CONFIG_MULTIPLE_INSTANCE_ENABLE
#if OPENTHREAD_CONFIG_HEAP_EXTERNAL_ENABLE
void *otPlatCAlloc(size_t aNum, size_t aSize)
{
return calloc(aNum, aSize);
@@ -70,16 +66,7 @@ int main(int argc, char *argv[])
{
otInstance *instance;
#if OPENTHREAD_EXAMPLES_SIMULATION
if (setjmp(gResetJump))
{
alarm(0);
#if OPENTHREAD_ENABLE_COVERAGE
__gcov_flush();
#endif
execvp(argv[0], argv);
}
#endif
OT_SETUP_RESET_JUMP(argv);
#if OPENTHREAD_CONFIG_MULTIPLE_INSTANCE_ENABLE
size_t otInstanceBufferLength = 0;
@@ -105,7 +92,7 @@ pseudo_reset:
#endif
assert(instance);
otNcpInit(instance);
otAppNcpInit(instance);
while (!otSysPseudoResetWasRequested())
{
+50
View File
@@ -0,0 +1,50 @@
#
# Copyright (c) 2020, 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.
#
add_executable(ot-ncp-mtd
main.c
ncp.c
)
target_include_directories(ot-ncp-mtd PRIVATE ${COMMON_INCLUDES})
if(NOT DEFINED OT_PLATFORM_LIB_MTD)
set(OT_PLATFORM_LIB_MTD ${OT_PLATFORM_LIB})
endif()
target_link_libraries(ot-ncp-mtd PRIVATE
openthread-ncp-mtd
${OT_PLATFORM_LIB_MTD}
openthread-mtd
${OT_PLATFORM_LIB_MTD}
openthread-ncp-mtd
${OT_MBEDTLS}
ot-config
)
install(TARGETS ot-ncp-mtd DESTINATION bin)
+70
View File
@@ -0,0 +1,70 @@
/*
* Copyright (c) 2021, 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 "openthread-core-config.h"
#include <openthread/ncp.h>
#include "common/code_utils.hpp"
#include "ncp/ncp_config.h"
#if !OPENTHREAD_CONFIG_NCP_SPI_ENABLE
#include "utils/uart.h"
void otPlatUartReceived(const uint8_t *aBuf, uint16_t aBufLength)
{
otNcpHdlcReceive(aBuf, aBufLength);
}
void otPlatUartSendDone(void)
{
otNcpHdlcSendDone();
}
#endif
#if !OPENTHREAD_ENABLE_NCP_VENDOR_HOOK
#if !OPENTHREAD_CONFIG_NCP_SPI_ENABLE
static int NcpSend(const uint8_t *aBuf, uint16_t aBufLength)
{
IgnoreError(otPlatUartSend(aBuf, aBufLength));
return aBufLength;
}
#endif
void otAppNcpInit(otInstance *aInstance)
{
#if OPENTHREAD_CONFIG_NCP_SPI_ENABLE
otNcpSpiInit(aInstance);
#else
IgnoreError(otPlatUartEnable());
otNcpHdlcInit(aInstance, NcpSend);
#endif
}
#endif // !OPENTHREAD_ENABLE_NCP_VENDOR_HOOK
-58
View File
@@ -1,58 +0,0 @@
#
# Copyright (c) 2020, 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.
#
add_executable(ot-ncp-ftd
main.c
)
add_executable(ot-ncp-mtd
main.c
)
target_include_directories(ot-ncp-ftd PRIVATE ${COMMON_INCLUDES})
target_include_directories(ot-ncp-mtd PRIVATE ${COMMON_INCLUDES})
target_link_libraries(ot-ncp-ftd PRIVATE
openthread-ncp-ftd
${OT_PLATFORM_LIB}
openthread-ftd
${OT_PLATFORM_LIB}
mbedcrypto
ot-config
)
target_link_libraries(ot-ncp-mtd PRIVATE
openthread-ncp-mtd
${OT_PLATFORM_LIB}
openthread-mtd
${OT_PLATFORM_LIB}
mbedcrypto
ot-config
)
install(TARGETS ot-ncp-ftd ot-ncp-mtd DESTINATION bin)
+8 -2
View File
@@ -28,15 +28,21 @@
add_executable(ot-rcp
main.c
ncp.c
)
target_include_directories(ot-rcp PRIVATE ${COMMON_INCLUDES})
if(NOT DEFINED OT_PLATFORM_LIB_RCP)
set(OT_PLATFORM_LIB_RCP ${OT_PLATFORM_LIB})
endif()
target_link_libraries(ot-rcp PRIVATE
openthread-rcp
${OT_PLATFORM_LIB}
${OT_PLATFORM_LIB_RCP}
openthread-radio
${OT_PLATFORM_LIB}
${OT_PLATFORM_LIB_RCP}
openthread-rcp
ot-config
)
+148 -74
View File
@@ -28,55 +28,74 @@
# OpenThread Features (Makefile default configuration).
BACKBONE_ROUTER ?= 0
BIG_ENDIAN ?= 0
BORDER_AGENT ?= 0
BORDER_ROUTER ?= 0
COAP ?= 0
COAP_OBSERVE ?= 0
COAPS ?= 0
COMMISSIONER ?= 0
COVERAGE ?= 0
CHANNEL_MANAGER ?= 0
CHANNEL_MONITOR ?= 0
CHILD_SUPERVISION ?= 0
CLI_TRANSPORT ?= UART
DEBUG ?= 0
DHCP6_CLIENT ?= 0
DHCP6_SERVER ?= 0
DIAGNOSTIC ?= 0
DISABLE_DOC ?= 0
DISABLE_TOOLS ?= 0
DNS_CLIENT ?= 0
DUA ?= 0
DYNAMIC_LOG_LEVEL ?= 0
ECDSA ?= 0
EXTERNAL_HEAP ?= 0
IP6_FRAGM ?= 0
JAM_DETECTION ?= 0
JOINER ?= 0
LEGACY ?= 0
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
LOG_OUTPUT ?= APP
endif
LINK_RAW ?= 0
MAC_FILTER ?= 0
MLE_LONG_ROUTES ?= 0
MLR ?= 0
MTD_NETDIAG ?= 0
MULTIPLE_INSTANCE ?= 0
OTNS ?= 0
PLATFORM_UDP ?= 0
REFERENCE_DEVICE ?= 0
SERVICE ?= 0
SETTINGS_RAM ?= 0
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
THREAD_VERSION ?= 1.1
TIME_SYNC ?= 0
UDP_FORWARD ?= 0
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
@@ -94,6 +113,14 @@ 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
@@ -102,6 +129,10 @@ 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
@@ -126,14 +157,24 @@ ifeq ($(CHILD_SUPERVISION),1)
COMMONCFLAGS += -DOPENTHREAD_CONFIG_CHILD_SUPERVISION_ENABLE=1
endif
ifneq ($(CLI_TRANSPORT),)
COMMONCFLAGS += -DOPENTHREAD_CONFIG_CLI_TRANSPORT=OT_CLI_TRANSPORT_$(CLI_TRANSPORT)
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
@@ -162,6 +203,14 @@ 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
@@ -178,6 +227,10 @@ 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
@@ -198,6 +251,14 @@ 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
@@ -206,6 +267,10 @@ 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
@@ -223,6 +288,18 @@ 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
@@ -244,20 +321,38 @@ 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
@@ -292,29 +387,8 @@ ifneq ($(SPINEL_ENCRYPTER_LIBS),)
configure_OPTIONS += --with-ncp-spinel-encrypter-libs=$(SPINEL_ENCRYPTER_LIBS)
endif
ifeq ($(FULL_LOGS),1)
# HINT: Add more here, or comment out ones you do not need/want
LOG_FLAGS += -DOPENTHREAD_CONFIG_LOG_LEVEL=OT_LOG_LEVEL_DEBG
LOG_FLAGS += -DOPENTHREAD_CONFIG_LOG_API=1
LOG_FLAGS += -DOPENTHREAD_CONFIG_LOG_ARP=1
LOG_FLAGS += -DOPENTHREAD_CONFIG_LOG_BBR=1
LOG_FLAGS += -DOPENTHREAD_CONFIG_LOG_CLI=1
LOG_FLAGS += -DOPENTHREAD_CONFIG_LOG_COAP=1
LOG_FLAGS += -DOPENTHREAD_CONFIG_LOG_DUA=1
LOG_FLAGS += -DOPENTHREAD_CONFIG_LOG_ICMP=1
LOG_FLAGS += -DOPENTHREAD_CONFIG_LOG_IP6=1
LOG_FLAGS += -DOPENTHREAD_CONFIG_LOG_MAC=1
LOG_FLAGS += -DOPENTHREAD_CONFIG_LOG_MEM=1
LOG_FLAGS += -DOPENTHREAD_CONFIG_LOG_MESHCOP=1
LOG_FLAGS += -DOPENTHREAD_CONFIG_LOG_MLE=1
LOG_FLAGS += -DOPENTHREAD_CONFIG_LOG_MLR=1
LOG_FLAGS += -DOPENTHREAD_CONFIG_LOG_NETDATA=1
LOG_FLAGS += -DOPENTHREAD_CONFIG_LOG_NETDIAG=1
LOG_FLAGS += -DOPENTHREAD_CONFIG_LOG_PKT_DUMP=1
LOG_FLAGS += -DOPENTHREAD_CONFIG_LOG_PLATFORM=1
LOG_FLAGS += -DOPENTHREAD_CONFIG_LOG_PREPEND_LEVEL=1
LOG_FLAGS += -DOPENTHREAD_CONFIG_LOG_PREPEND_REGION=1
endif
COMMONCFLAGS += -DOPENTHREAD_SPINEL_CONFIG_RCP_RESTORATION_MAX_COUNT=${RCP_RESTORATION_MAX_COUNT}
CFLAGS += ${LOG_FLAGS}
CXXFLAGS += ${LOG_FLAGS}
ifeq ($(FULL_LOGS),1)
COMMONCFLAGS += -DOPENTHREAD_CONFIG_LOG_LEVEL=OT_LOG_LEVEL_DEBG -DOPENTHREAD_CONFIG_LOG_PREPEND_LEVEL=1
endif
+11 -62
View File
@@ -28,24 +28,25 @@
include $(abs_top_nlbuild_autotools_dir)/automake/pre.am
# Always package (e.g. for 'make dist') these subdirectories.
DIST_SUBDIRS = \
EXTRA_DIST = \
cc1352 \
cc2538 \
cc2650 \
cc2652 \
efr32mg1 \
efr32mg12 \
efr32mg13 \
efr32mg21 \
efr32 \
gp712 \
k32w \
kw41z \
nrf528xx \
simulation \
qpg6095 \
qpg6100 \
qpg7015m \
samr21 \
$(NULL)
# Always package (e.g. for 'make dist') these subdirectories.
DIST_SUBDIRS = \
cc2538 \
simulation \
utils \
$(NULL)
@@ -55,66 +56,14 @@ SUBDIRS = \
utils \
$(NULL)
if OPENTHREAD_PLATFORM_CC1352
SUBDIRS += cc1352
endif
if OPENTHREAD_PLATFORM_CC2538
SUBDIRS += cc2538
endif
if OPENTHREAD_PLATFORM_CC2650
SUBDIRS += cc2650
endif
if OPENTHREAD_PLATFORM_CC2652
SUBDIRS += cc2652
endif
if OPENTHREAD_PLATFORM_EFR32MG1
SUBDIRS += efr32mg1
endif
if OPENTHREAD_PLATFORM_EFR32MG12
SUBDIRS += efr32mg12
endif
if OPENTHREAD_PLATFORM_EFR32MG13
SUBDIRS += efr32mg13
endif
if OPENTHREAD_PLATFORM_EFR32MG21
SUBDIRS += efr32mg21
endif
if OPENTHREAD_PLATFORM_GP712
SUBDIRS += gp712
endif
if OPENTHREAD_PLATFORM_K32W
SUBDIRS += k32w
endif
if OPENTHREAD_PLATFORM_KW41Z
SUBDIRS += kw41z
endif
if OPENTHREAD_PLATFORM_NRF528XX
SUBDIRS += nrf528xx
endif
if OPENTHREAD_PLATFORM_SIMULATION
SUBDIRS += simulation
endif
if OPENTHREAD_PLATFORM_QPG6095
SUBDIRS += qpg6095
endif
if OPENTHREAD_PLATFORM_SAMR21
SUBDIRS += samr21
endif
noinst_HEADERS = \
openthread-system.h \
$(NULL)
-64
View File
@@ -41,74 +41,10 @@ LDFLAGS_COMMON = $(NULL)
SOURCES_COMMON = $(NULL)
LIBTOOLFLAGS_COMMON = --preserve-dup-deps
if OPENTHREAD_EXAMPLES_CC1352
include $(top_srcdir)/examples/platforms/cc1352/Makefile.platform.am
endif
if OPENTHREAD_EXAMPLES_CC2538
include $(top_srcdir)/examples/platforms/cc2538/Makefile.platform.am
endif
if OPENTHREAD_EXAMPLES_CC2650
include $(top_srcdir)/examples/platforms/cc2650/Makefile.platform.am
endif
if OPENTHREAD_EXAMPLES_CC2652
include $(top_srcdir)/examples/platforms/cc2652/Makefile.platform.am
endif
if OPENTHREAD_EXAMPLES_EFR32MG1
include $(top_srcdir)/examples/platforms/efr32mg1/Makefile.platform.am
endif
if OPENTHREAD_EXAMPLES_EFR32MG12
include $(top_srcdir)/examples/platforms/efr32mg12/Makefile.platform.am
endif
if OPENTHREAD_EXAMPLES_EFR32MG13
include $(top_srcdir)/examples/platforms/efr32mg13/Makefile.platform.am
endif
if OPENTHREAD_EXAMPLES_EFR32MG21
include $(top_srcdir)/examples/platforms/efr32mg21/Makefile.platform.am
endif
if OPENTHREAD_EXAMPLES_GP712
include $(top_srcdir)/examples/platforms/gp712/Makefile.platform.am
endif
if OPENTHREAD_EXAMPLES_JN5189
include $(top_srcdir)/examples/platforms/k32w/jn5189/Makefile.platform.am
endif
if OPENTHREAD_EXAMPLES_K32W061
include $(top_srcdir)/examples/platforms/k32w/k32w061/Makefile.platform.am
endif
if OPENTHREAD_EXAMPLES_KW41Z
include $(top_srcdir)/examples/platforms/kw41z/Makefile.platform.am
endif
if OPENTHREAD_EXAMPLES_NRF52811
include $(top_srcdir)/examples/platforms/nrf528xx/nrf52811/Makefile.platform.am
endif
if OPENTHREAD_EXAMPLES_NRF52833
include $(top_srcdir)/examples/platforms/nrf528xx/nrf52833/Makefile.platform.am
endif
if OPENTHREAD_EXAMPLES_NRF52840
include $(top_srcdir)/examples/platforms/nrf528xx/nrf52840/Makefile.platform.am
endif
if OPENTHREAD_EXAMPLES_QPG6095
include $(top_srcdir)/examples/platforms/qpg6095/Makefile.platform.am
endif
if OPENTHREAD_EXAMPLES_SAMR21
include $(top_srcdir)/examples/platforms/samr21/Makefile.platform.am
endif # OPENTHREAD_EXAMPLES_SAMR21
if OPENTHREAD_EXAMPLES_SIMULATION
include $(top_srcdir)/examples/platforms/simulation/Makefile.platform.am
endif
-100
View File
@@ -1,100 +0,0 @@
#
# Copyright (c) 2020, 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(OT_PLATFORM_LIB "openthread-cc1352" PARENT_SCOPE)
if(NOT OT_CONFIG)
set(OT_CONFIG "openthread-core-cc1352-config.h")
set(OT_CONFIG ${OT_CONFIG} PARENT_SCOPE)
endif()
list(APPEND OT_PLATFORM_DEFINES
"OPENTHREAD_CORE_CONFIG_PLATFORM_CHECK_FILE=\"openthread-core-cc1352-config-check.h\""
)
set(OT_PLATFORM_DEFINES ${OT_PLATFORM_DEFINES} PARENT_SCOPE)
target_compile_definitions(ot-config INTERFACE "MBEDTLS_USER_CONFIG_FILE=\"cc1352-mbedtls-config.h\"")
list(APPEND OT_PUBLIC_INCLUDES
"${CMAKE_CURRENT_SOURCE_DIR}/crypto"
"${PROJECT_SOURCE_DIR}/third_party/ti/devices/cc13x2_cc26x2"
)
set(OT_PUBLIC_INCLUDES ${OT_PUBLIC_INCLUDES} PARENT_SCOPE)
list(APPEND OT_PLATFORM_DEFINES "OPENTHREAD_PROJECT_CORE_CONFIG_FILE=\"${OT_CONFIG}\"")
add_library(openthread-cc1352
alarm.c
diag.c
entropy.c
flash.c
logging.c
misc.c
radio.c
system.c
uart.c
crypto/aes_alt.c
cc1352_ccfg.c
cc1352_startup.c
cxx_helpers.c
)
set_target_properties(
openthread-cc1352
PROPERTIES
C_STANDARD 99
CXX_STANDARD 11
)
target_link_libraries(openthread-cc1352
PUBLIC
cc13x2-cc26x2-driver
PRIVATE
${OT_MBEDTLS}
ot-config
)
target_link_options(openthread-cc1352
PUBLIC
-Wl,--gc-sections
-Wl,-Map=$<TARGET_PROPERTY:NAME>.map
)
target_compile_definitions(openthread-cc1352
PUBLIC
${OT_PLATFORM_DEFINES}
)
target_compile_options(openthread-cc1352 PRIVATE ${OT_CFLAGS})
target_include_directories(openthread-cc1352
PRIVATE
${OT_PUBLIC_INCLUDES}
${PROJECT_SOURCE_DIR}/src/core
${PROJECT_SOURCE_DIR}/examples/platforms
)
-81
View File
@@ -1,81 +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.
#
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-cc1352.a
libopenthread_cc1352_a_CPPFLAGS = \
-I$(top_srcdir)/include \
-I$(top_srcdir)/src \
-I$(top_srcdir)/src/core \
-I$(top_srcdir)/examples/platforms \
-I$(top_srcdir)/examples/platforms/cc1352 \
-I$(top_srcdir)/third_party/ti/devices/cc13x2_cc26x2 \
-I$(top_srcdir)/third_party/mbedtls/repo/include \
$(MBEDTLS_CPPFLAGS) \
$(NULL)
PLATFORM_SOURCES = \
alarm.c \
cc1352_radio.h \
diag.c \
entropy.c \
flash.c \
logging.c \
misc.c \
openthread-core-cc1352-config.h \
openthread-core-cc1352-config-check.h \
platform-cc1352.h \
radio.c \
system.c \
uart.c \
crypto/aes_alt.c \
cc1352_ccfg.c \
cc1352_startup.c \
cxx_helpers.c \
$(NULL)
libopenthread_cc1352_a_SOURCES = \
$(PLATFORM_SOURCES) \
$(NULL)
libopenthread_cc1352_a_DEPENDENCIES = \
$(top_srcdir)/third_party/ti/devices/cc13x2_cc26x2/driverlib/bin/gcc/driverlib.a \
$(NULL)
Dash = -
libopenthread_cc1352_a_LIBADD = \
$(shell find $(top_builddir)/examples/platforms/utils $(Dash)type f $(Dash)name "*.o")
include $(abs_top_nlbuild_autotools_dir)/automake/post.am
@@ -1,44 +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.
#
#
# cc1352 platform-specific Makefile
#
CPPFLAGS_COMMON += \
-I$(top_srcdir)/third_party/ti/devices/cc13x2_cc26x2 \
$(NULL)
LDADD_COMMON += \
$(top_builddir)/examples/platforms/cc1352/libopenthread-cc1352.a \
$(top_srcdir)/third_party/ti/devices/cc13x2_cc26x2/driverlib/bin/gcc/driverlib.a \
$(NULL)
LDFLAGS_COMMON += \
-T $(top_srcdir)/third_party/ti/devices/cc13x2_cc26x2/linker_files/cc26x2r1f.lds \
$(NULL)

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